fix(operation): recognize wildcard HTTP status codes as documented responses#10833
Open
yogeshwaran-c wants to merge 1 commit intoswagger-api:masterfrom
Open
Conversation
…sponses When a response like 4XX is defined in the spec, individual status codes within that range (e.g. 401, 404) should not be marked as "Undocumented". The existing check only matched exact status code strings and "default". This adds a fallback check for range patterns (1XX, 2XX, 3XX, 4XX, 5XX) per the OpenAPI specification. Fixes swagger-api#6175
d6f9d70 to
2c32c5f
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.
Description
When an OpenAPI spec defines responses using HTTP status code ranges like
4XXor5XX, individual status codes within that range (e.g.,401,404,500) were being incorrectly marked as "Undocumented" in the live response section.The existing check in
operation.jsxonly matched exact status code strings (e.g.,"401") and the"default"key. This change adds a fallback check for range patterns (1XX,2XX,3XX,4XX,5XX) as defined in the OpenAPI specification.Motivation and Context
Fixes #6175
The OpenAPI specification supports HTTP status code ranges using patterns like
4XX(see describing-responses). When a server returns a401response and the spec defines4XX, the response should be recognized as documented.How Has This Been Tested?
"401"->"4XX")"default"still works as final fallbackScreenshots (if appropriate):
N/A - logic change only
Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests