Add OpenAPI examples for every domain error family (Fixes #1528)#1613
Open
DammyAji wants to merge 1 commit into
Open
Add OpenAPI examples for every domain error family (Fixes #1528)#1613DammyAji wants to merge 1 commit into
DammyAji wants to merge 1 commit into
Conversation
…l#1528) - Add ErrorEnvelope schema to components.schemas matching the runtime apiFailure() envelope shape (error.code, error.message, meta.*) - Add 12 reusable named examples in components.examples covering all domain error families: auth, validation, conflict, postage, receipt, policy, and rate-limit - Wire examples into all 17 path operations via $ref in responses blocks - ValidationError example uses the stable validationErrors[] format introduced by upstream issue Stellar-Mail#1519 - Keep upstream-added ValidationErrorItem and ValidationErrorDetails schemas intact (no conflict) - Add openapi.examples-domain-errors.test.ts verifying all four acceptance criteria: family coverage, envelope shape, no real user data, and error codes in the ApiErrorCode registry
Collaborator
|
@DammyAji tell your agent to run bun command with prettier to format the code Then check ✅ it again with bun after with bun prettier check ✅... That the case for all your issues. If you have CODEX try using it or just connect your GitHub with GPT and use chatGPT work with the GitHub mcp It should also solve it |
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.
Summary
Closes #1528
Adds reusable OpenAPI examples for every domain error family so integrators can see realistic, safe error responses directly in the API spec. All examples are tied to the central error registry and match the runtime envelope shape.
What changed
src/server/api/openapi.tsErrorEnvelopeschema tocomponents.schemas— formally documents the runtime shape produced byapiFailure()(error.code,error.message, optionaldetails, plusmeta.requestIdandmeta.timestamp)components.examples, one per domain error family:AuthUnauthorized,AuthForbiddenValidationBadRequest,ValidationErrorConflictDuplicatePostageNotFound,PostageConflictReceiptNotFound,ReceiptConflictPolicyNotFound,PolicyForbiddenRateLimitExceeded$refinresponsesblocks (63 total references)ValidationErrorexample uses the stablevalidationErrors[]structured format from Add bounded sampling for high-volume API logs #1519ValidationErrorItemandValidationErrorDetailsschemas preserved intacttests/unit/api/openapi.examples-domain-errors.test.ts(new file)Tests verifying all four acceptance criteria:
ErrorEnvelopeshapeerror.codeexists in theApiErrorCoderegistry$refs in path operations resolve to defined component examplesAcceptance criteria
CI
tsc --noEmit— 0 errorsprettier --check .— all files cleanCloses #1528