swagger-ui
swagger-ui copied to clipboard
Optional header parameter: Javascript error when not filling the header
Q&A (please complete the following information)
- OS: Ubuntu 22.04
- Browser: Firefox
- Version: 122
- Method of installation:
org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0
- Swagger-UI version:
5.10.3
(at least that's what I infer from springdoc giving meorg.webjars:swagger-ui:5.10.3
) - Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Example Swagger/OpenAPI definition:
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localhost:8080",
"description": "Generated server url"
}
],
"paths": {
"/dummy": {
"get": {
"tags": [
"Dummy-controller"
],
"description": "Dummy",
"operationId": "dummy_1",
"parameters": [
{
"name": "X-Request-ID",
"in": "header",
"description": "a dummy header",
"required": false,
"content": {
"text/plain": {
"schema": {}
}
}
}
],
"responses": {
"200": {
"description": "Dummy",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
}
}
Swagger-UI configuration options:
None that I did myself - maybe Springdoc does something.
Describe the bug you're encountering
To reproduce...
Given an endpoint definition with an optional header parameter (example is above) When I click on "Try out" and "Execute" of that endpoint without filling the header parameter: The "Loading" spinner keeps spinning infinitely and there is a JS error in the browser console.
The error from the console as text:
TypeError: i is undefined
serialize content-serializer.js:12
parameter_builders_header parameter-builders.js:89
execute_buildRequest index.js:234
execute_buildRequest index.js:201
executeRequest actions.js:454
systemThunkMiddleware index.js:174
bindActionCreator Redux
wrap_actions_executeRequest wrap-actions.js:33
newAction system.js:175
wrapWithTryCatch system.js:487
actions_execute actions.js:501
systemThunkMiddleware index.js:174
bindActionCreator Redux
execute wrap-actions.js:9
newAction system.js:175
wrapWithTryCatch system.js:487
handleValidationResultPass execute.jsx:66
handleValidationResult execute.jsx:80
onClick execute.jsx:90
React 11
Rb
Xb
Yb
Ze
se
jd
lt
Nb
jd
yc
hd
unstable_runWithPriority scheduler.production.min.js:18
React 3
gg
Hb
gd
system.js:490:16
Expected behavior
The request should be sent.