-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Field name "entries" in a schema causes swagger-ui javascript error and fails to load #6016
Copy link
Copy link
Closed
Description
- OS: ubuntu
- Browser: chrome, firefox
- Method of installation: python fastapi
- Swagger-UI version: https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-bundle.js
- Swagger/OpenAPI version: OpenAPI 3.0
Problem
The openapi definition below has a schema with a field name called "entries". This causes the ui to throw a javascript error "e.entries is not a function" (see the screenshot below).
This behavior only started Friday May 15th 2020 at around 15:00 CET. Before that swagger-ui had no problems loading a schema containing a field called entries, so I am assuming something changed in the bundle I use from the url above.
Example Swagger/OpenAPI definition:
{
"openapi": "3.0.2",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"paths": {
"/test/": {
"get": {
"summary": "Test",
"operationId": "test_test__get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Testmodel"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Testmodel": {
"title": "Testmodel",
"required": [
"name",
"entries"
],
"type": "object",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"entries": {
"title": "Entries",
"type": "integer"
}
}
}
}
}
}Screenshot
To reproduce...
Try to load swagger ui using the openapi.json above
Reactions are currently unavailable
