Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Correctly serialize STU3 ConceptMap and ActivityDefinition element order #683
This PR fixes #634.
The cause was the paths in the ChildOrder annotation on these resources used '[x]'. However, the forcedOrder logic in BaseRuntimeElementCompositeDefinition.scanCompositeElementForChildren() method didn't account for the '[x]'. This leads to e.g. in ConceptMap, the sourceUri/sourceReference element being written first before url element, leading to a validation failure later on if the serialized resource is validated.
I did a scan of the code and it seems like ChildOrder annotation is only used in the STU3 model classes. Moreover, it seems only ConceptMap and ActivityDefinition resources are the ones who have paths that have '[x]'.
Since the fix was made to generated code, I think a more permanent fix to this would be to update the FHIR code generator not to use '[x]' in ChildOrder annotation paths.