Table of Contents

Struct InputPointer

Namespace
Trellis
Assembly
Trellis.Core.dll

A pointer into a structured input document, expressed as an RFC 6901 JSON Pointer. Used by validation errors to identify the location of an offending value.

public readonly record struct InputPointer : IEquatable<InputPointer>
Implements
Inherited Members
Extension Methods

Examples

new InputPointer("/email")
new InputPointer("/items/0/quantity")
new InputPointer("")            // root

Constructors

InputPointer(string)

A pointer into a structured input document, expressed as an RFC 6901 JSON Pointer. Used by validation errors to identify the location of an offending value.

public InputPointer(string Path)

Parameters

Path string

The JSON Pointer path (e.g. "/email", "/items/0/quantity"). The root of the input is "".

Examples

new InputPointer("/email")
new InputPointer("/items/0/quantity")
new InputPointer("")            // root

Properties

Path

The JSON Pointer path (e.g. "/email", "/items/0/quantity"). The root of the input is "".

public string Path { get; init; }

Property Value

string

Root

A pointer to the root of the input document.

public static InputPointer Root { get; }

Property Value

InputPointer

Methods

ForProperty(string)

Builds an InputPointer from a property name, prepending "/" if the value is not already a JSON Pointer.

public static InputPointer ForProperty(string propertyName)

Parameters

propertyName string

A simple property name or full JSON Pointer.

Returns

InputPointer

An InputPointer.

Remarks

When the input is a simple property name (does not start with '/'), the special characters defined by RFC 6901 §3 are escaped: '~' becomes "~0" and '/' becomes "~1". The order is significant — '~' is escaped first so that an already-introduced "~1" from a slash escape is not re-escaped as "~01". Inputs that already start with '/' are assumed to be a fully-formed JSON Pointer (e.g. produced by JsonPointerNormalizer) and are passed through unchanged.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.