Description
- OS: macOS
- Browser: chrome
- Version: 83.0.4103.106
- Method of installation: part of fastapi
- Swagger-UI version: 3.27.0
- Swagger/OpenAPI version: OpenAPI 3.0
Swagger/OpenAPI schema for endpoint:
{
"post": {
"responses": {
"201": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EnvelopedEndpointResponse"
}
}
}
},
"4XX": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
},
"text/csv": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
}
}
}
},
"tags": [
"courses"
],
"summary": "Create Something",
"operationId": "create_something",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CourseSomethingRequest"
}
}
},
"required": true
},
"security": [
{
"APIKeyCookie": []
}
]
}
}
Query: curl -X POST "http://localhost:3000/api/something/" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"title\":\"string\",\"subtitle\":\"string\",\"slug\":\"string\",\"description\":\"string\",\"theme\":\"string\",\"picture\":\"string\",\"quiz_picture\":\"string\",\"complexity\":0}"
Good day.
Server generate schema with some endpoints with one, which schema little bit hight on text. On Screenshot#1 and on endpoint schema you can see defined response. For responses use {int}XX notation https://swagger.io/docs/specification/describing-responses/. I execute query to server. But schema mark response "Undocument".
In js code I found this (in operaion.jsx -> Operation):
if(responses && response && response.size > 0) {
let notDocumented = !responses.get(String(response.get("status"))) && !responses.get("default")
response = response.set("notDocumented", notDocumented)
}
Try to look in component on page
response from props:
{
"error": true,
"name": "Error",
"message": "Unauthorized",
"statusCode": 401,
"ok": false,
"url": "http://localhost:3000/api/somethings/",
"status": 401,
"statusText": "Unauthorized",
"headers": {
"access-control-allow-credentials": "true",
"access-control-allow-origin": "http://localhost:3000",
"content-length": "75",
"content-type": "application/json",
"date": [
"Thu",
"25 Jun 2020 10:50:23 GMT"
],
"server": "uvicorn",
"vary": "Origin"
},
"text": "{\"status\":\"error\",\"error\":{\"code\":\"unauthorized\",\"message\":\"Unauthorized\"}}",
"data": "{\"status\":\"error\",\"error\":{\"code\":\"unauthorized\",\"message\":\"Unauthorized\"}}",
"body": {
"status": "error",
"error": {
"code": "unauthorized",
"message": "Unauthorized"
}
},
"obj": {
"status": "error",
"error": {
"code": "unauthorized",
"message": "Unauthorized"
}
},
"notDocumented": true
}
In total: 4XX response defined, 401 response - Undocumented.
Expected behavior
401 response for 4XX is valid
Screenshots
Screenshot#1 Defined responses
It's look like a bug. Sorry if not.