Feat/add jsonschema extensions #91
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Extending
AllSchema.jsononly provides two easy options; add extensions directly intoAllSchema.jsonor maintain a file that lists every specific override.AllSchema.jsonprevents encapsulating extensions to definitions in a single file to maintain separation between original defintion and extensions,EquipmentTypewith a new attribute"Color": {"type": "string"}. I would need to change all occurences of EquipmentType and override; GetEquipment, ProcessEquipment.... e.g.{ "$id": "B2MML_schema_extension.json", "$schema": "http://json-schema.org/2020-12/schema#", "title": "ODH - B2MML Schema extensions", "type": "object", "allOf": [ { "$ref": "AllSchemas.json" } ], "properties": { "GetEquipment": { "properties": { "DataArea": { "properties": { "Equipment": { "type": "array", "items": { "properties": { "Color": "string" } } } } } } }, "ProcessEquipment": { "properties": { "DataArea": { "properties": { "Equipment": { "type": "array", "items": { "properties": { "Color": "string" } } } } } } }, ... other usages, e.g. ChangeEquipment, SyncEquimpent, AcknowledgeEquipmentType, CancelEquipment... } }Proposal
Introduce a new file for easy extension and update existing JSON schema to references the easy extension file. This change makes use of unevaluatedProperties attribute on original entities and drops additionalProperties.
Add
B2MML-AllExtensions.schema.jsonthat can be used to extend entities.allOfto include the extension file to allowChange
AllSchema.jsontoAllSchema.schema.jsonAllSchema.schema.jsonswap"additionalProperties": falsefor"unevaluatedProperties": false,Example Usage