Skip to content

Commit c3664f6

Browse files
author
Sebastian Scheibner
committed
Fix getHasQueryParams to take authMethods into account
getHasQueryParams only checks if queryParams is not empty, but query params could also be defined by authMethods. Fixes #7303
1 parent db8683e commit c3664f6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,18 @@ public boolean getHasBodyParam() {
6767
* @return true if query parameter exists, false otherwise
6868
*/
6969
public boolean getHasQueryParams() {
70-
return nonempty(queryParams);
70+
if (nonempty(queryParams)) {
71+
return true;
72+
}
73+
74+
// Check if one of the authMethods is a query param
75+
for (CodegenSecurity sec : authMethods) {
76+
if (sec.isKeyInQuery) {
77+
return true;
78+
}
79+
}
80+
81+
return false;
7182
}
7283

7384
/**

0 commit comments

Comments
 (0)