You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be preferable to avoid using the Schema Builder to assemble a set of classes and fields as other formats do, because we already have the class/field set up via pydantic or dataclasses.
Ideally there would be a generator to output an object/class as linkml, so that converting a schema comprising pydantic (or dataclass) classes would be a matter of running the classes through the generator / mixing the generator function into the classes / whatever specific mechanism was chosen. A simple solution could be having the classes be subclasses of YAMLRoot, but without a way to save the transformed schema as linkml, you'd have to do this transform every time you worked with that schema and you would not have the rest of the linkml tools to play with.
sierra-moxon
changed the title
Write a pydantic-importer
Write a pydantic-importer (pydantic class -> LinkML YAML)
Apr 14, 2023
From discussion with @ialarmedalien on slack
Approach 1: can convert to json schema and convert from that https://pydantic-docs.helpmanual.io/usage/schema/ --- but that’s not very satisfactory as there would be loss eg inheritance
Approach 2: write something specific to pydantic using https://pydantic-docs.helpmanual.io/usage/exporting_models/
The text was updated successfully, but these errors were encountered: