Hyperlinkv0.8.0-beta.28

SchemaRepresentation

SchemaRepresentation.fromASTconsteffect/SchemaRepresentation.ts:1637
(ast: SchemaAST.AST): Document

Converts a Schema AST into a Document.

When to use

Use when you have a single Schema AST and need a schema representation document.

Details

Shared/recursive sub-schemas are extracted into the references map.

Example (Converting a Schema to a Document)

import { Schema, SchemaRepresentation } from "effect"

const Person = Schema.Struct({
  name: Schema.String,
  age: Schema.Number
})

const doc = SchemaRepresentation.fromAST(Person.ast)
console.log(doc.representation._tag)
// "Objects"
constructorsDocumentfromASTs
export const fromAST: (ast: SchemaAST.AST) => Document = InternalRepresentation.fromAST