ForbiddenRepresents a schema issue produced when a forbidden operation is encountered during parsing,
such as an asynchronous Effect running inside Schema.decodeUnknownSync.
When to use
Use when you need to detect that a schema requires async execution but was run synchronously.
Details
actualisOption.some(value)when the input is known, orOption.none()when absent.annotationsoptionally carries amessagestring.- The default formatter renders this as
"Forbidden operation".
Example (Creating a Forbidden issue)
import { Option, SchemaIssue } from "effect"
const issue = new SchemaIssue.Forbidden(
Option.none(),
{ message: "async operation not allowed in sync context" }
)
console.log(String(issue))
// "async operation not allowed in sync context"export class class Forbiddenclass Forbidden {
_tag: 'Forbidden';
actual: Option.Option<unknown>;
annotations: Schema.Annotations.Issue | undefined;
toString: (this: Issue) => string;
}
Represents a schema issue produced when a forbidden operation is encountered during parsing,
such as an asynchronous Effect running inside Schema.decodeUnknownSync.
When to use
Use when you need to detect that a schema requires async execution but was run
synchronously.
Details
actual is Option.some(value) when the input is known, or
Option.none() when absent.
annotations optionally carries a message string.
- The default formatter renders this as
"Forbidden operation".
Example (Creating a Forbidden issue)
import { Option, SchemaIssue } from "effect"
const issue = new SchemaIssue.Forbidden(
Option.none(),
{ message: "async operation not allowed in sync context" }
)
console.log(String(issue))
// "async operation not allowed in sync context"
Forbidden extends class BaseBase {
readonly Forbidden._tag: "Forbidden"_tag = "Forbidden"
/**
* The input value that caused the issue.
*/
readonly Forbidden.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 metadata for the issue.
*/
readonly Forbidden.annotations: Schema.Annotations.Issue | undefinedThe metadata for the issue.
annotations: import SchemaSchema.Annotations.interface Annotations.IssueAnnotations that can be attached to schema issues.
Details
The optional message field overrides the default issue message.
Issue | undefined
constructor(
/**
* 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 metadata for the issue.
*/
annotations: Schema.Annotations.Issue | undefinedThe metadata for the issue.
annotations: import SchemaSchema.Annotations.interface Annotations.IssueAnnotations that can be attached to schema issues.
Details
The optional message field overrides the default issue message.
Issue | undefined
) {
super()
this.Forbidden.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.Forbidden.annotations: Schema.Annotations.Issue | undefinedThe metadata for the issue.
annotations = annotations: Schema.Annotations.Issue | undefinedThe metadata for the issue.
annotations
}
}