Sashiko.Validation
0.1.1
dotnet add package Sashiko.Validation --version 0.1.1
NuGet\Install-Package Sashiko.Validation -Version 0.1.1
<PackageReference Include="Sashiko.Validation" Version="0.1.1" />
<PackageVersion Include="Sashiko.Validation" Version="0.1.1" />
<PackageReference Include="Sashiko.Validation" />
paket add Sashiko.Validation --version 0.1.1
#r "nuget: Sashiko.Validation, 0.1.1"
#:package Sashiko.Validation@0.1.1
#addin nuget:?package=Sashiko.Validation&version=0.1.1
#tool nuget:?package=Sashiko.Validation&version=0.1.1
πΈ 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
ISchemaValidatorabstraction - 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 | Versions 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. |
-
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.