Schema.Struct<{
readonly _tag: Schema.tag<"Enum">
readonly annotations: Schema.optional<
Schema.decodeTo<
Schema.$Record<Schema.String, Schema.Unknown>,
Schema.$Record<
Schema.String,
Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>
>,
never,
never
>
>
readonly enums: Schema.$Array<
Schema.Tuple<
readonly [
Schema.String,
Schema.Union<readonly [Schema.String, Schema.Number]>
]
>
>
}>Schema for the Enum representation node.
schemasEnum
Source effect/SchemaRepresentation.ts:125213 lines
export const const $Enum: Schema.Struct<{
readonly _tag: Schema.tag<"Enum">
readonly annotations: Schema.optional<
Schema.decodeTo<
Schema.$Record<
Schema.String,
Schema.Unknown
>,
Schema.$Record<
Schema.String,
Schema.Codec<
PrimitiveTree,
PrimitiveTree,
never,
never
>
>,
never,
never
>
>
readonly enums: Schema.$Array<
Schema.Tuple<
readonly [
Schema.String,
Schema.Union<
readonly [Schema.String, Schema.Number]
>
]
>
>
}>
const $Enum: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly _tag: Schema.tag<'Enum'>; readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>,…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly _tag: 'Enum'; readonly enums: ReadonlyArray<readonly [string, string | number]>; readonly annotations?: { readonly [x: string]: unknown; } | undefined; }, readonly []>) => Schema.Struct<{ …;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly _tag: 'Enum'; readonly enums: ReadonlyArray<readonly [string, string | number]>; readonly annotations?: { readonly [x: string]: unknown } | undefined }>) => Schema.Struct<{ readonly _tag: Sch…;
check: (checks_0: SchemaAST.Check<{ readonly _tag: 'Enum'; readonly enums: ReadonlyArray<readonly [string, string | number]>; readonly annotations?: { readonly [x: string]: unknown } | undefined }>, ...checks: Array<SchemaAST.Check<{ readonly _ta…;
rebuild: (ast: SchemaAST.Objects) => Schema.Struct<{ readonly _tag: Schema.tag<'Enum'>; readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, P…;
make: (input: { readonly enums: ReadonlyArray<readonly [string, string | number]>; readonly _tag?: 'Enum' | undefined; readonly annotations?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => { readonly _tag: 'Enum'; rea…;
makeOption: (input: { readonly enums: ReadonlyArray<readonly [string, string | number]>; readonly _tag?: 'Enum' | undefined; readonly annotations?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Option_.Option<{ readonly _t…;
makeEffect: (input: { readonly enums: ReadonlyArray<readonly [string, string | number]>; readonly _tag?: 'Enum' | undefined; readonly annotations?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly _ta…;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Schema for the
Enum
representation node.
$Enum = import SchemaSchema.Struct({
_tag: Schema.tag<"Enum">(property) _tag: {
Type: S["Type"];
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
schema: S;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<'Enum', readonly []>) => Schema.withConstructorDefault<Schema.Literal<'Enum'>>;
annotateKey: (annotations: Schema.Annotations.Key<'Enum'>) => Schema.withConstructorDefault<Schema.Literal<'Enum'>>;
check: (checks_0: SchemaAST.Check<'Enum'>, ...checks: Array<SchemaAST.Check<'Enum'>>) => Schema.withConstructorDefault<Schema.Literal<'Enum'>>;
rebuild: (ast: SchemaAST.Literal) => Schema.withConstructorDefault<Schema.Literal<'Enum'>>;
make: (input: 'Enum', options?: MakeOptions) => 'Enum';
makeOption: (input: 'Enum', options?: MakeOptions) => Option_.Option<'Enum'>;
makeEffect: (input: 'Enum', options?: MakeOptions) => Effect.Effect<'Enum', SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
_tag: import SchemaSchema.tag("Enum"),
annotations: Schema.optional<
Schema.decodeTo<
Schema.$Record<Schema.String, Schema.Unknown>,
Schema.$Record<
Schema.String,
Schema.Codec<
PrimitiveTree,
PrimitiveTree,
never,
never
>
>,
never,
never
>
>
(property) annotations: {
Rebuild: optional<S>;
Type: S["Type"];
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
schema: S;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly [x: string]: unknown; } | undefined, readonly []>) => Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTre…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly [x: string]: unknown } | undefined>) => Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree,…;
check: (checks_0: SchemaAST.Check<{ readonly [x: string]: unknown } | undefined>, ...checks: Array<SchemaAST.Check<{ readonly [x: string]: unknown } | undefined>>) => Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, …;
rebuild: (ast: SchemaAST.Union<SchemaAST.Undefined | SchemaAST.Objects>) => Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, neve…;
make: (input: { readonly [x: string]: unknown } | undefined, options?: MakeOptions) => { readonly [x: string]: unknown } | undefined;
makeOption: (input: { readonly [x: string]: unknown } | undefined, options?: MakeOptions) => Option_.Option<{ readonly [x: string]: unknown } | undefined>;
makeEffect: (input: { readonly [x: string]: unknown } | undefined, options?: MakeOptions) => Effect.Effect<{ readonly [x: string]: unknown } | undefined, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
annotations: import SchemaSchema.optional(const $Annotations: Schema.decodeTo<
Schema.$Record<Schema.String, Schema.Unknown>,
Schema.$Record<
Schema.String,
Schema.Codec<
PrimitiveTree,
PrimitiveTree,
never,
never
>
>,
never,
never
>
const $Annotations: {
Type: To["Type"];
Encoded: From["Encoded"];
DecodingServices: To["DecodingServices"] | From["DecodingServices"] | RD;
EncodingServices: To["EncodingServices"] | From["EncodingServices"] | RE;
Iso: To["Iso"];
from: From;
to: To;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly [x: string]: unknown; }, readonly []>) => Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, nev…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly [x: string]: unknown }>) => Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, neve…;
check: (checks_0: SchemaAST.Check<{ readonly [x: string]: unknown }>, ...checks: Array<SchemaAST.Check<{ readonly [x: string]: unknown }>>) => Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Cod…;
rebuild: (ast: SchemaAST.Objects) => Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>;
make: (input: { readonly [x: string]: unknown }, options?: MakeOptions) => { readonly [x: string]: unknown };
makeOption: (input: { readonly [x: string]: unknown }, options?: MakeOptions) => Option_.Option<{ readonly [x: string]: unknown }>;
makeEffect: (input: { readonly [x: string]: unknown }, options?: MakeOptions) => Effect.Effect<{ readonly [x: string]: unknown }, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Schema for serializing public Schema.Annotations.Annotations values. It
filters out internal annotation keys and non-primitive values during
encoding.
When to use
Use to serialize schema annotations in representation schemas while retaining
only primitive-tree metadata.
Details
Decoding is passthrough. Encoding removes internal annotation keys and values
that are not accepted by $PrimitiveTree.
$Annotations),
enums: Schema.$Array<
Schema.Tuple<
readonly [
Schema.String,
Schema.Union<
readonly [Schema.String, Schema.Number]
>
]
>
>
(property) enums: {
Type: ReadonlyArray<S["Type"]>;
Encoded: ReadonlyArray<S["Encoded"]>;
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: ReadonlyArray<S["Iso"]>;
value: S;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<ReadonlyArray<readonly [string, string | number]>, readonly []>) => Schema.$Array<Schema.Tuple<readonly [Schema.String, Schema.Union<readonly [Schema.String, Schema.Number]>]>>;
annotateKey: (annotations: Schema.Annotations.Key<ReadonlyArray<readonly [string, string | number]>>) => Schema.$Array<Schema.Tuple<readonly [Schema.String, Schema.Union<readonly [Schema.String, Schema.Number]>]>>;
check: (checks_0: SchemaAST.Check<ReadonlyArray<readonly [string, string | number]>>, ...checks: Array<SchemaAST.Check<ReadonlyArray<readonly [string, string | number]>>>) => Schema.$Array<Schema.Tuple<readonly [Schema.String, Schema.Union<readon…;
rebuild: (ast: SchemaAST.Arrays) => Schema.$Array<Schema.Tuple<readonly [Schema.String, Schema.Union<readonly [Schema.String, Schema.Number]>]>>;
make: (input: ReadonlyArray<readonly [string, string | number]>, options?: MakeOptions) => ReadonlyArray<readonly [string, string | number]>;
makeOption: (input: ReadonlyArray<readonly [string, string | number]>, options?: MakeOptions) => Option_.Option<ReadonlyArray<readonly [string, string | number]>>;
makeEffect: (input: ReadonlyArray<readonly [string, string | number]>, options?: MakeOptions) => Effect.Effect<ReadonlyArray<readonly [string, string | number]>, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
enums: import SchemaSchema.Array(
import SchemaSchema.Tuple([
import SchemaSchema.String,
import SchemaSchema.Union([
import SchemaSchema.String,
import SchemaSchema.Number // NaN, Infinity, -Infinity are allowed enum values
])
])
)
}).annotate({ identifier: stringidentifier: "Enum" })Referenced by 1 symbols