Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

Commit 50e2848

Browse files
committed
fix: 🐛 correct media type handling for @DeleteMapping with @RequestBody
- CLOSE ISSUE #1133 - Remove redundant DELETE method check in bodyMediaType logic, which caused incorrect OpenAPI spec generation when `@DeleteMapping` is used with `@RequestBody` - Simplify query parameter handling by removing unnecessary DELETE-specific condition - Update copyright year from 2024 to 2025 in affected files
1 parent cf70544 commit 50e2848

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/main/java/com/ly/doc/template/IRestDocTemplate.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2024 smart-doc
2+
* Copyright (C) 2018-2025 smart-doc
33
*
44
* Licensed to the Apache Software Foundation (ASF) under one
55
* or more contributor license agreements. See the NOTICE file
@@ -1110,8 +1110,7 @@ else if (frameworkAnnotations.getRequestPartAnnotation()
11101110
required = Boolean.parseBoolean(strRequired);
11111111
}
11121112
// not get and delete method and has MediaType
1113-
boolean bodyMediaType = !(Methods.GET.getValue().equals(docJavaMethod.getMethodType())
1114-
|| Methods.DELETE.getValue().equals(docJavaMethod.getMethodType()))
1113+
boolean bodyMediaType = !Methods.GET.getValue().equals(docJavaMethod.getMethodType())
11151114
&& StringUtil.isNotEmpty(methodMediaType)
11161115
&& (MediaType.APPLICATION_FORM_URLENCODED_VALUE.equals(methodMediaType)
11171116
|| MediaType.APPLICATION_JSON_VALUE.equals(methodMediaType)

src/main/java/com/ly/doc/template/SpringBootDocBuildTemplate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public FrameworkAnnotations registeredAnnotations() {
163163
annotations.setServerEndpointAnnotation(serverEndpointAnnotation);
164164

165165
// add mapping annotations
166-
Map<String, MappingAnnotation> mappingAnnotations = buildSpringMappingAnnotations();
166+
Map<String, MappingAnnotation> mappingAnnotations = this.buildSpringMappingAnnotations();
167167
annotations.setMappingAnnotations(mappingAnnotations);
168168

169169
// Exception advice annotations

src/main/java/com/ly/doc/utils/ApiParamTreeUtil.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2024 smart-doc
2+
* Copyright (C) 2018-2025 smart-doc
33
*
44
* Licensed to the Apache Software Foundation (ASF) under one
55
* or more contributor license agreements. See the NOTICE file
@@ -129,8 +129,7 @@ public static ApiMethodReqParam buildMethodReqParam(List<ApiParam> paramList,
129129
param.setId(pathParams.size() + 1);
130130
pathParams.add(param);
131131
}
132-
else if (param.isQueryParam() || Methods.GET.getValue().equals(methodType)
133-
|| Methods.DELETE.getValue().equals(methodType)) {
132+
else if (param.isQueryParam() || Methods.GET.getValue().equals(methodType)) {
134133
if (queryReqParamMap.containsKey(param.getField())) {
135134
param.setConfigParam(true).setValue(queryReqParamMap.get(param.getField()).getValue());
136135
}

0 commit comments

Comments
 (0)