Hyperlinkv0.8.0-beta.28

SchemaIssue

SchemaIssue.UnexpectedKeyclasseffect/SchemaIssue.ts:358
UnexpectedKey

Represents a schema issue produced when an input object or tuple contains a key/index not declared by the schema.

When to use

Use when you need to detect excess properties during strict struct/tuple validation.

Details

  • actual is the raw value at the unexpected key (plain unknown).
  • ast is the schema that was being validated against.
  • annotations on ast may contain a custom messageUnexpectedKey.
export class UnexpectedKey extends Base {
  readonly _tag = "UnexpectedKey"
  /**
   * The schema that caused the issue.
   */
  readonly ast: SchemaAST.AST
  /**
   * The input value that caused the issue.
   */
  readonly actual: unknown

  constructor(
    /**
     * The schema that caused the issue.
     */
    ast: SchemaAST.AST,
    /**
     * The input value that caused the issue.
     */
    actual: unknown
  ) {
    super()
    this.ast = ast
    this.actual = actual
  }
}
Referenced by 3 symbols