Open dotasek opened 13 hours ago
The code that adds the #
appears to be here: https://github.com/hapifhir/hapi-fhir/blob/77fa7f78191aa83b48a12bd29a7ff26fc574bb84/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java#L442
Is this causing an issue somewhere else?
This is pretty old behaviour, changing it could be a breaking change for people depending on it
@jamesagnew you may have broken a record for quick replies.
It is, in fact causing an issue. I ran into it while incrementing the core library in HAPI: https://github.com/hapifhir/hapi-fhir/pull/6510.
Grahame's last updates to FHIRPathEngine now expect resources to match the spec for contained resources:
@tadgh and I looked into this after I mentioned it, and it's not just reading from JSON that displays odd behaviour.
FhirTerser appears to be mutating the contained resources in a multitude of irregular ways. For example:
I've outlined a few major ones here, with FIXME annotations where the tests are producing unexpected results.
Describe the bug HAPI's JSON parser is adding
#
characters to contained resource IDs.To Reproduce
I created a breaking test in a branch: https://github.com/hapifhir/hapi-fhir/blob/9e9f1e65e2534a7ece1574fa0529d813fbc6392b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/JsonParserR4Test.java#L1383-L1389
This parses the following JSON:
Expected behavior The JSON parser should parse the contained specimen ID as is, without adding an additional
#
.Otherwise, the parsed resource is not consistent with the FHIR specification for contained resources: https://hl7.org/fhir/r4/references.html#contained
Environment (please complete the following information):