fix: ignore rendering responses with extensions in the schema#10592
Merged
robert-hebel-sb merged 5 commits intoOct 8, 2025
Conversation
| <tbody> | ||
| { | ||
| responses.entrySeq().map( ([code, response]) => { | ||
| responses.filter((_, key) => !key.startsWith("x-")).entrySeq().map( ([code, response]) => { |
Contributor
There was a problem hiding this comment.
could we rewrite and reuse logic from core/utils to filter extensions?
const extensionRegExp = /^x-/
export const isExtension = (key) => extensionRegExp.test(key)
export const getExtensions = (defObj) => {
if(Map.isMap(defObj)) {
return defObj.filter((v, k) => isExtension(k))
}
return Object.keys(defObj).filter((key) => isExtension(key))
}
Suggested change
| responses.filter((_, key) => !key.startsWith("x-")).entrySeq().map( ([code, response]) => { | |
| responses.filter((_, key) => !isExtension(key)).entrySeq().map( ([code, response]) => { |
Contributor
|
hey @DarkMatter-999 could we address an issue where we don't have any responses besides extension? Currently we display an empty table but no table should be displayed in such case openapi: 3.1.0
paths:
/hello:
get:
responses:
x-tenant: acme
info:
title: prout-quarkus API
version: 1.0-SNAPSHOT |
Contributor
Author
|
Hi @robert-hebel-sb, thanks for the review. |
robert-hebel-sb
approved these changes
Oct 7, 2025
swagger-bot
pushed a commit
that referenced
this pull request
Oct 10, 2025
## [5.29.4](v5.29.3...v5.29.4) (2025-10-10) ### Bug Fixes * **core:** refactor UNSAFE_ lifecycle methods in ContentType and OperationContainer ([#10373](#10373)) ([2814709](2814709)), closes [#10212](#10212) * ignore rendering responses with extensions in the schema ([#10592](#10592)) ([23e3e00](23e3e00)) * include script in body ([#10593](#10593)) ([456274c](456274c)) * update vulnerable libxml2 to 2.13.9-r0 ([#10600](#10600)) ([8138154](8138154)) * use h1 for title heading to improve accessibility ([#10598](#10598)) ([c0bd7b6](c0bd7b6)), closes [#10480](#10480)
Contributor
|
🎉 This PR is included in version 5.29.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
delendik-testops
pushed a commit
to ModiusOpenData/swagger-ui
that referenced
this pull request
Mar 3, 2026
delendik-testops
pushed a commit
to ModiusOpenData/swagger-ui
that referenced
this pull request
Mar 3, 2026
## [5.29.4](swagger-api/swagger-ui@v5.29.3...v5.29.4) (2025-10-10) ### Bug Fixes * **core:** refactor UNSAFE_ lifecycle methods in ContentType and OperationContainer ([swagger-api#10373](swagger-api#10373)) ([2814709](swagger-api@2814709)), closes [swagger-api#10212](swagger-api#10212) * ignore rendering responses with extensions in the schema ([swagger-api#10592](swagger-api#10592)) ([23e3e00](swagger-api@23e3e00)) * include script in body ([swagger-api#10593](swagger-api#10593)) ([456274c](swagger-api@456274c)) * update vulnerable libxml2 to 2.13.9-r0 ([swagger-api#10600](swagger-api#10600)) ([8138154](swagger-api@8138154)) * use h1 for title heading to improve accessibility ([swagger-api#10598](swagger-api#10598)) ([c0bd7b6](swagger-api@c0bd7b6)), closes [swagger-api#10480](swagger-api#10480)
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.


Description
This PR fixes a rendering bug in the Responses when using custom OpenAPI extensions (
x-*) inside the responses object.Motivation and Context
fixes #10561
Swagger UI previously attempted to render all entries in the responses object, including custom extensions like
x-tenantas actual HTTP responses.How Has This Been Tested?
Manually tested with an OpenAPI 3.1.0 spec containing
x-tenantunder responsesVerified that the Responses section renders correctly and without errors
Confirmed that valid responses (200, 500, etc.) still display as expected
Ran relevant tests, no regressions observed.
Environment:
OS: Linux
Browser: Chromium 139
Swagger UI:
masterBranchSchema used for testing:
{ "openapi" : "3.1.0", "paths" : { "/hello" : { "get" : { "responses" : { "200" : { "description" : "The hello message", "content" : { "text/plain" : { "schema" : { "type" : "string" } } }, "x-tenant" : "acme" }, "500" : { "description" : "Internal server error", "x-tenant" : "acme" }, "x-tenant" : "acme" }, "x-tenant" : "acme", "summary" : "Hello", "tags" : [ "Example Resource" ] } } }, "info" : { "title" : "prout-quarkus API", "version" : "1.0-SNAPSHOT" } }Screenshots (if appropriate):
Before:
After:
Checklist
My PR contains...
My changes...
Documentation
Automated tests