Sashiko.Validation 0.1.1

dotnet add package Sashiko.Validation --version 0.1.1
                    
NuGet\Install-Package Sashiko.Validation -Version 0.1.1
                    
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="Sashiko.Validation" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sashiko.Validation" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Sashiko.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 Sashiko.Validation --version 0.1.1
                    
#r "nuget: Sashiko.Validation, 0.1.1"
                    
#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 Sashiko.Validation@0.1.1
                    
#: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=Sashiko.Validation&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Sashiko.Validation&version=0.1.1
                    
Install as a Cake Tool

🌸 Sashiko.Validation

Sashiko.Validation provides lightweight structural validation utilities for JSON data, C# models, and registry-style inputs.

It is built to catch shape problems early, before data is deserialized into a domain model or used by higher-level Sashiko packages.


✨ Features

  • C# schema extraction through reflection
  • JSON schema extraction through structural inspection
  • Schema comparison with clear missing/extra field reporting
  • JSON schema validator included out of the box
  • Case-sensitive or case-insensitive matching
  • Array element validation
  • Format-agnostic ISchemaValidator abstraction
  • Zero external dependencies

πŸ“¦ Installation

dotnet add package Sashiko.Validation

πŸš€ Usage

Validate JSON against a C# model

using Sashiko.Validation;
using Sashiko.Validation.Validators.Json;

var validator = new JsonSchemaValidator();

validator.Validate<MyConfig>(
    jsonString,
    new ValidationContext { Source = "config.json" });

If the JSON structure does not match the target model, a ValidationException is thrown with a readable diff.

Schema mismatch in 'config.json'.
Missing required fields:
  Settings.Mode
Unexpected fields:
  Debug.Verbose

🧠 How It Works

Sashiko.Validation compares two schema trees:

  • the expected schema extracted from a C# type
  • the actual schema extracted from JSON

The comparer reports:

  • missing required fields
  • unexpected fields
  • object, array, and leaf mismatches
  • nested mismatches
  • array element mismatches

This keeps validation focused on structure while leaving semantic domain rules to higher-level code.


πŸ§ͺ Testing

The test suite covers:

  • C# schema extraction
  • JSON schema extraction
  • schema comparison
  • nullable and required property behavior
  • validator integration
  • arrays, nested objects, primitives, and recursion safety

πŸ—ΊοΈ Roadmap

Future versions may include:

  • semantic validation helpers
  • structured validation error objects
  • error codes and diagnostics
  • additional format inspectors
  • composite validation pipelines

🀝 Contributing

Contributions are welcome.
Please see CONTRIBUTING.md in the repository root.


πŸ“„ License

This project is licensed under the Apache License 2.0.
See LICENSE for the full license text.

Copyright Β© 2026 Alexandru Luca (alex98luca)

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Sashiko.Validation:

Package Downloads
Sashiko.Registries

JSON-based registry loading utilities for the Sashiko ecosystem. Provides trusted (embedded) and validated (external) loading paths, schema validation integration, option-aware JSON parsing, and domain-specific error semantics through RegistryLoadException.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 140 5/3/2026
0.1.0 172 3/27/2026