Ignixa.Validation 0.0.59

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ignixa.Validation --version 0.0.59
                    
NuGet\Install-Package Ignixa.Validation -Version 0.0.59
                    
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.59" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ignixa.Validation" Version="0.0.59" />
                    
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.59
                    
#r "nuget: Ignixa.Validation, 0.0.59"
                    
#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.59
                    
#: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.59
                    
Install as a Cake Addin
#tool nuget:?package=Ignixa.Validation&version=0.0.59
                    
Install as a Cake Tool

Ignixa.Validation

FHIR validation system with three-tier architecture.

Architecture

Three-Tier Validation Pipeline (ADR-2527):

Tier Checks Use Case
Fast JSON structure, required fields CREATE/UPDATE (blocking)
Spec + Cardinality, types, FHIRPath invariants CREATE/UPDATE (blocking)
Profile + Custom profiles, slicing, terminology $validate (async)

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);

var result = validationSchema.Validate(element);

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));

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.127 87 12/29/2025
0.0.109 275 12/18/2025
0.0.101 267 12/16/2025
0.0.96 407 12/10/2025
0.0.87 412 12/8/2025
0.0.70 290 12/7/2025
0.0.68 208 12/7/2025
0.0.62 212 12/6/2025
0.0.59 163 12/5/2025
0.0.58 190 12/5/2025
0.0.57 186 12/3/2025
0.0.56 649 12/3/2025
0.0.55 415 12/1/2025
0.0.54 411 11/30/2025
0.0.53 400 11/30/2025
0.0.51 111 11/29/2025
0.0.50 101 11/29/2025