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

Model JSON Schema keyword additionalProperties in LinkML #28

Open
mahdanoura opened this issue Jul 17, 2024 · 0 comments
Open

Model JSON Schema keyword additionalProperties in LinkML #28

mahdanoura opened this issue Jul 17, 2024 · 0 comments

Comments

@mahdanoura
Copy link
Contributor

mahdanoura commented Jul 17, 2024

Currently, LinkML does not allow the equivalence of additionalProperties in JSON Schema. This means that the TD instance like the following will fail, because of the additional property "cov:methodName": "GET".

{
    "@context": "https://www.w3.org/2022/wot/td/v1.1",
    "id": "urn:uuid:014139c9-b267-4db5-9c61-cc2d2bfc217d",
    "@type": "Thing",
    "title": "MyCameraThing",
    "$title": "contentMedia and contentEncoding",
    "description": "Thing description for a camera thing",
    "$description": "In some cases, binary data is embedded in text-based values, e.g., a JSON string-based value embeds a base64 encoded image. The terms contentMediaType and contentEncoding can be used to clarify the context and encoding format of such name-value pairs.", 
    "securityDefinitions": {
        "basic_sc": {"scheme": "basic", "in": "header"}
    },
    "security": "basic_sc",
    "properties": {
        "image": { 
	        "description": "Provides latest image", 
	        "type": "string",
	        "contentMediaType": "image/png",
	        "contentEncoding": "base64",
	        "forms": [{ 
			    "op": "readproperty", 
			    "href": "http://camera.example.com/lastPicture", 
			    "cov:methodName": "GET",
			    "contentType": "application/json" 
		    }] 
        }
    }
}

Two ideas come to my mind, either

  1. model an attribute called additionalProperty with a default value of True, and then do some post processing on the generated JSON Schema.
  2. Extend the LinkML json schema generator, but then the question will be how should this modelled?
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

1 participant