@@ -308,16 +308,14 @@ protected synchronized OpenAPI getOpenApi(Locale locale) {
308308 final Locale finalLocale = locale == null ? Locale .getDefault () : locale ;
309309 if (openAPIService .getCachedOpenAPI (finalLocale ) == null || springDocConfigProperties .isCacheDisabled ()) {
310310 Instant start = Instant .now ();
311- openAPIService .build (finalLocale );
311+ openAPI = openAPIService .build (finalLocale );
312312 Map <String , Object > mappingsMap = openAPIService .getMappingsMap ().entrySet ().stream ()
313313 .filter (controller -> (AnnotationUtils .findAnnotation (controller .getValue ().getClass (),
314314 Hidden .class ) == null ))
315315 .filter (controller -> !AbstractOpenApiResource .isHiddenRestControllers (controller .getValue ().getClass ()))
316316 .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue , (a1 , a2 ) -> a1 ));
317317
318318 Map <String , Object > findControllerAdvice = openAPIService .getControllerAdviceMap ();
319- // calculate generic responses
320- openAPI = openAPIService .getCalculatedOpenAPI ();
321319 if (OpenApiVersion .OPENAPI_3_1 == springDocConfigProperties .getApiDocs ().getVersion ())
322320 openAPI .openapi (OpenApiVersion .OPENAPI_3_1 .getVersion ());
323321 if (springDocConfigProperties .isDefaultOverrideWithGenericResponse ()) {
@@ -359,7 +357,6 @@ protected synchronized OpenAPI getOpenApi(Locale locale) {
359357 openAPIService .setServersPresent (true );
360358
361359 openAPIService .setCachedOpenAPI (openAPI , finalLocale );
362- openAPIService .resetCalculatedOpenAPI ();
363360
364361 LOGGER .info ("Init duration for springdoc-openapi is: {} ms" ,
365362 Duration .between (start , Instant .now ()).toMillis ());
@@ -552,10 +549,10 @@ protected void calculatePath(List<RouterOperation> routerOperationList, Locale l
552549 }
553550 }
554551 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 );
556553 }
557554 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 );
559556 }
560557 }
561558 }
@@ -567,15 +564,14 @@ else if (routerOperation.getOperationModel() != null && StringUtils.isNotBlank(r
567564 * @param routerOperation the router operation
568565 * @param locale the locale
569566 */
570- protected void calculatePath (RouterOperation routerOperation , Locale locale ) {
567+ protected void calculatePath (RouterOperation routerOperation , Locale locale , OpenAPI openAPI ) {
571568 String operationPath = routerOperation .getPath ();
572569 io .swagger .v3 .oas .annotations .Operation apiOperation = routerOperation .getOperation ();
573570 String [] methodConsumes = routerOperation .getConsumes ();
574571 String [] methodProduces = routerOperation .getProduces ();
575572 String [] headers = routerOperation .getHeaders ();
576573 Map <String , String > queryParams = routerOperation .getQueryParams ();
577574
578- OpenAPI openAPI = openAPIService .getCalculatedOpenAPI ();
579575 Paths paths = openAPI .getPaths ();
580576 Map <HttpMethod , Operation > operationMap = null ;
581577 if (paths .containsKey (operationPath )) {
0 commit comments