Hyperlinkv0.8.0-beta.28

SchemaAST

SchemaAST.Contextclasseffect/SchemaAST.ts:546
Context

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).
export class Context {
  readonly isOptional: boolean
  readonly isMutable: boolean
  /** Used for constructor default values (e.g. `withConstructorDefault` API) */
  readonly defaultValue: Encoding | undefined
  readonly annotations: Schema.Annotations.Key<unknown> | undefined

  constructor(
    isOptional: boolean,
    isMutable: boolean,
    /** Used for constructor default values (e.g. `withConstructorDefault` API) */
    defaultValue: Encoding | undefined = undefined,
    annotations: Schema.Annotations.Key<unknown> | undefined = undefined
  ) {
    this.isOptional = isOptional
    this.isMutable = isMutable
    this.defaultValue = defaultValue
    this.annotations = annotations
  }
}
Referenced by 11 symbols