@@ -308,16 +308,14 @@ protected synchronized OpenAPI getOpenApi(Locale locale) {
308
308
final Locale finalLocale = locale == null ? Locale .getDefault () : locale ;
309
309
if (openAPIService .getCachedOpenAPI (finalLocale ) == null || springDocConfigProperties .isCacheDisabled ()) {
310
310
Instant start = Instant .now ();
311
- openAPIService .build (finalLocale );
311
+ openAPI = openAPIService .build (finalLocale );
312
312
Map <String , Object > mappingsMap = openAPIService .getMappingsMap ().entrySet ().stream ()
313
313
.filter (controller -> (AnnotationUtils .findAnnotation (controller .getValue ().getClass (),
314
314
Hidden .class ) == null ))
315
315
.filter (controller -> !AbstractOpenApiResource .isHiddenRestControllers (controller .getValue ().getClass ()))
316
316
.collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue , (a1 , a2 ) -> a1 ));
317
317
318
318
Map <String , Object > findControllerAdvice = openAPIService .getControllerAdviceMap ();
319
- // calculate generic responses
320
- openAPI = openAPIService .getCalculatedOpenAPI ();
321
319
if (OpenApiVersion .OPENAPI_3_1 == springDocConfigProperties .getApiDocs ().getVersion ())
322
320
openAPI .openapi (OpenApiVersion .OPENAPI_3_1 .getVersion ());
323
321
if (springDocConfigProperties .isDefaultOverrideWithGenericResponse ()) {
@@ -359,7 +357,6 @@ protected synchronized OpenAPI getOpenApi(Locale locale) {
359
357
openAPIService .setServersPresent (true );
360
358
361
359
openAPIService .setCachedOpenAPI (openAPI , finalLocale );
362
- openAPIService .resetCalculatedOpenAPI ();
363
360
364
361
LOGGER .info ("Init duration for springdoc-openapi is: {} ms" ,
365
362
Duration .between (start , Instant .now ()).toMillis ());
@@ -552,10 +549,10 @@ protected void calculatePath(List<RouterOperation> routerOperationList, Locale l
552
549
}
553
550
}
554
551
else if (routerOperation .getOperation () != null && StringUtils .isNotBlank (routerOperation .getOperation ().operationId ()) && isFilterCondition (routerOperation .getPath (), routerOperation .getProduces (), routerOperation .getConsumes (), routerOperation .getHeaders ())) {
555
- calculatePath (routerOperation , locale );
552
+ calculatePath (routerOperation , locale , openAPI );
556
553
}
557
554
else if (routerOperation .getOperationModel () != null && StringUtils .isNotBlank (routerOperation .getOperationModel ().getOperationId ()) && isFilterCondition (routerOperation .getPath (), routerOperation .getProduces (), routerOperation .getConsumes (), routerOperation .getHeaders ())) {
558
- calculatePath (routerOperation , locale );
555
+ calculatePath (routerOperation , locale , openAPI );
559
556
}
560
557
}
561
558
}
@@ -567,15 +564,14 @@ else if (routerOperation.getOperationModel() != null && StringUtils.isNotBlank(r
567
564
* @param routerOperation the router operation
568
565
* @param locale the locale
569
566
*/
570
- protected void calculatePath (RouterOperation routerOperation , Locale locale ) {
567
+ protected void calculatePath (RouterOperation routerOperation , Locale locale , OpenAPI openAPI ) {
571
568
String operationPath = routerOperation .getPath ();
572
569
io .swagger .v3 .oas .annotations .Operation apiOperation = routerOperation .getOperation ();
573
570
String [] methodConsumes = routerOperation .getConsumes ();
574
571
String [] methodProduces = routerOperation .getProduces ();
575
572
String [] headers = routerOperation .getHeaders ();
576
573
Map <String , String > queryParams = routerOperation .getQueryParams ();
577
574
578
- OpenAPI openAPI = openAPIService .getCalculatedOpenAPI ();
579
575
Paths paths = openAPI .getPaths ();
580
576
Map <HttpMethod , Operation > operationMap = null ;
581
577
if (paths .containsKey (operationPath )) {
0 commit comments