Skip to content

Commit 9cdc93c

Browse files
author
bnasslahsen
committed
code review
1 parent e070b44 commit 9cdc93c

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,10 @@ private void buildApiResponses(Components components, MethodParameter methodPara
294294
// API Responses at operation and @ApiResponse annotation
295295
for (Map.Entry<String, ApiResponse> entry : apiResponsesOp.entrySet()) {
296296
String httpCode = entry.getKey();
297-
if (!genericMapResponse.containsKey(httpCode)) {
298-
if (!methodAttributes.isMethodOverloaded() || (methodAttributes.isMethodOverloaded() && isValidHttpCode(httpCode, methodParameter))) {
299-
ApiResponse apiResponse = entry.getValue();
300-
buildApiResponses(components, methodParameter, apiResponsesOp, methodAttributes, httpCode, apiResponse, false);
301-
}
297+
boolean methodAttributesCondition = !methodAttributes.isMethodOverloaded() || (methodAttributes.isMethodOverloaded() && isValidHttpCode(httpCode, methodParameter));
298+
if (!genericMapResponse.containsKey(httpCode) && methodAttributesCondition) {
299+
ApiResponse apiResponse = entry.getValue();
300+
buildApiResponses(components, methodParameter, apiResponsesOp, methodAttributes, httpCode, apiResponse, false);
302301
}
303302
}
304303
}
@@ -546,20 +545,21 @@ private Map<String, ApiResponse> getGenericMapResponse(Class<?> beanType) {
546545
* @return the boolean
547546
*/
548547
private boolean isValidHttpCode(String httpCode, MethodParameter methodParameter) {
548+
boolean result = false;
549549
Set<io.swagger.v3.oas.annotations.responses.ApiResponse> responseSet = getApiResponses(methodParameter.getMethod());
550550
if (isHttpCodePresent(httpCode, responseSet))
551-
return true;
552-
io.swagger.v3.oas.annotations.Operation apiOperation = AnnotatedElementUtils.findMergedAnnotation(methodParameter.getMethod(),
553-
io.swagger.v3.oas.annotations.Operation.class);
554-
if (apiOperation != null) {
551+
result = true;
552+
else if (AnnotatedElementUtils.findMergedAnnotation(methodParameter.getMethod(),
553+
io.swagger.v3.oas.annotations.Operation.class) != null) {
554+
io.swagger.v3.oas.annotations.Operation apiOperation = AnnotatedElementUtils.findMergedAnnotation(methodParameter.getMethod(),
555+
io.swagger.v3.oas.annotations.Operation.class);
555556
responseSet = new HashSet<>(Arrays.asList(apiOperation.responses()));
556557
if (isHttpCodePresent(httpCode, responseSet))
557-
return true;
558+
result = true;
558559
}
559-
String httpCode1 = evaluateResponseStatus(methodParameter.getMethod(), methodParameter.getMethod().getClass(), false);
560-
if (httpCode.equals(httpCode1))
561-
return true;
562-
return false;
560+
else if (httpCode.equals(evaluateResponseStatus(methodParameter.getMethod(), methodParameter.getMethod().getClass(), false)))
561+
result = true;
562+
return result;
563563
}
564564

565565
/**

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ private Builder() {
220220
* @param group the group
221221
* @return the group
222222
* @deprecated Since v1.4.0, GroupedOpenApi.setGroup is marked as deprecated. Use {@link #group(String) } instead.
223+
* will be removed with v1.5.0
223224
*/
224225
@Deprecated
225226
public Builder setGroup(String group) {

springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/DataRestDelegatingMethodParameterCustomizer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,12 @@ public boolean nullable() {
249249

250250
@Override
251251
public boolean readOnly() {
252-
return parameter.schema().readOnly();
252+
return AccessMode.READ_ONLY.equals(parameter.schema().accessMode());
253253
}
254254

255255
@Override
256256
public boolean writeOnly() {
257-
return parameter.schema().writeOnly();
257+
return AccessMode.WRITE_ONLY.equals(parameter.schema().accessMode());
258258
}
259259

260260
@Override

0 commit comments

Comments
 (0)