Skip to content

Commit 240571e

Browse files
committed
Post without @RequestBody not getting all fields. Fixes #1455
1 parent e41a425 commit 240571e

File tree

24 files changed

+396
-369
lines changed

24 files changed

+396
-369
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- #1429 - Allow excluding individual methods from OpenApi output
1111
- #1372 - Customize operation and parameters by the return value
1212
- #1453 - Reverse proxy context path aware support for manually provided files
13+
1314
### Changed
1415
- #1424 - Upgrade to swagger-ui 4.2.1
1516
### Fixed
1617
- #1428 - Incorrect RequestBody type on schema/ui if class implements Map.
18+
- #1455 - Post without @RequestBody not getting all fields
1719
- #1442 - Springdoc-openapi-webmvc-core not enought for Springdoc-openapi-native
1820
- #1446 - Upgrade from Springdoc 1.6.3 to 1.6.4 causes issues if springdoc-openapi-common is on the classpath but springdoc-openapi-ui is not
1921
- #1458 - java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.getParameter() at /v3/api-docs request

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,9 @@ private boolean isRequestBodyParam(RequestMethod requestMethod, ParameterInfo pa
676676
&&
677677
((methodParameter.getParameterAnnotation(io.swagger.v3.oas.annotations.parameters.RequestBody.class) != null
678678
|| methodParameter.getParameterAnnotation(org.springframework.web.bind.annotation.RequestBody.class) != null
679-
|| methodParameter.getParameterAnnotation(org.springframework.web.bind.annotation.RequestPart.class) != null)
680-
|| (!ClassUtils.isPrimitiveOrWrapper(methodParameter.getParameterType()) && (!ArrayUtils.isEmpty(methodParameter.getParameterAnnotations()) || length == 1)));
679+
|| methodParameter.getParameterAnnotation(org.springframework.web.bind.annotation.RequestPart.class) != null
680+
|| methodParameter.getMethod().getAnnotation(io.swagger.v3.oas.annotations.parameters.RequestBody.class) !=null)
681+
|| (!ClassUtils.isPrimitiveOrWrapper(methodParameter.getParameterType()) && (!ArrayUtils.isEmpty(methodParameter.getParameterAnnotations()))));
681682
}
682683

