mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 14:40:53 +00:00
[Java] fix nullable arrays when JsonNullable is used (#10012)
This commit is contained in:
parent
ddd23ab197
commit
aa4018d09b
7
bin/configs/java-webclient-nullable-array.yaml
Normal file
7
bin/configs/java-webclient-nullable-array.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
generatorName: java
|
||||||
|
outputDir: samples/client/petstore/java/webclient-nulable-arrays
|
||||||
|
library: webclient
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/schema-with-nullable-arrays.yaml
|
||||||
|
additionalProperties:
|
||||||
|
artifactId: petstore-webclient-nullable-arrays
|
||||||
|
hideGenerationTimestamp: "true"
|
@ -1219,6 +1219,13 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
model.imports.add("ApiModelProperty");
|
model.imports.add("ApiModelProperty");
|
||||||
model.imports.add("ApiModel");
|
model.imports.add("ApiModel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (openApiNullable) {
|
||||||
|
if (Boolean.FALSE.equals(property.required) && Boolean.TRUE.equals(property.isNullable)) {
|
||||||
|
model.imports.add("JsonNullable");
|
||||||
|
model.getVendorExtensions().put("x-jackson-optional-nullable-helpers", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -126,6 +126,9 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
|||||||
supportingFiles.add(new SupportingFile("web.mustache", ("src/main/webapp/WEB-INF"), "web.xml")
|
supportingFiles.add(new SupportingFile("web.mustache", ("src/main/webapp/WEB-INF"), "web.xml")
|
||||||
.doNotOverwrite());
|
.doNotOverwrite());
|
||||||
supportingFiles.add(new SupportingFile("StringUtil.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "StringUtil.java"));
|
supportingFiles.add(new SupportingFile("StringUtil.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "StringUtil.java"));
|
||||||
|
|
||||||
|
// JsonNullable is not implemented for this generator
|
||||||
|
openApiNullable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,13 +278,17 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
|
|||||||
return false;
|
return false;
|
||||||
}{{#hasVars}}
|
}{{#hasVars}}
|
||||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||||
return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} &&
|
return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} &&
|
||||||
{{/-last}}{{/vars}}{{#additionalPropertiesType}}&&
|
{{/-last}}{{/vars}}{{#additionalPropertiesType}}&&
|
||||||
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} &&
|
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} &&
|
||||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||||
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
|
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
}
|
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
@ -292,9 +296,18 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
|
|||||||
return HashCodeBuilder.reflectionHashCode(this);
|
return HashCodeBuilder.reflectionHashCode(this);
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
{{^useReflectionEqualsHashCode}}
|
{{^useReflectionEqualsHashCode}}
|
||||||
return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#additionalPropertiesType}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/additionalPropertiesType}});
|
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#additionalPropertiesType}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/additionalPropertiesType}});
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
|
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
|
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -281,13 +281,17 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
|
|||||||
return false;
|
return false;
|
||||||
}{{#hasVars}}
|
}{{#hasVars}}
|
||||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||||
return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} &&
|
return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} &&
|
||||||
{{/-last}}{{/vars}}{{#additionalPropertiesType}}&&
|
{{/-last}}{{/vars}}{{#additionalPropertiesType}}&&
|
||||||
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} &&
|
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} &&
|
||||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||||
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
|
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
}
|
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
@ -295,9 +299,18 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
|
|||||||
return HashCodeBuilder.reflectionHashCode(this);
|
return HashCodeBuilder.reflectionHashCode(this);
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
{{^useReflectionEqualsHashCode}}
|
{{^useReflectionEqualsHashCode}}
|
||||||
return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#additionalPropertiesType}}, additionalProperties{{/additionalPropertiesType}});
|
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#additionalPropertiesType}}, additionalProperties{{/additionalPropertiesType}});
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
|
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
|
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -255,12 +255,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
|
|||||||
return false;
|
return false;
|
||||||
}{{#hasVars}}
|
}{{#hasVars}}
|
||||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||||
return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} &&
|
return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} &&
|
||||||
{{/-last}}{{/vars}}{{#parent}} &&
|
{{/-last}}{{/vars}}{{#parent}} &&
|
||||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||||
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
|
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
}
|
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
@ -268,9 +272,18 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
|
|||||||
return HashCodeBuilder.reflectionHashCode(this);
|
return HashCodeBuilder.reflectionHashCode(this);
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
{{^useReflectionEqualsHashCode}}
|
{{^useReflectionEqualsHashCode}}
|
||||||
return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
||||||
{{/useReflectionEqualsHashCode}}
|
{{/useReflectionEqualsHashCode}}
|
||||||
|
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
|
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -132,16 +132,29 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}
|
|||||||
return false;
|
return false;
|
||||||
}{{#hasVars}}
|
}{{#hasVars}}
|
||||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||||
return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} &&
|
return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} &&
|
||||||
{{/-last}}{{/vars}}{{#parent}} &&
|
{{/-last}}{{/vars}}{{#parent}} &&
|
||||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||||
return true;{{/hasVars}}
|
return true;{{/hasVars}}
|
||||||
}
|
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
||||||
|
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
|
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -276,7 +276,7 @@ public class JavaCXFClientCodegenTest {
|
|||||||
codegenProperty.isNullable = true;
|
codegenProperty.isNullable = true;
|
||||||
|
|
||||||
codegen.postProcessModelProperty(codegenModel, codegenProperty);
|
codegen.postProcessModelProperty(codegenModel, codegenProperty);
|
||||||
Assert.assertFalse(codegenModel.imports.contains("JsonNullable"));
|
Assert.assertTrue(codegenModel.imports.contains("JsonNullable"));
|
||||||
Assert.assertFalse(codegenModel.imports.contains("JsonIgnore"));
|
Assert.assertFalse(codegenModel.imports.contains("JsonIgnore"));
|
||||||
Assert.assertNull(codegenProperty.getVendorExtensions().get("x-is-jackson-optional-nullable"));
|
Assert.assertNull(codegenProperty.getVendorExtensions().get("x-is-jackson-optional-nullable"));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
title: 'Minimal Example '
|
||||||
|
description: byte Array error in equal method
|
||||||
|
version: v1
|
||||||
|
paths:
|
||||||
|
/nullable-array-test:
|
||||||
|
get:
|
||||||
|
summary: ''
|
||||||
|
description: ''
|
||||||
|
operationId: ''
|
||||||
|
parameters: []
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: ''
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
"$ref": "#/components/schemas/ByteArrayObject"
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
ByteArrayObject:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
nullableArray:
|
||||||
|
type: string
|
||||||
|
description: byte array.
|
||||||
|
format: byte
|
||||||
|
nullable: true
|
||||||
|
normalArray:
|
||||||
|
type: string
|
||||||
|
description: byte array.
|
||||||
|
format: byte
|
||||||
|
nullableString:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
stringField:
|
||||||
|
type: string
|
||||||
|
intField:
|
||||||
|
type: number
|
||||||
|
format: int32
|
1
pom.xml
1
pom.xml
@ -1343,6 +1343,7 @@
|
|||||||
<module>samples/client/petstore/java/resttemplate</module>
|
<module>samples/client/petstore/java/resttemplate</module>
|
||||||
<module>samples/client/petstore/java/resttemplate-withXml</module>
|
<module>samples/client/petstore/java/resttemplate-withXml</module>
|
||||||
<module>samples/client/petstore/java/webclient</module>
|
<module>samples/client/petstore/java/webclient</module>
|
||||||
|
<module>samples/client/petstore/java/webclient-nulable-arrays</module>
|
||||||
<module>samples/client/petstore/java/vertx</module>
|
<module>samples/client/petstore/java/vertx</module>
|
||||||
<module>samples/client/petstore/java/jersey2-java8-localdatetime</module>
|
<module>samples/client/petstore/java/jersey2-java8-localdatetime</module>
|
||||||
<module>samples/client/petstore/java/resteasy</module>
|
<module>samples/client/petstore/java/resteasy</module>
|
||||||
|
@ -26,6 +26,7 @@ import org.openapitools.client.model.OuterEnum;
|
|||||||
import org.openapitools.client.model.OuterEnumDefaultValue;
|
import org.openapitools.client.model.OuterEnumDefaultValue;
|
||||||
import org.openapitools.client.model.OuterEnumInteger;
|
import org.openapitools.client.model.OuterEnumInteger;
|
||||||
import org.openapitools.client.model.OuterEnumIntegerDefaultValue;
|
import org.openapitools.client.model.OuterEnumIntegerDefaultValue;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -453,15 +454,28 @@ public class EnumTest {
|
|||||||
Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) &&
|
Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) &&
|
||||||
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
||||||
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
|
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
|
||||||
Objects.equals(this.outerEnum, enumTest.outerEnum) &&
|
equalsNullable(this.outerEnum, enumTest.outerEnum) &&
|
||||||
Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) &&
|
Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) &&
|
||||||
Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) &&
|
Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) &&
|
||||||
Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue);
|
Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
|
return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -85,12 +86,25 @@ public class HealthCheckResult {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
HealthCheckResult healthCheckResult = (HealthCheckResult) o;
|
HealthCheckResult healthCheckResult = (HealthCheckResult) o;
|
||||||
return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage);
|
return equalsNullable(this.nullableMessage, healthCheckResult.nullableMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(nullableMessage);
|
return Objects.hash(hashCodeNullable(nullableMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,6 +27,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import org.threeten.bp.LocalDate;
|
import org.threeten.bp.LocalDate;
|
||||||
import org.threeten.bp.OffsetDateTime;
|
import org.threeten.bp.OffsetDateTime;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
@ -568,24 +569,37 @@ public class NullableClass extends HashMap<String, Object> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NullableClass nullableClass = (NullableClass) o;
|
NullableClass nullableClass = (NullableClass) o;
|
||||||
return Objects.equals(this.integerProp, nullableClass.integerProp) &&
|
return equalsNullable(this.integerProp, nullableClass.integerProp) &&
|
||||||
Objects.equals(this.numberProp, nullableClass.numberProp) &&
|
equalsNullable(this.numberProp, nullableClass.numberProp) &&
|
||||||
Objects.equals(this.booleanProp, nullableClass.booleanProp) &&
|
equalsNullable(this.booleanProp, nullableClass.booleanProp) &&
|
||||||
Objects.equals(this.stringProp, nullableClass.stringProp) &&
|
equalsNullable(this.stringProp, nullableClass.stringProp) &&
|
||||||
Objects.equals(this.dateProp, nullableClass.dateProp) &&
|
equalsNullable(this.dateProp, nullableClass.dateProp) &&
|
||||||
Objects.equals(this.datetimeProp, nullableClass.datetimeProp) &&
|
equalsNullable(this.datetimeProp, nullableClass.datetimeProp) &&
|
||||||
Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) &&
|
equalsNullable(this.arrayNullableProp, nullableClass.arrayNullableProp) &&
|
||||||
Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) &&
|
equalsNullable(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) &&
|
||||||
Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) &&
|
Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) &&
|
||||||
Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) &&
|
equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) &&
|
||||||
Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
|
equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
|
||||||
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) &&
|
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) &&
|
||||||
super.equals(o);
|
super.equals(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode());
|
return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
21
samples/client/petstore/java/webclient-nulable-arrays/.gitignore
vendored
Normal file
21
samples/client/petstore/java/webclient-nulable-arrays/.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
*.class
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# exclude jar for gradle wrapper
|
||||||
|
!gradle/wrapper/*.jar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
# build files
|
||||||
|
**/target
|
||||||
|
target
|
||||||
|
.gradle
|
||||||
|
build
|
@ -0,0 +1,23 @@
|
|||||||
|
# OpenAPI Generator Ignore
|
||||||
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
@ -0,0 +1,29 @@
|
|||||||
|
.gitignore
|
||||||
|
.travis.yml
|
||||||
|
README.md
|
||||||
|
api/openapi.yaml
|
||||||
|
build.gradle
|
||||||
|
build.sbt
|
||||||
|
docs/ByteArrayObject.md
|
||||||
|
docs/DefaultApi.md
|
||||||
|
git_push.sh
|
||||||
|
gradle.properties
|
||||||
|
gradle/wrapper/gradle-wrapper.jar
|
||||||
|
gradle/wrapper/gradle-wrapper.properties
|
||||||
|
gradlew
|
||||||
|
gradlew.bat
|
||||||
|
pom.xml
|
||||||
|
settings.gradle
|
||||||
|
src/main/AndroidManifest.xml
|
||||||
|
src/main/java/org/openapitools/client/ApiClient.java
|
||||||
|
src/main/java/org/openapitools/client/JavaTimeFormatter.java
|
||||||
|
src/main/java/org/openapitools/client/RFC3339DateFormat.java
|
||||||
|
src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||||
|
src/main/java/org/openapitools/client/ServerVariable.java
|
||||||
|
src/main/java/org/openapitools/client/StringUtil.java
|
||||||
|
src/main/java/org/openapitools/client/api/DefaultApi.java
|
||||||
|
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
|
||||||
|
src/main/java/org/openapitools/client/auth/Authentication.java
|
||||||
|
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
|
||||||
|
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
|
||||||
|
src/main/java/org/openapitools/client/model/ByteArrayObject.java
|
@ -0,0 +1 @@
|
|||||||
|
5.2.1-SNAPSHOT
|
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# Generated by OpenAPI Generator: https://openapi-generator.tech
|
||||||
|
#
|
||||||
|
# Ref: https://docs.travis-ci.com/user/languages/java/
|
||||||
|
#
|
||||||
|
language: java
|
||||||
|
jdk:
|
||||||
|
- openjdk12
|
||||||
|
- openjdk11
|
||||||
|
- openjdk10
|
||||||
|
- openjdk9
|
||||||
|
- openjdk8
|
||||||
|
before_install:
|
||||||
|
# ensure gradlew has proper permission
|
||||||
|
- chmod a+x ./gradlew
|
||||||
|
script:
|
||||||
|
# test using maven
|
||||||
|
#- mvn test
|
||||||
|
# test using gradle
|
||||||
|
- gradle test
|
||||||
|
# test using sbt
|
||||||
|
# - sbt test
|
128
samples/client/petstore/java/webclient-nulable-arrays/README.md
Normal file
128
samples/client/petstore/java/webclient-nulable-arrays/README.md
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
# petstore-webclient-nullable-arrays
|
||||||
|
|
||||||
|
Minimal Example
|
||||||
|
|
||||||
|
- API version: v1
|
||||||
|
|
||||||
|
byte Array error in equal method
|
||||||
|
|
||||||
|
|
||||||
|
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Building the API client library requires:
|
||||||
|
|
||||||
|
1. Java 1.8+
|
||||||
|
2. Maven/Gradle
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To install the API client library to your local Maven repository, simply execute:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean install
|
||||||
|
```
|
||||||
|
|
||||||
|
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
||||||
|
|
||||||
|
### Maven users
|
||||||
|
|
||||||
|
Add this dependency to your project's POM:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>petstore-webclient-nullable-arrays</artifactId>
|
||||||
|
<version>v1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gradle users
|
||||||
|
|
||||||
|
Add this dependency to your project's build file:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
compile "org.openapitools:petstore-webclient-nullable-arrays:v1"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Others
|
||||||
|
|
||||||
|
At first generate the JAR by executing:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean package
|
||||||
|
```
|
||||||
|
|
||||||
|
Then manually install the following JARs:
|
||||||
|
|
||||||
|
- `target/petstore-webclient-nullable-arrays-v1.jar`
|
||||||
|
- `target/lib/*.jar`
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
|
import org.openapitools.client.*;
|
||||||
|
import org.openapitools.client.auth.*;
|
||||||
|
import org.openapitools.client.model.*;
|
||||||
|
import org.openapitools.client.api.DefaultApi;
|
||||||
|
|
||||||
|
public class DefaultApiExample {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost");
|
||||||
|
|
||||||
|
DefaultApi apiInstance = new DefaultApi(defaultClient);
|
||||||
|
try {
|
||||||
|
List<ByteArrayObject> result = apiInstance.nullableArrayTestGet();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling DefaultApi#nullableArrayTestGet");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*DefaultApi* | [**nullableArrayTestGet**](docs/DefaultApi.md#nullableArrayTestGet) | **GET** /nullable-array-test |
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation for Models
|
||||||
|
|
||||||
|
- [ByteArrayObject](docs/ByteArrayObject.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation for Authorization
|
||||||
|
|
||||||
|
All endpoints do not require authorization.
|
||||||
|
Authentication schemes defined for the API:
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
description: byte Array error in equal method
|
||||||
|
title: 'Minimal Example '
|
||||||
|
version: v1
|
||||||
|
servers:
|
||||||
|
- url: /
|
||||||
|
paths:
|
||||||
|
/nullable-array-test:
|
||||||
|
get:
|
||||||
|
parameters: []
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/ByteArrayObject'
|
||||||
|
type: array
|
||||||
|
x-accepts: application/json
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
ByteArrayObject:
|
||||||
|
example:
|
||||||
|
nullableArray: nullableArray
|
||||||
|
nullableString: nullableString
|
||||||
|
normalArray: normalArray
|
||||||
|
stringField: stringField
|
||||||
|
intField: 0.8008281904610115
|
||||||
|
properties:
|
||||||
|
nullableArray:
|
||||||
|
description: byte array.
|
||||||
|
format: byte
|
||||||
|
nullable: true
|
||||||
|
type: string
|
||||||
|
normalArray:
|
||||||
|
description: byte array.
|
||||||
|
format: byte
|
||||||
|
type: string
|
||||||
|
nullableString:
|
||||||
|
nullable: true
|
||||||
|
type: string
|
||||||
|
stringField:
|
||||||
|
type: string
|
||||||
|
intField:
|
||||||
|
format: int32
|
||||||
|
type: number
|
||||||
|
type: object
|
||||||
|
|
@ -0,0 +1,141 @@
|
|||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
|
group = 'org.openapitools'
|
||||||
|
version = 'v1'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||||
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasProperty('target') && target == 'android') {
|
||||||
|
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion '25.0.2'
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 14
|
||||||
|
targetSdkVersion 25
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename the aar correctly
|
||||||
|
libraryVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
def outputFile = output.outputFile
|
||||||
|
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||||
|
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||||
|
output.outputFile = new File(outputFile.parent, fileName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
provided 'javax.annotation:jsr250-api:1.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
android.libraryVariants.all { variant ->
|
||||||
|
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||||
|
task.description = "Create jar artifact for ${variant.name}"
|
||||||
|
task.dependsOn variant.javaCompile
|
||||||
|
task.from variant.javaCompile.destinationDir
|
||||||
|
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||||
|
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||||
|
artifacts.add('archives', task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
from android.sourceSets.main.java.srcDirs
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
|
install {
|
||||||
|
repositories.mavenInstaller {
|
||||||
|
pom.artifactId = 'petstore-webclient-nullable-arrays'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task execute(type:JavaExec) {
|
||||||
|
main = System.getProperty('mainClass')
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
classifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
|
classifier = 'javadoc'
|
||||||
|
from javadoc.destinationDir
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
archives javadocJar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
swagger_annotations_version = "1.6.2"
|
||||||
|
spring_web_version = "2.4.3"
|
||||||
|
jackson_version = "2.11.3"
|
||||||
|
jackson_databind_version = "2.11.3"
|
||||||
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
|
javax_annotation_version = "1.3.2"
|
||||||
|
reactor_version = "3.4.3"
|
||||||
|
reactor_netty_version = "0.7.15.RELEASE"
|
||||||
|
jodatime_version = "2.9.9"
|
||||||
|
junit_version = "4.13.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||||
|
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||||
|
implementation "io.projectreactor:reactor-core:$reactor_version"
|
||||||
|
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_web_version"
|
||||||
|
implementation "io.projectreactor.ipc:reactor-netty:$reactor_netty_version"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
|
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||||
|
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||||
|
implementation "javax.annotation:javax.annotation-api:$javax_annotation_version"
|
||||||
|
testImplementation "junit:junit:$junit_version"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
# TODO
|
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# ByteArrayObject
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**nullableArray** | **byte[]** | byte array. | [optional]
|
||||||
|
**normalArray** | **byte[]** | byte array. | [optional]
|
||||||
|
**nullableString** | **String** | | [optional]
|
||||||
|
**stringField** | **String** | | [optional]
|
||||||
|
**intField** | **BigDecimal** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
|||||||
|
# DefaultApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**nullableArrayTestGet**](DefaultApi.md#nullableArrayTestGet) | **GET** /nullable-array-test |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## nullableArrayTestGet
|
||||||
|
|
||||||
|
> List<ByteArrayObject> nullableArrayTestGet()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.DefaultApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost");
|
||||||
|
|
||||||
|
DefaultApi apiInstance = new DefaultApi(defaultClient);
|
||||||
|
try {
|
||||||
|
List<ByteArrayObject> result = apiInstance.nullableArrayTestGet();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling DefaultApi#nullableArrayTestGet");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**List<ByteArrayObject>**](ByteArrayObject.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | | - |
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id="GIT_USER_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id="GIT_REPO_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note="Minor update"
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
git_remote=`git remote`
|
||||||
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
@ -0,0 +1,2 @@
|
|||||||
|
# Uncomment to build for Android
|
||||||
|
#target = android
|
BIN
samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/petstore/java/webclient-nulable-arrays/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
185
samples/client/petstore/java/webclient-nulable-arrays/gradlew
vendored
Normal file
185
samples/client/petstore/java/webclient-nulable-arrays/gradlew
vendored
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
89
samples/client/petstore/java/webclient-nulable-arrays/gradlew.bat
vendored
Normal file
89
samples/client/petstore/java/webclient-nulable-arrays/gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
138
samples/client/petstore/java/webclient-nulable-arrays/pom.xml
Normal file
138
samples/client/petstore/java/webclient-nulable-arrays/pom.xml
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>petstore-webclient-nullable-arrays</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>petstore-webclient-nullable-arrays</name>
|
||||||
|
<version>v1</version>
|
||||||
|
<url>https://github.com/openapitools/openapi-generator</url>
|
||||||
|
<description>OpenAPI Java</description>
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
|
||||||
|
<url>https://github.com/openapitools/openapi-generator</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>Unlicense</name>
|
||||||
|
<url>http://unlicense.org</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>OpenAPI-Generator Contributors</name>
|
||||||
|
<email>team@openapitools.org</email>
|
||||||
|
<organization>OpenAPITools.org</organization>
|
||||||
|
<organizationUrl>http://openapitools.org</organizationUrl>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>2.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>${swagger-annotations-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- @Nullable annotation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.projectreactor</groupId>
|
||||||
|
<artifactId>reactor-core</artifactId>
|
||||||
|
<version>${reactor-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- HTTP client: Springboot starter WebFlux -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
|
<version>${spring-web-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.projectreactor.ipc</groupId>
|
||||||
|
<artifactId>reactor-netty</artifactId>
|
||||||
|
<version>${reactor-netty-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON processing: jackson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>${jackson-databind-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.annotation</groupId>
|
||||||
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
|
<version>${javax-annotation-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- test dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<swagger-annotations-version>1.6.2</swagger-annotations-version>
|
||||||
|
<spring-web-version>2.4.3</spring-web-version>
|
||||||
|
<jackson-version>2.11.3</jackson-version>
|
||||||
|
<jackson-databind-version>2.11.3</jackson-databind-version>
|
||||||
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
|
<javax-annotation-version>1.3.2</javax-annotation-version>
|
||||||
|
<junit-version>4.13.1</junit-version>
|
||||||
|
<reactor-version>3.4.3</reactor-version>
|
||||||
|
<reactor-netty-version>0.7.15.RELEASE</reactor-netty-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "petstore-webclient-nullable-arrays"
|
@ -0,0 +1,3 @@
|
|||||||
|
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application />
|
||||||
|
</manifest>
|
@ -0,0 +1,720 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.HttpRequest;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.InvalidMediaTypeException;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.RequestEntity;
|
||||||
|
import org.springframework.http.RequestEntity.BodyBuilder;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.http.client.BufferingClientHttpRequestFactory;
|
||||||
|
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||||
|
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||||
|
import org.springframework.http.client.ClientHttpResponse;
|
||||||
|
import org.springframework.http.codec.json.Jackson2JsonDecoder;
|
||||||
|
import org.springframework.http.codec.json.Jackson2JsonEncoder;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.http.client.reactive.ClientHttpRequest;
|
||||||
|
import org.springframework.web.client.RestClientException;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
|
import org.springframework.web.reactive.function.client.WebClient.ResponseSpec;
|
||||||
|
import org.springframework.web.reactive.function.client.ClientResponse;
|
||||||
|
import org.springframework.web.reactive.function.BodyInserter;
|
||||||
|
import org.springframework.web.reactive.function.BodyInserters;
|
||||||
|
import org.springframework.web.reactive.function.client.ExchangeStrategies;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
|
||||||
|
import org.openapitools.client.auth.Authentication;
|
||||||
|
import org.openapitools.client.auth.HttpBasicAuth;
|
||||||
|
import org.openapitools.client.auth.HttpBearerAuth;
|
||||||
|
import org.openapitools.client.auth.ApiKeyAuth;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
|
public enum CollectionFormat {
|
||||||
|
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||||
|
|
||||||
|
private final String separator;
|
||||||
|
private CollectionFormat(String separator) {
|
||||||
|
this.separator = separator;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String collectionToString(Collection<?> collection) {
|
||||||
|
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private HttpHeaders defaultHeaders = new HttpHeaders();
|
||||||
|
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
|
private String basePath = "http://localhost";
|
||||||
|
|
||||||
|
private final WebClient webClient;
|
||||||
|
private final DateFormat dateFormat;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
private Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
|
||||||
|
public ApiClient() {
|
||||||
|
this.dateFormat = createDefaultDateFormat();
|
||||||
|
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
|
||||||
|
this.webClient = buildWebClient(this.objectMapper);
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient(WebClient webClient) {
|
||||||
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient()), createDefaultDateFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient(ObjectMapper mapper, DateFormat format) {
|
||||||
|
this(buildWebClient(mapper.copy()), format);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient(WebClient webClient, ObjectMapper mapper, DateFormat format) {
|
||||||
|
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApiClient(WebClient webClient, DateFormat format) {
|
||||||
|
this.webClient = webClient;
|
||||||
|
this.dateFormat = format;
|
||||||
|
this.objectMapper = createDefaultObjectMapper(format);
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateFormat createDefaultDateFormat() {
|
||||||
|
DateFormat dateFormat = new RFC3339DateFormat();
|
||||||
|
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
|
return dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFormat) {
|
||||||
|
if (null == dateFormat) {
|
||||||
|
dateFormat = createDefaultDateFormat();
|
||||||
|
}
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
mapper.setDateFormat(dateFormat);
|
||||||
|
mapper.registerModule(new JavaTimeModule());
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
JsonNullableModule jnm = new JsonNullableModule();
|
||||||
|
mapper.registerModule(jnm);
|
||||||
|
return mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init() {
|
||||||
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
|
authentications = new HashMap<String, Authentication>();
|
||||||
|
// Prevent the authentications from being modified.
|
||||||
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the WebClientBuilder used to make WebClient.
|
||||||
|
* @param mapper ObjectMapper used for serialize/deserialize
|
||||||
|
* @return WebClient
|
||||||
|
*/
|
||||||
|
public static WebClient.Builder buildWebClientBuilder(ObjectMapper mapper) {
|
||||||
|
ExchangeStrategies strategies = ExchangeStrategies
|
||||||
|
.builder()
|
||||||
|
.codecs(clientDefaultCodecsConfigurer -> {
|
||||||
|
clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(mapper, MediaType.APPLICATION_JSON));
|
||||||
|
clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(mapper, MediaType.APPLICATION_JSON));
|
||||||
|
}).build();
|
||||||
|
WebClient.Builder webClientBuilder = WebClient.builder().exchangeStrategies(strategies);
|
||||||
|
return webClientBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the WebClientBuilder used to make WebClient.
|
||||||
|
* @return WebClient
|
||||||
|
*/
|
||||||
|
public static WebClient.Builder buildWebClientBuilder() {
|
||||||
|
return buildWebClientBuilder(createDefaultObjectMapper(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the WebClient used to make HTTP requests.
|
||||||
|
* @param mapper ObjectMapper used for serialize/deserialize
|
||||||
|
* @return WebClient
|
||||||
|
*/
|
||||||
|
public static WebClient buildWebClient(ObjectMapper mapper) {
|
||||||
|
return buildWebClientBuilder(mapper).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the WebClient used to make HTTP requests.
|
||||||
|
* @return WebClient
|
||||||
|
*/
|
||||||
|
public static WebClient buildWebClient() {
|
||||||
|
return buildWebClientBuilder(createDefaultObjectMapper(null)).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current base path
|
||||||
|
* @return String the base path
|
||||||
|
*/
|
||||||
|
public String getBasePath() {
|
||||||
|
return basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the base path, which should include the host
|
||||||
|
* @param basePath the base path
|
||||||
|
* @return ApiClient this client
|
||||||
|
*/
|
||||||
|
public ApiClient setBasePath(String basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get authentications (key: authentication name, value: authentication).
|
||||||
|
* @return Map the currently configured authentication types
|
||||||
|
*/
|
||||||
|
public Map<String, Authentication> getAuthentications() {
|
||||||
|
return authentications;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get authentication for the given name.
|
||||||
|
*
|
||||||
|
* @param authName The authentication name
|
||||||
|
* @return The authentication, null if not found
|
||||||
|
*/
|
||||||
|
public Authentication getAuthentication(String authName) {
|
||||||
|
return authentications.get(authName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to set access token for the first Bearer authentication.
|
||||||
|
* @param bearerToken Bearer token
|
||||||
|
*/
|
||||||
|
public void setBearerToken(String bearerToken) {
|
||||||
|
for (Authentication auth : authentications.values()) {
|
||||||
|
if (auth instanceof HttpBearerAuth) {
|
||||||
|
((HttpBearerAuth) auth).setBearerToken(bearerToken);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("No Bearer authentication configured!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to set username for the first HTTP basic authentication.
|
||||||
|
* @param username the username
|
||||||
|
*/
|
||||||
|
public void setUsername(String username) {
|
||||||
|
for (Authentication auth : authentications.values()) {
|
||||||
|
if (auth instanceof HttpBasicAuth) {
|
||||||
|
((HttpBasicAuth) auth).setUsername(username);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("No HTTP basic authentication configured!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to set password for the first HTTP basic authentication.
|
||||||
|
* @param password the password
|
||||||
|
*/
|
||||||
|
public void setPassword(String password) {
|
||||||
|
for (Authentication auth : authentications.values()) {
|
||||||
|
if (auth instanceof HttpBasicAuth) {
|
||||||
|
((HttpBasicAuth) auth).setPassword(password);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("No HTTP basic authentication configured!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to set API key value for the first API key authentication.
|
||||||
|
* @param apiKey the API key
|
||||||
|
*/
|
||||||
|
public void setApiKey(String apiKey) {
|
||||||
|
for (Authentication auth : authentications.values()) {
|
||||||
|
if (auth instanceof ApiKeyAuth) {
|
||||||
|
((ApiKeyAuth) auth).setApiKey(apiKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("No API key authentication configured!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to set API key prefix for the first API key authentication.
|
||||||
|
* @param apiKeyPrefix the API key prefix
|
||||||
|
*/
|
||||||
|
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||||
|
for (Authentication auth : authentications.values()) {
|
||||||
|
if (auth instanceof ApiKeyAuth) {
|
||||||
|
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("No API key authentication configured!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the User-Agent header's value (by adding to the default header map).
|
||||||
|
* @param userAgent the user agent string
|
||||||
|
* @return ApiClient this client
|
||||||
|
*/
|
||||||
|
public ApiClient setUserAgent(String userAgent) {
|
||||||
|
addDefaultHeader("User-Agent", userAgent);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a default header.
|
||||||
|
*
|
||||||
|
* @param name The header's name
|
||||||
|
* @param value The header's value
|
||||||
|
* @return ApiClient this client
|
||||||
|
*/
|
||||||
|
public ApiClient addDefaultHeader(String name, String value) {
|
||||||
|
if (defaultHeaders.containsKey(name)) {
|
||||||
|
defaultHeaders.remove(name);
|
||||||
|
}
|
||||||
|
defaultHeaders.add(name, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a default cookie.
|
||||||
|
*
|
||||||
|
* @param name The cookie's name
|
||||||
|
* @param value The cookie's value
|
||||||
|
* @return ApiClient this client
|
||||||
|
*/
|
||||||
|
public ApiClient addDefaultCookie(String name, String value) {
|
||||||
|
if (defaultCookies.containsKey(name)) {
|
||||||
|
defaultCookies.remove(name);
|
||||||
|
}
|
||||||
|
defaultCookies.add(name, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the date format used to parse/format date parameters.
|
||||||
|
* @return DateFormat format
|
||||||
|
*/
|
||||||
|
public DateFormat getDateFormat() {
|
||||||
|
return dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the given string into Date object.
|
||||||
|
*/
|
||||||
|
public Date parseDate(String str) {
|
||||||
|
try {
|
||||||
|
return dateFormat.parse(str);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the given Date object into string.
|
||||||
|
*/
|
||||||
|
public String formatDate(Date date) {
|
||||||
|
return dateFormat.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the ObjectMapper used to make HTTP requests.
|
||||||
|
* @return ObjectMapper objectMapper
|
||||||
|
*/
|
||||||
|
public ObjectMapper getObjectMapper() {
|
||||||
|
return objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the WebClient used to make HTTP requests.
|
||||||
|
* @return WebClient webClient
|
||||||
|
*/
|
||||||
|
public WebClient getWebClient() {
|
||||||
|
return webClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the given parameter object into string.
|
||||||
|
* @param param the object to convert
|
||||||
|
* @return String the parameter represented as a String
|
||||||
|
*/
|
||||||
|
public String parameterToString(Object param) {
|
||||||
|
if (param == null) {
|
||||||
|
return "";
|
||||||
|
} else if (param instanceof Date) {
|
||||||
|
return formatDate( (Date) param);
|
||||||
|
} else if (param instanceof OffsetDateTime) {
|
||||||
|
return formatOffsetDateTime((OffsetDateTime) param);
|
||||||
|
} else if (param instanceof Collection) {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
for(Object o : (Collection<?>) param) {
|
||||||
|
if(b.length() > 0) {
|
||||||
|
b.append(",");
|
||||||
|
}
|
||||||
|
b.append(String.valueOf(o));
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
} else {
|
||||||
|
return String.valueOf(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a parameter to a {@link MultiValueMap} for use in REST requests
|
||||||
|
* @param collectionFormat The format to convert to
|
||||||
|
* @param name The name of the parameter
|
||||||
|
* @param value The parameter's value
|
||||||
|
* @return a Map containing the String value(s) of the input parameter
|
||||||
|
*/
|
||||||
|
public MultiValueMap<String, String> parameterToMultiValueMap(CollectionFormat collectionFormat, String name, Object value) {
|
||||||
|
final MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
|
||||||
|
|
||||||
|
if (name == null || name.isEmpty() || value == null) {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(collectionFormat == null) {
|
||||||
|
collectionFormat = CollectionFormat.CSV;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<?> valueCollection = null;
|
||||||
|
if (value instanceof Collection) {
|
||||||
|
valueCollection = (Collection<?>) value;
|
||||||
|
} else {
|
||||||
|
params.add(name, parameterToString(value));
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valueCollection.isEmpty()){
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (collectionFormat.equals(CollectionFormat.MULTI)) {
|
||||||
|
for (Object item : valueCollection) {
|
||||||
|
params.add(name, parameterToString(item));
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> values = new ArrayList<String>();
|
||||||
|
for(Object o : valueCollection) {
|
||||||
|
values.add(parameterToString(o));
|
||||||
|
}
|
||||||
|
params.add(name, collectionFormat.collectionToString(values));
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given {@code String} is a JSON MIME.
|
||||||
|
* @param mediaType the input MediaType
|
||||||
|
* @return boolean true if the MediaType represents JSON, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isJsonMime(String mediaType) {
|
||||||
|
// "* / *" is default to JSON
|
||||||
|
if ("*/*".equals(mediaType)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return isJsonMime(MediaType.parseMediaType(mediaType));
|
||||||
|
} catch (InvalidMediaTypeException e) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given MIME is a JSON MIME.
|
||||||
|
* JSON MIME examples:
|
||||||
|
* application/json
|
||||||
|
* application/json; charset=UTF8
|
||||||
|
* APPLICATION/JSON
|
||||||
|
* @param mediaType the input MediaType
|
||||||
|
* @return boolean true if the MediaType represents JSON, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isJsonMime(MediaType mediaType) {
|
||||||
|
return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given {@code String} is a Problem JSON MIME (RFC-7807).
|
||||||
|
* @param mediaType the input MediaType
|
||||||
|
* @return boolean true if the MediaType represents Problem JSON, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isProblemJsonMime(String mediaType) {
|
||||||
|
return "application/problem+json".equalsIgnoreCase(mediaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the Accept header's value from the given accepts array:
|
||||||
|
* if JSON exists in the given array, use it;
|
||||||
|
* otherwise use all of them (joining into a string)
|
||||||
|
*
|
||||||
|
* @param accepts The accepts array to select from
|
||||||
|
* @return List The list of MediaTypes to use for the Accept header
|
||||||
|
*/
|
||||||
|
public List<MediaType> selectHeaderAccept(String[] accepts) {
|
||||||
|
if (accepts.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (String accept : accepts) {
|
||||||
|
MediaType mediaType = MediaType.parseMediaType(accept);
|
||||||
|
if (isJsonMime(mediaType) && !isProblemJsonMime(accept)) {
|
||||||
|
return Collections.singletonList(mediaType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MediaType.parseMediaTypes(StringUtils.arrayToCommaDelimitedString(accepts));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the Content-Type header's value from the given array:
|
||||||
|
* if JSON exists in the given array, use it;
|
||||||
|
* otherwise use the first one of the array.
|
||||||
|
*
|
||||||
|
* @param contentTypes The Content-Type array to select from
|
||||||
|
* @return MediaType The Content-Type header to use. If the given array is empty, null will be returned.
|
||||||
|
*/
|
||||||
|
public MediaType selectHeaderContentType(String[] contentTypes) {
|
||||||
|
if (contentTypes.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (String contentType : contentTypes) {
|
||||||
|
MediaType mediaType = MediaType.parseMediaType(contentType);
|
||||||
|
if (isJsonMime(mediaType)) {
|
||||||
|
return mediaType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MediaType.parseMediaType(contentTypes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the body to use for the request
|
||||||
|
* @param obj the body object
|
||||||
|
* @param formParams the form parameters
|
||||||
|
* @param contentType the content type of the request
|
||||||
|
* @return Object the selected body
|
||||||
|
*/
|
||||||
|
protected BodyInserter<?, ? super ClientHttpRequest> selectBody(Object obj, MultiValueMap<String, Object> formParams, MediaType contentType) {
|
||||||
|
if(MediaType.APPLICATION_FORM_URLENCODED.equals(contentType)) {
|
||||||
|
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
|
formParams
|
||||||
|
.toSingleValueMap()
|
||||||
|
.entrySet()
|
||||||
|
.forEach(es -> map.add(es.getKey(), String.valueOf(es.getValue())));
|
||||||
|
|
||||||
|
return BodyInserters.fromFormData(map);
|
||||||
|
} else if(MediaType.MULTIPART_FORM_DATA.equals(contentType)) {
|
||||||
|
return BodyInserters.fromMultipartData(formParams);
|
||||||
|
} else {
|
||||||
|
return obj != null ? BodyInserters.fromValue(obj) : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoke API by sending HTTP request with the given options.
|
||||||
|
*
|
||||||
|
* @param <T> the return type to use
|
||||||
|
* @param path The sub-path of the HTTP URL
|
||||||
|
* @param method The request method
|
||||||
|
* @param pathParams The path parameters
|
||||||
|
* @param queryParams The query parameters
|
||||||
|
* @param body The request body object
|
||||||
|
* @param headerParams The header parameters
|
||||||
|
* @param formParams The form parameters
|
||||||
|
* @param accept The request's Accept header
|
||||||
|
* @param contentType The request's Content-Type header
|
||||||
|
* @param authNames The authentications to apply
|
||||||
|
* @param returnType The return type into which to deserialize the response
|
||||||
|
* @return The response body in chosen type
|
||||||
|
*/
|
||||||
|
public <T> ResponseSpec invokeAPI(String path, HttpMethod method, Map<String, Object> pathParams, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||||
|
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames);
|
||||||
|
return requestBuilder.retrieve();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include queryParams in uriParams taking into account the paramName
|
||||||
|
* @param queryParam The query parameters
|
||||||
|
* @param uriParams The path parameters
|
||||||
|
* return templatized query string
|
||||||
|
*/
|
||||||
|
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||||
|
StringBuilder queryBuilder = new StringBuilder();
|
||||||
|
queryParams.forEach((name, values) -> {
|
||||||
|
if (CollectionUtils.isEmpty(values)) {
|
||||||
|
if (queryBuilder.length() != 0) {
|
||||||
|
queryBuilder.append('&');
|
||||||
|
}
|
||||||
|
queryBuilder.append(name);
|
||||||
|
} else {
|
||||||
|
int valueItemCounter = 0;
|
||||||
|
for (Object value : values) {
|
||||||
|
if (queryBuilder.length() != 0) {
|
||||||
|
queryBuilder.append('&');
|
||||||
|
}
|
||||||
|
queryBuilder.append(name);
|
||||||
|
if (value != null) {
|
||||||
|
String templatizedKey = name + valueItemCounter++;
|
||||||
|
uriParams.put(templatizedKey, value.toString());
|
||||||
|
queryBuilder.append('=').append("{").append(templatizedKey).append("}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return queryBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||||
|
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||||
|
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||||
|
MediaType contentType, String[] authNames) {
|
||||||
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|
||||||
|
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
|
||||||
|
|
||||||
|
String finalUri = builder.build(false).toUriString();
|
||||||
|
Map<String, Object> uriParams = new HashMap();
|
||||||
|
uriParams.putAll(pathParams);
|
||||||
|
|
||||||
|
if (queryParams != null && !queryParams.isEmpty()) {
|
||||||
|
//Include queryParams in uriParams taking into account the paramName
|
||||||
|
String queryUri = generateQueryUri(queryParams, uriParams);
|
||||||
|
//Append to finalUri the templatized query string like "?param1={param1Value}&.......
|
||||||
|
finalUri += "?" + queryUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(finalUri, uriParams);
|
||||||
|
|
||||||
|
if (accept != null) {
|
||||||
|
requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
|
||||||
|
}
|
||||||
|
if(contentType != null) {
|
||||||
|
requestBuilder.contentType(contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
addHeadersToRequest(headerParams, requestBuilder);
|
||||||
|
addHeadersToRequest(defaultHeaders, requestBuilder);
|
||||||
|
addCookiesToRequest(cookieParams, requestBuilder);
|
||||||
|
addCookiesToRequest(defaultCookies, requestBuilder);
|
||||||
|
|
||||||
|
requestBuilder.body(selectBody(body, formParams, contentType));
|
||||||
|
return requestBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add headers to the request that is being built
|
||||||
|
* @param headers The headers to add
|
||||||
|
* @param requestBuilder The current request
|
||||||
|
*/
|
||||||
|
protected void addHeadersToRequest(HttpHeaders headers, WebClient.RequestBodySpec requestBuilder) {
|
||||||
|
for (Entry<String, List<String>> entry : headers.entrySet()) {
|
||||||
|
List<String> values = entry.getValue();
|
||||||
|
for(String value : values) {
|
||||||
|
if (value != null) {
|
||||||
|
requestBuilder.header(entry.getKey(), value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add cookies to the request that is being built
|
||||||
|
* @param cookies The cookies to add
|
||||||
|
* @param requestBuilder The current request
|
||||||
|
*/
|
||||||
|
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, WebClient.RequestBodySpec requestBuilder) {
|
||||||
|
for (Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||||
|
List<String> values = entry.getValue();
|
||||||
|
for(String value : values) {
|
||||||
|
if (value != null) {
|
||||||
|
requestBuilder.cookie(entry.getKey(), value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update query and header parameters based on authentication settings.
|
||||||
|
*
|
||||||
|
* @param authNames The authentications to apply
|
||||||
|
* @param queryParams The query parameters
|
||||||
|
* @param headerParams The header parameters
|
||||||
|
* @param cookieParams the cookie parameters
|
||||||
|
*/
|
||||||
|
private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||||
|
for (String authName : authNames) {
|
||||||
|
Authentication auth = authentications.get(authName);
|
||||||
|
if (auth == null) {
|
||||||
|
throw new RestClientException("Authentication undefined: " + authName);
|
||||||
|
}
|
||||||
|
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats the specified collection path parameter to a string value.
|
||||||
|
*
|
||||||
|
* @param collectionFormat The collection format of the parameter.
|
||||||
|
* @param values The values of the parameter.
|
||||||
|
* @return String representation of the parameter
|
||||||
|
*/
|
||||||
|
public String collectionPathParameterToString(CollectionFormat collectionFormat, Collection<?> values) {
|
||||||
|
// create the value based on the collection format
|
||||||
|
if (CollectionFormat.MULTI.equals(collectionFormat)) {
|
||||||
|
// not valid for path params
|
||||||
|
return parameterToString(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
// collectionFormat is assumed to be "csv" by default
|
||||||
|
if(collectionFormat == null) {
|
||||||
|
collectionFormat = CollectionFormat.CSV;
|
||||||
|
}
|
||||||
|
|
||||||
|
return collectionFormat.collectionToString(values);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Minimal Example
|
||||||
|
* byte Array error in equal method
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: v1
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class.
|
||||||
|
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
|
||||||
|
*/
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class JavaTimeFormatter {
|
||||||
|
|
||||||
|
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||||
|
* @return DateTimeFormatter
|
||||||
|
*/
|
||||||
|
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||||
|
return offsetDateTimeFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||||
|
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||||
|
*/
|
||||||
|
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||||
|
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the given string into {@code OffsetDateTime} object.
|
||||||
|
* @param str String
|
||||||
|
* @return {@code OffsetDateTime}
|
||||||
|
*/
|
||||||
|
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||||
|
try {
|
||||||
|
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||||
|
} catch (DateTimeParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Format the given {@code OffsetDateTime} object into string.
|
||||||
|
* @param offsetDateTime {@code OffsetDateTime}
|
||||||
|
* @return {@code OffsetDateTime} in string format
|
||||||
|
*/
|
||||||
|
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||||
|
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Minimal Example
|
||||||
|
* byte Array error in equal method
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: v1
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.util.StdDateFormat;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.FieldPosition;
|
||||||
|
import java.text.ParsePosition;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
public class RFC3339DateFormat extends DateFormat {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
|
||||||
|
|
||||||
|
private final StdDateFormat fmt = new StdDateFormat()
|
||||||
|
.withTimeZone(TIMEZONE_Z)
|
||||||
|
.withColonInTimeZone(true);
|
||||||
|
|
||||||
|
public RFC3339DateFormat() {
|
||||||
|
this.calendar = new GregorianCalendar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date parse(String source) {
|
||||||
|
return parse(source, new ParsePosition(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date parse(String source, ParsePosition pos) {
|
||||||
|
return fmt.parse(source, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
|
||||||
|
return fmt.format(date, toAppendTo, fieldPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A describtion of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replaceAll("\\{" + name + "\\}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Minimal Example
|
||||||
|
* byte Array error in equal method
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: v1
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class StringUtil {
|
||||||
|
/**
|
||||||
|
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||||
|
*
|
||||||
|
* @param array The array
|
||||||
|
* @param value The value to search
|
||||||
|
* @return true if the array contains the value
|
||||||
|
*/
|
||||||
|
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||||
|
for (String str : array) {
|
||||||
|
if (value == null && str == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (value != null && value.equalsIgnoreCase(str)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join an array of strings with the given separator.
|
||||||
|
* <p>
|
||||||
|
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||||
|
* if one of those libraries is added as dependency.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param array The array of strings
|
||||||
|
* @param separator The separator
|
||||||
|
* @return the resulting string
|
||||||
|
*/
|
||||||
|
public static String join(String[] array, String separator) {
|
||||||
|
int len = array.length;
|
||||||
|
if (len == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
out.append(array[0]);
|
||||||
|
for (int i = 1; i < len; i++) {
|
||||||
|
out.append(separator).append(array[i]);
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join a list of strings with the given separator.
|
||||||
|
*
|
||||||
|
* @param list The list of strings
|
||||||
|
* @param separator The separator
|
||||||
|
* @return the resulting string
|
||||||
|
*/
|
||||||
|
public static String join(Collection<String> list, String separator) {
|
||||||
|
Iterator<String> iterator = list.iterator();
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
if (iterator.hasNext()) {
|
||||||
|
out.append(iterator.next());
|
||||||
|
}
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
out.append(separator).append(iterator.next());
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.ByteArrayObject;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
|
import org.springframework.web.reactive.function.client.WebClient.ResponseSpec;
|
||||||
|
import org.springframework.web.reactive.function.client.WebClientResponseException;
|
||||||
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class DefaultApi {
|
||||||
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
public DefaultApi() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DefaultApi(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient getApiClient() {
|
||||||
|
return apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiClient(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* <p><b>200</b>
|
||||||
|
* @return List<ByteArrayObject>
|
||||||
|
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||||
|
*/
|
||||||
|
private ResponseSpec nullableArrayTestGetRequestCreation() throws WebClientResponseException {
|
||||||
|
Object postBody = null;
|
||||||
|
// create path and map variables
|
||||||
|
final Map<String, Object> pathParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||||
|
final HttpHeaders headerParams = new HttpHeaders();
|
||||||
|
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||||
|
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
final String[] localVarContentTypes = { };
|
||||||
|
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
ParameterizedTypeReference<ByteArrayObject> localVarReturnType = new ParameterizedTypeReference<ByteArrayObject>() {};
|
||||||
|
return apiClient.invokeAPI("/nullable-array-test", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* <p><b>200</b>
|
||||||
|
* @return List<ByteArrayObject>
|
||||||
|
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||||
|
*/
|
||||||
|
public Flux<ByteArrayObject> nullableArrayTestGet() throws WebClientResponseException {
|
||||||
|
ParameterizedTypeReference<ByteArrayObject> localVarReturnType = new ParameterizedTypeReference<ByteArrayObject>() {};
|
||||||
|
return nullableArrayTestGetRequestCreation().bodyToFlux(localVarReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mono<ResponseEntity<List<ByteArrayObject>>> nullableArrayTestGetWithHttpInfo() throws WebClientResponseException {
|
||||||
|
ParameterizedTypeReference<ByteArrayObject> localVarReturnType = new ParameterizedTypeReference<ByteArrayObject>() {};
|
||||||
|
return nullableArrayTestGetRequestCreation().toEntityList(localVarReturnType);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class ApiKeyAuth implements Authentication {
|
||||||
|
private final String location;
|
||||||
|
private final String paramName;
|
||||||
|
|
||||||
|
private String apiKey;
|
||||||
|
private String apiKeyPrefix;
|
||||||
|
|
||||||
|
public ApiKeyAuth(String location, String paramName) {
|
||||||
|
this.location = location;
|
||||||
|
this.paramName = paramName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParamName() {
|
||||||
|
return paramName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiKey() {
|
||||||
|
return apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKey(String apiKey) {
|
||||||
|
this.apiKey = apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiKeyPrefix() {
|
||||||
|
return apiKeyPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||||
|
this.apiKeyPrefix = apiKeyPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||||
|
if (apiKey == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String value;
|
||||||
|
if (apiKeyPrefix != null) {
|
||||||
|
value = apiKeyPrefix + " " + apiKey;
|
||||||
|
} else {
|
||||||
|
value = apiKey;
|
||||||
|
}
|
||||||
|
if (location.equals("query")) {
|
||||||
|
queryParams.add(paramName, value);
|
||||||
|
} else if (location.equals("header")) {
|
||||||
|
headerParams.add(paramName, value);
|
||||||
|
} else if (location.equals("cookie")) {
|
||||||
|
cookieParams.add(paramName, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
|
public interface Authentication {
|
||||||
|
/**
|
||||||
|
* Apply authentication settings to header and / or query parameters.
|
||||||
|
* @param queryParams The query parameters for the request
|
||||||
|
* @param headerParams The header parameters for the request
|
||||||
|
* @param cookieParams The cookie parameters for the request
|
||||||
|
*/
|
||||||
|
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams);
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.util.Base64Utils;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class HttpBasicAuth implements Authentication {
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||||
|
if (username == null && password == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||||
|
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8)));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.util.Base64Utils;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class HttpBearerAuth implements Authentication {
|
||||||
|
private final String scheme;
|
||||||
|
private String bearerToken;
|
||||||
|
|
||||||
|
public HttpBearerAuth(String scheme) {
|
||||||
|
this.scheme = scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBearerToken() {
|
||||||
|
return bearerToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBearerToken(String bearerToken) {
|
||||||
|
this.bearerToken = bearerToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||||
|
if (bearerToken == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
headerParams.add(HttpHeaders.AUTHORIZATION, (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String upperCaseBearer(String scheme) {
|
||||||
|
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,271 @@
|
|||||||
|
/*
|
||||||
|
* Minimal Example
|
||||||
|
* byte Array error in equal method
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: v1
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ByteArrayObject
|
||||||
|
*/
|
||||||
|
@JsonPropertyOrder({
|
||||||
|
ByteArrayObject.JSON_PROPERTY_NULLABLE_ARRAY,
|
||||||
|
ByteArrayObject.JSON_PROPERTY_NORMAL_ARRAY,
|
||||||
|
ByteArrayObject.JSON_PROPERTY_NULLABLE_STRING,
|
||||||
|
ByteArrayObject.JSON_PROPERTY_STRING_FIELD,
|
||||||
|
ByteArrayObject.JSON_PROPERTY_INT_FIELD
|
||||||
|
})
|
||||||
|
@JsonTypeName("ByteArrayObject")
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class ByteArrayObject {
|
||||||
|
public static final String JSON_PROPERTY_NULLABLE_ARRAY = "nullableArray";
|
||||||
|
private JsonNullable<byte[]> nullableArray = JsonNullable.<byte[]>undefined();
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_NORMAL_ARRAY = "normalArray";
|
||||||
|
private byte[] normalArray;
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_NULLABLE_STRING = "nullableString";
|
||||||
|
private JsonNullable<String> nullableString = JsonNullable.<String>undefined();
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_STRING_FIELD = "stringField";
|
||||||
|
private String stringField;
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_INT_FIELD = "intField";
|
||||||
|
private BigDecimal intField;
|
||||||
|
|
||||||
|
|
||||||
|
public ByteArrayObject nullableArray(byte[] nullableArray) {
|
||||||
|
this.nullableArray = JsonNullable.<byte[]>of(nullableArray);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte array.
|
||||||
|
* @return nullableArray
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "byte array.")
|
||||||
|
@JsonIgnore
|
||||||
|
|
||||||
|
public byte[] getNullableArray() {
|
||||||
|
return nullableArray.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_NULLABLE_ARRAY)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public JsonNullable<byte[]> getNullableArray_JsonNullable() {
|
||||||
|
return nullableArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_NULLABLE_ARRAY)
|
||||||
|
public void setNullableArray_JsonNullable(JsonNullable<byte[]> nullableArray) {
|
||||||
|
this.nullableArray = nullableArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNullableArray(byte[] nullableArray) {
|
||||||
|
this.nullableArray = JsonNullable.<byte[]>of(nullableArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ByteArrayObject normalArray(byte[] normalArray) {
|
||||||
|
|
||||||
|
this.normalArray = normalArray;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte array.
|
||||||
|
* @return normalArray
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "byte array.")
|
||||||
|
@JsonProperty(JSON_PROPERTY_NORMAL_ARRAY)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public byte[] getNormalArray() {
|
||||||
|
return normalArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_NORMAL_ARRAY)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setNormalArray(byte[] normalArray) {
|
||||||
|
this.normalArray = normalArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ByteArrayObject nullableString(String nullableString) {
|
||||||
|
this.nullableString = JsonNullable.<String>of(nullableString);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get nullableString
|
||||||
|
* @return nullableString
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonIgnore
|
||||||
|
|
||||||
|
public String getNullableString() {
|
||||||
|
return nullableString.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_NULLABLE_STRING)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public JsonNullable<String> getNullableString_JsonNullable() {
|
||||||
|
return nullableString;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_NULLABLE_STRING)
|
||||||
|
public void setNullableString_JsonNullable(JsonNullable<String> nullableString) {
|
||||||
|
this.nullableString = nullableString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNullableString(String nullableString) {
|
||||||
|
this.nullableString = JsonNullable.<String>of(nullableString);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ByteArrayObject stringField(String stringField) {
|
||||||
|
|
||||||
|
this.stringField = stringField;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get stringField
|
||||||
|
* @return stringField
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty(JSON_PROPERTY_STRING_FIELD)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public String getStringField() {
|
||||||
|
return stringField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_STRING_FIELD)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setStringField(String stringField) {
|
||||||
|
this.stringField = stringField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ByteArrayObject intField(BigDecimal intField) {
|
||||||
|
|
||||||
|
this.intField = intField;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get intField
|
||||||
|
* @return intField
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty(JSON_PROPERTY_INT_FIELD)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public BigDecimal getIntField() {
|
||||||
|
return intField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_INT_FIELD)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setIntField(BigDecimal intField) {
|
||||||
|
this.intField = intField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ByteArrayObject byteArrayObject = (ByteArrayObject) o;
|
||||||
|
return equalsNullable(this.nullableArray, byteArrayObject.nullableArray) &&
|
||||||
|
Arrays.equals(this.normalArray, byteArrayObject.normalArray) &&
|
||||||
|
equalsNullable(this.nullableString, byteArrayObject.nullableString) &&
|
||||||
|
Objects.equals(this.stringField, byteArrayObject.stringField) &&
|
||||||
|
Objects.equals(this.intField, byteArrayObject.intField);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(hashCodeNullable(nullableArray), Arrays.hashCode(normalArray), hashCodeNullable(nullableString), stringField, intField);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ByteArrayObject {\n");
|
||||||
|
sb.append(" nullableArray: ").append(toIndentedString(nullableArray)).append("\n");
|
||||||
|
sb.append(" normalArray: ").append(toIndentedString(normalArray)).append("\n");
|
||||||
|
sb.append(" nullableString: ").append(toIndentedString(nullableString)).append("\n");
|
||||||
|
sb.append(" stringField: ").append(toIndentedString(stringField)).append("\n");
|
||||||
|
sb.append(" intField: ").append(toIndentedString(intField)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Minimal Example
|
||||||
|
* byte Array error in equal method
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: v1
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.ByteArrayObject;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for DefaultApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
public class DefaultApiTest {
|
||||||
|
|
||||||
|
private final DefaultApi api = new DefaultApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void nullableArrayTestGetTest() {
|
||||||
|
List<ByteArrayObject> response = api.nullableArrayTestGet().collectList().block();
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Minimal Example
|
||||||
|
* byte Array error in equal method
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: v1
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for ByteArrayObject
|
||||||
|
*/
|
||||||
|
public class ByteArrayObjectTest {
|
||||||
|
private final ByteArrayObject model = new ByteArrayObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for ByteArrayObject
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testByteArrayObject() {
|
||||||
|
// TODO: test ByteArrayObject
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'nullableArray'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void nullableArrayTest() {
|
||||||
|
// TODO: test nullableArray
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'normalArray'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void normalArrayTest() {
|
||||||
|
// TODO: test normalArray
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -26,6 +26,7 @@ import org.openapitools.client.model.OuterEnum;
|
|||||||
import org.openapitools.client.model.OuterEnumDefaultValue;
|
import org.openapitools.client.model.OuterEnumDefaultValue;
|
||||||
import org.openapitools.client.model.OuterEnumInteger;
|
import org.openapitools.client.model.OuterEnumInteger;
|
||||||
import org.openapitools.client.model.OuterEnumIntegerDefaultValue;
|
import org.openapitools.client.model.OuterEnumIntegerDefaultValue;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -453,15 +454,28 @@ public class EnumTest {
|
|||||||
Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) &&
|
Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) &&
|
||||||
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
||||||
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
|
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
|
||||||
Objects.equals(this.outerEnum, enumTest.outerEnum) &&
|
equalsNullable(this.outerEnum, enumTest.outerEnum) &&
|
||||||
Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) &&
|
Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) &&
|
||||||
Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) &&
|
Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) &&
|
||||||
Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue);
|
Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
|
return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -85,12 +86,25 @@ public class HealthCheckResult {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
HealthCheckResult healthCheckResult = (HealthCheckResult) o;
|
HealthCheckResult healthCheckResult = (HealthCheckResult) o;
|
||||||
return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage);
|
return equalsNullable(this.nullableMessage, healthCheckResult.nullableMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(nullableMessage);
|
return Objects.hash(hashCodeNullable(nullableMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,6 +29,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -568,24 +569,37 @@ public class NullableClass extends HashMap<String, Object> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NullableClass nullableClass = (NullableClass) o;
|
NullableClass nullableClass = (NullableClass) o;
|
||||||
return Objects.equals(this.integerProp, nullableClass.integerProp) &&
|
return equalsNullable(this.integerProp, nullableClass.integerProp) &&
|
||||||
Objects.equals(this.numberProp, nullableClass.numberProp) &&
|
equalsNullable(this.numberProp, nullableClass.numberProp) &&
|
||||||
Objects.equals(this.booleanProp, nullableClass.booleanProp) &&
|
equalsNullable(this.booleanProp, nullableClass.booleanProp) &&
|
||||||
Objects.equals(this.stringProp, nullableClass.stringProp) &&
|
equalsNullable(this.stringProp, nullableClass.stringProp) &&
|
||||||
Objects.equals(this.dateProp, nullableClass.dateProp) &&
|
equalsNullable(this.dateProp, nullableClass.dateProp) &&
|
||||||
Objects.equals(this.datetimeProp, nullableClass.datetimeProp) &&
|
equalsNullable(this.datetimeProp, nullableClass.datetimeProp) &&
|
||||||
Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) &&
|
equalsNullable(this.arrayNullableProp, nullableClass.arrayNullableProp) &&
|
||||||
Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) &&
|
equalsNullable(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) &&
|
||||||
Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) &&
|
Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) &&
|
||||||
Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) &&
|
equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) &&
|
||||||
Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
|
equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
|
||||||
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) &&
|
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) &&
|
||||||
super.equals(o);
|
super.equals(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode());
|
return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,6 +27,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -336,7 +337,7 @@ public class AdditionalPropertiesClass {
|
|||||||
AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o;
|
AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o;
|
||||||
return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) &&
|
return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) &&
|
||||||
Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty) &&
|
Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty) &&
|
||||||
Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) &&
|
equalsNullable(this.anytype1, additionalPropertiesClass.anytype1) &&
|
||||||
Objects.equals(this.mapWithUndeclaredPropertiesAnytype1, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype1) &&
|
Objects.equals(this.mapWithUndeclaredPropertiesAnytype1, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype1) &&
|
||||||
Objects.equals(this.mapWithUndeclaredPropertiesAnytype2, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype2) &&
|
Objects.equals(this.mapWithUndeclaredPropertiesAnytype2, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype2) &&
|
||||||
Objects.equals(this.mapWithUndeclaredPropertiesAnytype3, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype3) &&
|
Objects.equals(this.mapWithUndeclaredPropertiesAnytype3, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype3) &&
|
||||||
@ -344,9 +345,22 @@ public class AdditionalPropertiesClass {
|
|||||||
Objects.equals(this.mapWithUndeclaredPropertiesString, additionalPropertiesClass.mapWithUndeclaredPropertiesString);
|
Objects.equals(this.mapWithUndeclaredPropertiesString, additionalPropertiesClass.mapWithUndeclaredPropertiesString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mapProperty, mapOfMapProperty, anytype1, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString);
|
return Objects.hash(mapProperty, mapOfMapProperty, hashCodeNullable(anytype1), mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,6 +34,7 @@ import org.openapitools.client.model.Fruit;
|
|||||||
import org.openapitools.client.model.NullableShape;
|
import org.openapitools.client.model.NullableShape;
|
||||||
import org.openapitools.client.model.Shape;
|
import org.openapitools.client.model.Shape;
|
||||||
import org.openapitools.client.model.ShapeOrNull;
|
import org.openapitools.client.model.ShapeOrNull;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -236,14 +237,27 @@ public class Drawing {
|
|||||||
Drawing drawing = (Drawing) o;
|
Drawing drawing = (Drawing) o;
|
||||||
return Objects.equals(this.mainShape, drawing.mainShape) &&
|
return Objects.equals(this.mainShape, drawing.mainShape) &&
|
||||||
Objects.equals(this.shapeOrNull, drawing.shapeOrNull) &&
|
Objects.equals(this.shapeOrNull, drawing.shapeOrNull) &&
|
||||||
Objects.equals(this.nullableShape, drawing.nullableShape) &&
|
equalsNullable(this.nullableShape, drawing.nullableShape) &&
|
||||||
Objects.equals(this.shapes, drawing.shapes)&&
|
Objects.equals(this.shapes, drawing.shapes)&&
|
||||||
Objects.equals(this.additionalProperties, drawing.additionalProperties);
|
Objects.equals(this.additionalProperties, drawing.additionalProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mainShape, shapeOrNull, nullableShape, shapes, additionalProperties);
|
return Objects.hash(mainShape, shapeOrNull, hashCodeNullable(nullableShape), shapes, additionalProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,6 +28,7 @@ import org.openapitools.client.model.OuterEnum;
|
|||||||
import org.openapitools.client.model.OuterEnumDefaultValue;
|
import org.openapitools.client.model.OuterEnumDefaultValue;
|
||||||
import org.openapitools.client.model.OuterEnumInteger;
|
import org.openapitools.client.model.OuterEnumInteger;
|
||||||
import org.openapitools.client.model.OuterEnumIntegerDefaultValue;
|
import org.openapitools.client.model.OuterEnumIntegerDefaultValue;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -517,15 +518,28 @@ public class EnumTest {
|
|||||||
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
||||||
Objects.equals(this.enumIntegerOnly, enumTest.enumIntegerOnly) &&
|
Objects.equals(this.enumIntegerOnly, enumTest.enumIntegerOnly) &&
|
||||||
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
|
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
|
||||||
Objects.equals(this.outerEnum, enumTest.outerEnum) &&
|
equalsNullable(this.outerEnum, enumTest.outerEnum) &&
|
||||||
Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) &&
|
Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) &&
|
||||||
Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) &&
|
Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) &&
|
||||||
Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue);
|
Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(enumString, enumStringRequired, enumInteger, enumIntegerOnly, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
|
return Objects.hash(enumString, enumStringRequired, enumInteger, enumIntegerOnly, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -90,12 +91,25 @@ public class HealthCheckResult {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
HealthCheckResult healthCheckResult = (HealthCheckResult) o;
|
HealthCheckResult healthCheckResult = (HealthCheckResult) o;
|
||||||
return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage);
|
return equalsNullable(this.nullableMessage, healthCheckResult.nullableMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(nullableMessage);
|
return Objects.hash(hashCodeNullable(nullableMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,6 +35,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -603,24 +604,37 @@ public class NullableClass {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NullableClass nullableClass = (NullableClass) o;
|
NullableClass nullableClass = (NullableClass) o;
|
||||||
return Objects.equals(this.integerProp, nullableClass.integerProp) &&
|
return equalsNullable(this.integerProp, nullableClass.integerProp) &&
|
||||||
Objects.equals(this.numberProp, nullableClass.numberProp) &&
|
equalsNullable(this.numberProp, nullableClass.numberProp) &&
|
||||||
Objects.equals(this.booleanProp, nullableClass.booleanProp) &&
|
equalsNullable(this.booleanProp, nullableClass.booleanProp) &&
|
||||||
Objects.equals(this.stringProp, nullableClass.stringProp) &&
|
equalsNullable(this.stringProp, nullableClass.stringProp) &&
|
||||||
Objects.equals(this.dateProp, nullableClass.dateProp) &&
|
equalsNullable(this.dateProp, nullableClass.dateProp) &&
|
||||||
Objects.equals(this.datetimeProp, nullableClass.datetimeProp) &&
|
equalsNullable(this.datetimeProp, nullableClass.datetimeProp) &&
|
||||||
Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) &&
|
equalsNullable(this.arrayNullableProp, nullableClass.arrayNullableProp) &&
|
||||||
Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) &&
|
equalsNullable(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) &&
|
||||||
Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) &&
|
Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) &&
|
||||||
Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) &&
|
equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) &&
|
||||||
Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
|
equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
|
||||||
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable)&&
|
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable)&&
|
||||||
Objects.equals(this.additionalProperties, nullableClass.additionalProperties);
|
Objects.equals(this.additionalProperties, nullableClass.additionalProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, additionalProperties);
|
return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, additionalProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.openapitools.jackson.nullable.JsonNullable;
|
import org.openapitools.jackson.nullable.JsonNullable;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -444,14 +445,27 @@ public class User {
|
|||||||
Objects.equals(this.phone, user.phone) &&
|
Objects.equals(this.phone, user.phone) &&
|
||||||
Objects.equals(this.userStatus, user.userStatus) &&
|
Objects.equals(this.userStatus, user.userStatus) &&
|
||||||
Objects.equals(this.objectWithNoDeclaredProps, user.objectWithNoDeclaredProps) &&
|
Objects.equals(this.objectWithNoDeclaredProps, user.objectWithNoDeclaredProps) &&
|
||||||
Objects.equals(this.objectWithNoDeclaredPropsNullable, user.objectWithNoDeclaredPropsNullable) &&
|
equalsNullable(this.objectWithNoDeclaredPropsNullable, user.objectWithNoDeclaredPropsNullable) &&
|
||||||
Objects.equals(this.anyTypeProp, user.anyTypeProp) &&
|
equalsNullable(this.anyTypeProp, user.anyTypeProp) &&
|
||||||
Objects.equals(this.anyTypePropNullable, user.anyTypePropNullable);
|
equalsNullable(this.anyTypePropNullable, user.anyTypePropNullable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||||
|
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, anyTypeProp, anyTypePropNullable);
|
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, hashCodeNullable(objectWithNoDeclaredPropsNullable), hashCodeNullable(anyTypeProp), hashCodeNullable(anyTypePropNullable));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||||
|
if (a == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return a.isPresent()
|
||||||
|
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
|
||||||
|
: 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user