Skip to content

Commit ee5ab03

Browse files
committed
Restentpoints with same name get mix up. Fixes #2876
2 parents 0775180 + 54ea28e commit ee5ab03

File tree

8 files changed

+137
-39
lines changed

8 files changed

+137
-39
lines changed

Diff for: springdoc-openapi-starter-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,7 @@ protected void calculatePath(HandlerMethod handlerMethod, RouterOperation router
661661
}
662662

663663
PathItem pathItemObject = buildPathItem(requestMethod, operation, operationPath, paths);
664-
if (!StringUtils.contains(operationPath, "**"))
665-
paths.addPathItem(operationPath, pathItemObject);
664+
paths.addPathItem(operationPath, pathItemObject);
666665
}
667666
}
668667

Diff for: springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocHints.java

+3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public class SpringDocHints implements RuntimeHintsRegistrar {
113113
io.swagger.v3.oas.models.media.Schema.class,
114114
io.swagger.v3.oas.models.media.Content.class,
115115
io.swagger.v3.oas.models.media.ArraySchema.class,
116+
io.swagger.v3.oas.models.media.JsonSchema.class,
116117
io.swagger.v3.oas.models.responses.ApiResponse.class,
117118
io.swagger.v3.oas.models.responses.ApiResponses.class,
118119
io.swagger.v3.oas.models.ExternalDocumentation.class,
@@ -122,6 +123,7 @@ public class SpringDocHints implements RuntimeHintsRegistrar {
122123
io.swagger.v3.oas.models.Operation.class,
123124
io.swagger.v3.oas.models.headers.Header.class,
124125
ModelConverter.class,
126+
io.swagger.v3.core.converter.ModelConverterContextImpl.class,
125127
ModelConverters.class,
126128
SpecFilter.class,
127129
MediaType.class,
@@ -166,6 +168,7 @@ public class SpringDocHints implements RuntimeHintsRegistrar {
166168
MediaTypeMixin.class,
167169
//oas 3.1
168170
Schema31Mixin.class,
171+
Schema31Mixin.TypeSerializer.class,
169172
Components31Mixin.class,
170173
OpenAPI31Mixin.class,
171174
Discriminator31Mixin.class,

Diff for: springdoc-openapi-starter-webmvc-api/src/main/java/org/springdoc/webmvc/api/OpenApiResource.java

+5
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ protected void getPaths(Map<String, Object> restControllers, Locale locale, Open
167167
Optional<ActuatorProvider> actuatorProviderOptional = springDocProviders.getActuatorProvider();
168168
if (actuatorProviderOptional.isPresent() && springDocConfigProperties.isShowActuator()) {
169169
Map<RequestMappingInfo, HandlerMethod> actuatorMap = actuatorProviderOptional.get().getMethods();
170+
List<RequestMappingInfo> globMatchActuators = actuatorMap.keySet().stream()
171+
.filter(requestMappingInfo -> requestMappingInfo.getPatternValues().stream()
172+
.anyMatch(patternValues -> patternValues.contains("**")))
173+
.toList();
174+
globMatchActuators.forEach(actuatorMap::remove);
170175
this.openAPIService.addTag(new HashSet<>(actuatorMap.values()), getTag());
171176
map.putAll(actuatorMap);
172177
}

Diff for: springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v31/app240/OpenApiConfig.java

-33
This file was deleted.

Diff for: springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v31/app240/DemoRestController.java renamed to springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v31/app241/DemoRestController.java

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
1-
package test.org.springdoc.api.v31.app240;
1+
/*
2+
*
3+
* *
4+
* * *
5+
* * * *
6+
* * * * *
7+
* * * * * * Copyright 2019-2025 the original author or authors.
8+
* * * * * *
9+
* * * * * * Licensed under the Apache License, Version 2.0 (the "License");
10+
* * * * * * you may not use this file except in compliance with the License.
11+
* * * * * * You may obtain a copy of the License at
12+
* * * * * *
13+
* * * * * * https://www.apache.org/licenses/LICENSE-2.0
14+
* * * * * *
15+
* * * * * * Unless required by applicable law or agreed to in writing, software
16+
* * * * * * distributed under the License is distributed on an "AS IS" BASIS,
17+
* * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* * * * * * See the License for the specific language governing permissions and
19+
* * * * * * limitations under the License.
20+
* * * * *
21+
* * * *
22+
* * *
23+
* *
24+
*
25+
*/
26+
27+
package test.org.springdoc.api.v31.app241;
228

329
import java.util.HashSet;
430
import java.util.Optional;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
*
3+
* *
4+
* * *
5+
* * * *
6+
* * * * *
7+
* * * * * * Copyright 2019-2025 the original author or authors.
8+
* * * * * *
9+
* * * * * * Licensed under the Apache License, Version 2.0 (the "License");
10+
* * * * * * you may not use this file except in compliance with the License.
11+
* * * * * * You may obtain a copy of the License at
12+
* * * * * *
13+
* * * * * * https://www.apache.org/licenses/LICENSE-2.0
14+
* * * * * *
15+
* * * * * * Unless required by applicable law or agreed to in writing, software
16+
* * * * * * distributed under the License is distributed on an "AS IS" BASIS,
17+
* * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* * * * * * See the License for the specific language governing permissions and
19+
* * * * * * limitations under the License.
20+
* * * * *
21+
* * * *
22+
* * *
23+
* *
24+
*
25+
*/
26+
27+
package test.org.springdoc.api.v31.app241;
28+
29+
import org.springdoc.core.customizers.OpenApiCustomizer;
30+
import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
31+
32+
import org.springframework.context.annotation.Bean;
33+
import org.springframework.context.annotation.Configuration;
34+
import org.springframework.http.HttpRequest;
35+
36+
@Configuration
37+
public class OpenApiConfig {
38+
39+
@Bean
40+
public OpenApiCustomizer openApiCustomiser() {
41+
return openApi -> {
42+
43+
};
44+
}
45+
46+
@Bean
47+
ServerBaseUrlCustomizer serverBaseUrlCustomizer() {
48+
return new ServerBaseUrlCustomizer() {
49+
50+
@Override
51+
public String customize(final String serverBaseUrl,
52+
final HttpRequest request) {
53+
// TODO Auto-generated method stub
54+
return null;
55+
}
56+
57+
};
58+
}
59+
}

Diff for: springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v31/app240/SpringDocApp240Test.java renamed to springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v31/app241/SpringDocApp241Test.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
*
2525
*/
2626

27-
package test.org.springdoc.api.v31.app240;
27+
package test.org.springdoc.api.v31.app241;
2828

2929
import test.org.springdoc.api.v31.AbstractSpringDocTest;
3030

3131
import org.springframework.boot.autoconfigure.SpringBootApplication;
3232
import org.springframework.test.context.TestPropertySource;
3333

3434
@TestPropertySource(properties = "springdoc.api-docs.resolve-schema-properties=true" )
35-
public class SpringDocApp240Test extends AbstractSpringDocTest {
35+
public class SpringDocApp241Test extends AbstractSpringDocTest {
3636

3737
@SpringBootApplication
3838
static class SpringDocTestApp {}
39-
}
39+
}

Diff for: springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app240.json renamed to springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app241.json

+39
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
<<<<<<< HEAD
23
"openapi": "3.1.0",
34
"info": {
45
"title": "OpenAPI definition",
@@ -149,3 +150,41 @@
149150
},
150151
"components": {}
151152
}
153+
=======
154+
"openapi": "3.1.0",
155+
"info": {
156+
"title": "OpenAPI definition",
157+
"version": "v0"
158+
},
159+
"servers": [
160+
{
161+
"url": "http://localhost",
162+
"description": "Generated server url"
163+
}
164+
],
165+
"paths": {
166+
"/**": {
167+
"post": {
168+
"tags": [
169+
"wildcard-controller"
170+
],
171+
"summary": "My Wildcard Operation",
172+
"operationId": "getItem",
173+
"responses": {
174+
"200": {
175+
"description": "OK",
176+
"content": {
177+
"*/*": {
178+
"schema": {
179+
"type": "string"
180+
}
181+
}
182+
}
183+
}
184+
}
185+
}
186+
}
187+
},
188+
"components": {}
189+
}
190+
>>>>>>> origin/main

0 commit comments

Comments
 (0)