Skip to content

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

Notifications You must be signed in to change notification settings

lzehrung/zod-express-openapi-routes

Folders and files

NameName
Last commit message
Last commit date
Apr 21, 2024
Apr 21, 2024
Feb 17, 2024
Apr 21, 2024
Feb 17, 2024
Apr 21, 2024
Apr 21, 2024
Apr 21, 2024
Apr 21, 2024
Apr 21, 2024

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