| Crates.io | tlq-fhir-validator |
| lib.rs | tlq-fhir-validator |
| version | 0.1.10 |
| created_at | 2026-01-06 15:15:35.469088+00 |
| updated_at | 2026-01-10 13:00:39.787296+00 |
| description | FHIR resource validation engine. |
| homepage | https://thalamiq.io |
| repository | https://github.com/thalamiq/tlq-fhir-core |
| max_upload_size | |
| id | 2026060 |
| size | 214,578 |
Flexible FHIR validation with a three-phase, pipeline-based architecture.
The validator cleanly separates configuration, planning, and execution, delegating all FHIR knowledge to fhir-context.
ValidatorConfig → ValidationPlan → Validator → ValidationOutcome
(declarative) (executable) (reusable) (structured)
Type: ValidatorConfig
Defines what to validate and how strict to be:
Key feature: No combinatorial explosion. Capabilities are selected via configuration, not encoded as type parameters.
Type: ValidationPlan
Configuration compiles into an ordered, executable pipeline:
Step enum variants (Schema, Profiles, Constraints, etc.)Key feature: Single validation pass at compile time ensures valid combinations.
Type: Validator<C: FhirContext>
Owns the plan and FHIR context, reusable across many validations:
DefaultFhirContext)validate() call creates short-lived ValidationRunKey feature: Amortizes expensive setup across thousands of validations.
Internal: ValidationRun<'a, C>
Short-lived struct that executes the plan:
ValidationIssuesValidationOutcomeKey feature: Zero allocation per-step, fail-fast support, issue limit enforcement.
Type: ValidationOutcome
Structured validation result:
ValidationIssue (severity, code, diagnostics, location, expression)OperationOutcomeKey feature: Structured output suitable for both human and machine consumption.
All FHIR-specific knowledge lives in fhir-context:
The validator never hard-codes FHIR rules - it queries the context.
New validation capabilities added by:
Step enumValidationRunValidator APIuse tlq_fhir_validator::{ValidatorConfig, Preset};
// Use a preset
let cfg = ValidatorConfig::preset(Preset::Server);
// Compile to executable plan
let plan = cfg.compile()?;
let cfg = ValidatorConfig::builder()
.preset(Preset::Server)
.terminology_mode(TerminologyMode::Local)
.fail_fast(true)
.build();
let yaml = r#"
preset: Server
terminology:
mode: Local
timeout: 2000
exec:
fail_fast: true
"#;
let cfg = ValidatorConfig::from_yaml(yaml)?;
let plan = cfg.compile()?;
mode: Off | Onallow_unknown_elements: boolallow_modifier_extensions: boolmode: Off | InvariantsOnly | Fullbest_practice: Ignore | Warn | Errorsuppress: List of constraint IDs to skiplevel_overrides: Override severity levelsmode: Off | Local | Remote | Hybridextensible_handling: Ignore | Warn | Errortimeout: Duration in millisecondson_timeout: Skip | Warn | Errorcache: None | Memorymode: Off | TypeOnly | Existence | Fullallow_external: boolmode: Off | Onmode: Off | OnSee examples/ for YAML configuration files for different use cases.