Could have a look at the following 3 places:
express-openapi-validator: Recommended tool. Although the name indicates it's just a validator. It actually can handle the routing work. Just implement the plain handler functions and EOV will take care of request validation and request routing according to the OAS you give;- OpenAPI Generator: widely used openapi codegen tools with custom generators to support various languages and frameworks. For Node.js, there is a nodejs-exporess-server, but it's marked beta. Actually it's based on
express-openapi-validator. - openapi.tools: a collection of numerous OpenAPI tools to try, including quite a few server codegen tools;
express-openapi-validator is widely used and actively maintained so I think the quality is solid. The quality of the tools in the latter 2 places remain unknown.
How to generate an Express + TypeScript API from OpenAPI 3.0 specification? - Stack Overflow
schemantic – Generate TypeScript types + API client from OpenAPI (FastAPI friendly)
Anyone have experience with generating OpenAPI TypeScript code for use directly in a Lambda?
Open source open api to typescript generator
Wish the opposite existed
More on reddit.comVideos
» npm install @openapi-generator-plus/typescript-express-example-server-generator
Could have a look at the following 3 places:
express-openapi-validator: Recommended tool. Although the name indicates it's just a validator. It actually can handle the routing work. Just implement the plain handler functions and EOV will take care of request validation and request routing according to the OAS you give;- OpenAPI Generator: widely used openapi codegen tools with custom generators to support various languages and frameworks. For Node.js, there is a nodejs-exporess-server, but it's marked beta. Actually it's based on
express-openapi-validator. - openapi.tools: a collection of numerous OpenAPI tools to try, including quite a few server codegen tools;
express-openapi-validator is widely used and actively maintained so I think the quality is solid. The quality of the tools in the latter 2 places remain unknown.
swagger-node-codegen allows to generate an expressjs server from an OpenAPI yaml or json file.
The following command:
snc schema.yml -o ./my-api
will generate the skeleton of the REST API, with mocked data if you have examples in your specifications. Then, you can add your business logic.
It has the following features:
- ES7
- ESLint
- YAML config file
- Express
The only thing is, it doesn't generate code in TypeScript with models. But the models can be integrated easily in the code. Upgrading the code Typescript using "tsc" and renaming all .js files to .ts does the job.
» npm install openapi-typescript-codegen
I just published the first release of a project I’ve been working on: schemantic – a TypeScript code generator for OpenAPI.
🔹 What it does:
-
Takes any OpenAPI v3 schema (from URL or file)
-
Generates strongly typed models (
types.ts) -
Generates a typed axios API client (
api-client.ts) -
(Optional) React hooks for queries/mutations (
hooks.ts) -
Customizable with a small plugin system (branded types, zod validation, perf monitoring, request dedup, etc.)
🔹 Why I built it:
I've been working a lot more with FastAPI, and while it’s great that it auto-exposes an OpenAPI schema, I wanted a simple, typed, and extensible way to consume those APIs in TypeScript without hand-rolling clients or relying on heavyweight tools. This is geared heavily towards FastAPI, but will will work with any openapi.json.
# From a running FastAPI app npx schemantic generate --url http://127.0.0.1:8000/openapi.json --output ./src/generated --hooks
This drops types.ts, api-client.ts, and (if you want) hooks.ts into your project.
🔹 Repo & docs:
GitHub: https://github.com/Cstannahill/schemantic
npm: https://www.npmjs.com/package/schemantic
This is the very first release (v0.1.0), so I’d love any feedback — whether you try it out on a project, compare it to tools like Orval or openapi-typescript, or just glance at the repo. This is an open-source project, and contribution is always welcome!
If you think this could be useful, please give it a spin! 🚀
Context:
-
API is specified "API first", as OpenAPI 3.0 or 3.1 YAML files
-
no API gateway, the lambda(s) would be published via a function-URL with a simple Lambda concurrency limit
-
DoS attacks are not a concern, 429 responses are fine
-
no authorization, the API endpoints are publicly available
I am specifically avoiding using a large, opinionated framework - not Serverless, not SAM or any of the others. Just pure TypeScript - maybe with usage of a library for the parsing/formatting of data structures.
Mostly I want something to generate the interfaces for the endpoints (i.e. data structures for request/response bodies) and the code to parse/assert that the objects conform to the YAML API specification.
It seems like the openapi-generator project doesn't really have any support for this yet - lots of client generators for TypeScript, but doesn't seem like there's anything for the server side.
I'm looking for any publicly available examples or codebases that folks might know of.