Skip to content

Commit d6f9d70

Browse files
committed
fix(operation): recognize wildcard HTTP status codes as documented responses
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 #6175
1 parent 34d6186 commit d6f9d70

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/core/components/operation.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ export default class Operation extends PureComponent {
106106

107107
// Merge in Live Response
108108
if(responses && response && response.size > 0) {
109-
let notDocumented = !responses.get(String(response.get("status"))) && !responses.get("default")
109+
const statusCode = String(response.get("status"))
110+
const statusRange = statusCode.length === 3 ? `${statusCode[0]}XX` : null
111+
let notDocumented = !responses.get(statusCode)
112+
&& !(statusRange && responses.get(statusRange))
113+
&& !responses.get("default")
110114
response = response.set("notDocumented", notDocumented)
111115
}
112116

0 commit comments

Comments
 (0)