Method Parse
- Namespace
- RuleWright.Serialization
- Assembly
- RuleWright.Serialization.dll
Parse(RuleJsonValue)
Validates and parses a rule document (a single rule or a rule set), against the built-in vocabulary only.
public static RuleSet Parse(RuleJsonValue document)
Parameters
documentRuleJsonValueThe document root.
Returns
- RuleSet
The parsed rule set; a single-rule document becomes a one-rule set.
Exceptions
- ArgumentNullException
documentis null.- RuleValidationException
The document fails structural validation.
Parse(RuleJsonValue, RuleDocumentOptions?)
Validates and parses a rule document, folding an engine's registered vocabulary (custom action types) into the schema contract.
Parsing is also where params disappear: a param is a named subexpression,
and every { "param": "..." } reference is replaced by the (immutable, shared)
expression it names — local names shadowing the set's. The domain model, the content
hash, and both execution paths therefore never see params at all, which is exactly why
a param-authored document and its hand-inlined equivalent compile to the same
delegates.
public static RuleSet Parse(RuleJsonValue document, RuleDocumentOptions? options)
Parameters
documentRuleJsonValueThe document root.
optionsRuleDocumentOptionsThe engine-registered vocabulary, or null for the built-ins only.
Returns
- RuleSet
The parsed rule set; a single-rule document becomes a one-rule set.
Exceptions
- ArgumentNullException
documentis null.- RuleValidationException
The document fails structural validation.