Skip to content

FieldDescription

FieldDescription holds metadata related to fields declared within a type.

  • description

new FieldDescription(descValue, keyType?, valueType?, reflectTypeValue?, zeroMsgValue?, jsonFieldName?): FieldDescription

DescField | DescExtension

FieldDescription

KeyType holds the key FieldDescription for map fields.

FieldDescription

ValueType holds the value FieldDescription for map fields.

unknown

Message

boolean = false

FieldDescription

readonly jsonFieldName: boolean = false


readonly optional keyType?: FieldDescription

KeyType holds the key FieldDescription for map fields.


readonly optional valueType?: FieldDescription

ValueType holds the value FieldDescription for map fields.

checkedType(): Type

CheckedType returns the type-definition used at type-check time.

Type


descriptor(): DescField | DescExtension

Descriptor returns the field descriptor.

DescField | DescExtension


documentation(): string

Documentation returns the documentation for the field.

string


getFrom(target): [unknown, Error | undefined]

GetFrom returns the accessor method associated with the field on the proto generated struct.

unknown

[unknown, Error | undefined]


isEnum(): boolean

IsEnum returns true if the field type refers to an enum value.

boolean


isList(): boolean

IsList returns true if the field is a repeated value.

boolean


isMap(): boolean

IsMap returns true if the field is of map type.

boolean


isMessage(): boolean

IsMessage returns true if the field is a message type.

boolean


isOneof(): boolean

IsOneof returns true if the field is declared within a oneof block.

boolean


isSet(target): boolean

IsSet returns whether the field is set on the target value.

unknown

boolean


jsonName(): string

JSONName returns the JSON name of the field, if present.

string


maybeUnwrapDynamic(msg): [unknown, boolean, Error | undefined]

MaybeUnwrapDynamic takes the reflected message and determines whether the value can be unwrapped.

Message

[unknown, boolean, Error | undefined]


name(): string

Name returns the snake_case name of the field within the proto-based struct.

string


protoKind(): string

ProtoKind returns the protobuf kind of the field.

string


reflectType(): unknown

ReflectType returns the reflected runtime type token for this field.

unknown


toString(): string

String returns the fully qualified name of the field within its type.

string


zero(): Message | undefined

Zero returns the zero value for the protobuf message represented by this field.

Message | undefined

description.zero