Skip to content

Commit df05f18

Browse files
committed
turn hasParams into getter
1 parent 3c664d1 commit df05f18

8 files changed

Lines changed: 12 additions & 21 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
public class CodegenOperation {
2626
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
27-
public boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams, hasRequiredParams,
27+
public boolean hasAuthMethods, hasConsumes, hasProduces, hasOptionalParams,
2828
returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
2929
isArray, isMultipart, isVoid = false,
3030
hasVersionHeaders = false, hasVersionQueryParams = false,
@@ -81,6 +81,15 @@ private static boolean nonEmpty(Map<?, ?> params) {
8181
return params != null && !params.isEmpty();
8282
}
8383

84+
/**
85+
* Check if there's at least one parameter
86+
*
87+
* @return true if parameter exists, false otherwise
88+
*/
89+
public boolean getHasParams() {
90+
return nonEmpty(allParams);
91+
}
92+
8493
/**
8594
* Check if there's at least one body parameter
8695
*
@@ -362,9 +371,7 @@ public String toString() {
362371
sb.append(", hasAuthMethods=").append(hasAuthMethods);
363372
sb.append(", hasConsumes=").append(hasConsumes);
364373
sb.append(", hasProduces=").append(hasProduces);
365-
sb.append(", hasParams=").append(hasParams);
366374
sb.append(", hasOptionalParams=").append(hasOptionalParams);
367-
sb.append(", hasRequiredParams=").append(hasRequiredParams);
368375
sb.append(", returnTypeIsPrimitive=").append(returnTypeIsPrimitive);
369376
sb.append(", returnSimpleType=").append(returnSimpleType);
370377
sb.append(", subresourceOperation=").append(subresourceOperation);
@@ -445,9 +452,7 @@ public boolean equals(Object o) {
445452
return hasAuthMethods == that.hasAuthMethods &&
446453
hasConsumes == that.hasConsumes &&
447454
hasProduces == that.hasProduces &&
448-
hasParams == that.hasParams &&
449455
hasOptionalParams == that.hasOptionalParams &&
450-
hasRequiredParams == that.hasRequiredParams &&
451456
returnTypeIsPrimitive == that.returnTypeIsPrimitive &&
452457
returnSimpleType == that.returnSimpleType &&
453458
subresourceOperation == that.subresourceOperation &&
@@ -522,8 +527,8 @@ public boolean equals(Object o) {
522527
@Override
523528
public int hashCode() {
524529

525-
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
526-
hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
530+
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasOptionalParams,
531+
returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
527532
isArray, isMultipart, isVoid, isResponseBinary, isResponseFile, isResponseOptional, hasReference,
528533
hasDefaultResponse, hasOnlyDefaultResponse, isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
529534
isRestful, isDeprecated, isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod,

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4834,11 +4834,6 @@ public CodegenOperation fromOperation(String path,
48344834
// legacy support
48354835
op.nickname = op.operationId;
48364836

4837-
if (op.allParams.size() > 0) {
4838-
op.hasParams = true;
4839-
}
4840-
op.hasRequiredParams = op.requiredParams.size() > 0;
4841-
48424837
// check if the operation has only a single parameter
48434838
op.hasSingleParam = op.allParams.size() == 1;
48444839

@@ -8678,6 +8673,5 @@ protected void handleConstantParams(CodegenOperation operation) {
86788673
operation.allParams.add(p);
86798674
}
86808675
}
8681-
operation.hasParams = !operation.allParams.isEmpty();
86828676
}
86838677
}

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2386,7 +2386,6 @@ protected void handleImplicitHeaders(CodegenOperation operation) {
23862386
operation.allParams.add(p);
23872387
}
23882388
}
2389-
operation.hasParams = !operation.allParams.isEmpty();
23902389
}
23912390

23922391
private boolean shouldBeImplicitHeader(CodegenParameter parameter) {

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,6 @@ public ExtendedCodegenOperation(CodegenOperation o) {
712712
this.hasAuthMethods = o.hasAuthMethods;
713713
this.hasConsumes = o.hasConsumes;
714714
this.hasProduces = o.hasProduces;
715-
this.hasParams = o.hasParams;
716715
this.hasOptionalParams = o.hasOptionalParams;
717716
this.returnTypeIsPrimitive = o.returnTypeIsPrimitive;
718717
this.returnSimpleType = o.returnSimpleType;

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ public ExtendedCodegenOperation(CodegenOperation o) {
417417
this.hasAuthMethods = o.hasAuthMethods;
418418
this.hasConsumes = o.hasConsumes;
419419
this.hasProduces = o.hasProduces;
420-
this.hasParams = o.hasParams;
421420
this.hasOptionalParams = o.hasOptionalParams;
422421
this.returnTypeIsPrimitive = o.returnTypeIsPrimitive;
423422
this.returnSimpleType = o.returnSimpleType;

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangProperCodegen.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ class ExtendedCodegenOperation extends CodegenOperation {
507507
this.hasAuthMethods = o.hasAuthMethods;
508508
this.hasConsumes = o.hasConsumes;
509509
this.hasProduces = o.hasProduces;
510-
this.hasParams = o.hasParams;
511510
this.hasOptionalParams = o.hasOptionalParams;
512511
this.returnTypeIsPrimitive = o.returnTypeIsPrimitive;
513512
this.returnSimpleType = o.returnSimpleType;

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,9 +1379,7 @@ public ExtendedCodegenOperation(CodegenOperation o) {
13791379
this.hasAuthMethods = o.hasAuthMethods;
13801380
this.hasConsumes = o.hasConsumes;
13811381
this.hasProduces = o.hasProduces;
1382-
this.hasParams = o.hasParams;
13831382
this.hasOptionalParams = o.hasOptionalParams;
1384-
this.hasRequiredParams = o.hasRequiredParams;
13851383
this.returnTypeIsPrimitive = o.returnTypeIsPrimitive;
13861384
this.returnSimpleType = o.returnSimpleType;
13871385
this.subresourceOperation = o.subresourceOperation;

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,7 @@ public ExtendedCodegenOperation(CodegenOperation o) {
348348
this.hasAuthMethods = o.hasAuthMethods;
349349
this.hasConsumes = o.hasConsumes;
350350
this.hasProduces = o.hasProduces;
351-
this.hasParams = o.hasParams;
352351
this.hasOptionalParams = o.hasOptionalParams;
353-
this.hasRequiredParams = o.hasRequiredParams;
354352
this.returnTypeIsPrimitive = o.returnTypeIsPrimitive;
355353
this.returnSimpleType = o.returnSimpleType;
356354
this.subresourceOperation = o.subresourceOperation;

0 commit comments

Comments
 (0)