@ztrehagem/oats
v0.2.0
Published
Generate TypeScript code from OpenAPI documents.
Downloads
1
Readme
@ztrehagem/oats
Generate TypeScript code from OpenAPI documents.
Installation
npm install @ztrehagem/oats
Example
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: