Skip to main content

generate_from_spec

Function generate_from_spec 

Source
pub fn generate_from_spec(spec: &Value) -> BTreeMap<String, String>
Expand description

Generate TypeScript type definitions from an OpenAPI 3.1 spec.

Reads the components.schemas section and produces one interface per schema. This generates types that match what openapi-typescript would produce from the same spec — the spec JSON is also written alongside so users can run npx openapi-typescript openapi.json -o types.ts if they prefer.