Stream: committers
Topic: Build example failing with contained
Rik Smithies (Aug 11 2020 at 17:04):
I am getting a build failure validating an example because the contained resource is not referenced.
The contained one references the parent but the build examples validator doesn't seem to recognise it.
I have tried:
<MedicinalProductDefinition xmlns="http://hl7.org/fhir">
<id value="equilidem-with-ing-and-auth"/>
<contained>
<RegulatedAuthorization>
<id value="authorization"/>
<subject>
<reference value="#"/>
</subject>
and
<MedicinalProductDefinition xmlns="http://hl7.org/fhir">
<id value="equilidem-with-ing-and-auth"/>
<contained>
<RegulatedAuthorization>
<id value="authorization"/>
<subject>
<reference value="#equilidem-with-ing-and-auth"/>
</subject>
and
<MedicinalProductDefinition xmlns="http://hl7.org/fhir">
<id value="equilidem-with-ing-and-auth"/>
<contained>
<RegulatedAuthorization>
<id value="authorization"/>
<subject>
<reference value="MedicinalProductDefinition/equilidem-with-ing-and-auth"/>
</subject>
Jose Costa Teixeira (Aug 11 2020 at 17:34):
it's the parent that references the contained right?
Jose Costa Teixeira (Aug 11 2020 at 17:35):
<MedicinalProductDefinition xmlns="http://hl7.org/fhir">
<contained>
<id value="equilidem-with-ing-and-auth"/>
<RegulatedAuthorization>
<id value="authorization"/>
<subject>
<reference value="#equilidem-with-ing-and-auth"/>
</subject>
</contained>
<anotherElementInTheParentResource>
<reference value="#equilidem-with-ing-and-auth"/>
</anotherElementInTheParentResource>
Jose Costa Teixeira (Aug 11 2020 at 17:36):
I thought that the contained cannot reference the parent - please correct me if I am mistaken
Rik Smithies (Aug 11 2020 at 19:40):
no - it is the contained that references the parent, in this case (though I also have the opposite in the same example). That is allowed. But the build doesn't seem to like it. Maybe I need a different syntax or maybe the validator doesn't know this case properly
Grahame Grieve (Aug 11 2020 at 20:13):
what's the actual error message?
Rik Smithies (Aug 11 2020 at 20:15):
[java] ERROR @ MedicinalProductDefinition.contained[0].ofType(RegulatedAuthorization).subject (line 0, col0): medicinalproductdefinition-example-equilidem-using-ingredient-and-auth:: MedicinalProductDefinition.contained[0].ofType(RegulatedAuthorization).subject: ref-1: SHALL have a contained resource if a local reference is provided ( (url: equilidem-with-ing-and-auth; ids: authorization,EquilidoniumPhosphate,CalciumCarbonate)) [reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))] (src = InstanceValidator)
Rik Smithies (Aug 11 2020 at 20:15):
and also [java] ERROR @ MedicinalProductDefinition.contained[0].ofType(RegulatedAuthorization).subject (line 0, col0): medicinalproductdefinition-example-equilidem-using-ingredient-and-auth:: MedicinalProductDefinition.contained[0].ofType(RegulatedAuthorization).subject: Unable to resolve resource "#equilidem-with-ing-and-auth" (src = InstanceValidator)
Rik Smithies (Aug 11 2020 at 20:16):
it varies based on what I try, but that is the gist of it
Rik Smithies (Aug 11 2020 at 20:50):
there is a resource that nothing points at, it thinks, and a resource reference that points at nothing, it thinks. But they actually point at each other.
Grahame Grieve (Aug 18 2020 at 04:57):
is this still a problem?
Grahame Grieve (Aug 18 2020 at 05:01):
your first example is correct. I'm confused as to why the invariant doesn't seem to allow it
Rik Smithies (Sep 09 2020 at 09:06):
yes this is still an issue as of today
[java] medicinalproductdefinition-example-equilidem-using-ingredient-and-auth:: MedicinalProductDefinition.contained[0].ofType(RegulatedAuthorization).subject: Unable to resolve resource "#"
[java] medicinalproductdefinition-example-equilidem-using-ingredient-and-auth:: MedicinalProductDefinition.contained[0].ofType(RegulatedAuthorization).subject: ref-1: SHALL have a contained resource if a local reference is provided ( (url: ; ids: authorization,EquilidoniumPhosphate,CalciumCarbonate)) [reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))]
Last updated: Apr 12 2022 at 19:14 UTC