File tree 3 files changed +8
-2
lines changed
springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service
springdoc-openapi-starter-webmvc-api/src/test
java/test/org/springdoc/api/v30/app173
3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 42
42
import java .util .stream .Collectors ;
43
43
import java .util .stream .Stream ;
44
44
45
+ import com .fasterxml .jackson .annotation .JsonInclude .Include ;
45
46
import com .fasterxml .jackson .core .JsonProcessingException ;
46
47
import com .fasterxml .jackson .databind .ObjectMapper ;
47
48
import io .swagger .v3 .core .jackson .TypeNameResolver ;
@@ -245,6 +246,9 @@ public OpenAPI build(Locale locale) {
245
246
try {
246
247
ObjectMapper objectMapper = ObjectMapperProvider .createJson (springDocConfigProperties );
247
248
calculatedOpenAPI = objectMapper .readValue (objectMapper .writeValueAsString (openAPI ), OpenAPI .class );
249
+ objectMapper .setSerializationInclusion (Include .NON_EMPTY );
250
+ Map extensionsClone = objectMapper .readValue (objectMapper .writeValueAsString (openAPI .getExtensions ()), Map .class );
251
+ calculatedOpenAPI .extensions (extensionsClone );
248
252
}
249
253
catch (JsonProcessingException e ) {
250
254
LOGGER .warn ("Json Processing Exception occurred: {}" , e .getMessage ());
Original file line number Diff line number Diff line change 25
25
package test .org .springdoc .api .v30 .app173 ;
26
26
27
27
import java .util .Locale ;
28
+ import java .util .Map ;
28
29
29
30
import io .swagger .v3 .oas .models .OpenAPI ;
30
31
import org .junit .jupiter .api .Test ;
@@ -67,7 +68,7 @@ private void testApp(Locale locale) throws Exception {
67
68
static class SpringDocTestApp {
68
69
@ Bean
69
70
public OpenAPI openAPI () {
70
- return new OpenAPI ();
71
+ return new OpenAPI (). extensions ( Map . of ( "TEST" , "HELLO" )) ;
71
72
}
72
73
}
73
74
Original file line number Diff line number Diff line change 25
25
}
26
26
}
27
27
},
28
- "components" : {}
28
+ "components" : {},
29
+ "TEST" : " HELLO"
29
30
}
You can’t perform that action at this time.
0 commit comments