-
Notifications
You must be signed in to change notification settings - Fork 5
Description
If an uploaded schema contains a "definitions" section, this will be ignored when the schema is uploaded to Song. E.g.
{
"name": "cholgen_sequence",
"schema": {
"type": "object",
"definitions": {
"species": {
"type": "string",
"enum": [
"Bos taurus",
"Homo sapiens"
]
}
},
"properties": {
"host": {
"$ref": "#/definitions/species"
}
}
}
}The "definitions" section of this will be ignored, instead only the "definitions" from analysisBase.json will be included in the final rendered schema, resulting in an invalid schema.
Description
As mentioned above, the end result is an invalid schema. When this is used in production, an error occurs - see this trace. This trace was produced by trying to use this schema.
While sometimes the use of "definitions" can be avoided (e.g. in a later version of the schema mentioned above), this is often a useful features of JSON-Schema.
Expected Behaviour
The "definitions" section of schema should be merged with that of the analysisBase.json.
Actual Behaviour
As mentioned above, the contents of the "definitions" part of an uploaded schema is silently ignored.
Possible Fix
I think that the relevant code that merges schemas is in renderPayloadJsonSchema. This could be extended to merge "definitions" much as "properties" are currently merged.
Steps to Reproduce
- Upload the schema mentioned above in the description
- Try and upload a JSON document compliant with the schema
Your Environment
- Version used: 5.2.0
- Environment name and version (e.g. Chrome 39, node.js 5.4): Not relevant
- Operating System and version (desktop or mobile): Upload was done using Muse
- Link to your project: https://github.com/african-pathogen-archive