Struct JsonPathResolution
- Namespace
- JsonAssertions
- Assembly
- JsonAssertions.TUnit.dll
The outcome of resolving a dot-separated JSON path against a JsonElement.
Carries enough context for an assertion to render a failure message that says where
on the path resolution stopped, not merely that it did, the diagnostics that justify this
being a package rather than a hand-rolled TryGetProperty(...).IsTrue() helper.
public readonly record struct JsonPathResolution : IEquatable<JsonPathResolution>
- Implements
- Inherited Members
- Extension Methods
Properties
ContainerKind
The JsonValueKind of the element that FailedSegment was looked up on (the element at ResolvedPrefix). Distinguishes "the object has no such property" (Object) from "the path tried to read a property off a non-object" (String, Array, etc.). Meaningful only when Found is false.
public JsonValueKind ContainerKind { get; }
Property Value
Element
public JsonElement Element { get; }
Property Value
FailedSegment
public string? FailedSegment { get; }
Property Value
Found
Whether the full path resolved to an existing property.
public bool Found { get; }
Property Value
ResolvedPrefix
The longest path prefix that resolved before the failure point, for example
user.address when resolving user.address.city stopped at city. An
empty string when the very first segment failed against the root element. The full path
when Found is true.
public string ResolvedPrefix { get; }