lantanagroup / FHIR.js

Node.JS library for serializing/deserializing FHIR resources between JS/JSON and XML using various node.js XML libraries
Apache License 2.0
102 stars 29 forks source link

primitive properties with the _ prefix to allow id and extension properties are unexpected #22

Closed synsteve closed 4 years ago

synsteve commented 4 years ago

E.g, in the example Patient.json on the FHIR website: ... "birthDate": "1974-12-25", "_birthDate": { "id": "314159", "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime", "valueDateTime": "1974-12-25T14:35:45-05:00" } ] } ...

Because brithDate is a primitive, in order to add "id" and/or "extension", you must use the _birthDate property. FHIR.js currently sees this as unexpected but should treat it as an object of type "Element"

synsteve commented 4 years ago

You could either add underscore properties to the parsedStructureDefinitions in the parser or change the validator to check for them if the 'standard' property is a primitive type. I favour the latter.

seanmcilvenna commented 4 years ago

This has been resolved as part of commit 83c25996afa7d01539a7b741f95976d04c72e7c6. I have tagged it as v4.7.4 and released version 4.7.4 on npm.