Skip to content

Commit 89c1fd0

Browse files
committed
WebFlux functional DSL does not recognise query parameters. Fixes #971
1 parent 93760bb commit 89c1fd0

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/core/AbstractRequestService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public Parameter buildParams(ParameterInfo parameterInfo, Components components,
420420
// By default
421421
DelegatingMethodParameter delegatingMethodParameter = (DelegatingMethodParameter) methodParameter;
422422
if (RequestMethod.GET.equals(requestMethod)
423-
|| (parameterInfo.getParameterModel() != null && (ParameterIn.PATH.toString().equals(parameterInfo.getParameterModel().getIn())))
423+
|| (parameterInfo.getParameterModel() != null && parameterInfo.getParameterModel().getIn() !=null)
424424
|| delegatingMethodParameter.isParameterObject()){
425425
parameterInfo.setRequired(!methodParameter.isOptional());
426426
parameterInfo.setParamType(QUERY_PARAM);

springdoc-openapi-webflux-core/src/test/java/test/org/springdoc/api/app82/RoutingConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public RouterFunction<ServerResponse> monoRouterFunction(UserHandler userHandler
2929
.and(route(POST("/api/user/post").and(accept(APPLICATION_JSON)), userHandler::postUser)
3030
.withAttribute(OPERATION_ATTRIBUTE, operationBuilder().beanClass(UserRepository.class).beanMethod("saveUser")))
3131

32-
.and(route(PUT("/api/user/put/{id}").and(accept(APPLICATION_JSON)), userHandler::putUser)
32+
.and(route(PUT("/api/user/put").and(accept(APPLICATION_JSON)), userHandler::putUser)
3333
.withAttribute(OPERATION_ATTRIBUTE, operationBuilder().beanClass(UserRepository.class).beanMethod("putUser")))
3434

3535
.and(route(DELETE("/api/user/delete/{id}").and(accept(APPLICATION_JSON)), userHandler::deleteUser)

springdoc-openapi-webflux-core/src/test/java/test/org/springdoc/api/app82/UserRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public interface UserRepository {
1818

1919
public Mono<Void> saveUser(Mono<User> user);
2020

21-
public Mono<User> putUser(@Parameter(in = ParameterIn.PATH) Long id, Mono<User> user);
21+
public Mono<User> putUser(@Parameter(in = ParameterIn.QUERY) Long id, Mono<User> user);
2222

2323
public Mono<String> deleteUser(@Parameter(in = ParameterIn.PATH) Long id);
2424
}

springdoc-openapi-webflux-core/src/test/resources/results/app82.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,55 +11,54 @@
1111
}
1212
],
1313
"paths": {
14-
"/api/user/index": {
15-
"get": {
14+
"/api/user/delete/{id}": {
15+
"delete": {
1616
"tags": [
1717
"user-repository-impl"
1818
],
19-
"description": "get all the users",
20-
"operationId": "getAllUsers",
19+
"operationId": "deleteUser",
20+
"parameters": [
21+
{
22+
"name": "id",
23+
"in": "path",
24+
"required": true,
25+
"schema": {
26+
"type": "integer",
27+
"format": "int64"
28+
}
29+
}
30+
],
2131
"responses": {
2232
"200": {
2333
"description": "OK",
2434
"content": {
2535
"application/json": {
2636
"schema": {
27-
"type": "array",
28-
"items": {
29-
"$ref": "#/components/schemas/User"
30-
}
37+
"type": "string"
3138
}
3239
}
3340
}
3441
}
3542
}
3643
}
3744
},
38-
"/api/user/{id}": {
45+
"/api/user/index": {
3946
"get": {
4047
"tags": [
4148
"user-repository-impl"
4249
],
43-
"operationId": "getUserById",
44-
"parameters": [
45-
{
46-
"name": "id",
47-
"in": "path",
48-
"description": "The user Id",
49-
"required": true,
50-
"schema": {
51-
"type": "integer",
52-
"format": "int64"
53-
}
54-
}
55-
],
50+
"description": "get all the users",
51+
"operationId": "getAllUsers",
5652
"responses": {
5753
"200": {
5854
"description": "OK",
5955
"content": {
6056
"application/json": {
6157
"schema": {
62-
"$ref": "#/components/schemas/User"
58+
"type": "array",
59+
"items": {
60+
"$ref": "#/components/schemas/User"
61+
}
6362
}
6463
}
6564
}
@@ -89,7 +88,7 @@
8988
}
9089
}
9190
},
92-
"/api/user/put/{id}": {
91+
"/api/user/put": {
9392
"put": {
9493
"tags": [
9594
"user-repository-impl"
@@ -98,7 +97,7 @@
9897
"parameters": [
9998
{
10099
"name": "id",
101-
"in": "path",
100+
"in": "query",
102101
"required": true,
103102
"schema": {
104103
"type": "integer",
@@ -129,16 +128,17 @@
129128
}
130129
}
131130
},
132-
"/api/user/delete/{id}": {
133-
"delete": {
131+
"/api/user/{id}": {
132+
"get": {
134133
"tags": [
135134
"user-repository-impl"
136135
],
137-
"operationId": "deleteUser",
136+
"operationId": "getUserById",
138137
"parameters": [
139138
{
140139
"name": "id",
141140
"in": "path",
141+
"description": "The user Id",
142142
"required": true,
143143
"schema": {
144144
"type": "integer",
@@ -152,7 +152,7 @@
152152
"content": {
153153
"application/json": {
154154
"schema": {
155-
"type": "string"
155+
"$ref": "#/components/schemas/User"
156156
}
157157
}
158158
}

0 commit comments

Comments
 (0)