feat(api-docs): automated OpenAPI spec generation from Zod schemas#136
Open
Paranoa-dev wants to merge 1 commit into
Open
feat(api-docs): automated OpenAPI spec generation from Zod schemas#136Paranoa-dev wants to merge 1 commit into
Paranoa-dev wants to merge 1 commit into
Conversation
- Add generate-openapi-spec.ts script to produce docs/openapi.json at build time - Add upload-openapi-spec.ts script for S3 deployment of the spec - Add npm scripts: generate:spec, validate:spec, check:spec, upload:spec - Update CI to generate, validate, and diff-check the spec; fail if stale - Add openapi-spec.yml workflow to deploy spec to S3 on main/release - Commit initial generated OpenAPI 3.0.3 spec
|
@Paranoa-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenAPI Spec Auto-Generation
Summary
Automates the generation, validation, and deployment of the OpenAPI 3.0 specification for the ProxyPay API. The spec is generated from Zod schemas and route definitions during the CI build, eliminating manual maintenance and ensuring the documentation is always accurate and in sync with the implementation.
Changes
New Scripts
scripts/generate-openapi-spec.ts— Generates the OpenAPI 3.0.3 specification from Zod schemas and path registrations at build time, writing it todocs/openapi.jsonscripts/upload-openapi-spec.ts— Uploads the generated spec to S3 for the Redoc-powered documentation portalCI/CD Integration
ci.yml— Enhanced with three new steps in the build job:generate:spec— Generate the spec from sourcevalidate:spec— Validate against the OpenAPI 3.0 standardcheck:spec— Fail the build if the generated spec differs from the committed spec, enforcing that developers commit updated spec files with their changesopenapi-spec.yml— New workflow that generates and uploads the spec to S3 on pushes to main and on releases, powering the Redoc documentation portalnpm Scripts
generate:spec— Generate the OpenAPI spec from Zod schemasvalidate:spec— Validate the spec against OpenAPI 3.0 (via swagger-cli)check:spec— Generate, validate, and diff — fails if committed spec is staleupload:spec— Upload the spec to S3Generated Artifact
docs/openapi.json— The committed OpenAPI spec, always kept in sync by thecheck:specCI gateBenefits
closes #111