Skip to content

lzehrung/zod-express-openapi-routes

Repository files navigation

Overview

  • Find an ergonomic way (minimize boilerplate and code duplication) to get typed, zod-validated express routes and an OpenAPI schema at the same time
  • Minimize code duplication and boilerplate between express routes, request parameter validation, and OpenAPI definitions

Highlights

Run the example

Dependencies

  • @anatine/zod-openapi: generates request parameter OpenAPI definitions from zod schemas
  • openapi3-ts: used to define OpenAPI schema in TypeScript
  • swagger-ui-express: serves the OpenAPI documentation
  • zod: used to define request parameter validation schemas

Limitations

  • file upload routes must be documented manually
  • haven't tested nested routers / routes
  • not extensively tested

About

POC for cozy API validation, typing, and OpenAPI/swagger schema generation with Zod and Express

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published