Skip to content

Commit 6862cdd

Browse files
authored
Merge pull request #8292 from AsamK/fix_getHasQueryParams_authMethods
Fix getHasQueryParams to take authMethods into account
2 parents db8683e + c3664f6 commit 6862cdd

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)