CodeDocumentThe output of toCodeDocument: generated TypeScript code for one or more schemas plus their shared references and auxiliary artifacts.
Details
codes contains one Code per input representation.
references.nonRecursives contains topologically sorted non-recursive
definitions. references.recursives contains definitions involved in cycles.
artifacts contains symbols, enums, and import statements needed by the
code.
export type type CodeDocument = {
readonly codes: ReadonlyArray<Code>
readonly references: {
readonly nonRecursives: ReadonlyArray<{
readonly $ref: string
readonly code: Code
}>
readonly recursives: {
readonly [$ref: string]: Code
}
}
readonly artifacts: ReadonlyArray<Artifact>
}
The output of
toCodeDocument
: generated TypeScript code for one or
more schemas plus their shared references and auxiliary artifacts.
Details
codes contains one
Code
per input representation.
references.nonRecursives contains topologically sorted non-recursive
definitions. references.recursives contains definitions involved in cycles.
artifacts contains symbols, enums, and import statements needed by the
code.
CodeDocument = {
readonly codes: ReadonlyArray<Code>codes: interface ReadonlyArray<T>ReadonlyArray<type Code = {
readonly runtime: string
readonly Type: string
}
A pair of TypeScript source strings for a schema: runtime is the
executable Schema expression, Type is the corresponding TypeScript type.
Code>
readonly references: {
readonly nonRecursives: ReadonlyArray<{
readonly $ref: string
readonly code: Code
}>
readonly recursives: {
readonly [$ref: string]: Code
}
}
references: {
readonly nonRecursives: ReadonlyArray<{
readonly $ref: string
readonly code: Code
}>
nonRecursives: interface ReadonlyArray<T>ReadonlyArray<{
readonly $ref: string$ref: string
readonly code: Code(property) code: {
runtime: string;
Type: string;
}
code: type Code = {
readonly runtime: string
readonly Type: string
}
A pair of TypeScript source strings for a schema: runtime is the
executable Schema expression, Type is the corresponding TypeScript type.
Code
}>
readonly recursives: { readonly [$ref: string]: Code }recursives: {
readonly [$ref: string$ref: string]: type Code = {
readonly runtime: string
readonly Type: string
}
A pair of TypeScript source strings for a schema: runtime is the
executable Schema expression, Type is the corresponding TypeScript type.
Code
}
}
readonly artifacts: ReadonlyArray<Artifact>artifacts: interface ReadonlyArray<T>ReadonlyArray<type Artifact =
| {
readonly _tag: "Symbol"
readonly identifier: string
readonly generation: Code
}
| {
readonly _tag: "Enum"
readonly identifier: string
readonly generation: Code
}
| {
readonly _tag: "Import"
readonly importDeclaration: string
}
An auxiliary code artifact produced during code generation — a symbol
declaration, an enum declaration, or an import statement.
Artifact>
}