Generate TypeScript code from OpenAPI documents.
npm install @ztrehagem/oats
import { Parser, TypeStringGenerator } from "@ztrehagem/oats";
const parser = new Parser();
const { operations, schemas } = await parser.parse("./path/to/openapidoc.yaml");
const generator = new TypeStringGenerator();
for (const [url, { name, schema }] of schemas.entries()) {
const schemaType = generator.generate(schema, { schemas });
}
// ...
code generation examples: