Package: effect
Module: SchemaGetter
Creates a getter that fails with MissingKey if the input is absent (Option.None).
When to use
Use when you need a schema getter to require a struct field in the encoded input and report a missing key error when it is absent.
Details
None, fails with SchemaIssue.MissingKey.Some, passes it through unchanged.annotations customize the error message for the missing key.Example (Defining a required struct field)
import { SchemaGetter } from "effect"
const mustExist = SchemaGetter.required<string>()
See
onNone to provide a fallback instead of failingwithDefault to substitute a default for undefined valuesSignature
declare const required: <T, E extends T = T>(annotations?: Schema.Annotations.Key<T>) => Getter<T, E>
Since v4.0.0