diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericResponseService.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericResponseService.java index 3ec5ff6d5..c54898caf 100644 --- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericResponseService.java +++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericResponseService.java @@ -772,7 +772,7 @@ private boolean isValidHttpCode(String httpCode, MethodParameter methodParameter if (isHttpCodePresent(httpCode, responseSet)) result = true; } - else if (httpCode.equals(evaluateResponseStatus(method, method.getClass(), false))) + if (httpCode.equals(evaluateResponseStatus(method, method.getClass(), false))) result = true; } } diff --git a/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app216/HelloController.java b/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app216/HelloController.java new file mode 100644 index 000000000..e3ea9f4c3 --- /dev/null +++ b/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app216/HelloController.java @@ -0,0 +1,47 @@ +/* + * + * * + * * * + * * * * Copyright 2019-2022 the original author or authors. + * * * * + * * * * Licensed under the Apache License, Version 2.0 (the "License"); + * * * * you may not use this file except in compliance with the License. + * * * * You may obtain a copy of the License at + * * * * + * * * * https://www.apache.org/licenses/LICENSE-2.0 + * * * * + * * * * Unless required by applicable law or agreed to in writing, software + * * * * distributed under the License is distributed on an "AS IS" BASIS, + * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * * * See the License for the specific language governing permissions and + * * * * limitations under the License. + * * * + * * + * + */ + +package test.org.springdoc.api.v30.app216; + + + +import io.swagger.v3.oas.annotations.Operation; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + + +@RestController +public class HelloController { + + @Operation(description = "a") + @GetMapping(path = "/", produces = "a/a") + public String a() { + return "A"; + } + + @Operation(description = "b") + @GetMapping(path = "/", produces = "b/b") + public String b() { + return "B"; + } +} \ No newline at end of file diff --git a/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app216/SpringDocApp216Test.java b/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app216/SpringDocApp216Test.java new file mode 100644 index 000000000..fa3321080 --- /dev/null +++ b/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app216/SpringDocApp216Test.java @@ -0,0 +1,38 @@ +/* + * + * * Copyright 2019-2023 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package test.org.springdoc.api.v30.app216; + +import org.springdoc.core.customizers.SpecPropertiesCustomizer; +import test.org.springdoc.api.v30.AbstractSpringDocV30Test; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +/** + *

+ * A test for {@link SpecPropertiesCustomizer} + */ +@SpringBootTest +public class SpringDocApp216Test extends AbstractSpringDocV30Test { + + @SpringBootApplication + static class SpringDocTestApp {} + +} \ No newline at end of file diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app216.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app216.json new file mode 100644 index 000000000..27d4c5e0c --- /dev/null +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app216.json @@ -0,0 +1,42 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "OpenAPI definition", + "version": "v0" + }, + "servers": [ + { + "url": "http://localhost", + "description": "Generated server url" + } + ], + "paths": { + "/": { + "get": { + "tags": [ + "hello-controller" + ], + "description": "a", + "operationId": "b_1", + "responses": { + "200": { + "description": "OK", + "content": { + "b/b": { + "schema": { + "type": "string" + } + }, + "a/a": { + "schema": { + "type": "string" + } + } + } + } + } + } + } + }, + "components": {} +}