Skip to content

Validate required bindings from the base spec #601

@lmsurpre

Description

@lmsurpre

For code values with a required binding, we generate Code subtypes in the model and invalid values cannot be parsed.
However, for CodeableConcept values with required bindings in the base spec, we don't validate the concepts at all.

Now that we have valueset membership operational, I think we should start using this to validate valueset membership for required bindings in the base spec.

To reproduce:
Create or validate a resource that has an element of type CodeableConcept and a ValueSet binding of Required.
Note that the server happily accepts any value for this element, even if there is no coding from the required ValueSet.

This should fail validation:

{
  "resourceType": "Condition",
  "id": "example",
  "clinicalStatus": {
    "coding": [
      {
        "system": "http://example.com",
        "code": "fake-code"
      }
    ]
  },
  "subject": {
    "reference": "Patient/example"
  }
}

This should pass validation:

{
  "resourceType": "Condition",
  "id": "example",
  "clinicalStatus": {
    "coding": [
      {
        "system": "http://example.com",
        "code": "fake-code"
      },
      {
        "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
        "code": "active"
      }
    ]
  },
  "subject": {
    "reference": "Patient/example"
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions