File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
springdoc-openapi-common/src/main/java/org/springdoc/core
springdoc-openapi-webmvc-core/src/test
java/test/org/springdoc/api/v30/app173 Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 3737import java .util .stream .Collectors ;
3838import java .util .stream .Stream ;
3939
40+ import com .fasterxml .jackson .annotation .JsonInclude .Include ;
4041import com .fasterxml .jackson .core .JsonProcessingException ;
4142import com .fasterxml .jackson .databind .ObjectMapper ;
4243import io .swagger .v3 .core .jackson .TypeNameResolver ;
@@ -249,6 +250,9 @@ public OpenAPI build(Locale locale) {
249250 try {
250251 ObjectMapper objectMapper = ObjectMapperProvider .createJson (springDocConfigProperties );
251252 calculatedOpenAPI = objectMapper .readValue (objectMapper .writeValueAsString (openAPI ), OpenAPI .class );
253+ objectMapper .setSerializationInclusion (Include .ALWAYS );
254+ Map extensionsClone = objectMapper .readValue (objectMapper .writeValueAsString (openAPI .getExtensions ()), Map .class );
255+ calculatedOpenAPI .extensions (extensionsClone );
252256 }
253257 catch (JsonProcessingException e ) {
254258 LOGGER .warn ("Json Processing Exception occurred: {}" , e .getMessage ());
Original file line number Diff line number Diff line change 2222
2323package test .org .springdoc .api .v30 .app173 ;
2424
25+ import java .util .Collections ;
2526import java .util .Locale ;
2627
2728import io .swagger .v3 .oas .models .OpenAPI ;
@@ -65,7 +66,7 @@ private void testApp(Locale locale) throws Exception {
6566 static class SpringDocTestApp {
6667 @ Bean
6768 public OpenAPI openAPI () {
68- return new OpenAPI ();
69+ return new OpenAPI (). extensions ( Collections . singletonMap ( "TEST" , "HELLO" )) ;
6970 }
7071 }
7172
Original file line number Diff line number Diff line change 4848 }
4949 }
5050 },
51- "components" : {}
51+ "components" : {},
52+ "TEST" : " HELLO"
5253}
You can’t perform that action at this time.
0 commit comments