Open
Description
(Note: the content of this issue is mostly copied from DailyDreaming#13)
Steps needed to reach a more complete state
- Lay out a
LinkmlGenerator
class that takes in PythonEnum
objects and Pydantic models for conversion to LinkML schema - Resolve Pydantic core schema for each model and each field
- Identify locally defined fields for each model, e.g. filter out those in
__annotations__
that areClassVar
- Separate locally defined fields as newly defined ones and overriding ones. The newly defined ones are to be used for global slot definitions, and the overriding ones are to be used for slot usage definitions.
- Layout a
SlotGenerator
class for generating slot definition from the Pydantic core schema for a field in a Pydantic model - Implement conversion of elemental Pydantic core schema to LinkML slot attribute values in
SlotGenerator
- Some special care possibly needed to be put in place for conversion of numeric types because "
exclusiveMaximum
" and "exclusiveMinimum
" are currently not available in LinkML
- Some special care possibly needed to be put in place for conversion of numeric types because "
- Implement the conversion of Pydantic core model schemas for Pydantic models to LinkML class definitions.
Issues to be solved to reach a more complete state
-
LinkML
- Questions needed to be answered:
- 1. How to specify a slot of range float that accepts values less than 10.0? #2144
(May not be needed for dandischema but needed for the support of other schemas) - 2. What are the default values for meta model slots? #2147
(Needed for dandischema but the question is mostly answered) - 3. Is there a way to specify a default value for a slot with a range of an arbitrary type? #2149
(May not be needed for dandischema but needed for the support of other schemas) - 4. How to specify the LinkML equivalent of Union[List[int], str]? #2154
(Needed for Dandischema which has field types such asOptional[Union[List[GenotypeInfo], Identifier]]
)- 1.
multivalued
meta slot doesn't work withinany_of
meta slot elements linkml/linkml#2190 - DANDI: To be solved via Refactoring model so we could avoid shortcoming of linkml model dandi-schema#257 by removing used of unions of a type that is single-valued and a type that is multi-valued.
- 1.
- 5. How to define a slot whose values are comparable to a dictionary in Python?
(Needed for Dandischema which has field type ofDict[DigestType, str]
fordigest
inBareAsset
.) - 6. DANDI/EMBER/... transfer/add "run-time" (instance) related validations. linkml model: how to add "run-time" or "instance specific" validations dandi-schema#274
- Issues
- Unable to generate valid YAML for
PermissibleValue
withtext
containing a colon linkml/linkml#2138
(Needed for dandischema which has enum values containing":"
.) - The
exact_cardinality
metamodel slot doesn't seem to have any effect when used in aSlotDefinition
linkml/linkml#2104
(Not needed. There is a workaround.) - Inconsistent nullability in generated Pydantic model linkml/linkml#2155
(Solution not needed for our purpose) equals_string_in
meta slot has no affect in validation linkml/linkml#2206
(Not needed. Found a workaround)- No validation for range
uri
beyond validation for rangestring
linkml/linkml#2215
(Needed for the current translation of URL types in Pydantic) - A slot requirement cannot be removed on a subclass linkml/linkml#1508 (comment)
(Needed for all translations)
- Unable to generate valid YAML for
-
Pydantic
Metadata
Metadata
Assignees
Labels
No labels