diff --git a/springdoc-openapi-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java b/springdoc-openapi-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java index d3c506319..62f34ca4c 100644 --- a/springdoc-openapi-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java +++ b/springdoc-openapi-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java @@ -49,7 +49,6 @@ import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature; @@ -67,7 +66,6 @@ import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponses; -import io.swagger.v3.oas.models.servers.Server; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -238,10 +236,9 @@ protected AbstractOpenApiResource(String groupName, ObjectFactory> routerOperationCustomizers, Optional> methodFilters, SpringDocConfigProperties springDocConfigProperties, SpringDocProviders springDocProviders) { - super(); this.groupName = Objects.requireNonNull(groupName, "groupName"); this.openAPIBuilderObjectFactory = openAPIBuilderObjectFactory; - this.openAPIService = openAPIBuilderObjectFactory.getObject(); + openAPIService = openAPIBuilderObjectFactory.getObject(); this.requestBuilder = requestBuilder; this.responseBuilder = responseBuilder; this.operationParser = operationParser; @@ -250,22 +247,24 @@ protected AbstractOpenApiResource(String groupName, ObjectFactory existingOpenApiCustomisers = openAPIService.getContext().getBeansOfType(OpenApiCustomiser.class); - if (!CollectionUtils.isEmpty(existingOpenApiCustomisers) && existingOpenApiCustomisers.containsKey(LINKS_SCHEMA_CUSTOMISER)) + final Map existingOpenApiCustomisers = openAPIService.getContext().getBeansOfType(OpenApiCustomiser.class); + if (!CollectionUtils.isEmpty(existingOpenApiCustomisers) && existingOpenApiCustomisers.containsKey(LINKS_SCHEMA_CUSTOMISER)) { openApiCustomisers.ifPresent(openApiCustomisersList -> openApiCustomisersList.add(existingOpenApiCustomisers.get(LINKS_SCHEMA_CUSTOMISER))); + } this.springDocConfigProperties = springDocConfigProperties; operationCustomizers.ifPresent(customizers -> customizers.removeIf(Objects::isNull)); this.operationCustomizers = operationCustomizers; - if (springDocConfigProperties.isPreLoadingEnabled()) + if (springDocConfigProperties.isPreLoadingEnabled()) { Executors.newSingleThreadExecutor().execute(this::getOpenApi); - this.openApiLocaleCustomizers = openAPIService.getContext().getBeansOfType(OpenApiLocaleCustomizer.class); + } + openApiLocaleCustomizers = openAPIService.getContext().getBeansOfType(OpenApiLocaleCustomizer.class); } /** * Gets open api. */ private void getOpenApi() { - this.getOpenApi(Locale.getDefault()); + getOpenApi(Locale.getDefault()); } /** @@ -292,7 +291,7 @@ public static void addHiddenRestControllers(Class... classes) { * @param classes the classes */ public static void addHiddenRestControllers(String... classes) { - Set> hiddenClasses = new HashSet<>(); + final Set> hiddenClasses = new HashSet<>(); for (String aClass : classes) { try { hiddenClasses.add(Class.forName(aClass)); @@ -313,53 +312,45 @@ protected synchronized OpenAPI getOpenApi(Locale locale) { final OpenAPI openAPI; final Locale finalLocale = locale == null ? Locale.getDefault() : locale; if (openAPIService.getCachedOpenAPI(finalLocale) == null || springDocConfigProperties.isCacheDisabled()) { - Instant start = Instant.now(); + final Instant start = Instant.now(); openAPI = openAPIService.build(finalLocale); - Map mappingsMap = openAPIService.getMappingsMap().entrySet().stream() - .filter(controller -> (AnnotationUtils.findAnnotation(controller.getValue().getClass(), - Hidden.class) == null)) - .filter(controller -> !AbstractOpenApiResource.isHiddenRestControllers(controller.getValue().getClass())) + final Map mappingsMap = openAPIService.getMappingsMap().entrySet().stream() + .filter(controller -> AnnotationUtils.findAnnotation(controller.getValue().getClass(), + Hidden.class) == null) + .filter(controller -> !isHiddenRestControllers(controller.getValue().getClass())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a1, a2) -> a1)); - Map findControllerAdvice = openAPIService.getControllerAdviceMap(); - if (OpenApiVersion.OPENAPI_3_1 == springDocConfigProperties.getApiDocs().getVersion()) + final Map findControllerAdvice = openAPIService.getControllerAdviceMap(); + if (OpenApiVersion.OPENAPI_3_1 == springDocConfigProperties.getApiDocs().getVersion()) { openAPI.openapi(OpenApiVersion.OPENAPI_3_1.getVersion()); + } if (springDocConfigProperties.isDefaultOverrideWithGenericResponse()) { - if (!CollectionUtils.isEmpty(mappingsMap)) + if (!CollectionUtils.isEmpty(mappingsMap)) { findControllerAdvice.putAll(mappingsMap); + } responseBuilder.buildGenericResponse(openAPI.getComponents(), findControllerAdvice, finalLocale); } getPaths(mappingsMap, finalLocale, openAPI); - Optional cloudFunctionProviderOptional = springDocProviders.getSpringCloudFunctionProvider(); + final Optional cloudFunctionProviderOptional = springDocProviders.getSpringCloudFunctionProvider(); cloudFunctionProviderOptional.ifPresent(cloudFunctionProvider -> { - List routerOperationList = cloudFunctionProvider.getRouterOperations(openAPI); - if (!CollectionUtils.isEmpty(routerOperationList)) - this.calculatePath(routerOperationList, locale, openAPI); + final List routerOperationList = cloudFunctionProvider.getRouterOperations(openAPI); + if (!CollectionUtils.isEmpty(routerOperationList)) { + calculatePath(routerOperationList, locale, openAPI); + } } ); - if (!CollectionUtils.isEmpty(openAPI.getServers())) + if (!CollectionUtils.isEmpty(openAPI.getServers())) { openAPIService.setServersPresent(true); - openAPIService.updateServers(openAPI); - - if (springDocConfigProperties.isRemoveBrokenReferenceDefinitions()) - this.removeBrokenReferenceDefinitions(openAPI); - - // run the optional customisers - List servers = openAPI.getServers(); - List serversCopy = null; - try { - serversCopy = springDocProviders.jsonMapper() - .readValue(springDocProviders.jsonMapper().writeValueAsString(servers), new TypeReference>() {}); } - catch (JsonProcessingException e) { - LOGGER.warn("Json Processing Exception occurred: {}", e.getMessage()); + + if (springDocConfigProperties.isRemoveBrokenReferenceDefinitions()) { + removeBrokenReferenceDefinitions(openAPI); } + openAPIService.updateServers(openAPI); openApiLocaleCustomizers.values().forEach(openApiLocaleCustomizer -> openApiLocaleCustomizer.customise(openAPI, finalLocale)); - openApiCustomisers.ifPresent(apiCustomisers -> apiCustomisers.forEach(openApiCustomiser -> openApiCustomiser.customise(openAPI))); - if (!CollectionUtils.isEmpty(openAPI.getServers()) && !openAPI.getServers().equals(serversCopy)) - openAPIService.setServersPresent(true); + openApiCustomisers.ifPresent(apiCustomizers -> apiCustomizers.forEach(openApiCustomizer -> openApiCustomizer.customise(openAPI))); openAPIService.setCachedOpenAPI(openAPI, finalLocale); @@ -399,34 +390,36 @@ protected void calculatePath(HandlerMethod handlerMethod, String operationPath = routerOperation.getPath(); Set requestMethods = new TreeSet<>(Arrays.asList(routerOperation.getMethods())); + io.swagger.v3.oas.annotations.Operation apiOperation = routerOperation.getOperation(); - String[] methodConsumes = routerOperation.getConsumes(); - String[] methodProduces = routerOperation.getProduces(); - String[] headers = routerOperation.getHeaders(); - Map queryParams = routerOperation.getQueryParams(); + final String[] methodConsumes = routerOperation.getConsumes(); + final String[] methodProduces = routerOperation.getProduces(); + final String[] headers = routerOperation.getHeaders(); + final Map queryParams = routerOperation.getQueryParams(); - Components components = openAPI.getComponents(); - Paths paths = openAPI.getPaths(); + final Components components = openAPI.getComponents(); + final Paths paths = openAPI.getPaths(); Map operationMap = null; if (paths.containsKey(operationPath)) { - PathItem pathItem = paths.get(operationPath); + final PathItem pathItem = paths.get(operationPath); operationMap = pathItem.readOperationsMap(); } - JavadocProvider javadocProvider = operationParser.getJavadocProvider(); + final JavadocProvider javadocProvider = operationParser.getJavadocProvider(); for (RequestMethod requestMethod : requestMethods) { - Operation existingOperation = getExistingOperation(operationMap, requestMethod); - Method method = handlerMethod.getMethod(); + final Operation existingOperation = getExistingOperation(operationMap, requestMethod); + final Method method = handlerMethod.getMethod(); // skip hidden operations - if (operationParser.isHidden(method)) + if (operationParser.isHidden(method)) { continue; + } - RequestMapping reqMappingClass = AnnotatedElementUtils.findMergedAnnotation(handlerMethod.getBeanType(), + final RequestMapping reqMappingClass = AnnotatedElementUtils.findMergedAnnotation(handlerMethod.getBeanType(), RequestMapping.class); - MethodAttributes methodAttributes = new MethodAttributes(springDocConfigProperties.getDefaultConsumesMediaType(), springDocConfigProperties.getDefaultProducesMediaType(), methodConsumes, methodProduces, headers, locale); + final MethodAttributes methodAttributes = new MethodAttributes(springDocConfigProperties.getDefaultConsumesMediaType(), springDocConfigProperties.getDefaultProducesMediaType(), methodConsumes, methodProduces, headers, locale); methodAttributes.setMethodOverloaded(existingOperation != null); //Use the javadoc return if present if (javadocProvider != null) { @@ -443,23 +436,26 @@ protected void calculatePath(HandlerMethod handlerMethod, Operation operation = (existingOperation != null) ? existingOperation : new Operation(); - if (isDeprecated(method)) + if (isDeprecated(method)) { operation.setDeprecated(true); + } // Add documentation from operation annotation - if (apiOperation == null || StringUtils.isBlank(apiOperation.operationId())) + if (apiOperation == null || StringUtils.isBlank(apiOperation.operationId())) { apiOperation = AnnotatedElementUtils.findMergedAnnotation(method, io.swagger.v3.oas.annotations.Operation.class); + } calculateJsonView(apiOperation, methodAttributes, method); - if (apiOperation != null) + if (apiOperation != null) { openAPI = operationParser.parse(apiOperation, operation, openAPI, methodAttributes); + } fillParametersList(operation, queryParams, methodAttributes); // compute tags operation = openAPIService.buildTags(handlerMethod, operation, openAPI, locale); - io.swagger.v3.oas.annotations.parameters.RequestBody requestBodyDoc = AnnotatedElementUtils.findMergedAnnotation(method, + final io.swagger.v3.oas.annotations.parameters.RequestBody requestBodyDoc = AnnotatedElementUtils.findMergedAnnotation(method, io.swagger.v3.oas.annotations.parameters.RequestBody.class); // RequestBody in Operation @@ -471,15 +467,15 @@ protected void calculatePath(HandlerMethod handlerMethod, operation = requestBuilder.build(handlerMethod, requestMethod, operation, methodAttributes, openAPI); // responses - ApiResponses apiResponses = responseBuilder.build(components, handlerMethod, operation, methodAttributes); + final ApiResponses apiResponses = responseBuilder.build(components, handlerMethod, operation, methodAttributes); operation.setResponses(apiResponses); // get javadoc method description if (javadocProvider != null) { - String description = javadocProvider.getMethodJavadocDescription(handlerMethod.getMethod()); - String summary = javadocProvider.getFirstSentence(description); - boolean emptyOverrideDescription = StringUtils.isEmpty(operation.getDescription()); - boolean emptyOverrideSummary = StringUtils.isEmpty(operation.getSummary()); + final String description = javadocProvider.getMethodJavadocDescription(handlerMethod.getMethod()); + final String summary = javadocProvider.getFirstSentence(description); + final boolean emptyOverrideDescription = StringUtils.isEmpty(operation.getDescription()); + final boolean emptyOverrideSummary = StringUtils.isEmpty(operation.getSummary()); if (!StringUtils.isEmpty(description) && emptyOverrideDescription) { operation.setDescription(description); } @@ -491,7 +487,7 @@ protected void calculatePath(HandlerMethod handlerMethod, } } - Set apiCallbacks = AnnotatedElementUtils.findMergedRepeatableAnnotations(method, io.swagger.v3.oas.annotations.callbacks.Callback.class); + final Set apiCallbacks = AnnotatedElementUtils.findMergedRepeatableAnnotations(method, Callback.class); // callbacks buildCallbacks(openAPI, methodAttributes, operation, apiCallbacks); @@ -499,7 +495,7 @@ protected void calculatePath(HandlerMethod handlerMethod, // allow for customisation operation = customizeOperation(operation, handlerMethod); - PathItem pathItemObject = buildPathItem(requestMethod, operation, operationPath, paths); + final PathItem pathItemObject = buildPathItem(requestMethod, operation, operationPath, paths); paths.addPathItem(operationPath, pathItemObject); } } @@ -513,9 +509,10 @@ protected void calculatePath(HandlerMethod handlerMethod, * @param apiCallbacks the api callbacks */ private void buildCallbacks(OpenAPI openAPI, MethodAttributes methodAttributes, Operation operation, Set apiCallbacks) { - if (!CollectionUtils.isEmpty(apiCallbacks)) + if (!CollectionUtils.isEmpty(apiCallbacks)) { operationParser.buildCallbacks(apiCallbacks, openAPI, methodAttributes) .ifPresent(operation::setCallbacks); + } } /** @@ -526,36 +523,40 @@ private void buildCallbacks(OpenAPI openAPI, MethodAttributes methodAttributes, * @param openAPI the open api */ protected void calculatePath(List routerOperationList, Locale locale, OpenAPI openAPI) { - ApplicationContext applicationContext = openAPIService.getContext(); + final ApplicationContext applicationContext = openAPIService.getContext(); if (!CollectionUtils.isEmpty(routerOperationList)) { Collections.sort(routerOperationList); for (RouterOperation routerOperation : routerOperationList) { if (routerOperation.getBeanClass() != null && !Void.class.equals(routerOperation.getBeanClass())) { - Object handlerBean = applicationContext.getBean(routerOperation.getBeanClass()); + final Object handlerBean = applicationContext.getBean(routerOperation.getBeanClass()); HandlerMethod handlerMethod = null; if (StringUtils.isNotBlank(routerOperation.getBeanMethod())) { try { if (ArrayUtils.isEmpty(routerOperation.getParameterTypes())) { - Method[] declaredMethods = AopUtils.getTargetClass(handlerBean).getDeclaredMethods(); + final Method[] declaredMethods = AopUtils.getTargetClass(handlerBean).getDeclaredMethods(); Optional methodOptional = Arrays.stream(declaredMethods) .filter(method -> routerOperation.getBeanMethod().equals(method.getName()) && method.getParameters().length == 0) .findAny(); - if (!methodOptional.isPresent()) + if (!methodOptional.isPresent()) { methodOptional = Arrays.stream(declaredMethods) .filter(method1 -> routerOperation.getBeanMethod().equals(method1.getName())) .findAny(); - if (methodOptional.isPresent()) + } + if (methodOptional.isPresent()) { handlerMethod = new HandlerMethod(handlerBean, methodOptional.get()); + } } - else + else { handlerMethod = new HandlerMethod(handlerBean, routerOperation.getBeanMethod(), routerOperation.getParameterTypes()); + } } catch (NoSuchMethodException e) { LOGGER.error(e.getMessage()); } - if (handlerMethod != null && isFilterCondition(handlerMethod, routerOperation.getPath(), routerOperation.getProduces(), routerOperation.getConsumes(), routerOperation.getHeaders())) + if (handlerMethod != null && isFilterCondition(handlerMethod, routerOperation.getPath(), routerOperation.getProduces(), routerOperation.getConsumes(), routerOperation.getHeaders())) { calculatePath(handlerMethod, routerOperation, locale, openAPI); + } } } else if (routerOperation.getOperation() != null && StringUtils.isNotBlank(routerOperation.getOperation().operationId()) && isFilterCondition(routerOperation.getPath(), routerOperation.getProduces(), routerOperation.getConsumes(), routerOperation.getHeaders())) { @@ -575,42 +576,46 @@ else if (routerOperation.getOperationModel() != null && StringUtils.isNotBlank(r * @param locale the locale */ protected void calculatePath(RouterOperation routerOperation, Locale locale, OpenAPI openAPI) { - String operationPath = routerOperation.getPath(); - io.swagger.v3.oas.annotations.Operation apiOperation = routerOperation.getOperation(); - String[] methodConsumes = routerOperation.getConsumes(); - String[] methodProduces = routerOperation.getProduces(); - String[] headers = routerOperation.getHeaders(); - Map queryParams = routerOperation.getQueryParams(); - - Paths paths = openAPI.getPaths(); + final String operationPath = routerOperation.getPath(); + final io.swagger.v3.oas.annotations.Operation apiOperation = routerOperation.getOperation(); + final String[] methodConsumes = routerOperation.getConsumes(); + final String[] methodProduces = routerOperation.getProduces(); + final String[] headers = routerOperation.getHeaders(); + final Map queryParams = routerOperation.getQueryParams(); + + final Paths paths = openAPI.getPaths(); Map operationMap = null; if (paths.containsKey(operationPath)) { - PathItem pathItem = paths.get(operationPath); + final PathItem pathItem = paths.get(operationPath); operationMap = pathItem.readOperationsMap(); } for (RequestMethod requestMethod : routerOperation.getMethods()) { - Operation existingOperation = getExistingOperation(operationMap, requestMethod); - MethodAttributes methodAttributes = new MethodAttributes(springDocConfigProperties.getDefaultConsumesMediaType(), springDocConfigProperties.getDefaultProducesMediaType(), methodConsumes, methodProduces, headers, locale); + final Operation existingOperation = getExistingOperation(operationMap, requestMethod); + final MethodAttributes methodAttributes = new MethodAttributes(springDocConfigProperties.getDefaultConsumesMediaType(), springDocConfigProperties.getDefaultProducesMediaType(), methodConsumes, methodProduces, headers, locale); methodAttributes.setMethodOverloaded(existingOperation != null); - Operation operation = getOperation(routerOperation, existingOperation); - if (apiOperation != null) + final Operation operation = getOperation(routerOperation, existingOperation); + if (apiOperation != null) { openAPI = operationParser.parse(apiOperation, operation, openAPI, methodAttributes); + } - String operationId = operationParser.getOperationId(operation.getOperationId(), openAPI); + final String operationId = operationParser.getOperationId(operation.getOperationId(), openAPI); operation.setOperationId(operationId); fillParametersList(operation, queryParams, methodAttributes); - if (!CollectionUtils.isEmpty(operation.getParameters())) + if (!CollectionUtils.isEmpty(operation.getParameters())) { operation.getParameters().stream() .filter(parameter -> StringUtils.isEmpty(parameter.get$ref())) .forEach(parameter -> { - if (parameter.getSchema() == null) + if (parameter.getSchema() == null) { parameter.setSchema(new StringSchema()); - if (parameter.getIn() == null) + } + if (parameter.getIn() == null) { parameter.setIn(ParameterIn.QUERY.toString()); + } } ); - PathItem pathItemObject = buildPathItem(requestMethod, operation, operationPath, paths); + } + final PathItem pathItemObject = buildPathItem(requestMethod, operation, operationPath, paths); paths.addPathItem(operationPath, pathItemObject); } } @@ -630,7 +635,7 @@ protected void calculatePath(RouterOperation routerOperation, Locale locale, Ope */ protected void calculatePath(HandlerMethod handlerMethod, String operationPath, Set requestMethods, String[] consumes, String[] produces, String[] headers, String[] params, Locale locale, OpenAPI openAPI) { - this.calculatePath(handlerMethod, + calculatePath(handlerMethod, new RouterOperation(operationPath, requestMethods.toArray(new RequestMethod[requestMethods.size()]), consumes, produces, headers, params), locale, openAPI); } @@ -645,27 +650,29 @@ protected void calculatePath(HandlerMethod handlerMethod, String operationPath, */ protected void getRouterFunctionPaths(String beanName, AbstractRouterFunctionVisitor routerFunctionVisitor, Locale locale, OpenAPI openAPI) { - boolean withRouterOperation = routerFunctionVisitor.getRouterFunctionDatas().stream() + final boolean withRouterOperation = routerFunctionVisitor.getRouterFunctionDatas().stream() .anyMatch(routerFunctionData -> routerFunctionData.getAttributes().containsKey(OPERATION_ATTRIBUTE)); if (withRouterOperation) { - List operationList = routerFunctionVisitor.getRouterFunctionDatas().stream().map(RouterOperation::new).collect(Collectors.toList()); + final List operationList = routerFunctionVisitor.getRouterFunctionDatas().stream().map(RouterOperation::new).collect(Collectors.toList()); calculatePath(operationList, locale, openAPI); } else { - List routerOperationList = new ArrayList<>(); - ApplicationContext applicationContext = openAPIService.getContext(); - RouterOperations routerOperations = applicationContext.findAnnotationOnBean(beanName, RouterOperations.class); + final List routerOperationList = new ArrayList<>(); + final ApplicationContext applicationContext = openAPIService.getContext(); + final RouterOperations routerOperations = applicationContext.findAnnotationOnBean(beanName, RouterOperations.class); if (routerOperations == null) { - org.springdoc.core.annotations.RouterOperation routerOperation = applicationContext.findAnnotationOnBean(beanName, org.springdoc.core.annotations.RouterOperation.class); - if (routerOperation != null) + final org.springdoc.core.annotations.RouterOperation routerOperation = applicationContext.findAnnotationOnBean(beanName, org.springdoc.core.annotations.RouterOperation.class); + if (routerOperation != null) { routerOperationList.add(routerOperation); + } } - else + else { routerOperationList.addAll(Arrays.asList(routerOperations.value())); - if (routerOperationList.size() == 1) + } + if (routerOperationList.size() == 1) { calculatePath(routerOperationList.stream().map(routerOperation -> new RouterOperation(routerOperation, routerFunctionVisitor.getRouterFunctionDatas().get(0))).collect(Collectors.toList()), locale, openAPI); - else { - List operationList = routerOperationList.stream().map(RouterOperation::new).collect(Collectors.toList()); + } else { + final List operationList = routerOperationList.stream().map(RouterOperation::new).collect(Collectors.toList()); mergeRouters(routerFunctionVisitor.getRouterFunctionDatas(), operationList); calculatePath(operationList, locale, openAPI); } @@ -695,7 +702,7 @@ && isPackageToScan(handlerMethod.getBeanType().getPackage()) * @return whether the method should be included in the current OpenAPI definition */ protected boolean isMethodToFilter(HandlerMethod handlerMethod) { - return this.methodFilters + return methodFilters .map(Collection::stream) .map(stream -> stream.allMatch(m -> m.isMethodToInclude(handlerMethod.getMethod()))) .orElse(true); @@ -711,9 +718,10 @@ protected boolean isMethodToFilter(HandlerMethod handlerMethod) { protected boolean isConditionToMatch(String[] existingConditions, ConditionType conditionType) { List conditionsToMatch = getConditionsToMatch(conditionType); if (CollectionUtils.isEmpty(conditionsToMatch)) { - Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> this.groupName.equals(groupConfig.getGroup())).findAny(); - if (optionalGroupConfig.isPresent()) + final Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> groupName.equals(groupConfig.getGroup())).findAny(); + if (optionalGroupConfig.isPresent()) { conditionsToMatch = getConditionsToMatch(conditionType, optionalGroupConfig.get()); + } } return CollectionUtils.isEmpty(conditionsToMatch) || (!ArrayUtils.isEmpty(existingConditions) && conditionsToMatch.size() == existingConditions.length && conditionsToMatch.containsAll(Arrays.asList(existingConditions))); @@ -726,27 +734,30 @@ protected boolean isConditionToMatch(String[] existingConditions, ConditionType * @return the boolean */ protected boolean isPackageToScan(Package aPackage) { - if (aPackage == null) + if (aPackage == null) { return true; + } final String packageName = aPackage.getName(); List packagesToScan = springDocConfigProperties.getPackagesToScan(); List packagesToExclude = springDocConfigProperties.getPackagesToExclude(); if (CollectionUtils.isEmpty(packagesToScan)) { - Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> this.groupName.equals(groupConfig.getGroup())).findAny(); - if (optionalGroupConfig.isPresent()) + final Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> groupName.equals(groupConfig.getGroup())).findAny(); + if (optionalGroupConfig.isPresent()) { packagesToScan = optionalGroupConfig.get().getPackagesToScan(); + } } if (CollectionUtils.isEmpty(packagesToExclude)) { - Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> this.groupName.equals(groupConfig.getGroup())).findAny(); - if (optionalGroupConfig.isPresent()) + final Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> groupName.equals(groupConfig.getGroup())).findAny(); + if (optionalGroupConfig.isPresent()) { packagesToExclude = optionalGroupConfig.get().getPackagesToExclude(); + } } - boolean include = CollectionUtils.isEmpty(packagesToScan) + final boolean include = CollectionUtils.isEmpty(packagesToScan) || packagesToScan.stream().anyMatch(pack -> packageName.equals(pack) || packageName.startsWith(pack + DOT)); - boolean exclude = !CollectionUtils.isEmpty(packagesToExclude) - && (packagesToExclude.stream().anyMatch(pack -> packageName.equals(pack) - || packageName.startsWith(pack + DOT))); + final boolean exclude = !CollectionUtils.isEmpty(packagesToExclude) + && packagesToExclude.stream().anyMatch(pack -> packageName.equals(pack) + || packageName.startsWith(pack + DOT)); return include && !exclude; } @@ -761,17 +772,19 @@ protected boolean isPathToMatch(String operationPath) { List pathsToMatch = springDocConfigProperties.getPathsToMatch(); List pathsToExclude = springDocConfigProperties.getPathsToExclude(); if (CollectionUtils.isEmpty(pathsToMatch)) { - Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> this.groupName.equals(groupConfig.getGroup())).findAny(); - if (optionalGroupConfig.isPresent()) + final Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> groupName.equals(groupConfig.getGroup())).findAny(); + if (optionalGroupConfig.isPresent()) { pathsToMatch = optionalGroupConfig.get().getPathsToMatch(); + } } if (CollectionUtils.isEmpty(pathsToExclude)) { - Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> this.groupName.equals(groupConfig.getGroup())).findAny(); - if (optionalGroupConfig.isPresent()) + final Optional optionalGroupConfig = springDocConfigProperties.getGroupConfigs().stream().filter(groupConfig -> groupName.equals(groupConfig.getGroup())).findAny(); + if (optionalGroupConfig.isPresent()) { pathsToExclude = optionalGroupConfig.get().getPathsToExclude(); + } } - boolean include = CollectionUtils.isEmpty(pathsToMatch) || pathsToMatch.stream().anyMatch(pattern -> antPathMatcher.match(pattern, operationPath)); - boolean exclude = !CollectionUtils.isEmpty(pathsToExclude) && pathsToExclude.stream().anyMatch(pattern -> antPathMatcher.match(pattern, operationPath)); + final boolean include = CollectionUtils.isEmpty(pathsToMatch) || pathsToMatch.stream().anyMatch(pattern -> antPathMatcher.match(pattern, operationPath)); + final boolean exclude = !CollectionUtils.isEmpty(pathsToExclude) && pathsToExclude.stream().anyMatch(pattern -> antPathMatcher.match(pattern, operationPath)); return include && !exclude; } @@ -808,8 +821,9 @@ protected boolean isAdditionalRestController(Class rawClass) { */ public static boolean containsResponseBody(HandlerMethod handlerMethod) { ResponseBody responseBodyAnnotation = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), ResponseBody.class); - if (responseBodyAnnotation == null) + if (responseBodyAnnotation == null) { responseBodyAnnotation = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), ResponseBody.class); + } return responseBodyAnnotation != null; } @@ -823,7 +837,7 @@ public static boolean containsResponseBody(HandlerMethod handlerMethod) { */ protected boolean isRestController(Map restControllers, HandlerMethod handlerMethod, String operationPath) { - boolean hasOperationAnnotation = AnnotatedElementUtils.hasAnnotation(handlerMethod.getMethod(), io.swagger.v3.oas.annotations.Operation.class); + final boolean hasOperationAnnotation = AnnotatedElementUtils.hasAnnotation(handlerMethod.getMethod(), io.swagger.v3.oas.annotations.Operation.class); return ((containsResponseBody(handlerMethod) || hasOperationAnnotation) && restControllers.containsKey(handlerMethod.getBean().toString()) || isAdditionalRestController(handlerMethod.getBeanType())) && operationPath.startsWith(DEFAULT_PATH_SEPARATOR) @@ -846,7 +860,7 @@ public static boolean isHiddenRestControllers(Class rawClass) { * @return the default allowed http methods */ protected Set getDefaultAllowedHttpMethods() { - RequestMethod[] allowedRequestMethods = { RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, RequestMethod.PATCH, RequestMethod.DELETE, RequestMethod.OPTIONS, RequestMethod.HEAD }; + final RequestMethod[] allowedRequestMethods = { RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, RequestMethod.PATCH, RequestMethod.DELETE, RequestMethod.OPTIONS, RequestMethod.HEAD }; return new HashSet<>(Arrays.asList(allowedRequestMethods)); } @@ -860,9 +874,10 @@ protected Set getDefaultAllowedHttpMethods() { */ protected Operation customizeOperation(Operation operation, HandlerMethod handlerMethod) { if (operationCustomizers.isPresent()) { - List operationCustomizerList = operationCustomizers.get(); - for (OperationCustomizer operationCustomizer : operationCustomizerList) + final List operationCustomizerList = operationCustomizers.get(); + for (OperationCustomizer operationCustomizer : operationCustomizerList) { operation = operationCustomizer.customize(operation, handlerMethod); + } } return operation; } @@ -875,7 +890,7 @@ protected Operation customizeOperation(Operation operation, HandlerMethod handle */ protected RouterOperation customizeRouterOperation(RouterOperation routerOperation, HandlerMethod handlerMethod) { if (routerOperationCustomizers.isPresent()) { - List routerOperationCustomizerList = routerOperationCustomizers.get(); + final List routerOperationCustomizerList = routerOperationCustomizers.get(); for (RouterOperationCustomizer routerOperationCustomizer : routerOperationCustomizerList) { routerOperation = routerOperationCustomizer.customize(routerOperation, handlerMethod); } @@ -896,26 +911,26 @@ protected void mergeRouters(List routerFunctionDatas, List routerFunctionDataList = routerFunctionDatas.stream() .filter(routerFunctionData1 -> routerFunctionData1.getPath().equals(routerOperation.getPath())) .collect(Collectors.toList()); - if (routerFunctionDataList.size() == 1) + if (routerFunctionDataList.size() == 1) { fillRouterOperation(routerFunctionDataList.get(0), routerOperation); - else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getMethods())) { + } else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getMethods())) { // PATH + METHOD routerFunctionDataList = routerFunctionDatas.stream() .filter(routerFunctionData1 -> routerFunctionData1.getPath().equals(routerOperation.getPath()) && isEqualMethods(routerOperation.getMethods(), routerFunctionData1.getMethods())) .collect(Collectors.toList()); - if (routerFunctionDataList.size() == 1) + if (routerFunctionDataList.size() == 1) { fillRouterOperation(routerFunctionDataList.get(0), routerOperation); - else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getProduces())) { + } else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getProduces())) { // PATH + METHOD + PRODUCES routerFunctionDataList = routerFunctionDatas.stream() .filter(routerFunctionData1 -> routerFunctionData1.getPath().equals(routerOperation.getPath()) && isEqualMethods(routerOperation.getMethods(), routerFunctionData1.getMethods()) && isEqualArrays(routerFunctionData1.getProduces(), routerOperation.getProduces())) .collect(Collectors.toList()); - if (routerFunctionDataList.size() == 1) + if (routerFunctionDataList.size() == 1) { fillRouterOperation(routerFunctionDataList.get(0), routerOperation); - else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getConsumes())) { + } else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getConsumes())) { // PATH + METHOD + PRODUCES + CONSUMES routerFunctionDataList = routerFunctionDatas.stream() .filter(routerFunctionData1 -> routerFunctionData1.getPath().equals(routerOperation.getPath()) @@ -923,8 +938,9 @@ && isEqualMethods(routerOperation.getMethods(), routerFunctionData1.getMethods() && isEqualArrays(routerFunctionData1.getProduces(), routerOperation.getProduces()) && isEqualArrays(routerFunctionData1.getConsumes(), routerOperation.getConsumes())) .collect(Collectors.toList()); - if (routerFunctionDataList.size() == 1) + if (routerFunctionDataList.size() == 1) { fillRouterOperation(routerFunctionDataList.get(0), routerOperation); + } } } else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getConsumes())) { @@ -934,8 +950,9 @@ else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperat && isEqualMethods(routerOperation.getMethods(), routerFunctionData1.getMethods()) && isEqualArrays(routerFunctionData1.getConsumes(), routerOperation.getConsumes())) .collect(Collectors.toList()); - if (routerFunctionDataList.size() == 1) + if (routerFunctionDataList.size() == 1) { fillRouterOperation(routerFunctionDataList.get(0), routerOperation); + } } } else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getProduces())) { @@ -944,9 +961,9 @@ else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperat .filter(routerFunctionData1 -> routerFunctionData1.getPath().equals(routerOperation.getPath()) && isEqualArrays(routerFunctionData1.getProduces(), routerOperation.getProduces())) .collect(Collectors.toList()); - if (routerFunctionDataList.size() == 1) + if (routerFunctionDataList.size() == 1) { fillRouterOperation(routerFunctionDataList.get(0), routerOperation); - else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getConsumes())) { + } else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getConsumes())) { // PATH + PRODUCES + CONSUMES routerFunctionDataList = routerFunctionDatas.stream() .filter(routerFunctionData1 -> routerFunctionData1.getPath().equals(routerOperation.getPath()) @@ -954,8 +971,9 @@ && isEqualMethods(routerOperation.getMethods(), routerFunctionData1.getMethods() && isEqualArrays(routerFunctionData1.getConsumes(), routerOperation.getConsumes()) && isEqualArrays(routerFunctionData1.getProduces(), routerOperation.getProduces())) .collect(Collectors.toList()); - if (routerFunctionDataList.size() == 1) + if (routerFunctionDataList.size() == 1) { fillRouterOperation(routerFunctionDataList.get(0), routerOperation); + } } } else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperation.getConsumes())) { @@ -964,8 +982,9 @@ else if (routerFunctionDataList.size() > 1 && ArrayUtils.isNotEmpty(routerOperat .filter(routerFunctionData1 -> routerFunctionData1.getPath().equals(routerOperation.getPath()) && isEqualArrays(routerFunctionData1.getConsumes(), routerOperation.getConsumes())) .collect(Collectors.toList()); - if (routerFunctionDataList.size() == 1) + if (routerFunctionDataList.size() == 1) { fillRouterOperation(routerFunctionDataList.get(0), routerOperation); + } } } } @@ -980,8 +999,8 @@ && isEqualArrays(routerFunctionData1.getConsumes(), routerOperation.getConsumes( */ private void calculateJsonView(io.swagger.v3.oas.annotations.Operation apiOperation, MethodAttributes methodAttributes, Method method) { - JsonView jsonViewAnnotation; - JsonView jsonViewAnnotationForRequestBody; + final JsonView jsonViewAnnotation; + final JsonView jsonViewAnnotationForRequestBody; if (apiOperation != null && apiOperation.ignoreJsonView()) { jsonViewAnnotation = null; jsonViewAnnotationForRequestBody = null; @@ -995,8 +1014,8 @@ private void calculateJsonView(io.swagger.v3.oas.annotations.Operation apiOperat */ jsonViewAnnotationForRequestBody = (JsonView) Arrays.stream(ReflectionUtils.getParameterAnnotations(method)) .filter(arr -> Arrays.stream(arr) - .anyMatch(annotation -> (annotation.annotationType() - .equals(io.swagger.v3.oas.annotations.parameters.RequestBody.class) || annotation.annotationType().equals(RequestBody.class)))) + .anyMatch(annotation -> annotation.annotationType() + .equals(io.swagger.v3.oas.annotations.parameters.RequestBody.class) || annotation.annotationType().equals(RequestBody.class))) .flatMap(Arrays::stream).filter(annotation -> annotation.annotationType().equals(JsonView.class)) .reduce((a, b) -> null).orElse(jsonViewAnnotation); } @@ -1039,13 +1058,14 @@ private boolean isEqualMethods(RequestMethod[] requestMethods1, RequestMethod[] */ private void fillParametersList(Operation operation, Map queryParams, MethodAttributes methodAttributes) { List parametersList = operation.getParameters(); - if (parametersList == null) + if (parametersList == null) { parametersList = new ArrayList<>(); - Collection headersMap = AbstractRequestService.getHeaders(methodAttributes, new LinkedHashMap<>()); + } + final Collection headersMap = AbstractRequestService.getHeaders(methodAttributes, new LinkedHashMap<>()); parametersList.addAll(headersMap); if (!CollectionUtils.isEmpty(queryParams)) { for (Map.Entry entry : queryParams.entrySet()) { - io.swagger.v3.oas.models.parameters.Parameter parameter = new io.swagger.v3.oas.models.parameters.Parameter(); + final Parameter parameter = new Parameter(); parameter.setName(entry.getKey()); parameter.setSchema(new StringSchema()._default(entry.getValue())); parameter.setRequired(true); @@ -1063,16 +1083,21 @@ private void fillParametersList(Operation operation, Map queryPa * @param routerOperation the router operation */ private void fillRouterOperation(RouterFunctionData routerFunctionData, RouterOperation routerOperation) { - if (ArrayUtils.isEmpty(routerOperation.getConsumes())) + if (ArrayUtils.isEmpty(routerOperation.getConsumes())) { routerOperation.setConsumes(routerFunctionData.getConsumes()); - if (ArrayUtils.isEmpty(routerOperation.getProduces())) + } + if (ArrayUtils.isEmpty(routerOperation.getProduces())) { routerOperation.setProduces(routerFunctionData.getProduces()); - if (ArrayUtils.isEmpty(routerOperation.getHeaders())) + } + if (ArrayUtils.isEmpty(routerOperation.getHeaders())) { routerOperation.setHeaders(routerFunctionData.getHeaders()); - if (ArrayUtils.isEmpty(routerOperation.getMethods())) + } + if (ArrayUtils.isEmpty(routerOperation.getMethods())) { routerOperation.setMethods(routerFunctionData.getMethods()); - if (CollectionUtils.isEmpty(routerOperation.getQueryParams())) + } + if (CollectionUtils.isEmpty(routerOperation.getQueryParams())) { routerOperation.setQueryParams(routerFunctionData.getQueryParams()); + } } /** @@ -1086,11 +1111,12 @@ private void fillRouterOperation(RouterFunctionData routerFunctionData, RouterOp */ private PathItem buildPathItem(RequestMethod requestMethod, Operation operation, String operationPath, Paths paths) { - PathItem pathItemObject; - if (paths.containsKey(operationPath)) + final PathItem pathItemObject; + if (paths.containsKey(operationPath)) { pathItemObject = paths.get(operationPath); - else + } else { pathItemObject = new PathItem(); + } switch (requestMethod) { case POST: @@ -1173,8 +1199,8 @@ private Operation getExistingOperation(Map operationMap, * @return the operation */ private Operation getOperation(RouterOperation routerOperation, Operation existingOperation) { - Operation operationModel = routerOperation.getOperationModel(); - Operation operation; + final Operation operationModel = routerOperation.getOperationModel(); + final Operation operation; if (existingOperation != null && operationModel == null) { operation = existingOperation; } @@ -1209,16 +1235,18 @@ protected void initOpenAPIBuilder(Locale locale) { * @throws JsonProcessingException the json processing exception */ protected String writeYamlValue(OpenAPI openAPI) throws JsonProcessingException { - String result; - ObjectMapper objectMapper = springDocProviders.yamlMapper(); - if (springDocConfigProperties.isWriterWithOrderByKeys()) + final String result; + final ObjectMapper objectMapper = springDocProviders.yamlMapper(); + if (springDocConfigProperties.isWriterWithOrderByKeys()) { ObjectMapperProvider.sortOutput(objectMapper, springDocConfigProperties); - YAMLFactory factory = (YAMLFactory) objectMapper.getFactory(); + } + final YAMLFactory factory = (YAMLFactory) objectMapper.getFactory(); factory.configure(Feature.USE_NATIVE_TYPE_ID, false); - if (!springDocConfigProperties.isWriterWithDefaultPrettyPrinter()) + if (!springDocConfigProperties.isWriterWithDefaultPrettyPrinter()) { result = objectMapper.writerFor(OpenAPI.class).writeValueAsString(openAPI); - else + } else { result = objectMapper.writerWithDefaultPrettyPrinter().forType(OpenAPI.class).writeValueAsString(openAPI); + } return result; } @@ -1233,19 +1261,20 @@ protected URI getActuatorURI(String scheme, String host) { final Optional actuatorProviderOptional = springDocProviders.getActuatorProvider(); URI uri = null; if (actuatorProviderOptional.isPresent()) { - ActuatorProvider actuatorProvider = actuatorProviderOptional.get(); - int port; + final ActuatorProvider actuatorProvider = actuatorProviderOptional.get(); + final int port; String path; - if (ACTUATOR_DEFAULT_GROUP.equals(this.groupName)) { + if (ACTUATOR_DEFAULT_GROUP.equals(groupName)) { port = actuatorProvider.getActuatorPort(); path = actuatorProvider.getActuatorPath(); } else { port = actuatorProvider.getApplicationPort(); path = actuatorProvider.getContextPath(); - String mvcServletPath = this.openAPIService.getContext().getBean(Environment.class).getProperty(SPRING_MVC_SERVLET_PATH); - if (StringUtils.isNotEmpty(mvcServletPath)) - path = path + mvcServletPath; + final String mvcServletPath = openAPIService.getContext().getBean(Environment.class).getProperty(SPRING_MVC_SERVLET_PATH); + if (StringUtils.isNotEmpty(mvcServletPath)) { + path += mvcServletPath; + } } try { uri = new URI(StringUtils.defaultIfEmpty(scheme, "http"), null, StringUtils.defaultIfEmpty(host, "localhost"), port, path, null, null); @@ -1265,10 +1294,11 @@ protected URI getActuatorURI(String scheme, String host) { * @return the boolean */ protected boolean isActuatorRestController(String operationPath, HandlerMethod handlerMethod) { - Optional actuatorProviderOptional = springDocProviders.getActuatorProvider(); + final Optional actuatorProviderOptional = springDocProviders.getActuatorProvider(); boolean isActuatorRestController = false; - if (actuatorProviderOptional.isPresent()) + if (actuatorProviderOptional.isPresent()) { isActuatorRestController = actuatorProviderOptional.get().isRestController(operationPath, handlerMethod); + return springDocConfigProperties.isShowActuator() && isActuatorRestController && (modelAndViewClass == null || !modelAndViewClass.isAssignableFrom(handlerMethod.getMethod().getReturnType())); } @@ -1280,14 +1310,16 @@ protected boolean isActuatorRestController(String operationPath, HandlerMethod h * @throws JsonProcessingException the json processing exception */ protected String writeJsonValue(OpenAPI openAPI) throws JsonProcessingException { - String result; - ObjectMapper objectMapper = springDocProviders.jsonMapper(); - if (springDocConfigProperties.isWriterWithOrderByKeys()) + final String result; + final ObjectMapper objectMapper = springDocProviders.jsonMapper(); + if (springDocConfigProperties.isWriterWithOrderByKeys()) { ObjectMapperProvider.sortOutput(objectMapper, springDocConfigProperties); - if (!springDocConfigProperties.isWriterWithDefaultPrettyPrinter()) + } + if (!springDocConfigProperties.isWriterWithDefaultPrettyPrinter()) { result = objectMapper.writerFor(OpenAPI.class).writeValueAsString(openAPI); - else + } else { result = objectMapper.writerWithDefaultPrettyPrinter().forType(OpenAPI.class).writeValueAsString(openAPI); + } return result; } @@ -1301,8 +1333,9 @@ protected String writeJsonValue(OpenAPI openAPI) throws JsonProcessingException private List getConditionsToMatch(ConditionType conditionType, GroupConfig... groupConfigs) { List conditionsToMatch = null; GroupConfig groupConfig = null; - if (ArrayUtils.isNotEmpty(groupConfigs)) + if (ArrayUtils.isNotEmpty(groupConfigs)) { groupConfig = groupConfigs[0]; + } switch (conditionType) { case HEADERS: conditionsToMatch = (groupConfig != null) ? groupConfig.getHeadersToMatch() : springDocConfigProperties.getHeadersToMatch(); diff --git a/springdoc-openapi-common/src/test/java/org/springdoc/api/AbstractOpenApiResourceTest.java b/springdoc-openapi-common/src/test/java/org/springdoc/api/AbstractOpenApiResourceTest.java index 88409bbca..287e130a0 100644 --- a/springdoc-openapi-common/src/test/java/org/springdoc/api/AbstractOpenApiResourceTest.java +++ b/springdoc-openapi-common/src/test/java/org/springdoc/api/AbstractOpenApiResourceTest.java @@ -29,7 +29,6 @@ import java.util.Map; import java.util.Optional; -import io.swagger.v3.core.util.Json; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; @@ -124,7 +123,6 @@ public void setUp() { when(openAPIService.build(any())).thenReturn(openAPI); when(openAPIBuilderObjectFactory.getObject()).thenReturn(openAPIService); - when(springDocProviders.jsonMapper()).thenReturn(Json.mapper()); } @Test diff --git a/springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app138.json b/springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app138.json index b5c657b22..7b757b5eb 100644 --- a/springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app138.json +++ b/springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app138.json @@ -1 +1 @@ -{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"http://localhost","description":"Generated server url"}],"paths":{"/testA":{"get":{"operationId":"testA","parameters":[{"in":"query","name":"hello","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"tags":["hello-controller"]}},"/testB":{"get":{"operationId":"testB","parameters":[{"in":"query","name":"hello","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"tags":["hello-controller"]}}},"components":{},"x-my-vendor-extensions":{"property1":"value1","property2":null}} \ No newline at end of file +{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"description":"Generated server url","url":"http://localhost"}],"paths":{"/testA":{"get":{"operationId":"testA","parameters":[{"in":"query","name":"hello","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"tags":["hello-controller"]}},"/testB":{"get":{"operationId":"testB","parameters":[{"in":"query","name":"hello","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"tags":["hello-controller"]}}},"components":{},"x-my-vendor-extensions":{"property1":"value1","property2":null}} \ No newline at end of file