Hyperlinkv0.8.0-beta.28

Schema

Schema.toCodecStringTreefunctioneffect/Schema.ts:13593
toCodecStringTree<S>

Converts a schema to the StringTree canonical codec, where every leaf value becomes a string while preserving the original structure.

Details

Declarations are converted to undefined (unless they have a toCodecJson or toCodec annotation).

Canonical Codecs
Source effect/Schema.ts:1359337 lines
export interface toCodecStringTree<S extends Constraint> extends
  BottomLazy<
    S["ast"],
    toCodecStringTree<S>,
    ReadonlyArray<Constraint>,
    S["~type.mutability"],
    S["~type.optionality"],
    S["~type.constructor.default"],
    S["~encoded.mutability"],
    S["~encoded.optionality"]
  >
{
  readonly "Type": S["Type"]
  readonly "Encoded": StringTree
  readonly "DecodingServices": S["DecodingServices"]
  readonly "EncodingServices": S["EncodingServices"]
  readonly "~type.make.in": S["~type.make.in"]
  readonly "~type.make": S["~type.make"]
  readonly "Iso": S["Iso"]
  readonly schema: S
}

/**
 * Converts a schema to the StringTree canonical codec, where every leaf value
 * becomes a string while preserving the original structure.
 *
 * **Details**
 *
 * Declarations are converted to `undefined` (unless they have a
 * `toCodecJson` or `toCodec` annotation).
 *
 * @category Canonical Codecs
 * @since 4.0.0
 */
export function toCodecStringTree<S extends Constraint>(schema: S): toCodecStringTree<S> {
  return make(serializerStringTree(schema.ast), { schema })
}
Referenced by 2 symbols