introduces a new openapi-gen parser that replaces the old EJS-based generator by aliamerj · Pull Request #429 · netbirdio/docs
This PR introduces a new openapi-gen parser that replaces the old EJS-based generator.
Why?
- The old approach relied on templates and third-party tools like swagger-codegen.
- It was brittle, hard to extend, and not easy to maintain.
What’s new
- No external deps → everything runs with plain TypeScript and TSX, no swagger-codegen or other codegen libraries.
- Full OpenAPI 3.1 support → handles $ref, allOf, oneOf, arrays, enums, nullables, min/max constraints.
- Consistent request/response schema → produces a clean, predictable object model (works great for docs + UI components).
- Examples preserved → examples are extracted and aligned with the schema.
- Extensible → easy to plug in custom rules (e.g. Markdown/MDX generation, TSX components, etc.).
Usage
Run the parser with npm
Run the parser directly with ts-node:
ts-node index.ts <openapi-url> [output-dir]
<openapi-url>→ Path or URL to an OpenAPI YAML file[output-dir]→ (optional) Output directory, defaults tosrc/pages/ipa/resources
Example:
ts-node index.ts ./openapi.yml ./docs/api
This will parse the spec, generate MDX files per tag, and write them into ./docs/api.