# asteasolutions/zod-to-openapi

A library that generates OpenAPI (Swagger) docs from Zod schemas

Repository: https://github.com/asteasolutions/zod-to-openapi
Canonical: https://ross.abutalabs.com/products/zod-to-openapi
Language: TypeScript
License: MIT
License Family: permissive
Topics: openapi, openapi3, schema, swagger, zod
Last push: 2026-07-19T10:59:36+00:00

## Health v2 (maintenance only)
Score: 94/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 93, release rhythm 93, longevity 100
- inputs: {"age_days": 1602, "days_push": 45, "days_rel": 45, "gap_med": 15, "n_releases_24m": 20}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1611, forks 102 (observed 2026-08-28T04:05:11.031686+00:00)

## What it is
A TypeScript library that generates OpenAPI (Swagger) documentation directly from Zod schemas, eliminating duplication between validation code and API docs. It provides a registry and generator for defining routes, webhooks, and reusable schema components from a single source of truth.

## Use cases
- generate openapi spec from zod schemas
- keep swagger docs in sync with api validation
- document express or hono api endpoints automatically
- convert zod types to openapi 3.0  schema
- generate swagger yaml as part of the build
- define api routes and webhooks with zod
- avoid duplicating schema definitions for docs and validation

## When to choose
- you already use zod for validation and want docs from the same schemas
- you want a single source of truth for API schemas and documentation
- you need OpenAPI 3.0/3.1 output generated at build time or runtime

## When to avoid
- your API is not written in TypeScript or does not use zod
- you need docs generated from code annotations or framework decorators instead
- you rely on zod v3 and need actively maintained support

## Facets
- artifact type: library
- maturity: active
- function: api-documentation, serialization, developer-tools
- domain: apis, web-development, backend, developer-tools, documentation
- platform: cross-platform
- tags: zod, openapi, swagger, schema-generation, api-docs, typescript, nodejs

## Member repositories
- asteasolutions/zod-to-openapi (main) score 94

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:11.031686+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:51:11.596102+00:00, confidence not recorded.
  - readme: https://github.com/asteasolutions/zod-to-openapi (fetched 2026-08-28T04:05:11.031686+00:00, sha 4c05c204bda7)
- Data as of 2026-08-30T08:39:29.467469+00:00.
