Sashiko.Registries
0.1.1
dotnet add package Sashiko.Registries --version 0.1.1
NuGet\Install-Package Sashiko.Registries -Version 0.1.1
<PackageReference Include="Sashiko.Registries" Version="0.1.1" />
<PackageVersion Include="Sashiko.Registries" Version="0.1.1" />
<PackageReference Include="Sashiko.Registries" />
paket add Sashiko.Registries --version 0.1.1
#r "nuget: Sashiko.Registries, 0.1.1"
#:package Sashiko.Registries@0.1.1
#addin nuget:?package=Sashiko.Registries&version=0.1.1
#tool nuget:?package=Sashiko.Registries&version=0.1.1
πΈ Sashiko.Registries
Sashiko.Registries provides lightweight helpers for loading structured registry data from JSON.
It is designed for packages and applications that rely on declarative data: languages, names, biomes, items, rules, or any domain where structured data defines behavior.
β¨ Features
- JSON object registry loader
- JSON list registry loader
- Separate loading behavior for trusted embedded data and untrusted external data
- Schema validation integration through
ISchemaValidator - Option-aware JSON parsing with
System.Text.Json - Predictable
RegistryLoadExceptionwrapping for external input failures - Clear source/type diagnostics for easier debugging
π¦ Installation
dotnet add package Sashiko.Registries
π Usage
Create a registry loader
using System.Text.Json;
using Sashiko.Registries.Json;
using Sashiko.Validation.Validators.Json;
var loader = new JsonRegistryObjectLoader<MyRegistryEntry>(
schemaValidator: new JsonSchemaValidator(),
embeddedOptions: new JsonSerializerOptions
{
PropertyNameCaseInsensitive = false
},
externalOptions: new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
AllowTrailingCommas = true
});
Load trusted embedded JSON
var entry = loader.LoadEmbedded(json, "MyRegistryEntry.json");
Load and validate external JSON
try
{
var entry = loader.LoadExternal(json, "MyRegistryEntry.json");
}
catch (RegistryLoadException ex)
{
Console.WriteLine($"Failed to load registry data from {ex.SourceName}");
}
π‘οΈ Error Model
| Scenario | Exception |
|---|---|
| Embedded JSON invalid | JsonException |
| External JSON invalid | RegistryLoadException |
| External schema mismatch | ValidationException |
| External deserialization failure | RegistryLoadException |
Embedded data is treated as trusted package data. External data is validated and wrapped so callers can handle registry-loading failures consistently.
π§ͺ Testing
The test suite covers:
- embedded vs external loading behavior
- JSON option inheritance
- trailing comma handling
- schema validation integration
- validation context metadata
- exception wrapping semantics
πΊοΈ Roadmap
Future versions may include:
- additional structured-data formats
- richer registry composition helpers
- source-mapped diagnostics
- built-in validator integrations
π€ 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
- Sashiko.Core (>= 0.3.1)
- Sashiko.Validation (>= 0.1.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Sashiko.Registries:
| Package | Downloads |
|---|---|
|
Sashiko.Names
Culturally aware person name generator for the Sashiko ecosystem. Provides embedded, curated name pools and language-specific generation rules for realistic structured person names without runtime external data sources. |
|
|
Sashiko.Languages
Strongly-typed ISO 639-3/2/1 language registry for the Sashiko ecosystem. Provides a complete embedded dataset derived from SIL International's ISO 639-3 tables, with lookup utilities and a stable, immutable registry model. |
GitHub repositories
This package is not used by any popular GitHub repositories.