Skip to content

Conversation

aliamerj
Copy link

@aliamerj aliamerj commented Sep 21, 2025

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

npm run api-gen

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 to src/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant