Getting started
Install
Section titled “Install”pnpm add -D @avsystem/openapi-ngopenapi-ng requires Node.js 22.12+. See Runtime & platforms
for the full compatibility matrix.
Generate from the CLI
Section titled “Generate from the CLI”openapi-ng generate --input petstore.openapi.yaml --output ./generatedOutput:
✓ Generated 5 files from Petstore (3.0.3) 1 path · 1 operation · 1 schema
model.generated.ts rest.model.ts rest.util.ts rest.validate.ts rest/pet.rest.generated.tsThe full flag list is on the CLI page.
Generate from Node
Section titled “Generate from Node”import { generate } from '@avsystem/openapi-ng';
const result = await generate({ inputPath: './petstore.openapi.yaml', outputPath: './generated', emit: ['models', 'angular'],});
console.log(result.summary);console.log(result.diagnostics);console.log(result.artifacts);Omit outputPath to keep the result entirely in memory.
What you get
Section titled “What you get”| Artifact | File | Description |
|---|---|---|
| TypeScript models | model.generated.ts |
Interfaces, type aliases, and string enum unions |
| Angular support | rest.model.ts, rest.util.ts |
HTTP helper types and request utilities |
| Forms validation | rest.validate.ts |
validateRest helper for signal-forms async validation (optional peer) |
| Angular services | rest/{tag}.rest.generated.ts |
@Injectable service classes grouped by OpenAPI tag |
See Angular generator for the shape of the emitted services and example component usage.
Next steps
Section titled “Next steps”- Tune naming and mapped types on the Configuration page.
- Walk through the Angular generator to see what the services look like and how to consume them.
- Skim the Diagnostics reference so error codes don’t surprise you later.