Class ProtoJsonReadSemantics

Namespace
ProtoTest.Json
Assembly
ProtoTest.Json.dll

How one protocol reads JSON: the exception its failures carry and the wording its required-read reasons use. The read itself - parse, resolve the optional path, apply the required null rules and deserialize - lives in ProtoJsonRead, so REST, GraphQL and messaging cannot drift.

public sealed record ProtoJsonReadSemantics : IEquatable<ProtoJsonReadSemantics>
Inheritance
ProtoJsonReadSemantics
Implements
Inherited Members
Extension Methods

Constructors

ProtoJsonReadSemantics(Func<string, Exception>, Func<string, Exception, Exception>, string, string, Action<Exception, string?>?, bool)

How one protocol reads JSON: the exception its failures carry and the wording its required-read reasons use. The read itself - parse, resolve the optional path, apply the required null rules and deserialize - lives in ProtoJsonRead, so REST, GraphQL and messaging cannot drift.

public ProtoJsonReadSemantics(Func<string, Exception> RequiredFailure, Func<string, Exception, Exception> PathMissFailure, string EmptyBodyReason, string NullBodyReason, Action<Exception, string?>? TraceFailure = null, bool NullRootReturnsDefault = false)

Parameters

RequiredFailure Func<string, Exception>
PathMissFailure Func<string, Exception, Exception>
EmptyBodyReason string
NullBodyReason string
TraceFailure Action<Exception, string>
NullRootReturnsDefault bool

Properties

EmptyBodyReason

public string EmptyBodyReason { get; init; }

Property Value

string

NullBodyReason

public string NullBodyReason { get; init; }

Property Value

string

NullRootReturnsDefault

public bool NullRootReturnsDefault { get; init; }

Property Value

bool

PathMissFailure

public Func<string, Exception, Exception> PathMissFailure { get; init; }

Property Value

Func<string, Exception, Exception>

RequiredFailure

public Func<string, Exception> RequiredFailure { get; init; }

Property Value

Func<string, Exception>

TraceFailure

public Action<Exception, string?>? TraceFailure { get; init; }

Property Value

Action<Exception, string>

Methods

NullValueReason(string)

The reason a required read names a JSON-null value at a path with.

public static string NullValueReason(string jsonPath)

Parameters

jsonPath string

Returns

string