Skip to content

LinkML JSON Schema Generator  #29

@mahdanoura

Description

@mahdanoura

LinkML support composition terms like anyOf, allOf, etc.
The following snippet is how I model the security term as a class.

security:
       description: >-
         A Thing may define abstract security schemes, used to configure the secure access of (a set of) affordance(s).
       from_schema: td:definesSecurityScheme
       required: true
       exactly_one_of:
         - range: string
           multivalued: true
         - range: string

The following JSON Schema is generated from compositions:

"security": {
                    "description": "A Thing may define abstract security schemes, used to configure the secure access of (a set of) affordance(s).",
                    "oneOf": [
                        {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        {
                            "type": "string"
                        }
                    ],
                    "type": "string"
                }

The outer type in compositions are always translated to the type: "string". Sometimes we want a type Object in there. LinkML support the keyword: Any. But this will allow any object, which is not what we want in the json schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjsonschemaLinkML JSON Schema generator bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions