'Are FHIR-resource-Logical-Id's MANDATORY for "contained" fhir-resources?

I'm trying to get a clarification

Under the definition of what is a (fhir-resource-logical-id)

https://www.hl7.org/fhir/resource-definitions.html#Resource.id

The comment says:

The only time that a resource does not have an id is when it is being submitted to the server using a create operation.

We have having an internal "debate" on the "contained-reference".

https://build.fhir.org/references.html#contained

Example one from the article:

JSON

{
  "resourceType" : "Condition",
  "contained": [
    {
      "resourceType" : "Practitioner",
      "id" : "p1",
      "name" : [{
        "family" : "Person",
        "given" : ["Patricia"]
      }]
      }],
   "asserter" : {
     "reference" : "#p1"
  }
}

XML

 <Condition xmlns="http://hl7.org/fhir">
  <contained>
    <Practitioner>
      <id value="p1"/>
      <name>
        <family value="Person"/>
        <given value="Patricia"/>
      </name>
    </Practitioner>
  </contained>
  <!-- other attributes -->
  <asserter>
    <reference value="#p1" />
  </asserter>
  <!-- other attributes -->
 </Condition>

So the "p1" (as the fhir-resource-logical-id) is populated....under the contained resourceType of "Practitioner".

So far, so good.

But there is another example with a comment in the example: (below xml)

<Patient xmlns="http://hl7.org/fhir">
  <id value="something"/>
  <contained>
    <Provenance>
      <!-- no id necessary (though still allowed) -->
      <target>
        <reference value="#"/>
      </target>
    </Provenance>
  </contained>
  <!-- other attributes -->
</Patient>

The xml-comment-part is (and I'll refer to this as the "comment-documentation") is:

  <!-- no id necessary (though still allowed) -->

We are confused. Is this a "Provenance-ONLY" comment for a contained FHIR resource?

Or does this comment-documentation "

   <!-- no id necessary (though still allowed) -->

" .. does this "comment-documentation" apply to any/all "contained" Fhir-Resource(s)?

The "comment-documentation" seems in conflict with the "The only time that a resource does not have an id is when it is being submitted to the server using a create operation" rule.

Another way to put it:

Does the rule "The only time that a resource does not have an id is when it is being submitted to the server using a create operation" (always and always) apply to "contained"-fhir-resources?

Thank you.



Solution 1:[1]

I wrote that, and I think I was just wrong when I did - just thinking that it wasn't needed functionally in that context, and didn't check whether it had to be present. This is a case where id is required

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Grahame Grieve