Comments Resources' definitions "from Resource" and "from DomainResource"

Hi everybody,

I have noticed two comments in the resources’ definitions :
// from Resource: id, meta, implicitRules, and language
// from DomainResource: text, contained, extension, and modifierExtension

What does each of “From Resource” and “From DomainResource” mean ?
When should be use one or both of them to design our APIs ?

Best regards,

All resource types inherit the fields from Resource. Most resource types also inherit the fields from DomainResource. This is a technical hierarchy, and you will never send/receive a Resource or DomainResource. The fields will be integrated in the regular resource data.
So for example, I could have a Patient resource:

  "resourceType": "Patient",
  "id": "123",
  "name": [{
      "family": "Everyman",
      "given": [ "Adam" ],
      "prefix": [ "Mr." ]
... etc ...

The ‘id’ field is inherited from Resource, so you do not see it on the Patient page. But on the data it is there, just like the other fields for Patient.


The resources that inherit only from Resource (instead of DomainResource) are those like Binary, Bundle and Parameters where it would be inappropriate to support extensions or contained resources.