Hyperlinkv0.8.0-beta.28

SchemaIssue

SchemaIssue.makeFormatterStandardSchemaV1functioneffect/SchemaIssue.ts:994
(options?: {
  readonly leafHook?: LeafHook | undefined
  readonly checkHook?: CheckHook | undefined
}): Formatter<StandardSchemaV1.FailureResult>

Creates a Formatter that produces a StandardSchemaV1.FailureResult.

When to use

Use when you need schema parse errors in Standard Schema V1 format, optionally customizing leaf or check issue rendering.

Details

  • Returns a Formatter<StandardSchemaV1.FailureResult>.
  • Each leaf issue is flattened into { message, path } entries.
  • Pointer paths are accumulated to produce full property paths.
  • Falls back to defaultLeafHook / defaultCheckHook when no hooks are provided.

Example (Creating a Standard Schema V1 formatter)

import { SchemaIssue } from "effect"

const formatter = SchemaIssue.makeFormatterStandardSchemaV1()
export function makeFormatterStandardSchemaV1(options?: {
  readonly leafHook?: LeafHook | undefined
  readonly checkHook?: CheckHook | undefined
}): Formatter<StandardSchemaV1.FailureResult> {
  return (issue) => ({
    issues: toDefaultIssues(issue, [], options?.leafHook ?? defaultLeafHook, options?.checkHook ?? defaultCheckHook)
  })
}
Referenced by 1 symbols