-
Notifications
You must be signed in to change notification settings - Fork 11
Generate the OpenAPI document from a single source of truth #79
Copy link
Copy link
Labels
GRANTFOX OSSGrantFox open-source campaign taskGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueOfficial GrantFox campaign issuearea:openapiopenapiopenapipriority:mediumMedium priorityMedium prioritystack:expressstack:expressstack:expressstack:nodejsNode.jsNode.jsstack:typescriptTypeScriptTypeScripttype:enhancementImprovement to existing functionalityImprovement to existing functionality
Description
Metadata
Metadata
Assignees
Labels
GRANTFOX OSSGrantFox open-source campaign taskGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueOfficial GrantFox campaign issuearea:openapiopenapiopenapipriority:mediumMedium priorityMedium prioritystack:expressstack:expressstack:expressstack:nodejsNode.jsNode.jsstack:typescriptTypeScriptTypeScripttype:enhancementImprovement to existing functionalityImprovement to existing functionality
Type
Fields
Give feedbackNo fields configured for Feature.
Drive the OpenAPI document from a maintained spec module
Description
The
GET /api/v1/openapi.jsonhandler insrc/index.tsreturns a hand-written object literal listing paths and one-line summaries. It is already drifting from reality — it omitsGET /api/v1/config,PATCH /api/v1/config, andGET /api/v1/health/deepquery behavior, and several entries have empty operation objects ({}). A hand-maintained literal inevitably diverges from the real routes. This issue moves the spec into a dedicated module and adds a test that keeps it honest against the mounted routes.Requirements and context
src/openapi.ts(create file) exporting the spec object with completepaths(includingGET/PATCH /api/v1/config) and proper operation summaries and basic response codes.GET /api/v1/openapi.jsonhandler return the imported spec unchanged in shape.openapi: "3.0.3"and the existinginfoblock.Suggested execution
git checkout -b enhancement/openapi-31-single-sourcesrc/openapi.ts; update the handler insrc/index.ts.src/__tests__/openapi.test.ts— fetch/api/v1/openapi.json, validate top-level fields, and assert no registered route is missing frompaths.README.md.Test and commit
npm run build,npm run lint, andnpm test.npm testoutput in the PR.Example commit message
feat(openapi): move spec to a module and add a route-drift guardGuidelines
Community & contribution rewards