effect-io-ai

Package: effect
Module: SchemaIssue

SchemaIssue.InvalidValue

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

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"

See

Signature

declare class InvalidValue { constructor(
    /**
     * The value that caused the issue.
     */
    actual: Option.Option<unknown>,
    /**
     * The metadata for the issue.
     */
    annotations?: Schema.Annotations.Issue | undefined
  ) }

Source

Since v4.0.0