InvalidValueRepresents a schema issue produced when the input has the correct type but its value violates a constraint (e.g. a string that is too short, a number out of range).
When to use
Use when you need to detect constraint violations from Schema.filter,
Schema.minLength, Schema.greaterThan, or similar checks.
Details
actualisOption.some(value)when the failing value is known, orOption.none()when absent.annotationsoptionally carries amessagestring for formatting.- The default formatter renders this as
"Invalid data <actual>"unless a custommessageannotation is provided.
Example (Returning InvalidValue from a custom filter)
import { Option, SchemaIssue } from "effect"
const issue = new SchemaIssue.InvalidValue(
Option.some(""),
{ message: "must not be empty" }
)
console.log(String(issue))
// "must not be empty"export class class InvalidValueclass InvalidValue {
_tag: 'InvalidValue';
actual: Option.Option<unknown>;
annotations: Schema.Annotations.Issue | undefined;
toString: (this: Issue) => string;
}
Represents a schema issue produced when the input has the correct type but its value violates a
constraint (e.g. a string that is too short, a number out of range).
When to use
Use when you need to detect constraint violations from Schema.filter,
Schema.minLength, Schema.greaterThan, or similar checks.
Details
actual is Option.some(value) when the failing value is known, or
Option.none() when absent.
annotations optionally carries a message string for formatting.
- The default formatter renders this as
"Invalid data <actual>" unless a
custom message annotation is provided.
Example (Returning InvalidValue from a custom filter)
import { Option, SchemaIssue } from "effect"
const issue = new SchemaIssue.InvalidValue(
Option.some(""),
{ message: "must not be empty" }
)
console.log(String(issue))
// "must not be empty"
InvalidValue extends class BaseBase {
readonly InvalidValue._tag: "InvalidValue"_tag = "InvalidValue"
/**
* The value that caused the issue.
*/
readonly InvalidValue.actual: Option.Option<unknown>The value that caused the issue.
actual: import OptionOption.type Option.Option = /*unresolved*/ anyOption<unknown>
/**
* The metadata for the issue.
*/
readonly InvalidValue.annotations: anyThe metadata for the issue.
annotations: import SchemaSchema.declareAnnotations.type Schema.Annotations.Issue = /*unresolved*/ anyIssue | undefined
constructor(
/**
* The value that caused the issue.
*/
actual: Option.Option<unknown>The value that caused the issue.
actual: import OptionOption.type Option.Option = /*unresolved*/ anyOption<unknown>,
/**
* The metadata for the issue.
*/
annotations: anyThe metadata for the issue.
annotations?: import SchemaSchema.declareAnnotations.type Schema.Annotations.Issue = /*unresolved*/ anyIssue | undefined
) {
super()
this.InvalidValue.actual: Option.Option<unknown>The value that caused the issue.
actual = actual: Option.Option<unknown>The value that caused the issue.
actual
this.InvalidValue.annotations: anyThe metadata for the issue.
annotations = annotations: anyThe metadata for the issue.
annotations
}
}