feat: add endpoint parameter contract snapshot tests for openapi.json#25
Draft
feat: add endpoint parameter contract snapshot tests for openapi.json#25
Conversation
Adds vitest snapshot tests that capture the full parameter contract for every endpoint in the OpenAPI spec. When openapi.json changes, these snapshots will fail and require explicit review/update. Snapshots cover: - Full endpoint contracts (params, request body, response codes) - Parameter-only view (name, location, required, type, enums) - Request body schemas (field names, types, required flags) - Required parameters per endpoint - Component schema definitions - Tag-to-endpoint mappings Co-Authored-By: romitgabani1 <romitgabani1.work@gmail.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This was referenced Mar 11, 2026
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.
feat: add endpoint parameter contract snapshot tests for openapi.json
Summary
Adds vitest snapshot tests that parse
docs/api-reference/v2/openapi.jsondirectly and capture the full parameter contract for every endpoint. When the OpenAPI spec changes — parameters added/removed, required flags flipped, types changed, request body schemas altered — the relevant snapshots will fail and must be explicitly reviewed and updated viabun run test:update.Changes:
vitestas a devDependency topackages/clitestandtest:updatescripts topackages/cli/package.jsonpackages/cli/src/__tests__/endpoint-parameter-contracts.test.tswith 6 snapshot tests:Review & Testing Checklist for Human
openapi.jsonchanges, snapshot diffs could be large.resolveSchemaContractresolves$refone level deep. Verify this catches the contract changes you care about — deeply nested schema changes may not surface.bun run test(planned for PR 2). Confirm you're okay with this being test-only for now.Suggested test plan
cd packages/cli && bun run test— all 6 tests should passopenapi.json(e.g., flip arequired: truetorequired: false) → re-runbun run test→ verify the relevant snapshot(s) failbun run test:updateto accept the change, verify the snapshot diff is readableNotes