683684
/**

springdoc-openapi-javadoc/src/test/resources/results/app108.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
],
1919
"description": "Update action result.",
2020
"operationId": "update",
21-
"requestBody": {
22-
"description": "the toto",
23-
"content": {
24-
"application/json": {
25-
"schema": {
26-
"type": "string"
27-
}
21+
"parameters": [
22+
{
23+
"name": "toto",
24+
"in": "query",
25+
"description": "the toto",
26+
"required": true,
27+
"schema": {
28+
"type": "string"
2829
}
2930
}
30-
},
31+
],
3132
"responses": {
3233
"200": {
3334
"description": "the action result",
@@ -76,4 +77,4 @@
7677
}
7778
}
7879
}
79-
}
80+
}

springdoc-openapi-javadoc/src/test/resources/results/app117.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,17 @@
7373
],
7474
"description": "Save person.",
7575
"operationId": "save",
76-
"requestBody": {
77-
"description": "the p",
78-
"content": {
79-
"application/json": {
80-
"schema": {
81-
"$ref": "#/components/schemas/Person"
82-
}
76+
"parameters": [
77+
{
78+
"name": "p",
79+
"in": "query",
80+
"description": "the p",
81+
"required": true,
82+
"schema": {
83+
"$ref": "#/components/schemas/Person"
8384
}
8485
}
85-
},
86+
],
8687
"responses": {
8788
"200": {
8889
"description": "the person",
@@ -149,4 +150,4 @@
149150
}
150151
}
151152
}
152-
}
153+
}

springdoc-openapi-javadoc/src/test/resources/results/app140.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,17 @@
7373
],
7474
"description": "Save person.",
7575
"operationId": "save",
76-
"requestBody": {
77-
"description": "the p",
78-
"content": {
79-
"application/json": {
80-
"schema": {
81-
"$ref": "#/components/schemas/Person"
82-
}
76+
"parameters": [
77+
{
78+
"name": "p",
79+
"in": "query",
80+
"description": "the p",
81+
"required": true,
82+
"schema": {
83+
"$ref": "#/components/schemas/Person"
8384
}
8485
}
85-
},
86+
],
8687
"responses": {
8788
"200": {
8889
"description": "the person",
@@ -149,4 +150,4 @@
149150
}
150151
}
151152
}
152-
}
153+
}

springdoc-openapi-javadoc/src/test/resources/results/app142.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,17 @@
7373
],
7474
"description": "Save person.",
7575
"operationId": "save",
76-
"requestBody": {
77-
"description": "the p",
78-
"content": {
79-
"application/json": {
80-
"schema": {
81-
"$ref": "#/components/schemas/Person"
82-
}
76+
"parameters": [
77+
{
78+
"name": "p",
79+
"in": "query",
80+
"description": "the p",
81+
"required": true,
82+
"schema": {
83+
"$ref": "#/components/schemas/Person"
8384
}
8485
}
85-
},
86+
],
8687
"responses": {
8788
"200": {
8889
"description": "the person",
@@ -149,4 +150,4 @@
149150
}
150151
}
151152
}
152-
}
153+
}

springdoc-openapi-javadoc/src/test/resources/results/app26.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
],
1919
"description": "Persons my model.",
2020
"operationId": "persons",
21-
"requestBody": {
22-
"description": "the my model",
23-
"content": {
24-
"application/json": {
25-
"schema": {
26-
"$ref": "#/components/schemas/MyModel"
27-
}
21+
"parameters": [
22+
{
23+
"name": "myModel",
24+
"in": "query",
25+
"description": "the my model",
26+
"required": true,
27+
"schema": {
28+
"$ref": "#/components/schemas/MyModel"
2829
}
2930
}
30-
},
31+
],
3132
"responses": {
3233
"200": {
3334
"description": "the my model",
@@ -56,4 +57,4 @@
5657
}
5758
}
5859
}
59-
}
60+
}

springdoc-openapi-javadoc/src/test/resources/results/app4.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
],
1919
"description": "List tracker data.",
2020
"operationId": "list",
21-
"requestBody": {
22-
"description": "the toto",
23-
"content": {
24-
"application/json": {
25-
"schema": {
26-
"$ref": "#/components/schemas/test.org.springdoc.api.app4.TrackerData"
27-
}
21+
"parameters": [
22+
{
23+
"name": "toto",
24+
"in": "query",
25+
"description": "the toto",
26+
"required": true,
27+
"schema": {
28+
"$ref": "#/components/schemas/test.org.springdoc.api.app4.TrackerData"
2829
}
2930
}
30-
},
31+
],
3132
"responses": {
3233
"200": {
3334
"description": "the tracker data",
@@ -74,4 +75,4 @@
7475
}
7576
}
7677
}
77-
}
78+
}

springdoc-openapi-javadoc/src/test/resources/results/app71.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
],
1919
"description": "Persons string.",
2020
"operationId": "persons",
21-
"requestBody": {
22-
"description": "the dog",
23-
"content": {
24-
"application/json": {
25-
"schema": {
26-
"$ref": "#/components/schemas/Dog"
27-
}
21+
"parameters": [
22+
{
23+
"name": "dog",
24+
"in": "query",
25+
"description": "the dog",
26+
"required": true,
27+
"schema": {
28+
"$ref": "#/components/schemas/Dog"
2829
}
2930
}
30-
},
31+
],
3132
"responses": {
3233
"200": {
3334
"description": "the string",
@@ -57,4 +58,4 @@
5758
}
5859
}
5960
}
60-
}
61+
}

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717
"test-controller"
1818
],
1919
"operationId": "echo",
20-
"requestBody": {
21-
"content": {
22-
"application/json": {
23-
"schema": {
24-
"type": "string"
25-
}
20+
"parameters": [
21+
{
22+
"name": "content",
23+
"in": "query",
24+
"required": true,
25+
"schema": {
26+
"type": "string"
2627
}
2728
}
28-
},
29+
],
2930
"responses": {
3031
"200": {
3132
"description": "OK",

0 commit comments

Comments
 (0)