Skip to main content
Version: 0.3.x (0.3.0)

Class KnownValueInfo

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

A value declared through [KnownValue]: the underlying value, the name of the static property the generator creates for it, and the description the attribute gives it.

public sealed record KnownValueInfo : IEquatable<KnownValueInfo>

Inheritance​

object ← KnownValueInfo

Implements​

IEquatable<KnownValueInfo>

Inherited Members​

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

Remarks​

lists one per known value, in declaration order. The OpenAPI integration publishes the names beside the enum of a closed value set, so that a client generated from the document names the members of its enumeration as the server code names its constants, France rather than FR.

The name therefore becomes part of the contract a generated client holds: renaming a known value renames that member in every client generated afterwards, as renaming a member of an enumeration would.

Constructors​

KnownValueInfo(object, string, string?)​

Initializes a new instance of the record.

public KnownValueInfo(object value, string name, string? description = null)

Parameters​

value object

The underlying value, as holds it: normalized, and of the underlying type wherever the generator wrote the schema.

name string

The name of the known value, the name of its static property on the value object.

description string?

Its description, if any.

Exceptions​

ArgumentNullException

value or name is null.

ArgumentException

name is empty or consists only of white space.

Properties​

Description​

Gets the description of the known value, if one was declared.

public string? Description { get; }

Property Value​

string?

Name​

Gets the name of the known value, the name of its static property on the value object.

public string Name { get; }

Property Value​

string

Value​

Gets the underlying value.

public object Value { get; }

Property Value​

object