ContextRepresents per-property metadata attached to AST nodes via Base.context.
Details
Tracks whether a property key is optional, mutable, has a constructor
default, or carries key-level annotations. Typically set by helpers like
optionalKey and Schema.mutableKey.
isOptional— the property key may be absent from the input.isMutable— the property isreadonlywhenfalse.defaultValue— an Encoding applied during construction to supply missing values.annotations— key-level annotations (e.g. description of the key itself).
export class class Contextclass Context {
isOptional: boolean;
isMutable: boolean;
defaultValue: Encoding | undefined;
annotations: Schema.Annotations.Key<unknown> | undefined;
}
Represents per-property metadata attached to AST nodes via
Base.context
.
Details
Tracks whether a property key is optional, mutable, has a constructor
default, or carries key-level annotations. Typically set by helpers like
optionalKey
and Schema.mutableKey.
isOptional — the property key may be absent from the input.
isMutable — the property is readonly when false.
defaultValue — an
Encoding
applied during construction to
supply missing values.
annotations — key-level annotations (e.g. description of the key
itself).
Context {
readonly Context.isOptional: booleanisOptional: boolean
readonly Context.isMutable: booleanisMutable: boolean
/** Used for constructor default values (e.g. `withConstructorDefault` API) */
readonly Context.defaultValue: Encoding | undefinedUsed for constructor default values (e.g. withConstructorDefault API)
defaultValue: type Encoding = readonly [Link, ...Link[]]A non-empty chain of
Link
values representing the transformation
steps between a schema's decoded (type) form and its encoded (wire) form.
Details
Stored on
Base.encoding
. When undefined, the node has no
encoding transformation (type and encoded forms are identical).
Encoding | undefined
readonly Context.annotations: anyannotations: import SchemaSchema.declareAnnotations.type Schema.Annotations.Key = /*unresolved*/ anyKey<unknown> | undefined
constructor(
isOptional: booleanisOptional: boolean,
isMutable: booleanisMutable: boolean,
/** Used for constructor default values (e.g. `withConstructorDefault` API) */
defaultValue: Encoding | undefinedUsed for constructor default values (e.g. withConstructorDefault API)
defaultValue: type Encoding = readonly [Link, ...Link[]]A non-empty chain of
Link
values representing the transformation
steps between a schema's decoded (type) form and its encoded (wire) form.
Details
Stored on
Base.encoding
. When undefined, the node has no
encoding transformation (type and encoded forms are identical).
Encoding | undefined = var undefinedundefined,
annotations: anyannotations: import SchemaSchema.declareAnnotations.type Schema.Annotations.Key = /*unresolved*/ anyKey<unknown> | undefined = var undefinedundefined
) {
this.Context.isOptional: booleanisOptional = isOptional: booleanisOptional
this.Context.isMutable: booleanisMutable = isMutable: booleanisMutable
this.Context.defaultValue: Encoding | undefinedUsed for constructor default values (e.g. withConstructorDefault API)
defaultValue = defaultValue: Encoding | undefinedUsed for constructor default values (e.g. withConstructorDefault API)
defaultValue
this.Context.annotations: anyannotations = annotations: anyannotations
}
}