Repository navigation
Conversation
Danger ReportNo issues found. |
numbata
force-pushed
the
pr/5-builder-responses-schemas
branch
from
October 14, 2026 18:28
6ac5bee to
f129d86
Compare
numbata
force-pushed
the
pr/5-builder-responses-schemas
branch
from
October 14, 2026 19:31
f129d86 to
946593f
Compare
numbata
force-pushed
the
pr/5-builder-responses-schemas
branch
from
October 14, 2026 19:41
946593f to
efdcc16
Compare
Without responses an OpenAPI 3 document says nothing about what an endpoint returns. This adds response objects built from `success`, `failure`, `http_codes` and `default_response`. Responses reference the models registered under components.schemas, as single objects, arrays or `add_root` wrappers, and carry response headers and file downloads. Model exposure, composition and discriminators are already handled by the core builder. Symbolic statuses such as `:created` are normalized to HTTP codes. A symbol Rack cannot resolve is reported once on stderr instead of producing an invalid response key; the response is skipped, or the default success status is used when the unknown symbol was the success code.
numbata
force-pushed
the
pr/5-builder-responses-schemas
branch
from
October 14, 2026 20:13
efdcc16 to
07a2acd
Compare
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
OpenAPI 3 documents now describe what each endpoint returns: status codes, descriptions, headers and the shape of the returned models. Together with the earlier steps this produces a complete document for typical Grape APIs, including those using entities and model parsers. Typos in symbolic statuses are reported instead of silently producing a broken document.
Problem solved
Consumers of an API description need to know what comes back and in what shape. Responses have to point at the models registered under components.schemas, as single objects, arrays or root-wrapped objects, with the right status and headers.
What changes
Responses are built from
success,failure,http_codesanddefault_response. Responses reference the models registered under components.schemas (model exposure, composition and discriminators are handled by the core builder in the earlier step); response headers (includingitems,exampleandcollectionFormat, which becomes thesimplestyle), file downloads and theadd_rootwrapper are supported, and any truthyadd_rootuses the default root name as in Swagger 2.0. Symbolic statuses become HTTP codes.Drawbacks and nuances
:not_foud) warns once on stderr and is skipped; an unknown success symbol falls back to 200.x: { nullable: true }; a plaindocumentation: { nullable: true }on an exposure is not forwarded by the entity parser.Alternatives considered
Stacks on: pr/4-builder-params-bodies.