Skip to content

Commit 71cf529

Browse files
committed
RequestPart Integer Param Is shown in the Parameters parameter. Fixes #1196
1 parent 088eb29 commit 71cf529

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,8 @@ private boolean isRequestBodyParam(RequestMethod requestMethod, ParameterInfo pa
647647
return (!RequestMethod.GET.equals(requestMethod) && (parameterInfo.getParameterModel() == null || parameterInfo.getParameterModel().getIn() == null) && !delegatingMethodParameter.isParameterObject())
648648
&&
649649
((methodParameter.getParameterAnnotation(io.swagger.v3.oas.annotations.parameters.RequestBody.class) != null
650-
|| methodParameter.getParameterAnnotation(org.springframework.web.bind.annotation.RequestBody.class) != null)
650+
|| methodParameter.getParameterAnnotation(org.springframework.web.bind.annotation.RequestBody.class) != null
651+
|| methodParameter.getParameterAnnotation(org.springframework.web.bind.annotation.RequestPart.class) != null)
651652
|| (!ClassUtils.isPrimitiveOrWrapper(methodParameter.getParameter().getType()) && (!ArrayUtils.isEmpty(methodParameter.getParameterAnnotations()) || length == 1)));
652653
}
653654

springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app161/HelloController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,10 @@ public ResponseEntity<Void> add2(
4646
) {
4747
return null;
4848
}
49+
50+
@PostMapping( produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
51+
@Operation(summary = "test")
52+
public void test(@RequestPart("strValue") String strValue,
53+
@RequestPart("intValue") Integer intValue) {
54+
}
4955
}

springdoc-openapi-webmvc-core/src/test/resources/results/app161.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,42 @@
1111
}
1212
],
1313
"paths": {
14+
"/": {
15+
"post": {
16+
"tags": [
17+
"hello-controller"
18+
],
19+
"summary": "test",
20+
"operationId": "test",
21+
"requestBody": {
22+
"content": {
23+
"multipart/form-data": {
24+
"schema": {
25+
"required": [
26+
"intValue",
27+
"strValue"
28+
],
29+
"type": "object",
30+
"properties": {
31+
"strValue": {
32+
"type": "string"
33+
},
34+
"intValue": {
35+
"type": "integer",
36+
"format": "int32"
37+
}
38+
}
39+
}
40+
}
41+
}
42+
},
43+
"responses": {
44+
"200": {
45+
"description": "OK"
46+
}
47+
}
48+
}
49+
},
1450
"/add": {
1551
"post": {
1652
"tags": [

0 commit comments

Comments
 (0)