Table of Contents

Class ViolationLocation

Namespace
Trellis.Asp
Assembly
Trellis.Asp.dll

The wire form of a validation error's location: which part of the input it came from, and where within that part.

[SuppressMessage("Naming", "CA1720:Identifier contains type name", Justification = "'pointer' is the frozen RFC 9457 wire member name for an RFC 6901 JSON Pointer, not a .NET type reference. Renaming it would change the published contract.")]
public sealed record ViolationLocation : IEquatable<ViolationLocation>
Inheritance
ViolationLocation
Implements
Inherited Members
Extension Methods

Remarks

unknown means "do not resolve pointer as a document location". A JSON Pointer addresses a location in a JSON document, and a query parameter is not in one — so a single member cannot carry both meanings.

Constructors

ViolationLocation(string, string?, string?)

The wire form of a validation error's location: which part of the input it came from, and where within that part.

public ViolationLocation(string In, string? Pointer, string? Name)

Parameters

In string

The location discriminator — body, query, path, header, or unknown. Always present, never defaulted by omission: an omitted discriminator would force every client to encode the default.

Pointer string

An RFC 6901 JSON Pointer into the request document. Present for body and unknown; absent otherwise.

Name string

The parameter name. Present for query, path and header; absent otherwise.

Remarks

unknown means "do not resolve pointer as a document location". A JSON Pointer addresses a location in a JSON document, and a query parameter is not in one — so a single member cannot carry both meanings.

Properties

In

The location discriminator — body, query, path, header, or unknown. Always present, never defaulted by omission: an omitted discriminator would force every client to encode the default.

public string In { get; init; }

Property Value

string

Name

The parameter name. Present for query, path and header; absent otherwise.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Name { get; init; }

Property Value

string

Pointer

An RFC 6901 JSON Pointer into the request document. Present for body and unknown; absent otherwise.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Pointer { get; init; }

Property Value

string