Ignixa.Validation 0.0.151

dotnet add package Ignixa.Validation --version 0.0.151
                    
NuGet\Install-Package Ignixa.Validation -Version 0.0.151
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ignixa.Validation" Version="0.0.151" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ignixa.Validation" Version="0.0.151" />
                    
Directory.Packages.props
<PackageReference Include="Ignixa.Validation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ignixa.Validation --version 0.0.151
                    
#r "nuget: Ignixa.Validation, 0.0.151"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ignixa.Validation@0.0.151
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ignixa.Validation&version=0.0.151
                    
Install as a Cake Addin
#tool nuget:?package=Ignixa.Validation&version=0.0.151
                    
Install as a Cake Tool

Ignixa.Validation

FHIR validation system with four validation depth levels.

Architecture

Four Validation Depth Levels (ADR-2527):

Depth Checks Use Case
Minimal JSON structure, required fields CREATE/UPDATE (blocking), bulk ingestion
Compatibility + Cardinality, types (lenient URIs) Microsoft FHIR Server migration
Spec + Required terminology, absolute URIs CREATE/UPDATE (blocking)
Full + FHIRPath invariants, all bindings $validate (async), compliance testing

Quick Start

using Ignixa.Validation.Schema;
using Ignixa.Specification.Generated;
using Ignixa.Serialization;

// 1. Get FHIR schema for your version (R4, R4B, R5, or STU3)
var fhirSchema = new R4CoreSchemaProvider();

// 2. Get the type definition for the resource you want to validate
var patientType = fhirSchema.GetTypeDefinition("Patient");

// 3. Build validation schema (automatically creates all checks from StructureDefinition)
var builder = new StructureDefinitionSchemaBuilder();
var validationSchema = builder.BuildSchema(patientType!, fhirSchema);

// 4. Parse and validate your FHIR resource
var json = "{\"resourceType\":\"Patient\",\"id\":\"123\"}";
var sourceNode = JsonSourceNodeFactory.Parse(json).ToSourceNode();
var element = sourceNode.ToElement(fhirSchema);

// 5. Choose validation depth
var settings = new ValidationSettings { Depth = ValidationDepth.Spec };
var state = new ValidationState();
var result = validationSchema.Validate(element, settings, state);

if (!result.IsValid)
{
    var operationOutcome = result.ToOperationOutcome();
    // Return operationOutcome to client
}

Validating Different Resource Types

using Ignixa.Validation.Schema;
using Ignixa.Specification.Generated;
using Ignixa.Serialization;

var fhirSchema = new R4CoreSchemaProvider();
var builder = new StructureDefinitionSchemaBuilder();

// Validate Observation
var observationType = fhirSchema.GetTypeDefinition("Observation");
var observationSchema = builder.BuildSchema(observationType!, fhirSchema);

var observationJson = "{\"resourceType\":\"Observation\",\"status\":\"final\",\"code\":{}}";
var sourceNode = JsonSourceNodeFactory.Parse(observationJson).ToSourceNode();
var result = observationSchema.Validate(sourceNode.ToElement(fhirSchema));

Validation Depth Guide

Minimal

Fastest validation for high-throughput scenarios:

var settings = new ValidationSettings { Depth = ValidationDepth.Minimal };

Compatibility

For migrating from Microsoft FHIR Server (Firely SDK validation):

var settings = new ValidationSettings { Depth = ValidationDepth.Compatibility };
  • Accepts relative URIs in Coding.system (e.g., "internal-tags")
  • Same checks as Spec, but more lenient for migration scenarios
  • Use when running Microsoft FHIR Server E2E test suite

Spec

Standard FHIR specification compliance:

var settings = new ValidationSettings { Depth = ValidationDepth.Spec };
  • Enforces absolute URIs in Coding.system
  • Required terminology bindings
  • Recommended for production API operations

Full

Complete FHIR profile validation:

var settings = new ValidationSettings { Depth = ValidationDepth.Full };
  • All Spec checks plus FHIRPath invariants
  • Extensible terminology bindings
  • Use for compliance testing and profile conformance

What Gets Validated

When you use StructureDefinitionSchemaBuilder, it automatically extracts and creates validation checks from FHIR StructureDefinition metadata. Here's what gets checked:

Tier 1 (Fast) - Universal Checks

These checks run for every CREATE/UPDATE operation:

Check Purpose When Applied
JsonStructureCheck Validates JSON is well-formed object with resourceType Resources only
NarrativeCheck Validates Narrative.status and Narrative.div Resources only
CardinalityCheck Validates min/max element count (0..1, 1..1, 0.., 1..) All elements except xhtml
TypeCheck Validates primitive types (id, string, integer, boolean, etc.) All primitive elements

Tier 2 (Spec) - Schema-Driven Checks

Additional checks extracted from StructureDefinition metadata:

Check Purpose When Applied
ReferenceFormatCheck Validates Reference.reference format (relative/literal/url) Elements with type=Reference
CodingStructureCheck Validates Coding.system + Coding.code structure Elements with type=Coding or CodeableConcept
ChoiceElementCheck Validates choice elements (only one variant present) Elements with name ending in [x]
ExtensionStructureCheck Validates Extension.url is present and value/extension rules Elements named "extension"
FixedValueCheck Validates element has exact fixed value Elements with fixedValue constraint
PatternCheck Validates element matches pattern constraint Elements with patternValue constraint
BindingCheck Validates coded values against built-in, required ValueSets Elements with binding
NestedComplexTypeCheck Validates nested BackboneElement and complex types BackboneElement children
UnknownPropertyCheck Rejects unknown/undefined properties All resources
FhirPathInvariantCheck Validates FHIRPath constraints (ele-1, dom-1, custom invariants) Elements with constraint definitions

Tier 3 (Profile) - Slicing, advanced terminology

Advanced validation for custom profiles:

Check Purpose When Applied
BindingCheck Validates coded values against ValueSet Elements with binding (requires ITerminologyService)

License

MIT License - see LICENSE file in repository root

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.151 36 1/21/2026
0.0.150 63 1/20/2026
0.0.149 77 1/19/2026
0.0.148 78 1/18/2026
0.0.142 83 1/12/2026
0.0.137 129 1/9/2026
0.0.127 123 12/29/2025
0.0.109 286 12/18/2025
0.0.101 273 12/16/2025
0.0.96 412 12/10/2025
0.0.87 420 12/8/2025
0.0.70 295 12/7/2025
0.0.68 217 12/7/2025
0.0.62 223 12/6/2025
0.0.59 172 12/5/2025
0.0.58 195 12/5/2025
0.0.57 195 12/3/2025
0.0.56 658 12/3/2025
0.0.55 421 12/1/2025
0.0.54 420 11/30/2025
0.0.53 407 11/30/2025
0.0.51 114 11/29/2025
0.0.50 109 11/29/2025