Integrated Swagger UI throws error on valid OpenAPI spec file
Summary
When opening a valid OpenAPI JSON file from the Repository / Files section, an error message is displayed saying:
Unable to render this definition
The provided definition does not specify a valid version field.
Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).
This problem did not occur yesterday (2022-10-26), but it does today on all our projects.
Steps to reproduce
- Create a new project
- Create a new file named
openapi.jsonwith the contents shown below and commit it - Open the new file from the
Repository / Filessection of the GitLab website
The file contents to use:
{
"openapi": "3.0.0",
"info": {
"title": "OpenAPI Bug Test",
"description": "OpenAPI specification Test in GitLab",
"contact": {
"name": "Test",
"url": "http://www.test.com/",
"email": "test@domain.tld"
},
"license": {
"name": "proprietary"
},
"version": "1.0"
},
"servers": [
{
"url": "https://test.domain.tld",
"description": "Test Server"
}
],
"paths": {
"/v1/my-operation": {
"get": {
"summary": "Some operation.",
"description": "Some REST operation.",
"security": [],
"tags": [
"Test"
],
"operationId": "getSomething",
"responses": {
"204": {
"description": "Indicates, the request was successful."
},
"500": {
"description": "Indicates, the request failed."
}
}
}
}
}
}
Example Project
https://gitlab.com/janschaeferpland/issue_221027_swaggerui_error_message_valid_openapi_file
What is the current bug behavior?
Swagger UI displays an error message for a valid OpenAPI spec file.
What is the expected correct behavior?
Swagger UI should render the interactive UI from the OpenAPI spec.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com