Repository navigation
Conversation
Response headers that describe their schema with `content` instead of an inline `schema` rendered nothing, because the schema lookup in FieldModel required `info.in` to be set and header objects have no `in`. Drop that guard so `content[<mime>].schema` is used for any field that lacks an inline `schema`; an inline `schema` still takes precedence. The media type of that content mapping was tracked as `serializationMime` but never rendered, so a reader had no way to tell which content type the schema belongs to. Render it below the field name, which is what the issue asked for for both headers and header parameters. Closes: Redocly#2632
Collaborator
|
@ump45nose Thanks for the contribution, and sorry we didn't get to this in time! 馃檹 We've just shipped Redoc v3.0.0, which reworked a large part of the codebase, so older PRs no longer apply cleanly. We're closing them to keep the queue manageable. If you think this is still relevant for v3, please rebase onto |
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.
Closes #2632
Response headers that describe their schema with
contentinstead of an inlineschemarendered nothing. The cause was in
FieldModel: the schema lookup requiredinfo.into beset, and header objects have no
in, so the lookup was skipped for every header.Dropping that guard means
content[<mime>].schemais resolved for any field that lacks aninline
schema. An inlineschemastill takes precedence, so existing behaviour forparameters is unchanged.
The media type of that content mapping was already being tracked as
serializationMimebutnever rendered, so a reader had no way to tell which content type the shown schema belonged
to. It is now rendered below the field name, for both headers and header parameters, which is
what the issue asked for.
Testing:
npx vitest run src/services/__tests__/models/FieldModel.test.tspasses, and I addedthree cases to it - a header with
contentbut noschema, a header that still uses an inlineschema, and a response header whosecontenthas several media types. I could not run thefull
yarn testsuite here because the workspace's other suites need a browser/E2E setup thatis not available in this sandbox.