Skip to content

Commit

Permalink
Don't warn about @notbody use in @get methods in REST Client
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Feb 15, 2024
1 parent 9d5e5b2 commit c18c33f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ protected void logMissingJsonWarning(MethodInfo info) {
+ "' but no JSON extension has been added. Consider adding 'quarkus-rest-client-reactive-jackson' (recommended) or 'quarkus-rest-client-reactive-jsonb'.");
}

@Override
protected void warnAboutMissUsedBodyParameter(DotName httpMethod, MethodInfo methodInfo) {
// do nothing in the case of the client
}

public static final class Builder extends AbstractBuilder<Builder> {

private final Capabilities capabilities;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,7 @@ private ResourceMethod createResourceMethod(ClassInfo currentClassInfo, ClassInf
+ currentMethodInfo.parameterName(i));
bodyParamType = paramType;
if (GET.equals(httpMethod) || HEAD.equals(httpMethod) || OPTIONS.equals(httpMethod)) {
log.warn("Using a body parameter with " + httpMethod + " is strongly discouraged. Offending method is '"
+ currentMethodInfo.declaringClass().name() + "#" + currentMethodInfo + "'");
warnAboutMissUsedBodyParameter(httpMethod, currentMethodInfo);
}
}
String elementType = parameterResult.getElementType();
Expand Down Expand Up @@ -778,6 +777,11 @@ private ResourceMethod createResourceMethod(ClassInfo currentClassInfo, ClassInf
}
}

protected void warnAboutMissUsedBodyParameter(DotName httpMethod, MethodInfo methodInfo) {
log.warn("Using a body parameter with " + httpMethod + " is strongly discouraged. Offending method is '"
+ methodInfo.declaringClass().name() + "#" + methodInfo + "'");
}

protected boolean skipParameter(Map<DotName, AnnotationInstance> anns) {
return skipMethodParameter != null && skipMethodParameter.test(anns);
}
Expand Down

0 comments on commit c18c33f

Please sign in to comment.