Package: effect
Module: Schema
Adds metadata annotations to the encoded side of a schema without
changing its runtime behavior. This is the encoded-side counterpart of
annotate, which targets the decoded (Type) side.
Details
Internally the schema is flipped so that Encoded becomes Type,
annotated, and then flipped back.
Example (Adding a title to the encoded representation)
import { Schema } from "effect"
const schema = Schema.NumberFromString.pipe(
Schema.annotateEncoded({
title: "my title"
})
)
console.log(Schema.toEncoded(schema).ast.annotations?.title)
// "my title"
See
annotate to annotate the type side instead.Signature
declare const annotateEncoded: <S extends Top>(annotations: Annotations.Bottom<S["Encoded"], readonly []>) => (self: S) => S["Rebuild"]
Since v4.0.0