mirror of
				https://github.com/OpenAPITools/openapi-generator.git
				synced 2025-10-31 16:53:54 +00:00 
			
		
		
		
	ensure correct value for hasParams (#21209)
* turn hasParams into getter * restore hasRequiredParams
This commit is contained in:
		
							parent
							
								
									d38898a4d0
								
							
						
					
					
						commit
						e22d079bb0
					
				| @ -24,7 +24,7 @@ import java.util.*; | ||||
| 
 | ||||
| public class CodegenOperation { | ||||
|     public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>(); | ||||
|     public boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams, hasRequiredParams, | ||||
|     public boolean hasAuthMethods, hasConsumes, hasProduces, hasOptionalParams, hasRequiredParams, | ||||
|             returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap, | ||||
|             isArray, isMultipart, isVoid = false, | ||||
|             hasVersionHeaders = false, hasVersionQueryParams = false, | ||||
| @ -81,6 +81,15 @@ public class CodegenOperation { | ||||
|         return params != null && !params.isEmpty(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Check if there's at least one parameter | ||||
|      * | ||||
|      * @return true if parameter exists, false otherwise | ||||
|      */ | ||||
|     public boolean getHasParams() { | ||||
|         return nonEmpty(allParams); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Check if there's at least one body parameter | ||||
|      * | ||||
| @ -362,7 +371,6 @@ public class CodegenOperation { | ||||
|         sb.append(", hasAuthMethods=").append(hasAuthMethods); | ||||
|         sb.append(", hasConsumes=").append(hasConsumes); | ||||
|         sb.append(", hasProduces=").append(hasProduces); | ||||
|         sb.append(", hasParams=").append(hasParams); | ||||
|         sb.append(", hasOptionalParams=").append(hasOptionalParams); | ||||
|         sb.append(", hasRequiredParams=").append(hasRequiredParams); | ||||
|         sb.append(", returnTypeIsPrimitive=").append(returnTypeIsPrimitive); | ||||
| @ -445,7 +453,6 @@ public class CodegenOperation { | ||||
|         return hasAuthMethods == that.hasAuthMethods && | ||||
|                 hasConsumes == that.hasConsumes && | ||||
|                 hasProduces == that.hasProduces && | ||||
|                 hasParams == that.hasParams && | ||||
|                 hasOptionalParams == that.hasOptionalParams && | ||||
|                 hasRequiredParams == that.hasRequiredParams && | ||||
|                 returnTypeIsPrimitive == that.returnTypeIsPrimitive && | ||||
| @ -522,7 +529,7 @@ public class CodegenOperation { | ||||
|     @Override | ||||
|     public int hashCode() { | ||||
| 
 | ||||
|         return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams, | ||||
|         return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasOptionalParams, | ||||
|                 hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap, | ||||
|                 isArray, isMultipart, isVoid, isResponseBinary, isResponseFile, isResponseOptional, hasReference, | ||||
|                 hasDefaultResponse, hasOnlyDefaultResponse, isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, | ||||
|  | ||||
| @ -4834,9 +4834,6 @@ public class DefaultCodegen implements CodegenConfig { | ||||
|         // legacy support | ||||
|         op.nickname = op.operationId; | ||||
| 
 | ||||
|         if (op.allParams.size() > 0) { | ||||
|             op.hasParams = true; | ||||
|         } | ||||
|         op.hasRequiredParams = op.requiredParams.size() > 0; | ||||
| 
 | ||||
|         // check if the operation has only a single parameter | ||||
| @ -8678,6 +8675,5 @@ public class DefaultCodegen implements CodegenConfig { | ||||
|                 operation.allParams.add(p); | ||||
|             } | ||||
|         } | ||||
|         operation.hasParams = !operation.allParams.isEmpty(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -2386,7 +2386,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code | ||||
|                 operation.allParams.add(p); | ||||
|             } | ||||
|         } | ||||
|         operation.hasParams = !operation.allParams.isEmpty(); | ||||
|     } | ||||
| 
 | ||||
|     private boolean shouldBeImplicitHeader(CodegenParameter parameter) { | ||||
|  | ||||
| @ -712,7 +712,6 @@ public class ElixirClientCodegen extends DefaultCodegen { | ||||
|             this.hasAuthMethods = o.hasAuthMethods; | ||||
|             this.hasConsumes = o.hasConsumes; | ||||
|             this.hasProduces = o.hasProduces; | ||||
|             this.hasParams = o.hasParams; | ||||
|             this.hasOptionalParams = o.hasOptionalParams; | ||||
|             this.returnTypeIsPrimitive = o.returnTypeIsPrimitive; | ||||
|             this.returnSimpleType = o.returnSimpleType; | ||||
|  | ||||
| @ -417,7 +417,6 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig | ||||
|             this.hasAuthMethods = o.hasAuthMethods; | ||||
|             this.hasConsumes = o.hasConsumes; | ||||
|             this.hasProduces = o.hasProduces; | ||||
|             this.hasParams = o.hasParams; | ||||
|             this.hasOptionalParams = o.hasOptionalParams; | ||||
|             this.returnTypeIsPrimitive = o.returnTypeIsPrimitive; | ||||
|             this.returnSimpleType = o.returnSimpleType; | ||||
|  | ||||
| @ -507,7 +507,6 @@ public class ErlangProperCodegen extends DefaultCodegen implements CodegenConfig | ||||
|             this.hasAuthMethods = o.hasAuthMethods; | ||||
|             this.hasConsumes = o.hasConsumes; | ||||
|             this.hasProduces = o.hasProduces; | ||||
|             this.hasParams = o.hasParams; | ||||
|             this.hasOptionalParams = o.hasOptionalParams; | ||||
|             this.returnTypeIsPrimitive = o.returnTypeIsPrimitive; | ||||
|             this.returnSimpleType = o.returnSimpleType; | ||||
|  | ||||
| @ -1379,7 +1379,6 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege | ||||
|             this.hasAuthMethods = o.hasAuthMethods; | ||||
|             this.hasConsumes = o.hasConsumes; | ||||
|             this.hasProduces = o.hasProduces; | ||||
|             this.hasParams = o.hasParams; | ||||
|             this.hasOptionalParams = o.hasOptionalParams; | ||||
|             this.hasRequiredParams = o.hasRequiredParams; | ||||
|             this.returnTypeIsPrimitive = o.returnTypeIsPrimitive; | ||||
|  | ||||
| @ -348,7 +348,6 @@ public class TypeScriptRxjsClientCodegen extends AbstractTypeScriptClientCodegen | ||||
|             this.hasAuthMethods = o.hasAuthMethods; | ||||
|             this.hasConsumes = o.hasConsumes; | ||||
|             this.hasProduces = o.hasProduces; | ||||
|             this.hasParams = o.hasParams; | ||||
|             this.hasOptionalParams = o.hasOptionalParams; | ||||
|             this.hasRequiredParams = o.hasRequiredParams; | ||||
|             this.returnTypeIsPrimitive = o.returnTypeIsPrimitive; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user