Hyperlinkv0.8.0-beta.28

SchemaIssue

SchemaIssue.OneOfclasseffect/SchemaIssue.ts:708
OneOf

Represents a schema issue produced when a value matches multiple members of a union that is configured to allow exactly one match (oneOf mode).

When to use

Use when you need to detect ambiguous union matches when oneOf validation is enabled.

Details

  • ast is the Union AST node.
  • actual is the raw input value (plain unknown).
  • successes lists the AST nodes of each member that accepted the input.
  • The default formatter renders this as "Expected exactly one member to match the input <actual>".
modelsAnyOf
export class OneOf extends Base {
  readonly _tag = "OneOf"
  /**
   * The schema that caused the issue.
   */
  readonly ast: SchemaAST.Union
  /**
   * The input value that caused the issue.
   */
  readonly actual: unknown
  /**
   * The schemas that were successful.
   */
  readonly successes: ReadonlyArray<SchemaAST.AST>

  constructor(
    /**
     * The schema that caused the issue.
     */
    ast: SchemaAST.Union,
    /**
     * The input value that caused the issue.
     */
    actual: unknown,
    /**
     * The schemas that were successful.
     */
    successes: ReadonlyArray<SchemaAST.AST>
  ) {
    super()
    this.ast = ast
    this.actual = actual
    this.successes = successes
  }
}
Referenced by 1 symbols