RuleWright.Serialization
1.0.2
See the version list below for details.
dotnet add package RuleWright.Serialization --version 1.0.2
NuGet\Install-Package RuleWright.Serialization -Version 1.0.2
<PackageReference Include="RuleWright.Serialization" Version="1.0.2" />
<PackageVersion Include="RuleWright.Serialization" Version="1.0.2" />
<PackageReference Include="RuleWright.Serialization" />
paket add RuleWright.Serialization --version 1.0.2
#r "nuget: RuleWright.Serialization, 1.0.2"
#:package RuleWright.Serialization@1.0.2
#addin nuget:?package=RuleWright.Serialization&version=1.0.2
#tool nuget:?package=RuleWright.Serialization&version=1.0.2
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.
Documentation
📖 RuleWright documentation ·
The rule document format ·
API reference: RuleWright.Serialization
Contact
Questions, support or licensing: salwan@albahadly.com · www.albahadly.com
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 (>= 1.0.2)
-
.NETStandard 2.0
- RuleWright.Core (>= 1.0.2)
-
net10.0
- RuleWright.Core (>= 1.0.2)
-
net8.0
- RuleWright.Core (>= 1.0.2)
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.Json.NewtonsoftJson
Newtonsoft.Json adapter for RuleWright: implements IRuleJsonReader and JToken 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. |
GitHub repositories
This package is not used by any popular GitHub repositories.
See https://github.com/albahadly/rulewright/releases for release notes.