-
Notifications
You must be signed in to change notification settings - Fork 22
Generic Resultsets #207
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
base: develop
Are you sure you want to change the base?
Generic Resultsets #207
Conversation
This commit open a possibility to redefine the Resultset content (e.g. specify that the message content is a 'biosamples' object).
|
This commit doesn't break the specification, but enforce JSON Schema 2020-12 usage (which is already in the spec.). Default resultsEntryType is still JSON object, but it may be overridden: This way endpoints (e.g. OpenAPI) may better define the type of results they return - in the above we define a response which must contain only 'biosamples' results. Best, Dmitry |
|
@redmitry But isn't the
At least that's what I thought & we're doing it like that: https://progenetix.org/beacon/biosamples?testMode=true I might be wrong, though |
Yes, but. Schema validators can't validate on metadata hints. This is especially useful for OpenAPI definitions - OpenAPI tools just have no knowledge about the entryTypes, so currently for them biosamples endpoint has no difference to the variations. Cheers, D. |
|
@redmitry could you provide an example of how this would looke like in the model, where, I assume, the schema is "de-generalized"? |
{
"$comment": "generic test",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$defs": {
"biosamples": {
"$dynamicAnchor": "resultsEntryType",
"$ref": "https://raw.githubusercontent.com/redmitry/beacon-v2/redmitry-generalize-resultset/models/json/beacon-v2-default-model/biosamples/defaultSchema.json"
}
},
"$ref" : "https://raw.githubusercontent.com/redmitry/beacon-v2/redmitry-generalize-resultset/framework/json/responses/beaconResultsetsResponse.json"
}The "de-generalization" here is: "$defs": {
"biosamples": {
"$dynamicAnchor": "resultsEntryType",
"$ref": "https://raw.githubusercontent.com/redmitry/beacon-v2/redmitry-generalize-resultset/models/json/beacon-v2-default-model/biosamples/defaultSchema.json"
}
}which enforces that "resultsEntryType" must be biosamples schema. "results": {
"$defs": {
"defaultResultsEntryType": {
"$dynamicAnchor": "resultsEntryType",
"type": "object"
}
},
"items": {
"$dynamicRef": "#resultsEntryType"
},
"minItems": 0,
"type": "array"
}Unless someone overrides the "resultsEntryType" $dynamicAnchor the value of items is "object". Cheers, Dmitry |
|
Thanks! In which Model file would that "de-generalized" schema reside? |
Ah! now understand the question. Dmitry |
|
Given that we are aiming to generate OpenAPI documents from the actual beacon instance, wouldn't it be better to include the information in /map or a similar place? |
IF we gonna generate OpenAPI we don't need to put it anywhere. It could be perfectly generated because we know entryTypes schemas. |
This commit open a possibility to redefine the Resultset content (e.g. specify that the message content is a 'biosamples' object).