Skip to main content

Module gen

Module gen 

Source
Expand description

Typed code generation from Active schemas (C-047, spec/converters.md §7). Reads the module’s schema tree and emits JSON Schema, an OpenAPI fragment, TypeScript interfaces, Go structs, and Rust serde types. Only static literal constraints render — dynamic bounds still validate at runtime but have no static form (documented, never guessed).

Functions§

schema_to_go
The schema tree as Go structs with json tags (nested tables become PascalCase structs; enums stay strings with their members documented).
schema_to_json_schema
The schema tree as JSON Schema: objects for tables (closed → additionalProperties: false), enums, arrays, constraints from static literals, static defaults, and deprecated flags.
schema_to_openapi
The JSON Schema wrapped as an OpenAPI 3.1 components.schemas.<name> fragment.
schema_to_rust
The schema tree as Rust serde types: structs with rename tags, real enums for Enum, Option for defaulted/Null fields.
schema_to_typescript
The schema tree as TypeScript export interface declarations (nested tables become PascalCase interfaces; ? marks defaulted/Null fields).