Skip to content

feat: full OpenAPI 3.1 spec for the billing, usage, and developer routes#370

Open
emarc99 wants to merge 1 commit into
CalloraOrg:mainfrom
emarc99:task/openapi-spec
Open

feat: full OpenAPI 3.1 spec for the billing, usage, and developer routes#370
emarc99 wants to merge 1 commit into
CalloraOrg:mainfrom
emarc99:task/openapi-spec

Conversation

@emarc99
Copy link
Copy Markdown

@emarc99 emarc99 commented Jun 1, 2026

Description

This PR implements and serves a machine-readable OpenAPI 3.1 specification covering the billing, usage, and developer routes, and introduces an automated coverage and schema validation test suite.

Key Changes

  1. OpenAPI 3.1 Contract (docs/openapi.json): Authored a complete, valid OpenAPI 3.1 specification detailing the /api/billing/deduct, /api/usage, /api/apis, and /api/developers/revenue endpoints, including exact request/response schemas and standardized error shapes (ErrorResponse).
  2. Endpoint Serving (src/routes/index.ts): Mounted GET /api/openapi.json to dynamically serve the contract. Replaced the fileURLToPath ES-module logic with process.cwd() to prevent CommonJS/Jest transpilation issues.
  3. Automated Spec Validation & Route Coverage (src/app.test.ts): Added tests verifying:
    • The OpenAPI route returns a valid 3.1 spec.
    • Target endpoints are fully described with secure error shapes.
    • Auto-detection of registered Express routes to flag any undocumented endpoints in CI.
  4. Pre-existing Test Fixes:
    • Timezone Offset: Standardized week boundary expectations using UTC dates to prevent regional timezone assertion failures.
    • Mock Database Crash: Passed standard api mock parameters to the isolation route checker to prevent database query failures in better-sqlite3.
    • Route Classifications: Properly updated route protection expectations for /api/usage (requires auth) and /api/openapi.json (public).

Verification Results

  • Ran npm test -- src/app.test.ts to execute all 58 suite tests.
  • Result: All 58 tests passed successfully.
image

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@emarc99 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! 🚀

Learn more about application limits

@emarc99
Copy link
Copy Markdown
Author

emarc99 commented Jun 1, 2026

@greatest0fallt1me build errors are unrelated to my changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate and serve an OpenAPI 3.1 spec for the billing, usage, and developer routes

1 participant