Rulewright.Serialization
0.3.0
dotnet add package Rulewright.Serialization --version 0.3.0
NuGet\Install-Package Rulewright.Serialization -Version 0.3.0
<PackageReference Include="Rulewright.Serialization" Version="0.3.0" />
<PackageVersion Include="Rulewright.Serialization" Version="0.3.0" />
<PackageReference Include="Rulewright.Serialization" />
paket add Rulewright.Serialization --version 0.3.0
#r "nuget: Rulewright.Serialization, 0.3.0"
#:package Rulewright.Serialization@0.3.0
#addin nuget:?package=Rulewright.Serialization&version=0.3.0
#tool nuget:?package=Rulewright.Serialization&version=0.3.0
Rulewright.Serialization
JSON-to-domain mapping, structural schema validation, and canonical rule hashing for Rulewright.
No JSON library dependency — parsing is abstracted behind IRuleJsonReader, which the
adapter packages implement.
Install
dotnet add package Rulewright.Serialization
You almost certainly want Rulewright
instead — it includes this package. Install Rulewright.Serialization directly when you
want to validate, hash, or inspect rule documents without evaluating them: a CI check on a
rules repository, a rule-authoring UI, or a schema-driven editor.
Validate a document
RuleSetValidator returns every error with a JSON pointer, so an editor can put a squiggle in
the right place rather than reporting "invalid".
using Rulewright.Serialization;
using Rulewright.Json.SystemText;
RuleJsonValue document = new SystemTextJsonReader().Read(json);
RuleSetValidationResult result = RuleSetValidator.Validate(document);
foreach (RuleValidationError error in result.Errors)
Console.WriteLine($"{error.Path}: {error.Message}");
// /rules/0/condition/value: 'value' must be a string for operator 'Contains'.
Enumerate the authoring vocabulary
RuleSchemaCatalog exposes the closed vocabulary as structured metadata — condition operators
with their value kinds, logical combinators with child arity, expression operators with operand
arity, and action types — derived from the same sources the parser and validator use, so a
builder UI cannot drift from what the engine accepts.
foreach (ConditionOperatorInfo op in RuleSchemaCatalog.ConditionOperators)
Console.WriteLine($"{op.JsonName} takes {op.ValueKind}");
Hash a rule
RuleHasher renders a rule's compilation-relevant content — the condition tree and actions —
in canonical form and SHA-256s it. It is insensitive to whitespace, key order, and the
layout, id, description, priority, and enabled members, so canvas edits and metadata
changes never invalidate a cache while any semantic change always does. This is the engine's
compiled-delegate cache key, and it works equally well as an "did this rule really change?"
check in review tooling.
string hash = RuleHasher.ComputeHash(rule);
string canonical = RuleHasher.GetCanonicalForm(rule); // for diagnostics
Parse
RuleSetParser.Parse maps a validated document to the immutable RuleSet model, expanding
decisionTable documents into ordinary rules on the way.
Requirements
.NET Framework 4.8, .NET Standard 2.0, .NET 8.0 or .NET 10.0.
License
MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- Rulewright.Core (>= 0.3.0)
-
.NETStandard 2.0
- Rulewright.Core (>= 0.3.0)
-
net10.0
- Rulewright.Core (>= 0.3.0)
-
net8.0
- Rulewright.Core (>= 0.3.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Rulewright.Serialization:
| Package | Downloads |
|---|---|
|
Rulewright.Execution
Rulewright execution engine: expression-tree rule compiler, dynamic-fact interpreter fallback, thread-safe compiled delegate cache, and the RulewrightBuilder/RulewrightEngine public API. |
|
|
Rulewright.Json.SystemText
System.Text.Json adapter for Rulewright: implements IRuleJsonReader and JsonElement fact helpers. |
|
|
Rulewright
The Rulewright rule engine — everything you need in one package: the core domain model, JSON parsing and schema validation, the expression-tree evaluation engine, the System.Text.Json adapter, and the built-in custom functions. Rules are plain JSON; evaluation is compiled expression trees. Install this unless you want to pick pieces individually. |
|
|
Rulewright.Json.NewtonsoftJson
Newtonsoft.Json adapter for Rulewright: implements IRuleJsonReader and JToken fact helpers. |
GitHub repositories
This package is not used by any popular GitHub repositories.
See https://github.com/albahadly/rulewright/releases for release notes.