OneOfRepresents 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
astis theUnionAST node.actualis the raw input value (plainunknown).successeslists 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>".
export class class OneOfclass OneOf {
_tag: 'OneOf';
ast: SchemaAST.Union;
actual: unknown;
successes: ReadonlyArray<SchemaAST.AST>;
toString: (this: Issue) => string;
}
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>".
OneOf extends class BaseBase {
readonly OneOf._tag: "OneOf"_tag = "OneOf"
/**
* The schema that caused the issue.
*/
readonly OneOf.ast: SchemaAST.Union(property) OneOf.ast: {
_tag: 'Union';
types: ReadonlyArray<A>;
mode: "anyOf" | "oneOf";
encodingChecks: Checks | undefined;
getParser: (recur: (ast: AST) => SchemaParser.Parser) => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Union<AST>;
recur: (recur: (ast: AST) => AST) => Union<AST>;
flip: (recur: (ast: AST) => AST) => Union<AST>;
matchPart: (s: string, options: ParseOptions) => LiteralValue | undefined;
getExpected: (getExpected: (ast: AST) => string) => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
The schema that caused the issue.
ast: import SchemaASTSchemaAST.type SchemaAST.Union = /*unresolved*/ anyUnion
/**
* The input value that caused the issue.
*/
readonly OneOf.actual: unknownThe input value that caused the issue.
actual: unknown
/**
* The schemas that were successful.
*/
readonly OneOf.successes: ReadonlyArray<SchemaAST.AST>The schemas that were successful.
successes: interface ReadonlyArray<T>ReadonlyArray<import SchemaASTSchemaAST.type SchemaAST.AST = /*unresolved*/ anyAST>
constructor(
/**
* The schema that caused the issue.
*/
ast: SchemaAST.Union(parameter) ast: {
_tag: 'Union';
types: ReadonlyArray<A>;
mode: "anyOf" | "oneOf";
encodingChecks: Checks | undefined;
getParser: (recur: (ast: AST) => SchemaParser.Parser) => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Union<AST>;
recur: (recur: (ast: AST) => AST) => Union<AST>;
flip: (recur: (ast: AST) => AST) => Union<AST>;
matchPart: (s: string, options: ParseOptions) => LiteralValue | undefined;
getExpected: (getExpected: (ast: AST) => string) => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
The schema that caused the issue.
ast: import SchemaASTSchemaAST.type SchemaAST.Union = /*unresolved*/ anyUnion,
/**
* The input value that caused the issue.
*/
actual: unknownThe input value that caused the issue.
actual: unknown,
/**
* The schemas that were successful.
*/
successes: ReadonlyArray<SchemaAST.AST>The schemas that were successful.
successes: interface ReadonlyArray<T>ReadonlyArray<import SchemaASTSchemaAST.type SchemaAST.AST = /*unresolved*/ anyAST>
) {
super()
this.OneOf.ast: SchemaAST.Union(property) OneOf.ast: {
_tag: 'Union';
types: ReadonlyArray<A>;
mode: "anyOf" | "oneOf";
encodingChecks: Checks | undefined;
getParser: (recur: (ast: AST) => SchemaParser.Parser) => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Union<AST>;
recur: (recur: (ast: AST) => AST) => Union<AST>;
flip: (recur: (ast: AST) => AST) => Union<AST>;
matchPart: (s: string, options: ParseOptions) => LiteralValue | undefined;
getExpected: (getExpected: (ast: AST) => string) => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
The schema that caused the issue.
ast = ast: SchemaAST.Union(parameter) ast: {
_tag: 'Union';
types: ReadonlyArray<A>;
mode: "anyOf" | "oneOf";
encodingChecks: Checks | undefined;
getParser: (recur: (ast: AST) => SchemaParser.Parser) => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Union<AST>;
recur: (recur: (ast: AST) => AST) => Union<AST>;
flip: (recur: (ast: AST) => AST) => Union<AST>;
matchPart: (s: string, options: ParseOptions) => LiteralValue | undefined;
getExpected: (getExpected: (ast: AST) => string) => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
The schema that caused the issue.
ast
this.OneOf.actual: unknownThe input value that caused the issue.
actual = actual: unknownThe input value that caused the issue.
actual
this.OneOf.successes: ReadonlyArray<SchemaAST.AST>The schemas that were successful.
successes = successes: ReadonlyArray<SchemaAST.AST>The schemas that were successful.
successes
}
}