Open niquola opened 7 years ago
Here is new option for primitives:
// in simple case
{"attribute": "primitiveValue"}
// in case with extensions
{"attribute": {"value": ...., "extensions": .....}}
// or
{"attribute": {"<type>": ...., "extensions": .....}}
{"attribute": {"string": ...., "extensions": .....}}
so all of your lookups should be like resource.attr.value OR resource.attr
Problem
In FHIR you could extend primitive types with additional attributes. This encoded in JSON with "_" prefix and has similar to variable type elements problems with collections, schema, databases etc:
Solution 1
We could apply the json-ld approach and encode primitives with objects:
Additionally, we fix weak typed JSON by embedding type labels into object
We pay by deeper paths and some size of Resource (because of additional $type labels):
But we simplify typed parsing of JSON because of type information is in the document and does not require lookup in meta-data. We also allow collections of extended primitives.
We could go farther and add $type annotation attribute to other elements (i.e. complex elements or datatypes):