Repository navigation
Match status ranges and default in the envelope client - #165
Merged
Merged
Conversation
cubahno
marked this pull request as ready for review
October 8, 2026 07:31
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.
With
generate.client-with-response,4XXand5XXboth becamecase 400and a singleJSON400field, typed as whichever range the spec listed last, so a 4xx body could decode into the 5XX schema.defaultbecame an emptycase 500with no field, and was dropped entirely when explicit error codes were documented. Every other status returned a generic error without decoding its body.What changes
JSON4XX,Headers5XX) anddefaultgetsJSONDefault, each typed by its own schema.default. With both400and4XXdocumented,JSON400andJSON4XXsit alongside and a 400 fillsJSON400. A documented code without a body keeps its precedence too, so a bare410is not decoded as4XX.defaultthat is the operation's only success counts as one for 2xx statuses only.$refs a component response ($ref: '#/components/responses/Error') now gets a typed field. It had none, which is how most real-world specs declare4XXand5XX.<Op>StreamWithResponsematches error ranges and an errordefaultthe same way.defaultwhose schema is a JSON pointer into another operation's response, as bundled specs like DigitalOcean's use, gets a type of its own instead of a reference to a type that is never generated. That already broke generation whendefaultwas the only error response.defaultunder a stand-in code (JSON200for2XX,JSON400for4XX,Headers500fordefault) stay as deprecated aliases that always equal the new field, so existing callers compile unchanged.defaultgenerate the same code as before, and so do handler, classic client and MCP generation, with one rare exception: when a range response's type needs a status suffix to stay unique, the suffix is the range (...JSON4XX), so...JSON400always names an explicit 400.defaultare in the newResponseDefinition.StatusRangesandDefaultrather thanSuccesses/Errors, andOperationDefinition.HeaderTypeNamereturns any response's header type name.HeaderTypeNamesis unchanged.Fixes #161