Table of Contents

Class RuleViolationProblemDetail

Namespace
Trellis.Asp
Assembly
Trellis.Asp.dll

JSON shape used for rule violations in ProblemDetails extensions.

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

Constructors

RuleViolationProblemDetail(string, string?, IReadOnlyList<ViolationLocation>, IReadOnlyDictionary<string, ValidationArgValue>?)

JSON shape used for rule violations in ProblemDetails extensions.

public RuleViolationProblemDetail(string Code, string? Detail, IReadOnlyList<ViolationLocation> Locations, IReadOnlyDictionary<string, ValidationArgValue>? Args)

Parameters

Code string

The machine-readable reason code.

Detail string

A human-readable explanation. Omitted when absent.

Locations IReadOnlyList<ViolationLocation>

Every location the rule spans. Always present: an empty array is a positive statement that the rule is form-level rather than bound to any field, which an omitted member could not express.

Args IReadOnlyDictionary<string, ValidationArgValue>

Arguments that parameterize the message. Omitted when absent.

Properties

Args

Arguments that parameterize the message. Omitted when absent.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyDictionary<string, ValidationArgValue>? Args { get; init; }

Property Value

IReadOnlyDictionary<string, ValidationArgValue>

Code

The machine-readable reason code.

public string Code { get; init; }

Property Value

string

Detail

A human-readable explanation. Omitted when absent.

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

Property Value

string

Locations

Every location the rule spans. Always present: an empty array is a positive statement that the rule is form-level rather than bound to any field, which an omitted member could not express.

public IReadOnlyList<ViolationLocation> Locations { get; init; }

Property Value

IReadOnlyList<ViolationLocation>