mirror of
https://github.com/Effect-TS/effect.git
synced 2026-12-04 03:35:36 +08:00
15 lines
519 B
TypeScript
15 lines
519 B
TypeScript
import * as Codegen from "effect/Codegen"
|
|
import * as Schema from "effect/Schema"
|
|
import * as SchemaRepresentation from "effect/SchemaRepresentation"
|
|
|
|
const schema = Schema.Struct({
|
|
a: Schema.String,
|
|
b: Schema.optional(Schema.FiniteFromString),
|
|
c: Schema.Array(Schema.String)
|
|
})
|
|
|
|
const document = SchemaRepresentation.toRepresentation(schema.ast)
|
|
const module = new Codegen.Module()
|
|
module.addSchemas({ Example: document.representation }, { references: document.references })
|
|
export const source = module.print()
|