EncodingRepresents a schema issue produced when a schema transformation (encode/decode step) fails.
When to use
Use when you need to inspect failures from Schema.decodeTo / Schema.encodeTo
transformations.
Details
astis the AST node for the transformation that failed.actualisOption.some(value)when the input was present, orOption.none()when it was absent.issueis the inner issue describing the failure.
export class class Encodingclass Encoding {
_tag: 'Encoding';
ast: SchemaAST.AST;
actual: Option.Option<unknown>;
issue: Issue;
toString: (this: Issue) => string;
}
Represents a schema issue produced when a schema transformation (encode/decode step) fails.
When to use
Use when you need to inspect failures from Schema.decodeTo / Schema.encodeTo
transformations.
Details
ast is the AST node for the transformation that failed.
actual is Option.some(value) when the input was present, or
Option.none() when it was absent.
issue is the inner issue describing the failure.
Encoding extends class BaseBase {
readonly Encoding._tag: "Encoding"_tag = "Encoding"
/**
* The schema that caused the issue.
*/
readonly Encoding.ast: SchemaAST.ASTThe schema that caused the issue.
ast: import SchemaASTSchemaAST.type AST = SchemaAST.Declaration | SchemaAST.Null | SchemaAST.Undefined | SchemaAST.Void | SchemaAST.Never | SchemaAST.Unknown | SchemaAST.Any | SchemaAST.String | SchemaAST.Number | SchemaAST.Boolean | SchemaAST.BigInt | SchemaAST.Symbol | SchemaAST.Literal | SchemaAST.UniqueSymbol | SchemaAST.ObjectKeyword | SchemaAST.Enum | SchemaAST.TemplateLiteral | SchemaAST.Arrays | SchemaAST.Objects | SchemaAST.Union<...> | SchemaAST.SuspendDiscriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST
/**
* The input value that caused the issue.
*/
readonly Encoding.actual: Option.Option<unknown>The input value that caused the issue.
actual: import OptionOption.type Option<A> = Option.None<A> | Option.Some<A>The Option data type represents optional values. An Option<A> is either
Some<A>, containing a value of type A, or None, representing absence.
When to use
Use to represent initial values that may not yet exist
- Returning from partial functions (not defined for all inputs)
- Managing optional fields in data structures
Namespace containing utility types for Option.
When to use
Use to access type-level helpers associated with Option.
Option<unknown>
/**
* The issue that occurred.
*/
readonly Encoding.issue: IssueThe issue that occurred.
issue: type Issue =
| Leaf
| Filter
| Encoding
| Pointer
| Composite
| AnyOf
The root discriminated union of all validation error nodes.
When to use
Use when typing the error channel in Effect<A, Issue, R> results from
schema parsing, or when writing custom formatters or issue-tree walkers.
Details
Every node has a _tag field for pattern-matching. The union includes both
terminal
Leaf
types and composite types that wrap inner issues:
Filter
,
Encoding
,
Pointer
,
Composite
,
AnyOf
. All Issue instances have a toString() that delegates to
the default formatter, so String(issue) produces a human-readable message.
Issue
constructor(
/**
* The schema that caused the issue.
*/
ast: SchemaAST.ASTThe schema that caused the issue.
ast: import SchemaASTSchemaAST.type AST = SchemaAST.Declaration | SchemaAST.Null | SchemaAST.Undefined | SchemaAST.Void | SchemaAST.Never | SchemaAST.Unknown | SchemaAST.Any | SchemaAST.String | SchemaAST.Number | SchemaAST.Boolean | SchemaAST.BigInt | SchemaAST.Symbol | SchemaAST.Literal | SchemaAST.UniqueSymbol | SchemaAST.ObjectKeyword | SchemaAST.Enum | SchemaAST.TemplateLiteral | SchemaAST.Arrays | SchemaAST.Objects | SchemaAST.Union<...> | SchemaAST.SuspendDiscriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST,
/**
* The input value that caused the issue.
*/
actual: Option.Option<unknown>The input value that caused the issue.
actual: import OptionOption.type Option<A> = Option.None<A> | Option.Some<A>The Option data type represents optional values. An Option<A> is either
Some<A>, containing a value of type A, or None, representing absence.
When to use
Use to represent initial values that may not yet exist
- Returning from partial functions (not defined for all inputs)
- Managing optional fields in data structures
Namespace containing utility types for Option.
When to use
Use to access type-level helpers associated with Option.
Option<unknown>,
/**
* The issue that occurred.
*/
issue: IssueThe issue that occurred.
issue: type Issue =
| Leaf
| Filter
| Encoding
| Pointer
| Composite
| AnyOf
The root discriminated union of all validation error nodes.
When to use
Use when typing the error channel in Effect<A, Issue, R> results from
schema parsing, or when writing custom formatters or issue-tree walkers.
Details
Every node has a _tag field for pattern-matching. The union includes both
terminal
Leaf
types and composite types that wrap inner issues:
Filter
,
Encoding
,
Pointer
,
Composite
,
AnyOf
. All Issue instances have a toString() that delegates to
the default formatter, so String(issue) produces a human-readable message.
Issue
) {
super()
this.Encoding.ast: SchemaAST.ASTThe schema that caused the issue.
ast = ast: SchemaAST.ASTThe schema that caused the issue.
ast
this.Encoding.actual: Option.Option<unknown>The input value that caused the issue.
actual = actual: Option.Option<unknown>The input value that caused the issue.
actual
this.Encoding.issue: IssueThe issue that occurred.
issue = issue: IssueThe issue that occurred.
issue
}
}