From e774db05b639d75e6945603b5a30a651227e4ff1 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 4 Dec 2019 10:07:33 +0800 Subject: [PATCH] Regenerate hashCode, equals, toString (#4648) * update hashCode, equals, toString in CodegenParameter * update equals, hashCode, toString in CodegenProperty * update toString, hashCode, equals in CodegenOperation * update toString, hashCode, equals in CodegenResponse * update toString, hashCode, equals in CodegenSecurity * update hashCode, toString, equals in CodegenModel * add hashCode, toString, equals to CodegenServer and more * update hashCode, equals, toString in CodegenDiscriminator * update testS * update samples --- .../openapitools/codegen/CodegenCallback.java | 5 + .../codegen/CodegenDiscriminator.java | 16 +- .../openapitools/codegen/CodegenModel.java | 296 ++++++------ .../codegen/CodegenOperation.java | 262 ++++++----- .../codegen/CodegenParameter.java | 378 +++++++--------- .../openapitools/codegen/CodegenProperty.java | 421 ++++++++---------- .../openapitools/codegen/CodegenResponse.java | 92 ++-- .../openapitools/codegen/CodegenSecurity.java | 129 +++--- .../openapitools/codegen/CodegenServer.java | 27 ++ .../codegen/CodegenServerVariable.java | 31 ++ .../codegen/DefaultCodegenTest.java | 2 + .../SymfonyBundle-php/Api/PetApiInterface.php | 18 +- 12 files changed, 827 insertions(+), 850 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java index 3dcf7cfbeaee..982433c64de3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java @@ -44,6 +44,7 @@ public class CodegenCallback { public int hashCode() { return Objects.hash(expression, hasMore, requests, vendorExtensions); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -64,10 +65,12 @@ public class CodegenCallback { return Objects.equals(that.name, name) && Objects.equals(that.hasMore, hasMore) && Objects.equals(that.urls, urls) && Objects.equals(that.vendorExtensions, vendorExtensions); } + @Override public int hashCode() { return Objects.hash(name, hasMore, urls, vendorExtensions); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -77,4 +80,6 @@ public class CodegenCallback { sb.append("}"); return sb.toString(); } + + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java index 1758abb2a1cd..9b548e8b5498 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java @@ -91,21 +91,25 @@ public class CodegenDiscriminator { if (o == null || getClass() != o.getClass()) return false; CodegenDiscriminator that = (CodegenDiscriminator) o; return Objects.equals(propertyName, that.propertyName) && + Objects.equals(propertyBaseName, that.propertyBaseName) && Objects.equals(mapping, that.mapping) && Objects.equals(mappedModels, that.mappedModels); } @Override public int hashCode() { - return Objects.hash(propertyName, mapping, mappedModels); + + return Objects.hash(propertyName, propertyBaseName, mapping, mappedModels); } @Override public String toString() { - return new ToStringBuilder(this) - .append("propertyName", propertyName) - .append("mapping", mapping) - .append("mappedModels", mappedModels) - .toString(); + final StringBuffer sb = new StringBuffer("CodegenDiscriminator{"); + sb.append("propertyName='").append(propertyName).append('\''); + sb.append(", propertyBaseName='").append(propertyBaseName).append('\''); + sb.append(", mapping=").append(mapping); + sb.append(", mappedModels=").append(mappedModels); + sb.append('}'); + return sb.toString(); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java index 876162afe139..a7289087ef5c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java @@ -70,157 +70,6 @@ public class CodegenModel { //The type of the value from additional properties. Used in map like objects. public String additionalPropertiesType; - @Override - public String toString() { - return new ToStringBuilder(this) - .append("parent", parent) - .append("parentSchema", parentSchema) - .append("interfaces", interfaces) - .append("parentModel", parentModel) - .append("interfaceModels", interfaceModels) - .append("children", children) - .append("name", name) - .append("classname", classname) - .append("title", title) - .append("description", description) - .append("classVarName", classVarName) - .append("modelJson", modelJson) - .append("dataType", dataType) - .append("xmlPrefix", xmlPrefix) - .append("xmlNamespace", xmlNamespace) - .append("xmlName", xmlName) - .append("classFilename", classFilename) - .append("unescapedDescription", unescapedDescription) - .append("discriminator", discriminator) - .append("defaultValue", defaultValue) - .append("arrayModelType", arrayModelType) - .append("isAlias", isAlias) - .append("isString", isString) - .append("isNumeric", isNumeric) - .append("isInteger", isInteger) - .append("isLong", isLong) - .append("isNumber", isNumber) - .append("isFloat", isFloat) - .append("isDouble", isDouble) - .append("vars", vars) - .append("requiredVars", requiredVars) - .append("optionalVars", optionalVars) - .append("readOnlyVars", readOnlyVars) - .append("readWriteVars", readWriteVars) - .append("allVars", allVars) - .append("parentVars", parentVars) - .append("allowableValues", allowableValues) - .append("mandatory", mandatory) - .append("allMandatory", allMandatory) - .append("imports", imports) - .append("hasVars", hasVars) - .append("emptyVars", emptyVars) - .append("hasMoreModels", hasMoreModels) - .append("hasEnums", hasEnums) - .append("isEnum", isEnum) - .append("isNullable", isNullable) - .append("hasRequired", hasRequired) - .append("hasOptional", hasOptional) - .append("isArrayModel", isArrayModel) - .append("hasChildren", hasChildren) - .append("isMapModel", isMapModel) - .append("hasOnlyReadOnly", hasOnlyReadOnly) - .append("externalDocumentation", externalDocumentation) - .append("vendorExtensions", vendorExtensions) - .append("additionalPropertiesType", additionalPropertiesType) - .toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CodegenModel that = (CodegenModel) o; - - return Objects.equals(parent, that.parent) && - Objects.equals(parentSchema, that.parentSchema) && - Objects.equals(interfaces, that.interfaces) && - Objects.equals(allParents, that.allParents) && - Objects.equals(parentModel, that.parentModel) && - Objects.equals(interfaceModels, that.interfaceModels) && - Objects.equals(name, that.name) && - Objects.equals(classname, that.classname) && - Objects.equals(title, that.title) && - Objects.equals(description, that.description) && - Objects.equals(classVarName, that.classVarName) && - Objects.equals(modelJson, that.modelJson) && - Objects.equals(dataType, that.dataType) && - Objects.equals(xmlPrefix, that.xmlPrefix) && - Objects.equals(xmlNamespace, that.xmlNamespace) && - Objects.equals(xmlName, that.xmlName) && - Objects.equals(classFilename, that.classFilename) && - Objects.equals(unescapedDescription, that.unescapedDescription) && - Objects.equals(discriminator, that.discriminator) && - Objects.equals(defaultValue, that.defaultValue) && - Objects.equals(vars, that.vars) && - Objects.equals(requiredVars, that.requiredVars) && - Objects.equals(optionalVars, that.optionalVars) && - Objects.equals(allVars, that.allVars) && - Objects.equals(allowableValues, that.allowableValues) && - Objects.equals(mandatory, that.mandatory) && - Objects.equals(allMandatory, that.allMandatory) && - Objects.equals(imports, that.imports) && - Objects.equals(hasVars, that.hasVars) && - Objects.equals(emptyVars, that.emptyVars) && - Objects.equals(hasMoreModels, that.hasMoreModels) && - Objects.equals(hasEnums, that.hasEnums) && - Objects.equals(isEnum, that.isEnum) && - Objects.equals(externalDocumentation, that.externalDocumentation) && - Objects.equals(hasOnlyReadOnly, that.hasOnlyReadOnly) && - Objects.equals(hasChildren, that.hasChildren) && - Objects.equals(parentVars, that.parentVars) && - Objects.equals(vendorExtensions, that.vendorExtensions); - } - - @Override - public int hashCode() { - return Objects.hash( - parent, - parentSchema, - interfaces, - allParents, - parentModel, - interfaceModels, - name, - classname, - title, - description, - classVarName, - modelJson, - dataType, - xmlPrefix, - xmlNamespace, - xmlName, - classFilename, - unescapedDescription, - discriminator, - defaultValue, - vars, - requiredVars, - optionalVars, - allVars, - allowableValues, - mandatory, - allMandatory, - imports, - hasVars, - emptyVars, - hasMoreModels, - hasEnums, - isEnum, - externalDocumentation, - vendorExtensions, - hasOnlyReadOnly, - hasChildren, - parentVars); - } - public String getParent() { return parent; } @@ -601,4 +450,149 @@ public class CodegenModel { } } } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenModel that = (CodegenModel) o; + return isAlias == that.isAlias && + isString == that.isString && + isInteger == that.isInteger && + isLong == that.isLong && + isNumber == that.isNumber && + isNumeric == that.isNumeric && + isFloat == that.isFloat && + isDouble == that.isDouble && + hasVars == that.hasVars && + emptyVars == that.emptyVars && + hasMoreModels == that.hasMoreModels && + hasEnums == that.hasEnums && + isEnum == that.isEnum && + isNullable == that.isNullable && + hasRequired == that.hasRequired && + hasOptional == that.hasOptional && + isArrayModel == that.isArrayModel && + hasChildren == that.hasChildren && + isMapModel == that.isMapModel && + hasOnlyReadOnly == that.hasOnlyReadOnly && + Objects.equals(parent, that.parent) && + Objects.equals(parentSchema, that.parentSchema) && + Objects.equals(interfaces, that.interfaces) && + Objects.equals(allParents, that.allParents) && + Objects.equals(parentModel, that.parentModel) && + Objects.equals(interfaceModels, that.interfaceModels) && + Objects.equals(children, that.children) && + Objects.equals(anyOf, that.anyOf) && + Objects.equals(oneOf, that.oneOf) && + Objects.equals(allOf, that.allOf) && + Objects.equals(name, that.name) && + Objects.equals(classname, that.classname) && + Objects.equals(title, that.title) && + Objects.equals(description, that.description) && + Objects.equals(classVarName, that.classVarName) && + Objects.equals(modelJson, that.modelJson) && + Objects.equals(dataType, that.dataType) && + Objects.equals(xmlPrefix, that.xmlPrefix) && + Objects.equals(xmlNamespace, that.xmlNamespace) && + Objects.equals(xmlName, that.xmlName) && + Objects.equals(classFilename, that.classFilename) && + Objects.equals(unescapedDescription, that.unescapedDescription) && + Objects.equals(discriminator, that.discriminator) && + Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(arrayModelType, that.arrayModelType) && + Objects.equals(vars, that.vars) && + Objects.equals(allVars, that.allVars) && + Objects.equals(requiredVars, that.requiredVars) && + Objects.equals(optionalVars, that.optionalVars) && + Objects.equals(readOnlyVars, that.readOnlyVars) && + Objects.equals(readWriteVars, that.readWriteVars) && + Objects.equals(parentVars, that.parentVars) && + Objects.equals(allowableValues, that.allowableValues) && + Objects.equals(mandatory, that.mandatory) && + Objects.equals(allMandatory, that.allMandatory) && + Objects.equals(imports, that.imports) && + Objects.equals(externalDocumentation, that.externalDocumentation) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(additionalPropertiesType, that.additionalPropertiesType); + } + + @Override + public int hashCode() { + + return Objects.hash(parent, parentSchema, interfaces, allParents, parentModel, interfaceModels, children, + anyOf, oneOf, allOf, name, classname, title, description, classVarName, modelJson, dataType, + xmlPrefix, xmlNamespace, xmlName, classFilename, unescapedDescription, discriminator, defaultValue, + arrayModelType, isAlias, isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, + vars, allVars, requiredVars, optionalVars, readOnlyVars, readWriteVars, parentVars, allowableValues, + mandatory, allMandatory, imports, hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, isNullable, + hasRequired, hasOptional, isArrayModel, hasChildren, isMapModel, hasOnlyReadOnly, + externalDocumentation, vendorExtensions, additionalPropertiesType); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenModel{"); + sb.append("parent='").append(parent).append('\''); + sb.append(", parentSchema='").append(parentSchema).append('\''); + sb.append(", interfaces=").append(interfaces); + sb.append(", allParents=").append(allParents); + sb.append(", parentModel=").append(parentModel); + sb.append(", interfaceModels=").append(interfaceModels); + sb.append(", children=").append(children); + sb.append(", anyOf=").append(anyOf); + sb.append(", oneOf=").append(oneOf); + sb.append(", allOf=").append(allOf); + sb.append(", name='").append(name).append('\''); + sb.append(", classname='").append(classname).append('\''); + sb.append(", title='").append(title).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", classVarName='").append(classVarName).append('\''); + sb.append(", modelJson='").append(modelJson).append('\''); + sb.append(", dataType='").append(dataType).append('\''); + sb.append(", xmlPrefix='").append(xmlPrefix).append('\''); + sb.append(", xmlNamespace='").append(xmlNamespace).append('\''); + sb.append(", xmlName='").append(xmlName).append('\''); + sb.append(", classFilename='").append(classFilename).append('\''); + sb.append(", unescapedDescription='").append(unescapedDescription).append('\''); + sb.append(", discriminator=").append(discriminator); + sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", arrayModelType='").append(arrayModelType).append('\''); + sb.append(", isAlias=").append(isAlias); + sb.append(", isString=").append(isString); + sb.append(", isInteger=").append(isInteger); + sb.append(", isLong=").append(isLong); + sb.append(", isNumber=").append(isNumber); + sb.append(", isNumeric=").append(isNumeric); + sb.append(", isFloat=").append(isFloat); + sb.append(", isDouble=").append(isDouble); + sb.append(", vars=").append(vars); + sb.append(", allVars=").append(allVars); + sb.append(", requiredVars=").append(requiredVars); + sb.append(", optionalVars=").append(optionalVars); + sb.append(", readOnlyVars=").append(readOnlyVars); + sb.append(", readWriteVars=").append(readWriteVars); + sb.append(", parentVars=").append(parentVars); + sb.append(", allowableValues=").append(allowableValues); + sb.append(", mandatory=").append(mandatory); + sb.append(", allMandatory=").append(allMandatory); + sb.append(", imports=").append(imports); + sb.append(", hasVars=").append(hasVars); + sb.append(", emptyVars=").append(emptyVars); + sb.append(", hasMoreModels=").append(hasMoreModels); + sb.append(", hasEnums=").append(hasEnums); + sb.append(", isEnum=").append(isEnum); + sb.append(", isNullable=").append(isNullable); + sb.append(", hasRequired=").append(hasRequired); + sb.append(", hasOptional=").append(hasOptional); + sb.append(", isArrayModel=").append(isArrayModel); + sb.append(", hasChildren=").append(hasChildren); + sb.append(", isMapModel=").append(isMapModel); + sb.append(", hasOnlyReadOnly=").append(hasOnlyReadOnly); + sb.append(", externalDocumentation=").append(externalDocumentation); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", additionalPropertiesType='").append(additionalPropertiesType).append('\''); + sb.append('}'); + return sb.toString(); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java index 583b1cbab1c9..2f8391710453 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java @@ -244,134 +244,160 @@ public class CodegenOperation { @Override public String toString() { - return String.format(Locale.ROOT, "%s(%s)", baseName, path); + final StringBuffer sb = new StringBuffer("CodegenOperation{"); + sb.append("responseHeaders=").append(responseHeaders); + 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); + sb.append(", returnSimpleType=").append(returnSimpleType); + sb.append(", subresourceOperation=").append(subresourceOperation); + sb.append(", isMapContainer=").append(isMapContainer); + sb.append(", isListContainer=").append(isListContainer); + sb.append(", isMultipart=").append(isMultipart); + sb.append(", hasMore=").append(hasMore); + sb.append(", isResponseBinary=").append(isResponseBinary); + sb.append(", isResponseFile=").append(isResponseFile); + sb.append(", hasReference=").append(hasReference); + sb.append(", isRestfulIndex=").append(isRestfulIndex); + sb.append(", isRestfulShow=").append(isRestfulShow); + sb.append(", isRestfulCreate=").append(isRestfulCreate); + sb.append(", isRestfulUpdate=").append(isRestfulUpdate); + sb.append(", isRestfulDestroy=").append(isRestfulDestroy); + sb.append(", isRestful=").append(isRestful); + sb.append(", isDeprecated=").append(isDeprecated); + sb.append(", isCallbackRequest=").append(isCallbackRequest); + sb.append(", path='").append(path).append('\''); + sb.append(", operationId='").append(operationId).append('\''); + sb.append(", returnType='").append(returnType).append('\''); + sb.append(", httpMethod='").append(httpMethod).append('\''); + sb.append(", returnBaseType='").append(returnBaseType).append('\''); + sb.append(", returnContainer='").append(returnContainer).append('\''); + sb.append(", summary='").append(summary).append('\''); + sb.append(", unescapedNotes='").append(unescapedNotes).append('\''); + sb.append(", notes='").append(notes).append('\''); + sb.append(", baseName='").append(baseName).append('\''); + sb.append(", defaultResponse='").append(defaultResponse).append('\''); + sb.append(", discriminator=").append(discriminator); + sb.append(", consumes=").append(consumes); + sb.append(", produces=").append(produces); + sb.append(", prioritizedContentTypes=").append(prioritizedContentTypes); + sb.append(", servers=").append(servers); + sb.append(", bodyParam=").append(bodyParam); + sb.append(", allParams=").append(allParams); + sb.append(", bodyParams=").append(bodyParams); + sb.append(", pathParams=").append(pathParams); + sb.append(", queryParams=").append(queryParams); + sb.append(", headerParams=").append(headerParams); + sb.append(", formParams=").append(formParams); + sb.append(", cookieParams=").append(cookieParams); + sb.append(", requiredParams=").append(requiredParams); + sb.append(", optionalParams=").append(optionalParams); + sb.append(", authMethods=").append(authMethods); + sb.append(", tags=").append(tags); + sb.append(", responses=").append(responses); + sb.append(", callbacks=").append(callbacks); + sb.append(", imports=").append(imports); + sb.append(", examples=").append(examples); + sb.append(", requestBodyExamples=").append(requestBodyExamples); + sb.append(", externalDocs=").append(externalDocs); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", nickname='").append(nickname).append('\''); + sb.append(", operationIdOriginal='").append(operationIdOriginal).append('\''); + sb.append(", operationIdLowerCase='").append(operationIdLowerCase).append('\''); + sb.append(", operationIdCamelCase='").append(operationIdCamelCase).append('\''); + sb.append(", operationIdSnakeCase='").append(operationIdSnakeCase).append('\''); + sb.append('}'); + return sb.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - CodegenOperation that = (CodegenOperation) o; - - return Objects.equals(responseHeaders, that.responseHeaders) && - Objects.equals(hasAuthMethods, that.hasAuthMethods) && - Objects.equals(hasConsumes, that.hasConsumes) && - Objects.equals(hasProduces, that.hasProduces) && - Objects.equals(hasParams, that.hasParams) && - Objects.equals(hasOptionalParams, that.hasOptionalParams) && - Objects.equals(returnTypeIsPrimitive, that.returnTypeIsPrimitive) && - Objects.equals(returnSimpleType, that.returnSimpleType) && - Objects.equals(subresourceOperation, that.subresourceOperation) && - Objects.equals(isMapContainer, that.isMapContainer) && - Objects.equals(isListContainer, that.isListContainer) && - Objects.equals(isMultipart, that.isMultipart) && - Objects.equals(hasMore, that.hasMore) && - Objects.equals(isResponseBinary, that.isResponseBinary) && - Objects.equals(hasReference, that.hasReference) && - Objects.equals(isResponseFile, that.isResponseFile) && - Objects.equals(isDeprecated, that.isDeprecated) && - Objects.equals(isCallbackRequest, that.isCallbackRequest) && - Objects.equals(path, that.path) && - Objects.equals(operationId, that.operationId) && - Objects.equals(returnType, that.returnType) && - Objects.equals(httpMethod, that.httpMethod) && - Objects.equals(returnBaseType, that.returnBaseType) && - Objects.equals(returnContainer, that.returnContainer) && - Objects.equals(summary, that.summary) && - Objects.equals(unescapedNotes, that.unescapedNotes) && - Objects.equals(notes, that.notes) && - Objects.equals(baseName, that.baseName) && - Objects.equals(defaultResponse, that.defaultResponse) && - Objects.equals(discriminator, that.discriminator) && - Objects.equals(consumes, that.consumes) && - Objects.equals(produces, that.produces) && - Objects.equals(servers, that.servers) && - Objects.equals(bodyParam, that.bodyParam) && - Objects.equals(allParams, that.allParams) && - Objects.equals(bodyParams, that.bodyParams) && - Objects.equals(pathParams, that.pathParams) && - Objects.equals(queryParams, that.queryParams) && - Objects.equals(headerParams, that.headerParams) && - Objects.equals(formParams, that.formParams) && - Objects.equals(cookieParams, that.cookieParams) && - Objects.equals(requiredParams, that.requiredParams) && - Objects.equals(optionalParams, that.optionalParams) && - Objects.equals(authMethods, that.authMethods) && - Objects.equals(tags, that.tags) && - Objects.equals(responses, that.responses) && - Objects.equals(callbacks, that.callbacks) && - Objects.equals(imports, that.imports) && - Objects.equals(examples, that.examples) && - Objects.equals(externalDocs, that.externalDocs) && - Objects.equals(vendorExtensions, that.vendorExtensions) && - Objects.equals(nickname, that.nickname) && - Objects.equals(prioritizedContentTypes, that.prioritizedContentTypes) && - Objects.equals(operationIdOriginal, that.operationIdOriginal) && - Objects.equals(operationIdLowerCase, that.operationIdLowerCase) && - Objects.equals(operationIdCamelCase, that.operationIdCamelCase); + return hasAuthMethods == that.hasAuthMethods && + hasConsumes == that.hasConsumes && + hasProduces == that.hasProduces && + hasParams == that.hasParams && + hasOptionalParams == that.hasOptionalParams && + hasRequiredParams == that.hasRequiredParams && + returnTypeIsPrimitive == that.returnTypeIsPrimitive && + returnSimpleType == that.returnSimpleType && + subresourceOperation == that.subresourceOperation && + isMapContainer == that.isMapContainer && + isListContainer == that.isListContainer && + isMultipart == that.isMultipart && + hasMore == that.hasMore && + isResponseBinary == that.isResponseBinary && + isResponseFile == that.isResponseFile && + hasReference == that.hasReference && + isRestfulIndex == that.isRestfulIndex && + isRestfulShow == that.isRestfulShow && + isRestfulCreate == that.isRestfulCreate && + isRestfulUpdate == that.isRestfulUpdate && + isRestfulDestroy == that.isRestfulDestroy && + isRestful == that.isRestful && + isDeprecated == that.isDeprecated && + isCallbackRequest == that.isCallbackRequest && + Objects.equals(responseHeaders, that.responseHeaders) && + Objects.equals(path, that.path) && + Objects.equals(operationId, that.operationId) && + Objects.equals(returnType, that.returnType) && + Objects.equals(httpMethod, that.httpMethod) && + Objects.equals(returnBaseType, that.returnBaseType) && + Objects.equals(returnContainer, that.returnContainer) && + Objects.equals(summary, that.summary) && + Objects.equals(unescapedNotes, that.unescapedNotes) && + Objects.equals(notes, that.notes) && + Objects.equals(baseName, that.baseName) && + Objects.equals(defaultResponse, that.defaultResponse) && + Objects.equals(discriminator, that.discriminator) && + Objects.equals(consumes, that.consumes) && + Objects.equals(produces, that.produces) && + Objects.equals(prioritizedContentTypes, that.prioritizedContentTypes) && + Objects.equals(servers, that.servers) && + Objects.equals(bodyParam, that.bodyParam) && + Objects.equals(allParams, that.allParams) && + Objects.equals(bodyParams, that.bodyParams) && + Objects.equals(pathParams, that.pathParams) && + Objects.equals(queryParams, that.queryParams) && + Objects.equals(headerParams, that.headerParams) && + Objects.equals(formParams, that.formParams) && + Objects.equals(cookieParams, that.cookieParams) && + Objects.equals(requiredParams, that.requiredParams) && + Objects.equals(optionalParams, that.optionalParams) && + Objects.equals(authMethods, that.authMethods) && + Objects.equals(tags, that.tags) && + Objects.equals(responses, that.responses) && + Objects.equals(callbacks, that.callbacks) && + Objects.equals(imports, that.imports) && + Objects.equals(examples, that.examples) && + Objects.equals(requestBodyExamples, that.requestBodyExamples) && + Objects.equals(externalDocs, that.externalDocs) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(nickname, that.nickname) && + Objects.equals(operationIdOriginal, that.operationIdOriginal) && + Objects.equals(operationIdLowerCase, that.operationIdLowerCase) && + Objects.equals(operationIdCamelCase, that.operationIdCamelCase) && + Objects.equals(operationIdSnakeCase, that.operationIdSnakeCase); } @Override public int hashCode() { - return Objects.hash( - responseHeaders, - hasAuthMethods, - hasConsumes, - hasProduces, - hasParams, - hasOptionalParams, - returnTypeIsPrimitive, - returnSimpleType, - subresourceOperation, - isMapContainer, - isListContainer, - isMultipart, - hasMore, - isResponseBinary, - isResponseFile, - hasReference, - isDeprecated, - isCallbackRequest, - path, - operationId, - returnType, - httpMethod, - returnBaseType, - returnContainer, - summary, - unescapedNotes, - notes, - baseName, - defaultResponse, - discriminator, - consumes, - produces, - servers, - bodyParam, - allParams, - bodyParams, - pathParams, - queryParams, - headerParams, - formParams, - cookieParams, - requiredParams, - optionalParams, - authMethods, - tags, - responses, - callbacks, - imports, - examples, - externalDocs, - vendorExtensions, - nickname, - prioritizedContentTypes, - operationIdOriginal, - operationIdLowerCase, - operationIdCamelCase); + + return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams, + hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMapContainer, + isListContainer, isMultipart, hasMore, isResponseBinary, isResponseFile, hasReference, isRestfulIndex, + isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestful, isDeprecated, + isCallbackRequest, path, operationId, returnType, httpMethod, returnBaseType, returnContainer, + summary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes, produces, + prioritizedContentTypes, servers, bodyParam, allParams, bodyParams, pathParams, queryParams, + headerParams, formParams, cookieParams, requiredParams, optionalParams, authMethods, tags, + responses, callbacks, imports, examples, requestBodyExamples, externalDocs, vendorExtensions, + nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase, operationIdSnakeCase); } - - } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index 1e8c89b6408e..15979f7ad613 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -43,6 +43,167 @@ public class CodegenParameter { public CodegenProperty mostInnerItems; public Map vendorExtensions = new HashMap(); public boolean hasValidation; + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenParameter{"); + sb.append("isFormParam=").append(isFormParam); + sb.append(", isQueryParam=").append(isQueryParam); + sb.append(", isPathParam=").append(isPathParam); + sb.append(", isHeaderParam=").append(isHeaderParam); + sb.append(", isCookieParam=").append(isCookieParam); + sb.append(", isBodyParam=").append(isBodyParam); + sb.append(", hasMore=").append(hasMore); + sb.append(", isContainer=").append(isContainer); + sb.append(", secondaryParam=").append(secondaryParam); + sb.append(", isCollectionFormatMulti=").append(isCollectionFormatMulti); + sb.append(", isPrimitiveType=").append(isPrimitiveType); + sb.append(", isModel=").append(isModel); + sb.append(", isExplode=").append(isExplode); + sb.append(", baseName='").append(baseName).append('\''); + sb.append(", paramName='").append(paramName).append('\''); + sb.append(", dataType='").append(dataType).append('\''); + sb.append(", datatypeWithEnum='").append(datatypeWithEnum).append('\''); + sb.append(", dataFormat='").append(dataFormat).append('\''); + sb.append(", collectionFormat='").append(collectionFormat).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", unescapedDescription='").append(unescapedDescription).append('\''); + sb.append(", baseType='").append(baseType).append('\''); + sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", enumName='").append(enumName).append('\''); + sb.append(", style='").append(style).append('\''); + sb.append(", example='").append(example).append('\''); + sb.append(", jsonSchema='").append(jsonSchema).append('\''); + sb.append(", isString=").append(isString); + sb.append(", isNumeric=").append(isNumeric); + sb.append(", isInteger=").append(isInteger); + sb.append(", isLong=").append(isLong); + sb.append(", isNumber=").append(isNumber); + sb.append(", isFloat=").append(isFloat); + sb.append(", isDouble=").append(isDouble); + sb.append(", isByteArray=").append(isByteArray); + sb.append(", isBinary=").append(isBinary); + sb.append(", isBoolean=").append(isBoolean); + sb.append(", isDate=").append(isDate); + sb.append(", isDateTime=").append(isDateTime); + sb.append(", isUuid=").append(isUuid); + sb.append(", isUri=").append(isUri); + sb.append(", isEmail=").append(isEmail); + sb.append(", isFreeFormObject=").append(isFreeFormObject); + sb.append(", isListContainer=").append(isListContainer); + sb.append(", isMapContainer=").append(isMapContainer); + sb.append(", isFile=").append(isFile); + sb.append(", isEnum=").append(isEnum); + sb.append(", _enum=").append(_enum); + sb.append(", allowableValues=").append(allowableValues); + sb.append(", items=").append(items); + sb.append(", mostInnerItems=").append(mostInnerItems); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", hasValidation=").append(hasValidation); + sb.append(", isNullable=").append(isNullable); + sb.append(", required=").append(required); + sb.append(", maximum='").append(maximum).append('\''); + sb.append(", exclusiveMaximum=").append(exclusiveMaximum); + sb.append(", minimum='").append(minimum).append('\''); + sb.append(", exclusiveMinimum=").append(exclusiveMinimum); + sb.append(", maxLength=").append(maxLength); + sb.append(", minLength=").append(minLength); + sb.append(", pattern='").append(pattern).append('\''); + sb.append(", maxItems=").append(maxItems); + sb.append(", minItems=").append(minItems); + sb.append(", uniqueItems=").append(uniqueItems); + sb.append(", multipleOf=").append(multipleOf); + sb.append('}'); + return sb.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenParameter that = (CodegenParameter) o; + return isFormParam == that.isFormParam && + isQueryParam == that.isQueryParam && + isPathParam == that.isPathParam && + isHeaderParam == that.isHeaderParam && + isCookieParam == that.isCookieParam && + isBodyParam == that.isBodyParam && + hasMore == that.hasMore && + isContainer == that.isContainer && + secondaryParam == that.secondaryParam && + isCollectionFormatMulti == that.isCollectionFormatMulti && + isPrimitiveType == that.isPrimitiveType && + isModel == that.isModel && + isExplode == that.isExplode && + isString == that.isString && + isNumeric == that.isNumeric && + isInteger == that.isInteger && + isLong == that.isLong && + isNumber == that.isNumber && + isFloat == that.isFloat && + isDouble == that.isDouble && + isByteArray == that.isByteArray && + isBinary == that.isBinary && + isBoolean == that.isBoolean && + isDate == that.isDate && + isDateTime == that.isDateTime && + isUuid == that.isUuid && + isUri == that.isUri && + isEmail == that.isEmail && + isFreeFormObject == that.isFreeFormObject && + isListContainer == that.isListContainer && + isMapContainer == that.isMapContainer && + isFile == that.isFile && + isEnum == that.isEnum && + hasValidation == that.hasValidation && + isNullable == that.isNullable && + required == that.required && + exclusiveMaximum == that.exclusiveMaximum && + exclusiveMinimum == that.exclusiveMinimum && + uniqueItems == that.uniqueItems && + Objects.equals(baseName, that.baseName) && + Objects.equals(paramName, that.paramName) && + Objects.equals(dataType, that.dataType) && + Objects.equals(datatypeWithEnum, that.datatypeWithEnum) && + Objects.equals(dataFormat, that.dataFormat) && + Objects.equals(collectionFormat, that.collectionFormat) && + Objects.equals(description, that.description) && + Objects.equals(unescapedDescription, that.unescapedDescription) && + Objects.equals(baseType, that.baseType) && + Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(enumName, that.enumName) && + Objects.equals(style, that.style) && + Objects.equals(example, that.example) && + Objects.equals(jsonSchema, that.jsonSchema) && + Objects.equals(_enum, that._enum) && + Objects.equals(allowableValues, that.allowableValues) && + Objects.equals(items, that.items) && + Objects.equals(mostInnerItems, that.mostInnerItems) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(maximum, that.maximum) && + Objects.equals(minimum, that.minimum) && + Objects.equals(maxLength, that.maxLength) && + Objects.equals(minLength, that.minLength) && + Objects.equals(pattern, that.pattern) && + Objects.equals(maxItems, that.maxItems) && + Objects.equals(minItems, that.minItems) && + Objects.equals(multipleOf, that.multipleOf); + } + + @Override + public int hashCode() { + + return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, + isContainer, secondaryParam, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, + paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, + baseType, defaultValue, enumName, style, example, jsonSchema, isString, isNumeric, isInteger, isLong, + isNumber, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, + isEmail, isFreeFormObject, isListContainer, isMapContainer, isFile, isEnum, _enum, allowableValues, + items, mostInnerItems, vendorExtensions, hasValidation, isNullable, required, maximum, + exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, maxItems, minItems, + uniqueItems, multipleOf); + } + public boolean isNullable; /** @@ -179,222 +340,5 @@ public class CodegenParameter { return output; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CodegenParameter that = (CodegenParameter) o; - - return Objects.equals(isEnum, that.isEnum) && - Objects.equals(isFormParam, that.isFormParam) && - Objects.equals(isQueryParam, that.isQueryParam) && - Objects.equals(isPathParam, that.isPathParam) && - Objects.equals(isHeaderParam, that.isHeaderParam) && - Objects.equals(isCookieParam, that.isCookieParam) && - Objects.equals(isBodyParam, that.isBodyParam) && - Objects.equals(hasMore, that.hasMore) && - Objects.equals(isContainer, that.isContainer) && - Objects.equals(secondaryParam, that.secondaryParam) && - Objects.equals(isCollectionFormatMulti, that.isCollectionFormatMulti) && - Objects.equals(isPrimitiveType, that.isPrimitiveType) && - Objects.equals(isModel, that.isModel) && - Objects.equals(baseName, that.baseName) && - Objects.equals(paramName, that.paramName) && - Objects.equals(dataType, that.dataType) && - Objects.equals(datatypeWithEnum, that.datatypeWithEnum) && - Objects.equals(enumName, that.enumName) && - Objects.equals(dataFormat, that.dataFormat) && - Objects.equals(collectionFormat, that.collectionFormat) && - Objects.equals(description, that.description) && - Objects.equals(unescapedDescription, that.unescapedDescription) && - Objects.equals(baseType, that.baseType) && - Objects.equals(defaultValue, that.defaultValue) && - Objects.equals(example, that.example) && - Objects.equals(jsonSchema, that.jsonSchema) && - Objects.equals(isString, that.isString) && - Objects.equals(isNumeric, that.isNumeric) && - Objects.equals(isInteger, that.isInteger) && - Objects.equals(isLong, that.isLong) && - Objects.equals(isNumber, that.isNumber) && - Objects.equals(isFloat, that.isFloat) && - Objects.equals(isDouble, that.isDouble) && - Objects.equals(isByteArray, that.isByteArray) && - Objects.equals(isBinary, that.isBinary) && - Objects.equals(isBoolean, that.isBoolean) && - Objects.equals(isDate, that.isDate) && - Objects.equals(isDateTime, that.isDateTime) && - Objects.equals(isUuid, that.isUuid) && - Objects.equals(isUri, that.isUri) && - Objects.equals(isEmail, that.isEmail) && - Objects.equals(isFreeFormObject, that.isFreeFormObject) && - Objects.equals(isListContainer, that.isListContainer) && - Objects.equals(isMapContainer, that.isMapContainer) && - Objects.equals(isFile, that.isFile) && - Objects.equals(_enum, that._enum) && - Objects.equals(allowableValues, that.allowableValues) && - Objects.equals(items, that.items) && - Objects.equals(mostInnerItems, that.mostInnerItems) && - Objects.equals(vendorExtensions, that.vendorExtensions) && - Objects.equals(hasValidation, that.hasValidation) && - Objects.equals(isNullable, that.isNullable) && - Objects.equals(required, that.required) && - Objects.equals(maximum, that.maximum) && - Objects.equals(exclusiveMaximum, that.exclusiveMaximum) && - Objects.equals(minimum, that.minimum) && - Objects.equals(exclusiveMinimum, that.exclusiveMinimum) && - Objects.equals(maxLength, that.maxLength) && - Objects.equals(minLength, that.minLength) && - Objects.equals(pattern, that.pattern) && - Objects.equals(maxItems, that.maxItems) && - Objects.equals(minItems, that.minItems) && - Objects.equals(uniqueItems, that.uniqueItems) && - Objects.equals(multipleOf, that.multipleOf) && - Objects.equals(isExplode, that.isExplode) && - Objects.equals(style, that.style); - } - - @Override - public int hashCode() { - return Objects.hash( - isFormParam, - isQueryParam, - isPathParam, - isHeaderParam, - isCookieParam, - isBodyParam, - hasMore, - isContainer, - secondaryParam, - isCollectionFormatMulti, - isPrimitiveType, - isModel, - baseName, - paramName, - dataType, - datatypeWithEnum, - enumName, - dataFormat, - collectionFormat, - description, - unescapedDescription, - baseType, - defaultValue, - example, - jsonSchema, - isString, - isNumeric, - isInteger, - isLong, - isFloat, - isNumber, - isDouble, - isByteArray, - isBinary, - isBoolean, - isDate, - isDateTime, - isUuid, - isUri, - isEmail, - isFreeFormObject, - isListContainer, - isMapContainer, - isFile, - isEnum, - _enum, - allowableValues, - items, - mostInnerItems, - vendorExtensions, - hasValidation, - isNullable, - required, - maximum, - exclusiveMaximum, - minimum, - exclusiveMinimum, - maxLength, - minLength, - pattern, - maxItems, - minItems, - uniqueItems, - multipleOf, - isExplode, - style); - } - - @java.lang.Override - public java.lang.String toString() { - return "CodegenParameter{" + - "isFormParam=" + isFormParam + - ", isQueryParam=" + isQueryParam + - ", isPathParam=" + isPathParam + - ", isHeaderParam=" + isHeaderParam + - ", isCookieParam=" + isCookieParam + - ", isBodyParam=" + isBodyParam + - ", hasMore=" + hasMore + - ", isContainer=" + isContainer + - ", secondaryParam=" + secondaryParam + - ", isCollectionFormatMulti=" + isCollectionFormatMulti + - ", isPrimitiveType=" + isPrimitiveType + - ", isModel=" + isModel + - ", baseName='" + baseName + '\'' + - ", paramName='" + paramName + '\'' + - ", dataType='" + dataType + '\'' + - ", datatypeWithEnum='" + datatypeWithEnum + '\'' + - ", dataFormat='" + dataFormat + '\'' + - ", collectionFormat='" + collectionFormat + '\'' + - ", description='" + description + '\'' + - ", unescapedDescription='" + unescapedDescription + '\'' + - ", baseType='" + baseType + '\'' + - ", defaultValue='" + defaultValue + '\'' + - ", enumName='" + enumName + '\'' + - ", example='" + example + '\'' + - ", jsonSchema='" + jsonSchema + '\'' + - ", isString=" + isString + - ", isNumeric=" + isNumeric + - ", isInteger=" + isInteger + - ", isLong=" + isLong + - ", isNumber=" + isNumber + - ", isFloat=" + isFloat + - ", isDouble=" + isDouble + - ", isByteArray=" + isByteArray + - ", isBinary=" + isBinary + - ", isBoolean=" + isBoolean + - ", isDate=" + isDate + - ", isDateTime=" + isDateTime + - ", isUuid=" + isUuid + - ", isUri=" + isUri + - ", isEmail=" + isEmail + - ", isFreeFormObject=" + isFreeFormObject + - ", isListContainer=" + isListContainer + - ", isMapContainer=" + isMapContainer + - ", isFile=" + isFile + - ", isEnum=" + isEnum + - ", _enum=" + _enum + - ", allowableValues=" + allowableValues + - ", items=" + items + - ", mostInnerItems=" + mostInnerItems + - ", vendorExtensions=" + vendorExtensions + - ", hasValidation=" + hasValidation + - ", isNullable=" + isNullable + - ", required=" + required + - ", maximum='" + maximum + '\'' + - ", exclusiveMaximum=" + exclusiveMaximum + - ", minimum='" + minimum + '\'' + - ", exclusiveMinimum=" + exclusiveMinimum + - ", maxLength=" + maxLength + - ", minLength=" + minLength + - ", pattern='" + pattern + '\'' + - ", maxItems=" + maxItems + - ", minItems=" + minItems + - ", uniqueItems=" + uniqueItems + - ", multipleOf=" + multipleOf + - ", isExplode=" + isExplode + - ", style='" + style + '\'' + - '}'; - } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index 137e2596925b..2b36fd5a2275 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -410,170 +410,6 @@ public class CodegenProperty implements Cloneable { this.xmlNamespace = xmlNamespace; } - @Override - public int hashCode() { - return Objects.hash( - _enum, - allowableValues, - openApiType, - baseName, - baseType, - complexType, - containerType, - dataType, - datatypeWithEnum, - dataFormat, - defaultValue, - defaultValueWithParam, - description, - title, - example, - exclusiveMaximum, - exclusiveMinimum, - getter, - hasMore, - hasMoreNonReadOnly, - isContainer, - isEnum, - isPrimitiveType, - isModel, - isReadOnly, - isWriteOnly, - isNullable, - isSelfReference, - items, - mostInnerItems, - jsonSchema, - max, - maxLength, - maximum, - min, - minLength, - minimum, - name, - pattern, - required, - secondaryParam, - setter, - unescapedDescription, - vendorExtensions, - hasValidation, - isString, - isNumeric, - isInteger, - isLong, - isNumber, - isFloat, - isDouble, - isByteArray, - isBinary, - isFile, - isBoolean, - isDate, - isDateTime, - isUuid, - isUri, - isEmail, - isFreeFormObject, - isMapContainer, - isListContainer, - isInherited, - discriminatorValue, - nameInCamelCase, - nameInSnakeCase, - enumName, - maxItems, - minItems, - isXmlAttribute, - xmlPrefix, - xmlName, - xmlNamespace, - isXmlWrapped); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - - final CodegenProperty other = (CodegenProperty) obj; - - return Objects.equals(baseName, other.baseName) && - Objects.equals(openApiType, other.openApiType) && - Objects.equals(complexType, other.complexType) && - Objects.equals(getter, other.getter) && - Objects.equals(setter, other.setter) && - Objects.equals(description, other.description) && - Objects.equals(title, other.title) && - Objects.equals(dataType, other.dataType) && - Objects.equals(datatypeWithEnum, other.datatypeWithEnum) && - Objects.equals(dataFormat, other.dataFormat) && - Objects.equals(name, other.name) && - Objects.equals(min, other.min) && - Objects.equals(max, other.max) && - Objects.equals(defaultValue, other.defaultValue) && - Objects.equals(baseType, other.baseType) && - Objects.equals(containerType, other.containerType) && - Objects.equals(maxLength, other.maxLength) && - Objects.equals(minLength, other.minLength) && - Objects.equals(pattern, other.pattern) && - Objects.equals(example, other.example) && - Objects.equals(jsonSchema, other.jsonSchema) && - Objects.equals(minimum, other.minimum) && - Objects.equals(maximum, other.maximum) && - Objects.equals(exclusiveMinimum, other.exclusiveMinimum) && - Objects.equals(exclusiveMaximum, other.exclusiveMaximum) && - Objects.equals(required, other.required) && - Objects.equals(secondaryParam, other.secondaryParam) && - Objects.equals(isPrimitiveType, other.isPrimitiveType) && - Objects.equals(isModel, other.isModel) && - Objects.equals(isContainer, other.isContainer) && - Objects.equals(isEnum, other.isEnum) && - Objects.equals(isReadOnly, other.isReadOnly) && - Objects.equals(isWriteOnly, other.isWriteOnly) && - Objects.equals(isNullable, other.isNullable) && - Objects.equals(isSelfReference, other.isSelfReference) && - Objects.equals(_enum, other._enum) && - Objects.equals(allowableValues, other.allowableValues) && - Objects.equals(vendorExtensions, other.vendorExtensions) && - Objects.equals(hasValidation, other.hasValidation) && - Objects.equals(isString, other.isString) && - Objects.equals(isNumeric, other.isNumeric) && - Objects.equals(isInteger, other.isInteger) && - Objects.equals(isLong, other.isLong) && - Objects.equals(isNumber, other.isNumber) && - Objects.equals(isFloat, other.isFloat) && - Objects.equals(isDouble, other.isDouble) && - Objects.equals(isByteArray, other.isByteArray) && - Objects.equals(isBoolean, other.isBoolean) && - Objects.equals(isDate, other.isDate) && - Objects.equals(isDateTime, other.isDateTime) && - Objects.equals(isUuid, other.isUuid) && - Objects.equals(isUri, other.isUri) && - Objects.equals(isEmail, other.isEmail) && - Objects.equals(isFreeFormObject, other.isFreeFormObject) && - Objects.equals(isBinary, other.isBinary) && - Objects.equals(isFile, other.isFile) && - Objects.equals(isListContainer, other.isListContainer) && - Objects.equals(isMapContainer, other.isMapContainer) && - Objects.equals(isInherited, other.isInherited) && - Objects.equals(discriminatorValue, other.discriminatorValue) && - Objects.equals(nameInCamelCase, other.nameInCamelCase) && - Objects.equals(nameInSnakeCase, other.nameInSnakeCase) && - Objects.equals(enumName, other.enumName) && - Objects.equals(maxItems, other.maxItems) && - Objects.equals(minItems, other.minItems) && - Objects.equals(isXmlAttribute, other.isXmlAttribute) && - Objects.equals(xmlPrefix, other.xmlPrefix) && - Objects.equals(xmlName, other.xmlName) && - Objects.equals(xmlNamespace, other.xmlNamespace) && - Objects.equals(isXmlWrapped, other.isXmlWrapped); - } - @Override public CodegenProperty clone() { try { @@ -600,86 +436,185 @@ public class CodegenProperty implements Cloneable { } } - @java.lang.Override - public java.lang.String toString() { - return "CodegenProperty{" + - "baseName='" + baseName + '\'' + - ", openApiType='" + openApiType + '\'' + - ", complexType='" + complexType + '\'' + - ", getter='" + getter + '\'' + - ", setter='" + setter + '\'' + - ", description='" + description + '\'' + - ", datatype='" + dataType + '\'' + - ", datatypeWithEnum='" + datatypeWithEnum + '\'' + - ", dataFormat='" + dataFormat + '\'' + - ", name='" + name + '\'' + - ", min='" + min + '\'' + - ", max='" + max + '\'' + - ", defaultValue='" + defaultValue + '\'' + - ", defaultValueWithParam='" + defaultValueWithParam + '\'' + - ", baseType='" + baseType + '\'' + - ", containerType='" + containerType + '\'' + - ", title='" + title + '\'' + - ", unescapedDescription='" + unescapedDescription + '\'' + - ", maxLength=" + maxLength + - ", minLength=" + minLength + - ", pattern='" + pattern + '\'' + - ", example='" + example + '\'' + - ", jsonSchema='" + jsonSchema + '\'' + - ", minimum='" + minimum + '\'' + - ", maximum='" + maximum + '\'' + - ", exclusiveMinimum=" + exclusiveMinimum + - ", exclusiveMaximum=" + exclusiveMaximum + - ", hasMore=" + hasMore + - ", required=" + required + - ", secondaryParam=" + secondaryParam + - ", hasMoreNonReadOnly=" + hasMoreNonReadOnly + - ", isPrimitiveType=" + isPrimitiveType + - ", isModel=" + isModel + - ", isContainer=" + isContainer + - ", isString=" + isString + - ", isNumeric=" + isNumeric + - ", isInteger=" + isInteger + - ", isLong=" + isLong + - ", isNumber=" + isNumber + - ", isFloat=" + isFloat + - ", isDouble=" + isDouble + - ", isByteArray=" + isByteArray + - ", isBinary=" + isBinary + - ", isFile=" + isFile + - ", isBoolean=" + isBoolean + - ", isDate=" + isDate + - ", isDateTime=" + isDateTime + - ", isUuid=" + isUuid + - ", isUri=" + isUri + - ", isEmail=" + isEmail + - ", isFreeFormObject=" + isFreeFormObject + - ", isListContainer=" + isListContainer + - ", isMapContainer=" + isMapContainer + - ", isEnum=" + isEnum + - ", isReadOnly=" + isReadOnly + - ", isWriteOnly=" + isWriteOnly + - ", isNullable=" + isNullable + - ", isSelfReference=" + isSelfReference + - ", _enum=" + _enum + - ", allowableValues=" + allowableValues + - ", items=" + items + - ", mostInnerItems=" + mostInnerItems + - ", vendorExtensions=" + vendorExtensions + - ", hasValidation=" + hasValidation + - ", isInherited=" + isInherited + - ", discriminatorValue='" + discriminatorValue + '\'' + - ", nameInCamelCase='" + nameInCamelCase + '\'' + - ", enumName='" + enumName + '\'' + - ", maxItems=" + maxItems + - ", minItems=" + minItems + - ", isXmlAttribute=" + isXmlAttribute + - ", xmlPrefix='" + xmlPrefix + '\'' + - ", xmlName='" + xmlName + '\'' + - ", xmlNamespace='" + xmlNamespace + '\'' + - ", isXmlWrapped=" + isXmlWrapped + - '}'; + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenProperty{"); + sb.append("openApiType='").append(openApiType).append('\''); + sb.append(", baseName='").append(baseName).append('\''); + sb.append(", complexType='").append(complexType).append('\''); + sb.append(", getter='").append(getter).append('\''); + sb.append(", setter='").append(setter).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", dataType='").append(dataType).append('\''); + sb.append(", datatypeWithEnum='").append(datatypeWithEnum).append('\''); + sb.append(", dataFormat='").append(dataFormat).append('\''); + sb.append(", name='").append(name).append('\''); + sb.append(", min='").append(min).append('\''); + sb.append(", max='").append(max).append('\''); + sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", defaultValueWithParam='").append(defaultValueWithParam).append('\''); + sb.append(", baseType='").append(baseType).append('\''); + sb.append(", containerType='").append(containerType).append('\''); + sb.append(", title='").append(title).append('\''); + sb.append(", unescapedDescription='").append(unescapedDescription).append('\''); + sb.append(", maxLength=").append(maxLength); + sb.append(", minLength=").append(minLength); + sb.append(", pattern='").append(pattern).append('\''); + sb.append(", example='").append(example).append('\''); + sb.append(", jsonSchema='").append(jsonSchema).append('\''); + sb.append(", minimum='").append(minimum).append('\''); + sb.append(", maximum='").append(maximum).append('\''); + sb.append(", exclusiveMinimum=").append(exclusiveMinimum); + sb.append(", exclusiveMaximum=").append(exclusiveMaximum); + sb.append(", hasMore=").append(hasMore); + sb.append(", required=").append(required); + sb.append(", secondaryParam=").append(secondaryParam); + sb.append(", hasMoreNonReadOnly=").append(hasMoreNonReadOnly); + sb.append(", isPrimitiveType=").append(isPrimitiveType); + sb.append(", isModel=").append(isModel); + sb.append(", isContainer=").append(isContainer); + sb.append(", isString=").append(isString); + sb.append(", isNumeric=").append(isNumeric); + sb.append(", isInteger=").append(isInteger); + sb.append(", isLong=").append(isLong); + sb.append(", isNumber=").append(isNumber); + sb.append(", isFloat=").append(isFloat); + sb.append(", isDouble=").append(isDouble); + sb.append(", isByteArray=").append(isByteArray); + sb.append(", isBinary=").append(isBinary); + sb.append(", isFile=").append(isFile); + sb.append(", isBoolean=").append(isBoolean); + sb.append(", isDate=").append(isDate); + sb.append(", isDateTime=").append(isDateTime); + sb.append(", isUuid=").append(isUuid); + sb.append(", isUri=").append(isUri); + sb.append(", isEmail=").append(isEmail); + sb.append(", isFreeFormObject=").append(isFreeFormObject); + sb.append(", isListContainer=").append(isListContainer); + sb.append(", isMapContainer=").append(isMapContainer); + sb.append(", isEnum=").append(isEnum); + sb.append(", isReadOnly=").append(isReadOnly); + sb.append(", isWriteOnly=").append(isWriteOnly); + sb.append(", isNullable=").append(isNullable); + sb.append(", isSelfReference=").append(isSelfReference); + sb.append(", _enum=").append(_enum); + sb.append(", allowableValues=").append(allowableValues); + sb.append(", items=").append(items); + sb.append(", mostInnerItems=").append(mostInnerItems); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", hasValidation=").append(hasValidation); + sb.append(", isInherited=").append(isInherited); + sb.append(", discriminatorValue='").append(discriminatorValue).append('\''); + sb.append(", nameInCamelCase='").append(nameInCamelCase).append('\''); + sb.append(", nameInSnakeCase='").append(nameInSnakeCase).append('\''); + sb.append(", enumName='").append(enumName).append('\''); + sb.append(", maxItems=").append(maxItems); + sb.append(", minItems=").append(minItems); + sb.append(", isXmlAttribute=").append(isXmlAttribute); + sb.append(", xmlPrefix='").append(xmlPrefix).append('\''); + sb.append(", xmlName='").append(xmlName).append('\''); + sb.append(", xmlNamespace='").append(xmlNamespace).append('\''); + sb.append(", isXmlWrapped=").append(isXmlWrapped); + sb.append('}'); + return sb.toString(); } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenProperty that = (CodegenProperty) o; + return exclusiveMinimum == that.exclusiveMinimum && + exclusiveMaximum == that.exclusiveMaximum && + hasMore == that.hasMore && + required == that.required && + secondaryParam == that.secondaryParam && + hasMoreNonReadOnly == that.hasMoreNonReadOnly && + isPrimitiveType == that.isPrimitiveType && + isModel == that.isModel && + isContainer == that.isContainer && + isString == that.isString && + isNumeric == that.isNumeric && + isInteger == that.isInteger && + isLong == that.isLong && + isNumber == that.isNumber && + isFloat == that.isFloat && + isDouble == that.isDouble && + isByteArray == that.isByteArray && + isBinary == that.isBinary && + isFile == that.isFile && + isBoolean == that.isBoolean && + isDate == that.isDate && + isDateTime == that.isDateTime && + isUuid == that.isUuid && + isUri == that.isUri && + isEmail == that.isEmail && + isFreeFormObject == that.isFreeFormObject && + isListContainer == that.isListContainer && + isMapContainer == that.isMapContainer && + isEnum == that.isEnum && + isReadOnly == that.isReadOnly && + isWriteOnly == that.isWriteOnly && + isNullable == that.isNullable && + isSelfReference == that.isSelfReference && + hasValidation == that.hasValidation && + isInherited == that.isInherited && + isXmlAttribute == that.isXmlAttribute && + isXmlWrapped == that.isXmlWrapped && + Objects.equals(openApiType, that.openApiType) && + Objects.equals(baseName, that.baseName) && + Objects.equals(complexType, that.complexType) && + Objects.equals(getter, that.getter) && + Objects.equals(setter, that.setter) && + Objects.equals(description, that.description) && + Objects.equals(dataType, that.dataType) && + Objects.equals(datatypeWithEnum, that.datatypeWithEnum) && + Objects.equals(dataFormat, that.dataFormat) && + Objects.equals(name, that.name) && + Objects.equals(min, that.min) && + Objects.equals(max, that.max) && + Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(defaultValueWithParam, that.defaultValueWithParam) && + Objects.equals(baseType, that.baseType) && + Objects.equals(containerType, that.containerType) && + Objects.equals(title, that.title) && + Objects.equals(unescapedDescription, that.unescapedDescription) && + Objects.equals(maxLength, that.maxLength) && + Objects.equals(minLength, that.minLength) && + Objects.equals(pattern, that.pattern) && + Objects.equals(example, that.example) && + Objects.equals(jsonSchema, that.jsonSchema) && + Objects.equals(minimum, that.minimum) && + Objects.equals(maximum, that.maximum) && + Objects.equals(_enum, that._enum) && + Objects.equals(allowableValues, that.allowableValues) && + Objects.equals(items, that.items) && + Objects.equals(mostInnerItems, that.mostInnerItems) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(discriminatorValue, that.discriminatorValue) && + Objects.equals(nameInCamelCase, that.nameInCamelCase) && + Objects.equals(nameInSnakeCase, that.nameInSnakeCase) && + Objects.equals(enumName, that.enumName) && + Objects.equals(maxItems, that.maxItems) && + Objects.equals(minItems, that.minItems) && + Objects.equals(xmlPrefix, that.xmlPrefix) && + Objects.equals(xmlName, that.xmlName) && + Objects.equals(xmlNamespace, that.xmlNamespace); + } + @Override + public int hashCode() { + + return Objects.hash(openApiType, baseName, complexType, getter, setter, description, dataType, + datatypeWithEnum, dataFormat, name, min, max, defaultValue, defaultValueWithParam, baseType, + containerType, title, unescapedDescription, maxLength, minLength, pattern, example, jsonSchema, + minimum, maximum, exclusiveMinimum, exclusiveMaximum, hasMore, required, secondaryParam, + hasMoreNonReadOnly, isPrimitiveType, isModel, isContainer, isString, isNumeric, isInteger, + isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, + isUuid, isUri, isEmail, isFreeFormObject, isListContainer, isMapContainer, isEnum, isReadOnly, + isWriteOnly, isNullable, isSelfReference, _enum, allowableValues, items, mostInnerItems, + vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase, nameInSnakeCase, + enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName, xmlNamespace, isXmlWrapped); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index e4241ee00eb9..42120f9ea5dc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -43,46 +43,6 @@ public class CodegenResponse { return "0".equals(code) || "default".equals(code); } - @Override - public String toString() { - return "CodegenResponse{" + - "headers=" + headers + - ", code='" + code + '\'' + - ", message='" + message + '\'' + - ", hasMore=" + hasMore + - ", examples=" + examples + - ", dataType='" + dataType + '\'' + - ", baseType='" + baseType + '\'' + - ", containerType='" + containerType + '\'' + - ", hasHeaders=" + hasHeaders + - ", isString=" + isString + - ", isNumeric=" + isNumeric + - ", isInteger=" + isInteger + - ", isLong=" + isLong + - ", isNumber=" + isNumber + - ", isFloat=" + isFloat + - ", isDouble=" + isDouble + - ", isByteArray=" + isByteArray + - ", isBoolean=" + isBoolean + - ", isDate=" + isDate + - ", isDateTime=" + isDateTime + - ", isUuid=" + isUuid + - ", isEmail=" + isEmail + - ", isFreeFormObject=" + isFreeFormObject + - ", isModel=" + isModel + - ", isDefault=" + isDefault + - ", simpleType=" + simpleType + - ", primitiveType=" + primitiveType + - ", isMapContainer=" + isMapContainer + - ", isListContainer=" + isListContainer + - ", isBinary=" + isBinary + - ", isFile=" + isFile + - ", schema=" + schema + - ", jsonSchema='" + jsonSchema + '\'' + - ", vendorExtensions=" + vendorExtensions + - '}'; - } - @Override public boolean equals(Object o) { if (this == o) return true; @@ -103,8 +63,8 @@ public class CodegenResponse { isDateTime == that.isDateTime && isUuid == that.isUuid && isEmail == that.isEmail && - isFreeFormObject == that.isFreeFormObject && isModel == that.isModel && + isFreeFormObject == that.isFreeFormObject && isDefault == that.isDefault && simpleType == that.simpleType && primitiveType == that.primitiveType && @@ -126,9 +86,51 @@ public class CodegenResponse { @Override public int hashCode() { - return Objects.hash(headers, code, message, hasMore, examples, dataType, baseType, containerType, hasHeaders, - isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBoolean, isDate, - isDateTime, isUuid, isEmail, isFreeFormObject, isModel, isDefault, simpleType, primitiveType, isMapContainer, - isListContainer, isBinary, isFile, schema, jsonSchema, vendorExtensions); + + return Objects.hash(headers, code, message, hasMore, examples, dataType, baseType, containerType, + hasHeaders, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, + isBoolean, isDate, isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isDefault, simpleType, + primitiveType, isMapContainer, isListContainer, isBinary, isFile, schema, jsonSchema, vendorExtensions); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenResponse{"); + sb.append("headers=").append(headers); + sb.append(", code='").append(code).append('\''); + sb.append(", message='").append(message).append('\''); + sb.append(", hasMore=").append(hasMore); + sb.append(", examples=").append(examples); + sb.append(", dataType='").append(dataType).append('\''); + sb.append(", baseType='").append(baseType).append('\''); + sb.append(", containerType='").append(containerType).append('\''); + sb.append(", hasHeaders=").append(hasHeaders); + sb.append(", isString=").append(isString); + sb.append(", isNumeric=").append(isNumeric); + sb.append(", isInteger=").append(isInteger); + sb.append(", isLong=").append(isLong); + sb.append(", isNumber=").append(isNumber); + sb.append(", isFloat=").append(isFloat); + sb.append(", isDouble=").append(isDouble); + sb.append(", isByteArray=").append(isByteArray); + sb.append(", isBoolean=").append(isBoolean); + sb.append(", isDate=").append(isDate); + sb.append(", isDateTime=").append(isDateTime); + sb.append(", isUuid=").append(isUuid); + sb.append(", isEmail=").append(isEmail); + sb.append(", isModel=").append(isModel); + sb.append(", isFreeFormObject=").append(isFreeFormObject); + sb.append(", isDefault=").append(isDefault); + sb.append(", simpleType=").append(simpleType); + sb.append(", primitiveType=").append(primitiveType); + sb.append(", isMapContainer=").append(isMapContainer); + sb.append(", isListContainer=").append(isListContainer); + sb.append(", isBinary=").append(isBinary); + sb.append(", isFile=").append(isFile); + sb.append(", schema=").append(schema); + sb.append(", jsonSchema='").append(jsonSchema).append('\''); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append('}'); + return sb.toString(); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenSecurity.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenSecurity.java index ea51d6ff5593..e7abb8c90d1a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenSecurity.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenSecurity.java @@ -41,67 +41,6 @@ public class CodegenSecurity { public List> scopes; public Boolean isCode, isPassword, isApplication, isImplicit; - @Override - public String toString() { - return String.format(Locale.ROOT, "%s(%s)", name, type); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CodegenSecurity that = (CodegenSecurity) o; - - return Objects.equals(name, that.name) && - Objects.equals(type, that.type) && - Objects.equals(hasMore, that.hasMore) && - Objects.equals(isBasic, that.isBasic) && - Objects.equals(isBasicBasic, that.isBasicBasic) && - Objects.equals(isBasicBearer, that.isBasicBearer) && - Objects.equals(bearerFormat, that.bearerFormat) && - Objects.equals(isOAuth, that.isOAuth) && - Objects.equals(isApiKey, that.isApiKey) && - Objects.equals(vendorExtensions, that.vendorExtensions) && - Objects.equals(keyParamName, that.keyParamName) && - Objects.equals(isKeyInQuery, that.isKeyInQuery) && - Objects.equals(isKeyInHeader, that.isKeyInHeader) && - Objects.equals(flow, that.flow) && - Objects.equals(authorizationUrl, that.authorizationUrl) && - Objects.equals(tokenUrl, that.tokenUrl) && - Objects.equals(isCode, that.isCode) && - Objects.equals(isPassword, that.isPassword) && - Objects.equals(isApplication, that.isApplication) && - Objects.equals(isImplicit, that.isImplicit) && - Objects.equals(scopes, that.scopes); - } - - @Override - public int hashCode() { - return Objects.hash( - name, - type, - hasMore, - isBasic, - isBasicBasic, - isBasicBearer, - bearerFormat, - isOAuth, - isApiKey, - vendorExtensions, - keyParamName, - isKeyInQuery, - isKeyInHeader, - flow, - authorizationUrl, - tokenUrl, - isCode, - isPassword, - isApplication, - isImplicit, - scopes); - } - // Return a copy of the security object, filtering out any scopes from the passed-in list. public CodegenSecurity filterByScopeNames(List filterScopes) { CodegenSecurity filteredSecurity = new CodegenSecurity(); @@ -144,4 +83,72 @@ public class CodegenSecurity { return filteredSecurity; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenSecurity that = (CodegenSecurity) o; + return Objects.equals(name, that.name) && + Objects.equals(type, that.type) && + Objects.equals(scheme, that.scheme) && + Objects.equals(hasMore, that.hasMore) && + Objects.equals(isBasic, that.isBasic) && + Objects.equals(isOAuth, that.isOAuth) && + Objects.equals(isApiKey, that.isApiKey) && + Objects.equals(isBasicBasic, that.isBasicBasic) && + Objects.equals(isBasicBearer, that.isBasicBearer) && + Objects.equals(bearerFormat, that.bearerFormat) && + Objects.equals(vendorExtensions, that.vendorExtensions) && + Objects.equals(keyParamName, that.keyParamName) && + Objects.equals(isKeyInQuery, that.isKeyInQuery) && + Objects.equals(isKeyInHeader, that.isKeyInHeader) && + Objects.equals(isKeyInCookie, that.isKeyInCookie) && + Objects.equals(flow, that.flow) && + Objects.equals(authorizationUrl, that.authorizationUrl) && + Objects.equals(tokenUrl, that.tokenUrl) && + Objects.equals(scopes, that.scopes) && + Objects.equals(isCode, that.isCode) && + Objects.equals(isPassword, that.isPassword) && + Objects.equals(isApplication, that.isApplication) && + Objects.equals(isImplicit, that.isImplicit); + } + + @Override + public int hashCode() { + + return Objects.hash(name, type, scheme, hasMore, isBasic, isOAuth, isApiKey, isBasicBasic, isBasicBearer, + bearerFormat, vendorExtensions, keyParamName, isKeyInQuery, isKeyInHeader, isKeyInCookie, flow, + authorizationUrl, tokenUrl, scopes, isCode, isPassword, isApplication, isImplicit); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenSecurity{"); + sb.append("name='").append(name).append('\''); + sb.append(", type='").append(type).append('\''); + sb.append(", scheme='").append(scheme).append('\''); + sb.append(", hasMore=").append(hasMore); + sb.append(", isBasic=").append(isBasic); + sb.append(", isOAuth=").append(isOAuth); + sb.append(", isApiKey=").append(isApiKey); + sb.append(", isBasicBasic=").append(isBasicBasic); + sb.append(", isBasicBearer=").append(isBasicBearer); + sb.append(", bearerFormat='").append(bearerFormat).append('\''); + sb.append(", vendorExtensions=").append(vendorExtensions); + sb.append(", keyParamName='").append(keyParamName).append('\''); + sb.append(", isKeyInQuery=").append(isKeyInQuery); + sb.append(", isKeyInHeader=").append(isKeyInHeader); + sb.append(", isKeyInCookie=").append(isKeyInCookie); + sb.append(", flow='").append(flow).append('\''); + sb.append(", authorizationUrl='").append(authorizationUrl).append('\''); + sb.append(", tokenUrl='").append(tokenUrl).append('\''); + sb.append(", scopes=").append(scopes); + sb.append(", isCode=").append(isCode); + sb.append(", isPassword=").append(isPassword); + sb.append(", isApplication=").append(isApplication); + sb.append(", isImplicit=").append(isImplicit); + sb.append('}'); + return sb.toString(); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java index 0708d4407fc2..f11165460280 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java @@ -1,9 +1,36 @@ package org.openapitools.codegen; import java.util.List; +import java.util.Objects; public class CodegenServer { public String url; public String description; public List variables; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenServer that = (CodegenServer) o; + return Objects.equals(url, that.url) && + Objects.equals(description, that.description) && + Objects.equals(variables, that.variables); + } + + @Override + public int hashCode() { + + return Objects.hash(url, description, variables); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenServer{"); + sb.append("url='").append(url).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", variables=").append(variables); + sb.append('}'); + return sb.toString(); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java index 15ae1ca15b1d..0cd643e27231 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java @@ -1,6 +1,7 @@ package org.openapitools.codegen; import java.util.List; +import java.util.Objects; public class CodegenServerVariable { public String name; @@ -8,4 +9,34 @@ public class CodegenServerVariable { public String description; public List enumValues; public String value; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenServerVariable that = (CodegenServerVariable) o; + return Objects.equals(name, that.name) && + Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(description, that.description) && + Objects.equals(enumValues, that.enumValues) && + Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + + return Objects.hash(name, defaultValue, description, enumValues, value); + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("CodegenServerVariable{"); + sb.append("name='").append(name).append('\''); + sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", enumValues=").append(enumValues); + sb.append(", value='").append(value).append('\''); + sb.append('}'); + return sb.toString(); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 4221086015c0..609e57e946b0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -450,6 +450,7 @@ public class DefaultCodegenTest { CodegenDiscriminator discriminator = animalModel.getDiscriminator(); CodegenDiscriminator test = new CodegenDiscriminator(); test.setPropertyName("className"); + test.setPropertyBaseName("className"); test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Dog", "Dog")); test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Cat", "Cat")); Assert.assertEquals(discriminator, test); @@ -804,6 +805,7 @@ public class DefaultCodegenTest { private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) { CodegenDiscriminator test = new CodegenDiscriminator(); test.setPropertyName("DollarUnderscoretype"); + test.setPropertyBaseName("$_type"); test.setMapping(new HashMap<>()); test.getMapping().put("a", "#/components/schemas/Adult"); test.getMapping().put("c", "Child"); diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php index 864fa5cd80f5..3d822e56f299 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php @@ -43,15 +43,6 @@ use OpenAPI\Server\Model\Pet; interface PetApiInterface { - /** - * Sets authentication method petstore_auth - * - * @param string $value Value of the petstore_auth authentication method. - * - * @return void - */ - public function setpetstore_auth($value); - /** * Sets authentication method api_key * @@ -61,6 +52,15 @@ interface PetApiInterface */ public function setapi_key($value); + /** + * Sets authentication method petstore_auth + * + * @param string $value Value of the petstore_auth authentication method. + * + * @return void + */ + public function setpetstore_auth($value); + /** * Operation addPet *