Skip to content

Commit 245d42e

Browse files
authored
Fix getHasQueryParams to take authMethods into account
Fixes #7303 for V3 This is the V3 port of the fix #8292
1 parent 2a2ad12 commit 245d42e

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/v3/CodegenOperation.java

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

7182
/**

0 commit comments

Comments
 (0)