Developers · Validation engine
Embed FHIR validation in TypeScript.
Use the Apache-2.0 engine directly in Node.js, CI, GitHub Actions, or your own TypeScript backend.
Available now · v0.8.0 · Apache-2.0
Smallest useful example
Validate one resource in process.
Load the pinned core definitions, select the profile and check a known error. This example expects a type mismatch at Patient.active; an empty result would fail the control.
import { createFilesystemProfileSource, recordsValidator, setProfileSource,} from '@records-fhir/validator';// Extract hl7.fhir.r4.core 4.0.1 here before running:// profiles/hl7.fhir.r4.core#4.0.1/package/*.jsonsetProfileSource(createFilesystemProfileSource({ packageDirs: ['./profiles'], packageVersionPins: { 'hl7.fhir.r4.core': '4.0.1' },}));const issues = await recordsValidator.validateRequest({ resource: { resourceType: 'Patient', id: 'example', active: 'yes' }, profileUrl: 'http://hl7.org/fhir/StructureDefinition/Patient', fhirVersion: 'R4',});// The negative control should flag the string at Patient.active.Expected contract
What comes back
A normalized list of validation findings that your service can render, store, or turn into its own gate decision.
| Runtime | Supported Node.js LTS (22 or 24) / TypeScript; no JVM or Records server required |
|---|---|
| Inputs | Resource, FHIR release and an explicitly configured profile source; terminology and IG dependencies for checks that require them |
| Output | Findings for the configured checks; retain incomplete-check signals and verify a negative control |
Built for one clear integration job
Choose the functions your integration needs.
In-process API
Validate FHIR resources without a Records server or Java runtime.
Eight validation aspects
Structure, profiles, terminology, references, invariants, custom rules, metadata, and anomaly signals.
Version-aware packages
Load core definitions and pinned implementation-guide packages for the release you are validating.
Saved runs, comparisons and reports require a Records workspace.
Scope
The boundary
Know what this surface owns before you put it into a workflow.
What remains outside this surface
Configure the required profiles and terminology, and verify the setup with positive and negative controls. Findings apply to the enabled checks and available dependencies. Records adds connected servers, run history, comparisons and reports.
Continue with the exact next question
Tested example
Run the tested example
Pinned setup, executable script and a known-error control with recorded output.
Open source
Review the diagnostic evidence
See newer differences alongside separate historical archives.
Package
View the package on npm
Install the current public validator package.
Source
Browse the source
Inspect the Apache-2.0 implementation and examples.
Records
Explore the workspace workflow
See how investigation, saved runs, comparison and the final report connect in Records.