-
-
Notifications
You must be signed in to change notification settings - Fork 553
Description
Describe the bug
It seems that the ability to add Extesntions to the OpenAPI object no longer works.
Previously you could provide .extensions() a Map<String, Object> which would reflect in the OpenAPI JSON.
Our application relied heavily on these custom extensions which is how I noticed the issue initially.
After trying several different versions, this functionality appears to have broken starting version 1.6.2 and still appears to be presnt in the latest version 2.0.2.
To Reproduce
Steps to reproduce the behavior:
Spring Boot : 2.7.9 (has to be 2.x.x so you can switch between Springdoc 1.6.1 and 1.6.2 easily)
JDK: 17.0.4
OS: Tested on Window 11 + RHEL8
Gradle 7.6.1
Example project to reproduce the bug: https://github.com/kjc14f/springdoc-test
Create a very simple Config class that sets an extremely simple extension(s):
@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.extensions(Map.of("TEST", "HELLO"));
}
}In build.gradle add implementation 'org.springdoc:springdoc-openapi-ui:1.6.1' as a dependency.
Run the app and view http://localhost:8080/v3/api-docs, you will notice "TEST": "HELLO" which is correct.
Version 1.6.1 working:
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localhost:8080",
"description": "Generated server url"
}
],
"paths": {},
"components": {},
"TEST": "HELLO"
}Stop the app, switch the import to org.springdoc:springdoc-openapi-ui:1.6.2 and restart the app.
You will now see the extension "TEST": "HELLO" disappear.
Version >= 1.6.2 broken:
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localhost:8080",
"description": "Generated server url"
}
],
"paths": {},
"components": {}
}Expected behavior
OpenAPI JSON should show the extensions set on the OpenAPI object on all versions of Springdoc.
In the above example "TEST": "HELLO"