← ReferenceStandards
What is Validation?
Validation checks that a FHIR Resource conforms to the FHIR specification, a Profile, or both. The result is an OperationOutcome resource listing any errors, warnings, or informational messages.
Types of validation
- Structural: JSON is valid, resourceType is known, required fields are present
- Cardinality: elements appear the correct number of times (0..1, 1..*, etc.)
- Data type: dates are valid dates, codes are from the right CodeSystem
- Profile conformance: resource meets must-support, binding, and cardinality rules of a Profile
- Business rules: invariants defined in the spec (e.g. Observation must have a value or dataAbsentReason)
$validate operation
POST /Patient/$validate
Body: the Patient resource to validate
Returns: OperationOutcome
OperationOutcome severity levels
error — resource is invalid, cannot be processed
warning — resource is usable but has issues worth noting
information — informational message, no action required
Validation tools
- HAPI FHIR — validates on write by default, $validate operation available
- HL7 FHIR Validator — official CLI tool, supports all profiles and IGs
- Inferno — test suite for profile conformance, used in EHDS certification