I think that works well, to use a ‘type’ enumeration. I assume then that ‘type’ will be a required property?
Dr. Robert van Engelen, CEO/CTO Genivia Inc. voice: (850) 270 6179 ext 104 fax: (850) 270 6179 mobile: (850) 264 2676 engelen@genivia.com
Hi Robert,
I think this direction is great -- the use of oneOf is very similar to what I was thinking about to try to clean up the subunit structure a little bit.
Regarding your question about using a boolean called "segment" or a boolean called "ignorable" to indicate type, a third option would be to use an enumerated string:
"oneOf": [ { "properties": { "type": { "type": "string", "default": "segment", "enum": [ "segment" ] }, "canResegment": { "type": "boolean" }, ... }, { "properties": { "type": { "type": "string", "enum": ["ignorable"] }, .... } ]
This would mean you can write unit data that looked like:
... "subunits": [ { "type": "segment", "canResegment": false, "source": { .... }, "target": { .... }, }, { "type": "ignorable", "source": { ... }, "target": { .... } } ]
I don't know how if that makes the language bindings easier or harder, but it might make the representation a little clearer.
|