-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Various improvements #13
Conversation
Allow classes to be input as positional argument makes the function more portable
This func is intended to be used for converting a docstring to description in metadata in a LinkML schema
a8a6401
to
76f1920
Compare
@satra @djarecka @yarikoptic The assumption that there is exactly one Pydantic model corresponds to a class in a target LinkML schema is incorrect in This conversion tool to LinkML schema is able to pickup name collisions in classes and enums. Here is the error.
As you can see, class names such as P.S. We don't have this problem on dandischema. |
@saskiad - any thoughts on the above comment would be much appreciated. this is the pydantic to linkml conversion effort and issac is writing a converter that hopefully generalizes to multiple models. @candleindark - as a first pass we could augment class name with module name to create a unique class. this would require storing that info. the second thing is to check what's different between the classes. |
A method that adds the slots construed from the models in `self._models` to the schema
In generate_linkml_from_aind.py
`pydantic.BaseModel` doesn't really model anything. It is merely a template to specify a model.
Pydantic 2.9 adds support of validation of complex numbers. To be compatible with Pydantic 2.9, We need this interface defined.
Pydantic 2.8 doesn't have "core_schema.ComplexSchema" needed in the current code. Let's support Pydantic 2.8 only when needed
Due to the transfer of the project to the DANDI organization on github
…rsion With this contingency in place Pydantic no longer need to be 2.9 or greater
This PR has been migrated and merged by dandi#1. The remaining issues and steps are to be tracked with dandi#2 @yarikoptic Should I just close this PR at this point? |
This PR improves the existing conversion from Pydantic models to LinkML the following areas:
EnumDefinition
metamodel are populated more accuratelyslot usage
in class populationREADME.md
TODOs to achieve the above implementation.
LinkmlGenerator
class that takes in PythonEnum
objects and Pydantic models for conversion to LinkML schema__annotations__
that areClassVar
SlotGenerator
class for generating slot definition from the Pydantic core schema for a field in a Pydantic modelSlotGenerator
exclusiveMaximum
" and "exclusiveMinimum
" are currently not available in LinkMLRequests filed in pursue of completing this PR.
LinkML
(May not be needed for dandischema but needed for the support of other schemas)
(Needed for dandischema but the question is mostly answered)
(May not be needed for dandischema but needed for the support of other schemas)
(Needed for Dandischema which has field types such as
Optional[Union[List[GenotypeInfo], Identifier]]
)multivalued
meta slot doesn't work withinany_of
meta slot elements linkml/linkml#2190(Needed for Dandischema which has field type of
Dict[DigestType, str]
fordigest
inBareAsset
.)PermissibleValue
withtext
containing a colon linkml/linkml#2138(Needed for dandischema which has enum values containing
":"
.)exact_cardinality
metamodel slot doesn't seem to have any effect when used in aSlotDefinition
linkml/linkml#2104(Not needed. There is a workaround.)
(Solution not needed for our purpose)
equals_string_in
meta slot has no affect in validation linkml/linkml#2206(Not needed. Found a workaround)
uri
beyond validation for rangestring
linkml/linkml#2215(Needed for the current translation of URL types in Pydantic)
(Needed for all translations)
Pydantic
Note:
This PR has been migrated and merged by dandi#1.
The remaining issues and steps are to be tracked with dandi#2