Skip to content

Steps and issues to reach a more complete state #2

Open
@candleindark

Description

@candleindark

(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 Python Enum 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 are ClassVar
  • 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
  • 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

  1. LinkML

    1. Questions needed to be answered:
    1. Issues
      1. Unable to generate valid YAML for PermissibleValue with text containing a colon linkml/linkml#2138
        (Needed for dandischema which has enum values containing ":".)
      2. The exact_cardinality metamodel slot doesn't seem to have any effect when used in a SlotDefinition linkml/linkml#2104
        (Not needed. There is a workaround.)
      3. Inconsistent nullability in generated Pydantic model linkml/linkml#2155
        (Solution not needed for our purpose)
      4. equals_string_in meta slot has no affect in validation linkml/linkml#2206
        (Not needed. Found a workaround)
      5. No validation for range uri beyond validation for range string linkml/linkml#2215
        (Needed for the current translation of URL types in Pydantic)
      6. A slot requirement cannot be removed on a subclass linkml/linkml#1508 (comment)
        (Needed for all translations)
  2. Pydantic

    1. Is there a guide/tutorial to the Pydantic core schema? pydantic/pydantic#9485

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions