Table of Contents

Class JsonPointerNormalizer

Namespace
Trellis.FluentValidation
Assembly
Trellis.FluentValidation.dll

Converts FluentValidation member-chain property names (e.g., Address.PostCode, Items[0].Sku) into camelCase RFC 6901 JSON Pointers (e.g., /address/postCode, /items/0/sku) so they can be carried through Trellis InputPointer values. Each name segment's first character is lower-cased (via ToCamelCase(string?)) so FluentValidation error keys match the camelCase JSON wire and the rest of Trellis's validation field names; indexer segments are left unchanged.

public static class JsonPointerNormalizer
Inheritance
JsonPointerNormalizer
Inherited Members

Remarks

Public surface. Promoted from internal in the v3 package split so the Trellis.Mediator.FluentValidation adapter (which lives in a separate assembly after the split) can call ToJsonPointer(string?) across the package boundary without forcing every consumer of Trellis.FluentValidation to take the Mediator dependency. Third-party FluentValidation adapters that need to project FluentValidation property names into InputPointer values can also use this helper directly.

Methods

ToJsonPointer(string?)

Converts a FluentValidation PropertyName to an RFC 6901 JSON Pointer string.

public static string ToJsonPointer(string? propertyName)

Parameters

propertyName string

The FluentValidation property name. May contain dotted member chains (Address.PostCode) and indexer expressions (Items[0].Sku).

Returns

string

An RFC 6901 JSON Pointer string. Returns "" for null/empty input. Inputs that already start with "/" are assumed to already be pointers and are returned unchanged.