Skip to main content

Class ValueObjectSchema

Namespace: AdCodicem.ValueObjects.Metadata
Assembly: AdCodicem.ValueObjects.Abstractions.dll

The declarative constraints of a value object, captured once at compile time.

public sealed record ValueObjectSchema : IEquatable<ValueObjectSchema>

Inheritance

objectValueObjectSchema

Implements

IEquatable<ValueObjectSchema>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks

The generator fills this from the ValueObjectAttribute so that the rules enforced by Validate and the rules published in the OpenAPI schema or applied to an EF Core column can never drift apart: they all read the same instance.

Properties

Description

Gets the human-readable description of the value object, if any.

public string? Description { get; init; }

Property Value

string?

Example

Gets an example value, if any.

public string? Example { get; init; }

Property Value

string?

Format

Gets the OpenAPI format keyword for the value, if any.

public string? Format { get; init; }

Property Value

string?

IsClosedValueSet

Gets a value indicating whether only are accepted.

public bool IsClosedValueSet { get; init; }

Property Value

bool

KnownValues

Gets the declared known underlying values, boxed, in declaration order.

public ImmutableArray<object> KnownValues { get; init; }

Property Value

ImmutableArray<object>

Remarks

Surfaced as the enum keyword of the OpenAPI schema.

MaxLength

Gets the maximum accepted length, if any.

public int? MaxLength { get; init; }

Property Value

int?

Remarks

Used by the EF Core integration to size the mapped column.

Maximum

Gets the inclusive upper bound in invariant culture, if any.

public string? Maximum { get; init; }

Property Value

string?

MinLength

Gets the minimum accepted length, if any.

public int? MinLength { get; init; }

Property Value

int?

Minimum

Gets the inclusive lower bound in invariant culture, if any.

public string? Minimum { get; init; }

Property Value

string?

Pattern

Gets the regular expression the value must match, if any.

public string? Pattern { get; init; }

Property Value

string?

Unconstrained

Gets the schema of a value object that declares no constraint.

public static ValueObjectSchema Unconstrained { get; }

Property Value

ValueObjectSchema