Skip to content
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

LinkML JSON Schema Generator #29

Open
mahdanoura opened this issue Jul 17, 2024 · 1 comment
Open

LinkML JSON Schema Generator #29

mahdanoura opened this issue Jul 17, 2024 · 1 comment

Comments

@mahdanoura
Copy link
Contributor

mahdanoura commented Jul 17, 2024

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.

@relu91
Copy link
Member

relu91 commented Jul 22, 2024

Btw combing oneOf with type is actually allowed but JSON Schema is used to factor out similar properties. I hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants