From 96781bb3a06cfd2d1c51310243afbe7f585646f7 Mon Sep 17 00:00:00 2001 From: Thibault Duperron Date: Sun, 18 Oct 2020 23:54:43 +0200 Subject: [PATCH 1/4] Sanitize additionalProperties with CliOptions fix #6591 --- .../codegen/config/CodegenConfigurator.java | 45 ++++++++++++++----- .../languages/AbstractJavaCodegen.java | 2 +- .../config/CodegenConfiguratorTest.java | 34 ++++++++++++++ 3 files changed, 70 insertions(+), 11 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index cf0de7a73882..b6a447c07914 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -42,13 +42,14 @@ import java.io.IOException; import java.util.*; +import static io.swagger.v3.parser.util.SchemaTypeUtil.BOOLEAN_TYPE; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isNotEmpty; /** * A class which manages the contextual configuration for code generation. * This includes configuring the generator, templating, and the workflow which orchestrates these. - * + *

* This helper also enables the deserialization of {@link GeneratorSettings} via application-specific Jackson JSON usage * (see {@link DynamicSettings}. */ @@ -99,25 +100,25 @@ public static CodegenConfigurator fromFile(String configFile, Module... modules) if (workflowSettings.getGlobalProperties() != null) { configurator.globalProperties.putAll(workflowSettings.getGlobalProperties()); } - if(generatorSettings.getInstantiationTypes() != null) { + if (generatorSettings.getInstantiationTypes() != null) { configurator.instantiationTypes.putAll(generatorSettings.getInstantiationTypes()); } - if(generatorSettings.getTypeMappings() != null) { + if (generatorSettings.getTypeMappings() != null) { configurator.typeMappings.putAll(generatorSettings.getTypeMappings()); } - if(generatorSettings.getAdditionalProperties() != null) { + if (generatorSettings.getAdditionalProperties() != null) { configurator.additionalProperties.putAll(generatorSettings.getAdditionalProperties()); } - if(generatorSettings.getImportMappings() != null) { + if (generatorSettings.getImportMappings() != null) { configurator.importMappings.putAll(generatorSettings.getImportMappings()); } - if(generatorSettings.getLanguageSpecificPrimitives() != null) { + if (generatorSettings.getLanguageSpecificPrimitives() != null) { configurator.languageSpecificPrimitives.addAll(generatorSettings.getLanguageSpecificPrimitives()); } - if(generatorSettings.getReservedWordMappings() != null) { + if (generatorSettings.getReservedWordMappings() != null) { configurator.reservedWordMappings.putAll(generatorSettings.getReservedWordMappings()); } - if(generatorSettings.getServerVariables() != null) { + if (generatorSettings.getServerVariables() != null) { configurator.serverVariables.putAll(generatorSettings.getServerVariables()); } @@ -596,7 +597,11 @@ public ClientOptInput toClientOptInput() { config.importMapping().putAll(generatorSettings.getImportMappings()); config.languageSpecificPrimitives().addAll(generatorSettings.getLanguageSpecificPrimitives()); config.reservedWordsMappings().putAll(generatorSettings.getReservedWordMappings()); - config.additionalProperties().putAll(generatorSettings.getAdditionalProperties()); + generatorSettings.getAdditionalProperties().forEach((k, v) -> { + Object value = sanitizeAdditionalPropertyValue(config, k, v); + config.additionalProperties().put(k, value); + }); + Map serverVariables = generatorSettings.getServerVariables(); if (!serverVariables.isEmpty()) { @@ -615,6 +620,26 @@ public ClientOptInput toClientOptInput() { .config(config) .userDefinedTemplates(userDefinedTemplates); - return input.openAPI((OpenAPI)context.getSpecDocument()); + return input.openAPI((OpenAPI) context.getSpecDocument()); + } + + private Object sanitizeAdditionalPropertyValue(CodegenConfig config, String opt, Object value) { + return findCliOptionsByOpt(config, opt) + .map(it -> parseByType(value, it)) + .orElse(value); + } + + private Object parseByType(Object v, CliOption it) { + if (BOOLEAN_TYPE.equals(it.getType())) { + return Boolean.parseBoolean(v.toString()); + } else { + return v; + } + } + + private Optional findCliOptionsByOpt(CodegenConfig config, String k) { + return config.cliOptions().stream() + .filter(it -> it.getOpt().equals(k)) + .findFirst(); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index fc87e5bc9682..b4a5d0a7a4c0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -544,7 +544,7 @@ public void processOpts() { importMapping.put("LocalDate", "org.joda.time.LocalDate"); importMapping.put("DateTime", "org.joda.time.DateTime"); } else if (dateLibrary.startsWith("java8")) { - additionalProperties.put("java8", "true"); + additionalProperties.put("java8", true); additionalProperties.put("jsr310", "true"); typeMapping.put("date", "LocalDate"); importMapping.put("LocalDate", "java.time.LocalDate"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java index 7055bff46595..6c273146c441 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java @@ -122,4 +122,38 @@ public void shouldSetConfiglProperties() throws IOException { want(props, "foo", "bar"); want(props, "baz", "quux"); } + + @Test + public void shouldParsAdditionalProperties() throws IOException { + Map properties = new HashMap() {{ + put("reactive", "true"); + put("interfaceOnly", "false"); + put("java8", true); + put("apiFirst", false); + put("anotherOne", "true"); + }}; + + File output = Files.createTempDirectory("test").toFile(); + String outDir = Paths.get(output.toURI()).toAbsolutePath().toString(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("spring") + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/ping.yaml") + .setOutputDir(outDir); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + + CodegenConfig config = clientOptInput.getConfig(); + config.processOpts(); + + Map props = config.additionalProperties(); + + want(props, "reactive", true); + want(props, "interfaceOnly", false); + want(props, "java8", true); + want(props, "apiFirst", false); + want(props, "anotherOne", "true"); + } + } \ No newline at end of file From bdf33da0f59072fa24a8828d994680bee1d24f15 Mon Sep 17 00:00:00 2001 From: Thibault Duperron Date: Sat, 24 Oct 2020 18:26:13 +0200 Subject: [PATCH 2/4] Move coerceAdditionalProperties to javaCodegen --- .../codegen/config/CodegenConfigurator.java | 45 +++------- .../languages/AbstractJavaCodegen.java | 60 +++++++++---- .../codegen/languages/SpringCodegen.java | 85 ++++++++++++------- .../config/CodegenConfiguratorTest.java | 34 -------- 4 files changed, 106 insertions(+), 118 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index b6a447c07914..cf0de7a73882 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -42,14 +42,13 @@ import java.io.IOException; import java.util.*; -import static io.swagger.v3.parser.util.SchemaTypeUtil.BOOLEAN_TYPE; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isNotEmpty; /** * A class which manages the contextual configuration for code generation. * This includes configuring the generator, templating, and the workflow which orchestrates these. - *

+ * * This helper also enables the deserialization of {@link GeneratorSettings} via application-specific Jackson JSON usage * (see {@link DynamicSettings}. */ @@ -100,25 +99,25 @@ public static CodegenConfigurator fromFile(String configFile, Module... modules) if (workflowSettings.getGlobalProperties() != null) { configurator.globalProperties.putAll(workflowSettings.getGlobalProperties()); } - if (generatorSettings.getInstantiationTypes() != null) { + if(generatorSettings.getInstantiationTypes() != null) { configurator.instantiationTypes.putAll(generatorSettings.getInstantiationTypes()); } - if (generatorSettings.getTypeMappings() != null) { + if(generatorSettings.getTypeMappings() != null) { configurator.typeMappings.putAll(generatorSettings.getTypeMappings()); } - if (generatorSettings.getAdditionalProperties() != null) { + if(generatorSettings.getAdditionalProperties() != null) { configurator.additionalProperties.putAll(generatorSettings.getAdditionalProperties()); } - if (generatorSettings.getImportMappings() != null) { + if(generatorSettings.getImportMappings() != null) { configurator.importMappings.putAll(generatorSettings.getImportMappings()); } - if (generatorSettings.getLanguageSpecificPrimitives() != null) { + if(generatorSettings.getLanguageSpecificPrimitives() != null) { configurator.languageSpecificPrimitives.addAll(generatorSettings.getLanguageSpecificPrimitives()); } - if (generatorSettings.getReservedWordMappings() != null) { + if(generatorSettings.getReservedWordMappings() != null) { configurator.reservedWordMappings.putAll(generatorSettings.getReservedWordMappings()); } - if (generatorSettings.getServerVariables() != null) { + if(generatorSettings.getServerVariables() != null) { configurator.serverVariables.putAll(generatorSettings.getServerVariables()); } @@ -597,11 +596,7 @@ public ClientOptInput toClientOptInput() { config.importMapping().putAll(generatorSettings.getImportMappings()); config.languageSpecificPrimitives().addAll(generatorSettings.getLanguageSpecificPrimitives()); config.reservedWordsMappings().putAll(generatorSettings.getReservedWordMappings()); - generatorSettings.getAdditionalProperties().forEach((k, v) -> { - Object value = sanitizeAdditionalPropertyValue(config, k, v); - config.additionalProperties().put(k, value); - }); - + config.additionalProperties().putAll(generatorSettings.getAdditionalProperties()); Map serverVariables = generatorSettings.getServerVariables(); if (!serverVariables.isEmpty()) { @@ -620,26 +615,6 @@ public ClientOptInput toClientOptInput() { .config(config) .userDefinedTemplates(userDefinedTemplates); - return input.openAPI((OpenAPI) context.getSpecDocument()); - } - - private Object sanitizeAdditionalPropertyValue(CodegenConfig config, String opt, Object value) { - return findCliOptionsByOpt(config, opt) - .map(it -> parseByType(value, it)) - .orElse(value); - } - - private Object parseByType(Object v, CliOption it) { - if (BOOLEAN_TYPE.equals(it.getType())) { - return Boolean.parseBoolean(v.toString()); - } else { - return v; - } - } - - private Optional findCliOptionsByOpt(CodegenConfig config, String k) { - return config.cliOptions().stream() - .filter(it -> it.getOpt().equals(k)) - .findFirst(); + return input.openAPI((OpenAPI)context.getSpecDocument()); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index b4a5d0a7a4c0..bff1059fee82 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -43,6 +43,7 @@ import java.util.regex.Pattern; import java.util.stream.Stream; +import static java.util.Arrays.asList; import static org.openapitools.codegen.utils.StringUtils.*; public abstract class AbstractJavaCodegen extends DefaultCodegen implements CodegenConfig { @@ -229,7 +230,7 @@ public AbstractJavaCodegen() { cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_VERSION, CodegenConstants.PARENT_VERSION_DESC)); - CliOption snapShotVersion = CliOption.newString(CodegenConstants.SNAPSHOT_VERSION, CodegenConstants.SNAPSHOT_VERSION_DESC); + CliOption snapShotVersion = CliOption.newBoolean(CodegenConstants.SNAPSHOT_VERSION, CodegenConstants.SNAPSHOT_VERSION_DESC); Map snapShotVersionOptions = new HashMap<>(); snapShotVersionOptions.put("true", "Use a SnapShot Version"); snapShotVersionOptions.put("false", "Use a Release Version"); @@ -240,6 +241,7 @@ public AbstractJavaCodegen() { @Override public void processOpts() { + coerceBooleanAdditionalProperties(); super.processOpts(); if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) { @@ -504,26 +506,15 @@ public void processOpts() { importMapping.put("com.fasterxml.jackson.annotation.JsonProperty", "com.fasterxml.jackson.annotation.JsonCreator"); if (additionalProperties.containsKey(JAVA8_MODE)) { - setJava8Mode(Boolean.parseBoolean(additionalProperties.get(JAVA8_MODE).toString())); - if (java8Mode) { - additionalProperties.put("java8", true); - } else { - additionalProperties.put("java8", false); - } + setJava8Mode((boolean) additionalProperties.get(JAVA8_MODE)); } if (additionalProperties.containsKey(SUPPORT_ASYNC)) { - setSupportAsync(Boolean.parseBoolean(additionalProperties.get(SUPPORT_ASYNC).toString())); - if (supportAsync) { - additionalProperties.put(SUPPORT_ASYNC, "true"); - } + setSupportAsync((boolean) additionalProperties.get(SUPPORT_ASYNC)); } if (additionalProperties.containsKey(WITH_XML)) { - setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString())); - if (withXml) { - additionalProperties.put(WITH_XML, "true"); - } + setWithXml((boolean) additionalProperties.get(WITH_XML)); } if (additionalProperties.containsKey(DATE_LIBRARY)) { @@ -888,7 +879,7 @@ public String toDefaultValue(Schema schema) { LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); return String.format(Locale.ROOT, localDate.toString(), ""); } else if (schema.getDefault() instanceof java.time.OffsetDateTime) { - return "OffsetDateTime.parse(\"" + String.format(Locale.ROOT, ((java.time.OffsetDateTime) schema.getDefault()).atZoneSameInstant(ZoneId.systemDefault()).toString(), "") + "\", java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault()))"; + return "OffsetDateTime.parse(\"" + String.format(Locale.ROOT, ((java.time.OffsetDateTime) schema.getDefault()).atZoneSameInstant(ZoneId.systemDefault()).toString(), "") + "\", java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault()))"; } else { _default = (String) schema.getDefault(); } @@ -1166,7 +1157,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) { additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); if (additionalProperties.containsKey(CodegenConstants.SNAPSHOT_VERSION)) { - if (convertPropertyToBooleanAndWriteBack(CodegenConstants.SNAPSHOT_VERSION)) { + if ((boolean) additionalProperties.get(CodegenConstants.SNAPSHOT_VERSION)) { this.setArtifactVersion(this.buildSnapshotVersion(this.getArtifactVersion())); } } @@ -1727,4 +1718,39 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc addImport(codegenModel, codegenModel.additionalPropertiesType); } } + + protected Set booleanAdditionalProperties() { + return new HashSet<>(asList( + CodegenConstants.SERIALIZABLE_MODEL, + CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, + FULL_JAVA_UTIL, + DISCRIMINATOR_CASE_SENSITIVE, + CodegenConstants.HIDE_GENERATION_TIMESTAMP, + WITH_XML, + JAVA8_MODE, + DISABLE_HTML_ESCAPING, + IGNORE_ANYOF_IN_ENUM, + OPENAPI_NULLABLE, + CodegenConstants.SNAPSHOT_VERSION + )); + } + + protected void coerceBooleanAdditionalProperties() { + booleanAdditionalProperties().forEach(prop -> { + Boolean defaultValue = cliOptions.stream() + .filter(it -> it.getOpt().equals(prop)) + .findFirst() + .map(it -> Boolean.parseBoolean(it.getDefault())) + .orElse(null); + Object value = additionalProperties.getOrDefault(prop, defaultValue); + if (value != null) { + if (value instanceof String) { + additionalProperties.put(prop, Boolean.valueOf((String) value)); + } + if (value instanceof Boolean) { + additionalProperties.put(prop, value); + } + } + }); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index a219a17a9de4..1b7965166442 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -39,6 +39,7 @@ import java.util.regex.Matcher; import java.util.stream.Collectors; +import static java.util.Arrays.asList; import static org.apache.commons.lang3.StringUtils.isNotEmpty; import static org.openapitools.codegen.utils.StringUtils.camelize; @@ -206,9 +207,8 @@ public String getHelp() { @Override public void processOpts() { - List> configOptions = additionalProperties.entrySet().stream() - .filter(e -> !Arrays.asList(API_FIRST, "hideGenerationTimestamp").contains(e.getKey())) + .filter(e -> !asList(API_FIRST, "hideGenerationTimestamp").contains(e.getKey())) .filter(e -> cliOptions.stream().map(CliOption::getOpt).anyMatch(opt -> opt.equals(e.getKey()))) .map(e -> Pair.of(e.getKey(), e.getValue().toString())) .collect(Collectors.toList()); @@ -257,36 +257,34 @@ public void processOpts() { } if (additionalProperties.containsKey(VIRTUAL_SERVICE)) { - this.setVirtualService(Boolean.valueOf(additionalProperties.get(VIRTUAL_SERVICE).toString())); + this.setVirtualService((boolean) additionalProperties.get(VIRTUAL_SERVICE)); } if (additionalProperties.containsKey(INTERFACE_ONLY)) { - this.setInterfaceOnly(Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString())); + this.setInterfaceOnly((boolean) additionalProperties.get(INTERFACE_ONLY)); } if (additionalProperties.containsKey(DELEGATE_PATTERN)) { - this.setDelegatePattern(Boolean.valueOf(additionalProperties.get(DELEGATE_PATTERN).toString())); + this.setDelegatePattern((boolean) additionalProperties.get(DELEGATE_PATTERN)); } if (additionalProperties.containsKey(SINGLE_CONTENT_TYPES)) { - this.setSingleContentTypes(Boolean.valueOf(additionalProperties.get(SINGLE_CONTENT_TYPES).toString())); + this.setSingleContentTypes((boolean) additionalProperties.get(SINGLE_CONTENT_TYPES)); } if (additionalProperties.containsKey(SKIP_DEFAULT_INTERFACE)) { - this.setSkipDefaultInterface(Boolean.valueOf(additionalProperties.get(SKIP_DEFAULT_INTERFACE).toString())); + this.setSkipDefaultInterface((boolean) additionalProperties.get(SKIP_DEFAULT_INTERFACE)); } if (additionalProperties.containsKey(ASYNC)) { - this.setAsync(Boolean.valueOf(additionalProperties.get(ASYNC).toString())); - //fix for issue/1164 - convertPropertyToBooleanAndWriteBack(ASYNC); + this.setAsync((boolean) additionalProperties.get(ASYNC)); } if (additionalProperties.containsKey(REACTIVE)) { if (!SPRING_BOOT.equals(library)) { throw new IllegalArgumentException("Currently, reactive option is only supported with Spring-boot"); } - this.setReactive(Boolean.valueOf(additionalProperties.get(REACTIVE).toString())); + this.setReactive((boolean) additionalProperties.get(REACTIVE)); } if (additionalProperties.containsKey(RESPONSE_WRAPPER)) { @@ -294,55 +292,49 @@ public void processOpts() { } if (additionalProperties.containsKey(USE_TAGS)) { - this.setUseTags(Boolean.valueOf(additionalProperties.get(USE_TAGS).toString())); + this.setUseTags((boolean) additionalProperties.get(USE_TAGS)); } if (additionalProperties.containsKey(USE_BEANVALIDATION)) { this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION)); } - writePropertyBack(USE_BEANVALIDATION, useBeanValidation); if (additionalProperties.containsKey(PERFORM_BEANVALIDATION)) { this.setPerformBeanValidation(convertPropertyToBoolean(PERFORM_BEANVALIDATION)); } - writePropertyBack(PERFORM_BEANVALIDATION, performBeanValidation); if (additionalProperties.containsKey(USE_OPTIONAL)) { this.setUseOptional(convertPropertyToBoolean(USE_OPTIONAL)); } if (additionalProperties.containsKey(IMPLICIT_HEADERS)) { - this.setImplicitHeaders(Boolean.valueOf(additionalProperties.get(IMPLICIT_HEADERS).toString())); + this.setImplicitHeaders((boolean) additionalProperties.get(IMPLICIT_HEADERS)); } if (additionalProperties.containsKey(OPENAPI_DOCKET_CONFIG)) { - this.setOpenapiDocketConfig(Boolean.valueOf(additionalProperties.get(OPENAPI_DOCKET_CONFIG).toString())); + this.setOpenapiDocketConfig((boolean) additionalProperties.get(OPENAPI_DOCKET_CONFIG)); } if (additionalProperties.containsKey(API_FIRST)) { - this.setApiFirst(Boolean.valueOf(additionalProperties.get(API_FIRST).toString())); + this.setApiFirst((boolean) additionalProperties.get(API_FIRST)); } if (additionalProperties.containsKey(HATEOAS)) { - this.setHateoas(Boolean.valueOf(additionalProperties.get(HATEOAS).toString())); + this.setHateoas((boolean) additionalProperties.get(HATEOAS)); } if (additionalProperties.containsKey(RETURN_SUCCESS_CODE)) { - this.setReturnSuccessCode(Boolean.valueOf(additionalProperties.get(RETURN_SUCCESS_CODE).toString())); + this.setReturnSuccessCode((boolean) additionalProperties.get(RETURN_SUCCESS_CODE)); } if (additionalProperties.containsKey(UNHANDLED_EXCEPTION_HANDLING)) { - this.setUnhandledException(Boolean.valueOf(additionalProperties.get(UNHANDLED_EXCEPTION_HANDLING).toString())); + this.setUnhandledException((boolean) additionalProperties.get(UNHANDLED_EXCEPTION_HANDLING)); } additionalProperties.put(UNHANDLED_EXCEPTION_HANDLING, this.isUnhandledException()); typeMapping.put("file", "Resource"); importMapping.put("Resource", "org.springframework.core.io.Resource"); - if (useOptional) { - writePropertyBack(USE_OPTIONAL, useOptional); - } - if (this.interfaceOnly && this.delegatePattern) { if (this.java8) { this.delegateMethod = true; @@ -548,7 +540,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) { additionalProperties.put(TITLE, this.title); } - if(!additionalProperties.containsKey(SERVER_PORT)) { + if (!additionalProperties.containsKey(SERVER_PORT)) { URL url = URLPathUtils.getServerURL(openAPI, serverVariableOverrides()); this.additionalProperties.put(SERVER_PORT, URLPathUtils.getPort(url, 8080)); } @@ -571,7 +563,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) { } if (operation.getTags().size() > 0) { String tag = operation.getTags().get(0); - operation.setTags(Arrays.asList(tag)); + operation.setTags(asList(tag)); } operation.addExtension("x-tags", tags); } @@ -772,9 +764,13 @@ public void setSingleContentTypes(boolean singleContentTypes) { this.singleContentTypes = singleContentTypes; } - public void setSkipDefaultInterface(boolean skipDefaultInterface) { this.skipDefaultInterface = skipDefaultInterface; } + public void setSkipDefaultInterface(boolean skipDefaultInterface) { + this.skipDefaultInterface = skipDefaultInterface; + } - public void setJava8(boolean java8) { this.java8 = java8; } + public void setJava8(boolean java8) { + this.java8 = java8; + } public void setVirtualService(boolean virtualService) { this.virtualService = virtualService; @@ -890,12 +886,37 @@ public void postProcessParameter(CodegenParameter p) { if (p.defaultValue == null) { return; } - Boolean fixLong = (p.isLong && "l".equals(p.defaultValue.substring(p.defaultValue.length()-1))); - Boolean fixDouble = (p.isDouble && "d".equals(p.defaultValue.substring(p.defaultValue.length()-1))); - Boolean fixFloat = (p.isFloat && "f".equals(p.defaultValue.substring(p.defaultValue.length()-1))); + Boolean fixLong = (p.isLong && "l".equals(p.defaultValue.substring(p.defaultValue.length() - 1))); + Boolean fixDouble = (p.isDouble && "d".equals(p.defaultValue.substring(p.defaultValue.length() - 1))); + Boolean fixFloat = (p.isFloat && "f".equals(p.defaultValue.substring(p.defaultValue.length() - 1))); if (fixLong || fixDouble || fixFloat) { - p.defaultValue = p.defaultValue.substring(0, p.defaultValue.length()-1); + p.defaultValue = p.defaultValue.substring(0, p.defaultValue.length() - 1); } } + @Override + protected Set booleanAdditionalProperties() { + Set parent = super.booleanAdditionalProperties(); + Set props = new HashSet<>(parent); + props.addAll(asList( + INTERFACE_ONLY, + DELEGATE_PATTERN, + SINGLE_CONTENT_TYPES, + SKIP_DEFAULT_INTERFACE, + ASYNC, + REACTIVE, + VIRTUAL_SERVICE, + USE_TAGS, + USE_BEANVALIDATION, + PERFORM_BEANVALIDATION, + IMPLICIT_HEADERS, + OPENAPI_DOCKET_CONFIG, + API_FIRST, + USE_OPTIONAL, + HATEOAS, + RETURN_SUCCESS_CODE, + UNHANDLED_EXCEPTION_HANDLING + )); + return props; + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java index 6c273146c441..7055bff46595 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java @@ -122,38 +122,4 @@ public void shouldSetConfiglProperties() throws IOException { want(props, "foo", "bar"); want(props, "baz", "quux"); } - - @Test - public void shouldParsAdditionalProperties() throws IOException { - Map properties = new HashMap() {{ - put("reactive", "true"); - put("interfaceOnly", "false"); - put("java8", true); - put("apiFirst", false); - put("anotherOne", "true"); - }}; - - File output = Files.createTempDirectory("test").toFile(); - String outDir = Paths.get(output.toURI()).toAbsolutePath().toString(); - - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("spring") - .setAdditionalProperties(properties) - .setInputSpec("src/test/resources/3_0/ping.yaml") - .setOutputDir(outDir); - - final ClientOptInput clientOptInput = configurator.toClientOptInput(); - - CodegenConfig config = clientOptInput.getConfig(); - config.processOpts(); - - Map props = config.additionalProperties(); - - want(props, "reactive", true); - want(props, "interfaceOnly", false); - want(props, "java8", true); - want(props, "apiFirst", false); - want(props, "anotherOne", "true"); - } - } \ No newline at end of file From 10939623b7112e25154e317f6c007f37b66cd765 Mon Sep 17 00:00:00 2001 From: Thibault Duperron Date: Sat, 24 Oct 2020 18:26:57 +0200 Subject: [PATCH 3/4] Samples --- .../java/feign-no-nullable/build.gradle | 9 +++---- .../petstore/java/feign-no-nullable/build.sbt | 2 +- .../petstore/java/feign-no-nullable/pom.xml | 9 +++++-- .../org/openapitools/client/ApiClient.java | 2 ++ .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../client/petstore/java/feign/build.gradle | 9 +++---- samples/client/petstore/java/feign/build.sbt | 2 +- samples/client/petstore/java/feign/pom.xml | 9 +++++-- .../org/openapitools/client/ApiClient.java | 2 ++ .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../petstore/java/google-api-client/README.md | 2 +- .../java/google-api-client/build.gradle | 9 +++---- .../petstore/java/google-api-client/build.sbt | 1 + .../petstore/java/google-api-client/pom.xml | 11 ++++++--- .../org/openapitools/client/ApiClient.java | 2 ++ .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../client/petstore/java/jersey1/README.md | 2 +- .../client/petstore/java/jersey1/build.gradle | 10 ++++---- samples/client/petstore/java/jersey1/pom.xml | 17 +++++++------ .../org/openapitools/client/ApiClient.java | 7 +++++- .../client/auth/HttpBasicAuth.java | 10 +++----- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../java/microprofile-rest-client/pom.xml | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../okhttp-gson-parcelableModel/README.md | 2 +- .../okhttp-gson-parcelableModel/build.gradle | 8 +++---- .../java/okhttp-gson-parcelableModel/pom.xml | 2 +- .../org/openapitools/client/ApiClient.java | 3 +++ .../java/org/openapitools/client/JSON.java | 3 +++ .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../petstore/java/okhttp-gson/README.md | 2 +- .../petstore/java/okhttp-gson/build.gradle | 8 +++---- .../client/petstore/java/okhttp-gson/pom.xml | 2 +- .../org/openapitools/client/ApiClient.java | 3 +++ .../java/org/openapitools/client/JSON.java | 3 +++ .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../java/rest-assured/docs/FakeApi.md | 14 +++++------ .../petstore/java/rest-assured/docs/PetApi.md | 4 ++-- .../java/org/openapitools/client/JSON.java | 3 +++ .../org/openapitools/client/api/FakeApi.java | 8 +++---- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../client/petstore/java/resteasy/README.md | 2 +- .../petstore/java/resteasy/build.gradle | 13 ++++------ .../client/petstore/java/resteasy/build.sbt | 4 +--- samples/client/petstore/java/resteasy/pom.xml | 24 +++---------------- .../org/openapitools/client/ApiClient.java | 5 +++- .../java/org/openapitools/client/JSON.java | 4 ++-- .../org/openapitools/client/api/FakeApi.java | 4 ++-- .../client/auth/HttpBasicAuth.java | 10 +++----- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../java/resttemplate-withXml/README.md | 2 +- .../java/resttemplate-withXml/build.gradle | 9 +++---- .../java/resttemplate-withXml/pom.xml | 9 +++++-- .../org/openapitools/client/ApiClient.java | 5 +++- .../org/openapitools/client/api/FakeApi.java | 8 +++---- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../petstore/java/resttemplate/README.md | 2 +- .../petstore/java/resttemplate/build.gradle | 9 +++---- .../client/petstore/java/resttemplate/pom.xml | 9 +++++-- .../org/openapitools/client/ApiClient.java | 5 +++- .../org/openapitools/client/api/FakeApi.java | 8 +++---- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../petstore/java/retrofit2/build.gradle | 8 +++---- .../client/petstore/java/retrofit2/pom.xml | 8 +++---- .../org/openapitools/client/ApiClient.java | 1 + .../java/org/openapitools/client/JSON.java | 3 +++ .../org/openapitools/client/api/FakeApi.java | 4 ++-- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../petstore/java/retrofit2rx2/build.gradle | 8 +++---- .../client/petstore/java/retrofit2rx2/pom.xml | 8 +++---- .../org/openapitools/client/ApiClient.java | 1 + .../java/org/openapitools/client/JSON.java | 3 +++ .../org/openapitools/client/api/FakeApi.java | 4 ++-- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../petstore/java/retrofit2rx3/build.gradle | 8 +++---- .../client/petstore/java/retrofit2rx3/pom.xml | 8 +++---- .../org/openapitools/client/ApiClient.java | 1 + .../java/org/openapitools/client/JSON.java | 3 +++ .../org/openapitools/client/api/FakeApi.java | 4 ++-- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 6 ++--- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../org/openapitools/client/model/Pet.java | 4 ++-- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../openapitools/client/model/XmlItem.java | 18 +++++++------- .../java/jersey2-java8/README.md | 2 +- .../java/jersey2-java8/build.gradle | 10 ++++---- .../java/jersey2-java8/build.sbt | 2 +- .../java/jersey2-java8/pom.xml | 17 +++++++------ .../org/openapitools/client/ApiClient.java | 5 +++- .../java/org/openapitools/client/JSON.java | 2 ++ .../client/auth/HttpBasicAuth.java | 10 +++----- samples/server/petstore/java-msf4j/pom.xml | 2 +- .../java/org/openapitools/api/FakeApi.java | 14 +++++------ .../gen/java/org/openapitools/api/PetApi.java | 4 ++-- .../model/AdditionalPropertiesClass.java | 16 ++++++------- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../openapitools/model/ArrayOfNumberOnly.java | 2 +- .../org/openapitools/model/ArrayTest.java | 6 ++--- .../org/openapitools/model/EnumArrays.java | 2 +- .../model/FileSchemaTestClass.java | 2 +- .../java/org/openapitools/model/MapTest.java | 8 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../gen/java/org/openapitools/model/Pet.java | 4 ++-- .../openapitools/model/TypeHolderDefault.java | 2 +- .../openapitools/model/TypeHolderExample.java | 2 +- .../java/org/openapitools/model/XmlItem.java | 18 +++++++------- 245 files changed, 713 insertions(+), 667 deletions(-) diff --git a/samples/client/petstore/java/feign-no-nullable/build.gradle b/samples/client/petstore/java/feign-no-nullable/build.gradle index 75fe013bae28..282f7eebdf96 100644 --- a/samples/client/petstore/java/feign-no-nullable/build.gradle +++ b/samples/client/petstore/java/feign-no-nullable/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -115,6 +115,7 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" compile "com.brsanthu:migbase64:2.2" diff --git a/samples/client/petstore/java/feign-no-nullable/build.sbt b/samples/client/petstore/java/feign-no-nullable/build.sbt index e2f16203405f..1389104e53c6 100644 --- a/samples/client/petstore/java/feign-no-nullable/build.sbt +++ b/samples/client/petstore/java/feign-no-nullable/build.sbt @@ -17,7 +17,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", diff --git a/samples/client/petstore/java/feign-no-nullable/pom.xml b/samples/client/petstore/java/feign-no-nullable/pom.xml index 21d576291266..762ca2815995 100644 --- a/samples/client/petstore/java/feign-no-nullable/pom.xml +++ b/samples/client/petstore/java/feign-no-nullable/pom.xml @@ -154,7 +154,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -257,6 +257,11 @@ jackson-databind ${jackson-databind-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + com.github.joschi.jackson jackson-datatype-threetenbp @@ -296,7 +301,7 @@ UTF-8 - 1.7 + 1.8 ${java.version} ${java.version} 1.5.24 diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index 69315cfc70c1..3ae185cdce29 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import feign.Feign; @@ -139,6 +140,7 @@ private ObjectMapper createObjectMapper() { objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); objectMapper.setDateFormat(new RFC3339DateFormat()); + objectMapper.registerModule(new JavaTimeModule()); ThreeTenModule module = new ThreeTenModule(); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index e5d48f8135eb..e043653d8ec5 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -90,7 +90,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -123,7 +123,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -156,7 +156,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -189,7 +189,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -222,7 +222,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -255,7 +255,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -288,7 +288,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -321,7 +321,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 475b8f3b19db..13caf8dc66f1 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -49,7 +49,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b94aa84873cb..74aa16366bc4 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -49,7 +49,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java index 371ead4207dc..65068435d98e 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -57,7 +57,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -90,7 +90,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -123,7 +123,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java index c58efb04291b..9a8842d81e42 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -147,7 +147,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 956d66a44ea5..674d5644bed4 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -77,7 +77,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java index b8002359f63a..8a9278e8555d 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java @@ -96,7 +96,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -129,7 +129,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -162,7 +162,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -195,7 +195,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 838311fb01b6..ae938962d88b 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -110,7 +110,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Pet.java index 5080f9b0a788..b2d468637d97 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Pet.java @@ -55,7 +55,7 @@ public class Pet { private String name; public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -212,7 +212,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index c07109fea75c..a3c7bcbbd417 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -54,7 +54,7 @@ public class TypeHolderDefault { private Boolean boolItem = true; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java index b4eaa509eee5..b9439af53304 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -58,7 +58,7 @@ public class TypeHolderExample { private Boolean boolItem; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java index af4c426b8f81..7a96c414de2c 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java @@ -261,7 +261,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -394,7 +394,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -427,7 +427,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -560,7 +560,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -593,7 +593,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -726,7 +726,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -759,7 +759,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -892,7 +892,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -925,7 +925,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index febaebd1b371..105a52f74274 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -117,6 +117,7 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" compile "com.brsanthu:migbase64:2.2" diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt index 1af0ed0153aa..32b419a28a4d 100644 --- a/samples/client/petstore/java/feign/build.sbt +++ b/samples/client/petstore/java/feign/build.sbt @@ -17,7 +17,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index b7a9b1f4be8a..d3d79871c9c0 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -154,7 +154,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -262,6 +262,11 @@ jackson-databind-nullable ${jackson-databind-nullable-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + com.github.joschi.jackson jackson-datatype-threetenbp @@ -301,7 +306,7 @@ UTF-8 - 1.7 + 1.8 ${java.version} ${java.version} 1.5.24 diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java index 4e256daf6b29..2f2e913ed62c 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import feign.Feign; @@ -140,6 +141,7 @@ private ObjectMapper createObjectMapper() { objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); objectMapper.setDateFormat(new RFC3339DateFormat()); + objectMapper.registerModule(new JavaTimeModule()); ThreeTenModule module = new ThreeTenModule(); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b682..e133c0e82183 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -89,7 +89,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -122,7 +122,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -155,7 +155,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -188,7 +188,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -221,7 +221,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -254,7 +254,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -287,7 +287,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -320,7 +320,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552dc..366494a73a5b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a248..60a0c6bb7070 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe5821..cf38d7891675 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -56,7 +56,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -89,7 +89,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -122,7 +122,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb4..6ed55a192bcd 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -146,7 +146,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f63..bac6aa62f077 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -76,7 +76,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be3..ccb739e3bb83 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java @@ -95,7 +95,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -128,7 +128,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -161,7 +161,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -194,7 +194,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a6576..9ce84ceeb3cc 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -109,7 +109,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b783345..25d1f3c49f06 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java @@ -54,7 +54,7 @@ public class Pet { private String name; public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -211,7 +211,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 4dabcf030cc9..4befc651d5aa 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -53,7 +53,7 @@ public class TypeHolderDefault { private Boolean boolItem = true; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 1c18b7dc99f0..c4203264ffd9 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -57,7 +57,7 @@ public class TypeHolderExample { private Boolean boolItem; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java index 0b968d7136a1..9a0907693e69 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java @@ -260,7 +260,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -393,7 +393,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -426,7 +426,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -559,7 +559,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -592,7 +592,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -725,7 +725,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -758,7 +758,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -891,7 +891,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -924,7 +924,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/google-api-client/README.md b/samples/client/petstore/java/google-api-client/README.md index a72fd4e47405..837ba0a464d4 100644 --- a/samples/client/petstore/java/google-api-client/README.md +++ b/samples/client/petstore/java/google-api-client/README.md @@ -13,7 +13,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/samples/client/petstore/java/google-api-client/build.gradle b/samples/client/petstore/java/google-api-client/build.gradle index 04fba9afc8ed..ce61cfd5cb69 100644 --- a/samples/client/petstore/java/google-api-client/build.gradle +++ b/samples/client/petstore/java/google-api-client/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -116,6 +116,7 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version" compile 'javax.annotation:javax.annotation-api:1.3.2' testCompile "junit:junit:$junit_version" diff --git a/samples/client/petstore/java/google-api-client/build.sbt b/samples/client/petstore/java/google-api-client/build.sbt index c14e982e3efb..669aa3d9b765 100644 --- a/samples/client/petstore/java/google-api-client/build.sbt +++ b/samples/client/petstore/java/google-api-client/build.sbt @@ -15,6 +15,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-core" % "2.10.1" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.1" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.4" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", "junit" % "junit" % "4.13.1" % "test", diff --git a/samples/client/petstore/java/google-api-client/pom.xml b/samples/client/petstore/java/google-api-client/pom.xml index 23c20f06f1f3..db92a42ad3d7 100644 --- a/samples/client/petstore/java/google-api-client/pom.xml +++ b/samples/client/petstore/java/google-api-client/pom.xml @@ -137,8 +137,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -147,7 +147,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -243,6 +243,11 @@ jackson-databind-nullable ${jackson-databind-nullable-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + com.github.joschi.jackson jackson-datatype-threetenbp diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/ApiClient.java index 80cb32e59f5c..68bc290328a7 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/ApiClient.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import org.threeten.bp.*; import com.google.api.client.googleapis.util.Utils; @@ -31,6 +32,7 @@ private static ObjectMapper createDefaultObjectMapper() { .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .setDateFormat(new RFC3339DateFormat()); + objectMapper.registerModule(new JavaTimeModule()); ThreeTenModule module = new ThreeTenModule(); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b682..e133c0e82183 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -89,7 +89,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -122,7 +122,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -155,7 +155,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -188,7 +188,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -221,7 +221,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -254,7 +254,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -287,7 +287,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -320,7 +320,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552dc..366494a73a5b 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a248..60a0c6bb7070 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe5821..cf38d7891675 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -56,7 +56,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -89,7 +89,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -122,7 +122,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb4..6ed55a192bcd 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -146,7 +146,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f63..bac6aa62f077 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -76,7 +76,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be3..ccb739e3bb83 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java @@ -95,7 +95,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -128,7 +128,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -161,7 +161,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -194,7 +194,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a6576..9ce84ceeb3cc 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -109,7 +109,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b783345..25d1f3c49f06 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java @@ -54,7 +54,7 @@ public class Pet { private String name; public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -211,7 +211,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 53bf7905e157..027702c37678 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -53,7 +53,7 @@ public class TypeHolderDefault { private Boolean boolItem = true; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 68fa374847d9..2c8941f56e73 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -57,7 +57,7 @@ public class TypeHolderExample { private Boolean boolItem; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/XmlItem.java index 1067826b0d57..2ffd4927861d 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/XmlItem.java @@ -260,7 +260,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -393,7 +393,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -426,7 +426,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -559,7 +559,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -592,7 +592,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -725,7 +725,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -758,7 +758,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -891,7 +891,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -924,7 +924,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/jersey1/README.md b/samples/client/petstore/java/jersey1/README.md index f57457ded314..be3c2465a174 100644 --- a/samples/client/petstore/java/jersey1/README.md +++ b/samples/client/petstore/java/jersey1/README.md @@ -13,7 +13,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/samples/client/petstore/java/jersey1/build.gradle b/samples/client/petstore/java/jersey1/build.gradle index 241cbc5b44d0..9210e16b7ed1 100644 --- a/samples/client/petstore/java/jersey1/build.gradle +++ b/samples/client/petstore/java/jersey1/build.gradle @@ -34,8 +34,8 @@ if(hasProperty('target') && target == 'android') { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -80,8 +80,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -131,8 +131,8 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - compile "com.brsanthu:migbase64:2.2" compile 'javax.annotation:javax.annotation-api:1.3.2' testCompile "junit:junit:$junit_version" } diff --git a/samples/client/petstore/java/jersey1/pom.xml b/samples/client/petstore/java/jersey1/pom.xml index c28acc505a4e..8c8dacbfd124 100644 --- a/samples/client/petstore/java/jersey1/pom.xml +++ b/samples/client/petstore/java/jersey1/pom.xml @@ -152,8 +152,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -162,7 +162,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -261,17 +261,16 @@ jackson-jaxrs-json-provider ${jackson-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + com.github.joschi.jackson jackson-datatype-threetenbp ${jackson-threetenbp-version} - - - com.brsanthu - migbase64 - 2.2 - javax.annotation javax.annotation-api diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/ApiClient.java index f5748ef44075..320759940c69 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/ApiClient.java @@ -16,6 +16,8 @@ import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.time.OffsetDateTime; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @@ -59,7 +61,7 @@ import org.openapitools.client.auth.OAuth; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ApiClient { +public class ApiClient extends JavaTimeFormatter { private Map defaultHeaderMap = new HashMap(); private Map defaultCookieMap = new HashMap(); private String basePath = "http://petstore.swagger.io:80/v2"; @@ -93,6 +95,7 @@ public ApiClient() { objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + objectMapper.registerModule(new JavaTimeModule()); ThreeTenModule module = new ThreeTenModule(); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); @@ -443,6 +446,8 @@ public String parameterToString(Object param) { 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) { diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index bd1f1225416a..b75583565424 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -15,12 +15,12 @@ import org.openapitools.client.Pair; -import com.migcomponents.migbase64.Base64; +import java.util.Base64; +import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.List; -import java.io.UnsupportedEncodingException; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class HttpBasicAuth implements Authentication { @@ -49,10 +49,6 @@ public void applyToParams(List queryParams, Map headerPara return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - try { - headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); } } diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b682..e133c0e82183 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -89,7 +89,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -122,7 +122,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -155,7 +155,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -188,7 +188,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -221,7 +221,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -254,7 +254,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -287,7 +287,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -320,7 +320,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552dc..366494a73a5b 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a248..60a0c6bb7070 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe5821..cf38d7891675 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -56,7 +56,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -89,7 +89,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -122,7 +122,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb4..6ed55a192bcd 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -146,7 +146,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f63..bac6aa62f077 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -76,7 +76,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be3..ccb739e3bb83 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java @@ -95,7 +95,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -128,7 +128,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -161,7 +161,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -194,7 +194,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a6576..9ce84ceeb3cc 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -109,7 +109,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b783345..25d1f3c49f06 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java @@ -54,7 +54,7 @@ public class Pet { private String name; public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -211,7 +211,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 53bf7905e157..027702c37678 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -53,7 +53,7 @@ public class TypeHolderDefault { private Boolean boolItem = true; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 68fa374847d9..2c8941f56e73 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -57,7 +57,7 @@ public class TypeHolderExample { private Boolean boolItem; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/XmlItem.java index 1067826b0d57..2ffd4927861d 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/XmlItem.java @@ -260,7 +260,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -393,7 +393,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -426,7 +426,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -559,7 +559,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -592,7 +592,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -725,7 +725,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -758,7 +758,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -891,7 +891,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -924,7 +924,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/microprofile-rest-client/pom.xml b/samples/client/petstore/java/microprofile-rest-client/pom.xml index 5faf0c0c062f..2d77ac97f51b 100644 --- a/samples/client/petstore/java/microprofile-rest-client/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client/pom.xml @@ -115,7 +115,7 @@ com.fasterxml.jackson.datatype - jackson-datatype-joda + jackson-datatype-jsr310 ${jackson-jaxrs-version} diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java index d828105ec48b..1174fc2ef377 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/model/Pet.java @@ -40,7 +40,7 @@ public class Pet { private String name; - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); private List tags = null; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md index 940c1f16203a..4cc8748a0f76 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md @@ -12,7 +12,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod ## Requirements Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle index 3a9cbd718c68..d3543ce24ece 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle @@ -36,8 +36,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -82,8 +82,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml index a3798d00f11c..9fb3e00ec35f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml @@ -278,7 +278,7 @@ - 1.7 + 1.8 ${java.version} ${java.version} 1.8.4 diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java index 7ba953150638..b8ad3a40ab3a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java @@ -43,6 +43,9 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java index 08bf82ccae6f..203b7c33f826 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java @@ -36,6 +36,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 95a60c8d07c1..0cc628fd4c59 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -90,7 +90,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -121,7 +121,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -152,7 +152,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -183,7 +183,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -214,7 +214,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -245,7 +245,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -276,7 +276,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -307,7 +307,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 18d1d5c0feb3..b4a6d6b3eec4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -49,7 +49,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 522be04febcc..b961bb6be4d1 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -49,7 +49,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java index 81d699bb0ee4..7438adb817ea 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -57,7 +57,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -88,7 +88,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -119,7 +119,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java index 9cd622349b19..a812fce06830 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -169,7 +169,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 17d2bc90ce27..860820ea94b4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -75,7 +75,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java index e3b394e269c6..ccd8f5608b6d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java @@ -108,7 +108,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -139,7 +139,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -170,7 +170,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -201,7 +201,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index bf7d7f9c8b60..297d0b163b70 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -106,7 +106,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java index b10d8d054ce4..65284497e841 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -51,7 +51,7 @@ public class Pet { public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) @@ -216,7 +216,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index c2fa377d0d9e..d57e5f6ad16c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -52,7 +52,7 @@ public class TypeHolderDefault { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java index bf4a2d5a6cbb..0fe34b74d270 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -56,7 +56,7 @@ public class TypeHolderExample { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java index 7bcdd44ecc6c..9237597b6c0f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java @@ -253,7 +253,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -376,7 +376,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -407,7 +407,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -530,7 +530,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -561,7 +561,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -684,7 +684,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -715,7 +715,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -838,7 +838,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -869,7 +869,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index 68964ee24531..07c81400d651 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -12,7 +12,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod ## Requirements Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/samples/client/petstore/java/okhttp-gson/build.gradle b/samples/client/petstore/java/okhttp-gson/build.gradle index 857292fc8af6..7d4667a79e6f 100644 --- a/samples/client/petstore/java/okhttp-gson/build.gradle +++ b/samples/client/petstore/java/okhttp-gson/build.gradle @@ -36,8 +36,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -82,8 +82,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 8a927846d799..f90f80f0945c 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -271,7 +271,7 @@ - 1.7 + 1.8 ${java.version} ${java.version} 1.8.4 diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index 7ba953150638..b8ad3a40ab3a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -43,6 +43,9 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index 08bf82ccae6f..203b7c33f826 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -36,6 +36,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8dfd..5ac981425354 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -86,7 +86,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -117,7 +117,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -148,7 +148,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -179,7 +179,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -210,7 +210,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -241,7 +241,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -272,7 +272,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -303,7 +303,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70d..1b91d3c9d916 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -45,7 +45,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ffe..499f791e38d5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -45,7 +45,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e84687..ae9e4f70f356 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -53,7 +53,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -84,7 +84,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -115,7 +115,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff9..8b7586161cf6 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -165,7 +165,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e621..a1ca8b8cf471 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -71,7 +71,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa31373..d801b4ea2fae 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java @@ -104,7 +104,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -135,7 +135,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -166,7 +166,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -197,7 +197,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced179133135..adae88d6db67 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -102,7 +102,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc1..860c5bc43764 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java @@ -49,7 +49,7 @@ public class Pet { public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) @@ -212,7 +212,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd863..078148ba5c76 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -50,7 +50,7 @@ public class TypeHolderDefault { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4c..f4e11cfac4a6 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -54,7 +54,7 @@ public class TypeHolderExample { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c575..b5755815d572 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/XmlItem.java @@ -249,7 +249,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -372,7 +372,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -403,7 +403,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -526,7 +526,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -557,7 +557,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -680,7 +680,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -711,7 +711,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -834,7 +834,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -865,7 +865,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/rest-assured/docs/FakeApi.md b/samples/client/petstore/java/rest-assured/docs/FakeApi.md index 0cac20cb770b..075077996e76 100644 --- a/samples/client/petstore/java/rest-assured/docs/FakeApi.md +++ b/samples/client/petstore/java/rest-assured/docs/FakeApi.md @@ -436,9 +436,9 @@ api.testEnumParameters().execute(r -> r.prettyPeek()); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [default to new ArrayList<String>()] [enum: >, $] + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [default to new ArrayList<>()] [enum: >, $] **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [default to new ArrayList<String>()] [enum: >, $] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [default to new ArrayList<>()] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] @@ -620,11 +620,11 @@ api.testQueryParameterCollectionFormat() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pipe** | [**List<String>**](String.md)| | [default to new ArrayList<String>()] - **ioutil** | [**List<String>**](String.md)| | [default to new ArrayList<String>()] - **http** | [**List<String>**](String.md)| | [default to new ArrayList<String>()] - **url** | [**List<String>**](String.md)| | [default to new ArrayList<String>()] - **context** | [**List<String>**](String.md)| | [default to new ArrayList<String>()] + **pipe** | [**List<String>**](String.md)| | [default to new ArrayList<>()] + **ioutil** | [**List<String>**](String.md)| | [default to new ArrayList<>()] + **http** | [**List<String>**](String.md)| | [default to new ArrayList<>()] + **url** | [**List<String>**](String.md)| | [default to new ArrayList<>()] + **context** | [**List<String>**](String.md)| | [default to new ArrayList<>()] ### Return type diff --git a/samples/client/petstore/java/rest-assured/docs/PetApi.md b/samples/client/petstore/java/rest-assured/docs/PetApi.md index 0dffe0775339..b4808cf52676 100644 --- a/samples/client/petstore/java/rest-assured/docs/PetApi.md +++ b/samples/client/petstore/java/rest-assured/docs/PetApi.md @@ -123,7 +123,7 @@ api.findPetsByStatus() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to new ArrayList<String>()] [enum: available, pending, sold] + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to new ArrayList<>()] [enum: available, pending, sold] ### Return type @@ -165,7 +165,7 @@ api.findPetsByTags() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**Set<String>**](String.md)| Tags to filter by | [default to new LinkedHashSet<String>()] + **tags** | [**Set<String>**](String.md)| Tags to filter by | [default to new LinkedHashSet<>()] ### Return type diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java index 08bf82ccae6f..203b7c33f826 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java @@ -36,6 +36,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java index 5049424b2d90..af953b2fa0c5 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java @@ -1014,9 +1014,9 @@ public TestEndpointParametersOper respSpec(Consumer respSpe * To test enum parameters * To test enum parameters * - * @see #enumHeaderStringArrayHeader Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @see #enumHeaderStringArrayHeader Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @see #enumHeaderStringHeader Header parameter enum test (string) (optional, default to -efg) - * @see #enumQueryStringArrayQuery Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @see #enumQueryStringArrayQuery Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @see #enumQueryStringQuery Query parameter enum test (string) (optional, default to -efg) * @see #enumQueryIntegerQuery Query parameter enum test (double) (optional) * @see #enumQueryDoubleQuery Query parameter enum test (double) (optional) @@ -1052,7 +1052,7 @@ public T execute(Function handler) { public static final String ENUM_HEADER_STRING_ARRAY_HEADER = "enum_header_string_array"; /** - * @param enumHeaderStringArray (List<String>) Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray (List<String>) Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @return operation */ public TestEnumParametersOper enumHeaderStringArrayHeader(String enumHeaderStringArray) { @@ -1074,7 +1074,7 @@ public TestEnumParametersOper enumHeaderStringHeader(String enumHeaderString) { public static final String ENUM_QUERY_STRING_ARRAY_QUERY = "enum_query_string_array"; /** - * @param enumQueryStringArray (List<String>) Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray (List<String>) Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @return operation */ public TestEnumParametersOper enumQueryStringArrayQuery(Object... enumQueryStringArray) { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 55cbf3ef4842..ab98a02c1fe4 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -89,7 +89,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -120,7 +120,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -152,7 +152,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -183,7 +183,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -214,7 +214,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -246,7 +246,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -278,7 +278,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -310,7 +310,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 1130cb952bb5..9431c70400cc 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 852c6df189ff..703b58d7070f 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayTest.java index ff6848cbc9b2..ae46e74559ad 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -56,7 +56,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -87,7 +87,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -119,7 +119,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java index 2daaad5b6944..ae16ad21a654 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -168,7 +168,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index b2b6ed0fb47a..9068fe72bf58 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -75,7 +75,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java index 8ef66b594c54..ebc0b57d2cb8 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java @@ -107,7 +107,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -139,7 +139,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -170,7 +170,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -201,7 +201,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index e6897bd51f3b..83b81ba0848d 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -107,7 +107,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java index f35302125715..a04967434afa 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java @@ -52,7 +52,7 @@ public class Pet { public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) @@ -218,7 +218,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 35981b8f1081..9680f07ddeba 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -53,7 +53,7 @@ public class TypeHolderDefault { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderExample.java index d527ccc144be..021469941a31 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -57,7 +57,7 @@ public class TypeHolderExample { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/XmlItem.java index a0286e54452a..35588f7cc7e4 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/XmlItem.java @@ -253,7 +253,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -377,7 +377,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -408,7 +408,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -532,7 +532,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -563,7 +563,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -687,7 +687,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -718,7 +718,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -842,7 +842,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -873,7 +873,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/resteasy/README.md b/samples/client/petstore/java/resteasy/README.md index 6a6d3e6b69dd..35b1b3e8770e 100644 --- a/samples/client/petstore/java/resteasy/README.md +++ b/samples/client/petstore/java/resteasy/README.md @@ -13,7 +13,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/samples/client/petstore/java/resteasy/build.gradle b/samples/client/petstore/java/resteasy/build.gradle index e23483b58276..be457e2514dd 100644 --- a/samples/client/petstore/java/resteasy/build.gradle +++ b/samples/client/petstore/java/resteasy/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 23 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -78,8 +78,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -100,7 +100,6 @@ ext { jackson_databind_nullable_version = "0.2.1" threetenbp_version = "2.9.10" resteasy_version = "3.1.3.Final" - jodatime_version = "2.9.9" junit_version = "4.13" } @@ -115,9 +114,7 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" - compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" - compile "joda-time:joda-time:$jodatime_version" - compile "com.brsanthu:migbase64:2.2" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" compile 'javax.annotation:javax.annotation-api:1.3.2' testCompile "junit:junit:$junit_version" } diff --git a/samples/client/petstore/java/resteasy/build.sbt b/samples/client/petstore/java/resteasy/build.sbt index 6e0ee4b7d3c7..9b40e6676e45 100644 --- a/samples/client/petstore/java/resteasy/build.sbt +++ b/samples/client/petstore/java/resteasy/build.sbt @@ -17,9 +17,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.4" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.4" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile", - "joda-time" % "joda-time" % "2.9.9" % "compile", - "com.brsanthu" % "migbase64" % "2.2" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", "junit" % "junit" % "4.13" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/client/petstore/java/resteasy/pom.xml b/samples/client/petstore/java/resteasy/pom.xml index 2f6bfd4a8adc..7b15da0d5d2e 100644 --- a/samples/client/petstore/java/resteasy/pom.xml +++ b/samples/client/petstore/java/resteasy/pom.xml @@ -135,8 +135,8 @@ maven-compiler-plugin 2.5.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -145,7 +145,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -202,23 +202,6 @@ jackson-databind-nullable ${jackson-databind-nullable-version} - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - - - joda-time - joda-time - ${jodatime-version} - - - - - com.brsanthu - migbase64 - 2.2 - org.jboss.resteasy @@ -258,7 +241,6 @@ 0.2.1 1.3.2 2.9.10 - 2.9.9 1.0.0 4.13 diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java index 433318b74b08..def125dcc64c 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java @@ -22,6 +22,7 @@ import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.time.OffsetDateTime; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @@ -46,7 +47,7 @@ import org.openapitools.client.auth.OAuth; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ApiClient { +public class ApiClient extends JavaTimeFormatter { private Map defaultHeaderMap = new HashMap(); private Map defaultCookieMap = new HashMap(); private String basePath = "http://petstore.swagger.io:80/v2"; @@ -329,6 +330,8 @@ public String parameterToString(Object param) { 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) { diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/JSON.java index 9368681606c6..85ff9ce7928a 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/JSON.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; import org.openapitools.jackson.nullable.JsonNullableModule; -import com.fasterxml.jackson.datatype.joda.*; +import com.fasterxml.jackson.datatype.jsr310.*; import java.text.DateFormat; @@ -24,7 +24,7 @@ public JSON() { mapper.setDateFormat(new RFC3339DateFormat()); JsonNullableModule jnm = new JsonNullableModule(); mapper.registerModule(jnm); - mapper.registerModule(new JodaModule()); + mapper.registerModule(new JavaTimeModule()); } /** diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java index 697b70fc85c2..756d5f548025 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java @@ -471,9 +471,9 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index bd1f1225416a..b75583565424 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -15,12 +15,12 @@ import org.openapitools.client.Pair; -import com.migcomponents.migbase64.Base64; +import java.util.Base64; +import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.List; -import java.io.UnsupportedEncodingException; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class HttpBasicAuth implements Authentication { @@ -49,10 +49,6 @@ public void applyToParams(List queryParams, Map headerPara return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - try { - headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); } } diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b682..e133c0e82183 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -89,7 +89,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -122,7 +122,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -155,7 +155,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -188,7 +188,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -221,7 +221,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -254,7 +254,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -287,7 +287,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -320,7 +320,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552dc..366494a73a5b 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a248..60a0c6bb7070 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe5821..cf38d7891675 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -56,7 +56,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -89,7 +89,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -122,7 +122,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb4..6ed55a192bcd 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -146,7 +146,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f63..bac6aa62f077 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -76,7 +76,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be3..ccb739e3bb83 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java @@ -95,7 +95,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -128,7 +128,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -161,7 +161,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -194,7 +194,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a6576..9ce84ceeb3cc 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -109,7 +109,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b783345..25d1f3c49f06 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java @@ -54,7 +54,7 @@ public class Pet { private String name; public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -211,7 +211,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 53bf7905e157..027702c37678 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -53,7 +53,7 @@ public class TypeHolderDefault { private Boolean boolItem = true; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 68fa374847d9..2c8941f56e73 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -57,7 +57,7 @@ public class TypeHolderExample { private Boolean boolItem; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/XmlItem.java index 1067826b0d57..2ffd4927861d 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/XmlItem.java @@ -260,7 +260,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -393,7 +393,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -426,7 +426,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -559,7 +559,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -592,7 +592,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -725,7 +725,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -758,7 +758,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -891,7 +891,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -924,7 +924,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/README.md b/samples/client/petstore/java/resttemplate-withXml/README.md index 419778f2ccc1..9824bb25a38a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/README.md +++ b/samples/client/petstore/java/resttemplate-withXml/README.md @@ -13,7 +13,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/samples/client/petstore/java/resttemplate-withXml/build.gradle b/samples/client/petstore/java/resttemplate-withXml/build.gradle index b7650c1bd236..e809860d4f20 100644 --- a/samples/client/petstore/java/resttemplate-withXml/build.gradle +++ b/samples/client/petstore/java/resttemplate-withXml/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -115,6 +115,7 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version" compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version" compile 'javax.annotation:javax.annotation-api:1.3.2' diff --git a/samples/client/petstore/java/resttemplate-withXml/pom.xml b/samples/client/petstore/java/resttemplate-withXml/pom.xml index ce438bd56ae7..0d609a5d3f99 100644 --- a/samples/client/petstore/java/resttemplate-withXml/pom.xml +++ b/samples/client/petstore/java/resttemplate-withXml/pom.xml @@ -137,8 +137,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -257,6 +257,11 @@ ${jackson-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + com.github.joschi.jackson jackson-datatype-threetenbp diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java index 0a2f38a339c6..e9f9dfa373ea 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java @@ -58,6 +58,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.TimeZone; +import java.time.OffsetDateTime; import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; @@ -66,7 +67,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @Component("org.openapitools.client.ApiClient") -public class ApiClient { +public class ApiClient extends JavaTimeFormatter { public enum CollectionFormat { CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); @@ -363,6 +364,8 @@ public String parameterToString(Object param) { 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) { diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java index 9dac72496a7b..4e51829d7c6b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java @@ -542,9 +542,9 @@ public ResponseEntity testEndpointParametersWithHttpInfo(BigDecimal number * To test enum parameters *

400 - Invalid request *

404 - Not found - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) @@ -561,9 +561,9 @@ public void testEnumParameters(List enumHeaderStringArray, String enumHe * To test enum parameters *

400 - Invalid request *

404 - Not found - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 87aeed9fa269..26e1e0ecfc4b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -129,7 +129,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -162,7 +162,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -195,7 +195,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -228,7 +228,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -261,7 +261,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -294,7 +294,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -327,7 +327,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -360,7 +360,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 34e15755d1a0..30a1242b5441 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -57,7 +57,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 90b918656754..5a8d2cbf47d8 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -57,7 +57,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java index c608ad4b8277..12a04f1f179f 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -73,7 +73,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -106,7 +106,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -139,7 +139,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java index 5c59edc23f73..fa7d147b8e1a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -157,7 +157,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index ae70d339f3d1..89e5bf10db08 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -87,7 +87,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java index 70841a359886..4b95eac8cc9f 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java @@ -116,7 +116,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -149,7 +149,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -182,7 +182,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -215,7 +215,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 68c325a65374..e00e5eab6e3a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -122,7 +122,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java index 66b6b012cc96..326cf54838c7 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java @@ -67,7 +67,7 @@ public class Pet { // items.example= items.type=String @XmlElement(name = "photoUrls") @XmlElementWrapper(name = "photoUrl") - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String JSON_PROPERTY_TAGS = "tags"; // Is a container wrapped=true @@ -235,7 +235,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 8799eb056c44..30f6763fd81a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -66,7 +66,7 @@ public class TypeHolderDefault { // items.name=arrayItem items.baseName=arrayItem items.xmlName= items.xmlNamespace= // items.example= items.type=Integer @XmlElement(name = "arrayItem") - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java index ebed8649f0f0..8c1080262a1a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -71,7 +71,7 @@ public class TypeHolderExample { // items.name=arrayItem items.baseName=arrayItem items.xmlName= items.xmlNamespace= // items.example= items.type=Integer @XmlElement(name = "arrayItem") - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java index 5d3a673bb8f9..6d2e4532f11d 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java @@ -330,7 +330,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -469,7 +469,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -502,7 +502,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -641,7 +641,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -674,7 +674,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -813,7 +813,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -846,7 +846,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -985,7 +985,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -1018,7 +1018,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/resttemplate/README.md b/samples/client/petstore/java/resttemplate/README.md index 7d146241632b..09b5beca47bc 100644 --- a/samples/client/petstore/java/resttemplate/README.md +++ b/samples/client/petstore/java/resttemplate/README.md @@ -13,7 +13,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/samples/client/petstore/java/resttemplate/build.gradle b/samples/client/petstore/java/resttemplate/build.gradle index dec10adc14ee..f1b8f99bb2dc 100644 --- a/samples/client/petstore/java/resttemplate/build.gradle +++ b/samples/client/petstore/java/resttemplate/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -115,6 +115,7 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version" compile 'javax.annotation:javax.annotation-api:1.3.2' testCompile "junit:junit:$junit_version" diff --git a/samples/client/petstore/java/resttemplate/pom.xml b/samples/client/petstore/java/resttemplate/pom.xml index 4fba8dd3f069..25a29ca64cfd 100644 --- a/samples/client/petstore/java/resttemplate/pom.xml +++ b/samples/client/petstore/java/resttemplate/pom.xml @@ -137,8 +137,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -249,6 +249,11 @@ jackson-databind-nullable ${jackson-databind-nullable-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + com.github.joschi.jackson jackson-datatype-threetenbp diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java index acb991c66067..1dd6ab588033 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java @@ -53,6 +53,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.TimeZone; +import java.time.OffsetDateTime; import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; @@ -61,7 +62,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @Component("org.openapitools.client.ApiClient") -public class ApiClient { +public class ApiClient extends JavaTimeFormatter { public enum CollectionFormat { CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); @@ -358,6 +359,8 @@ public String parameterToString(Object param) { 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) { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java index 9dac72496a7b..4e51829d7c6b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java @@ -542,9 +542,9 @@ public ResponseEntity testEndpointParametersWithHttpInfo(BigDecimal number * To test enum parameters *

400 - Invalid request *

404 - Not found - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) @@ -561,9 +561,9 @@ public void testEnumParameters(List enumHeaderStringArray, String enumHe * To test enum parameters *

400 - Invalid request *

404 - Not found - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b682..e133c0e82183 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -89,7 +89,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -122,7 +122,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -155,7 +155,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -188,7 +188,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -221,7 +221,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -254,7 +254,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -287,7 +287,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -320,7 +320,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552dc..366494a73a5b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a248..60a0c6bb7070 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -48,7 +48,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe5821..cf38d7891675 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -56,7 +56,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -89,7 +89,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -122,7 +122,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb4..6ed55a192bcd 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -146,7 +146,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f63..bac6aa62f077 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -76,7 +76,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be3..ccb739e3bb83 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java @@ -95,7 +95,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -128,7 +128,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -161,7 +161,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -194,7 +194,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a6576..9ce84ceeb3cc 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -109,7 +109,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b783345..25d1f3c49f06 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java @@ -54,7 +54,7 @@ public class Pet { private String name; public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -211,7 +211,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 53bf7905e157..027702c37678 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -53,7 +53,7 @@ public class TypeHolderDefault { private Boolean boolItem = true; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 68fa374847d9..2c8941f56e73 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -57,7 +57,7 @@ public class TypeHolderExample { private Boolean boolItem; public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/XmlItem.java index 1067826b0d57..2ffd4927861d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/XmlItem.java @@ -260,7 +260,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -393,7 +393,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -426,7 +426,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -559,7 +559,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -592,7 +592,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -725,7 +725,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -758,7 +758,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -891,7 +891,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -924,7 +924,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/retrofit2/build.gradle b/samples/client/petstore/java/retrofit2/build.gradle index 0a3a053c7cca..2bf10db35ea5 100644 --- a/samples/client/petstore/java/retrofit2/build.gradle +++ b/samples/client/petstore/java/retrofit2/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index 10c1ec0dc8b2..1401a6c583ce 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -137,8 +137,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -147,7 +147,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -262,7 +262,7 @@ UTF-8 - 1.7 + 1.8 ${java.version} ${java.version} 1.8.3 diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/ApiClient.java index 250b4b4d47a5..269d1ccd80e0 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/ApiClient.java @@ -25,6 +25,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.text.DateFormat; +import java.time.format.DateTimeFormatter; import java.util.LinkedHashMap; import java.util.Map; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/JSON.java index 21ee1d248f59..5c8a24419e44 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/JSON.java @@ -35,6 +35,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/FakeApi.java index dbaa2f6d1b76..383b2faa8323 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -154,9 +154,9 @@ Call testEndpointParameters( /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8dfd..5ac981425354 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -86,7 +86,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -117,7 +117,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -148,7 +148,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -179,7 +179,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -210,7 +210,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -241,7 +241,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -272,7 +272,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -303,7 +303,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70d..1b91d3c9d916 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -45,7 +45,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ffe..499f791e38d5 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -45,7 +45,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e84687..ae9e4f70f356 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -53,7 +53,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -84,7 +84,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -115,7 +115,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff9..8b7586161cf6 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -165,7 +165,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e621..a1ca8b8cf471 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -71,7 +71,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa31373..d801b4ea2fae 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java @@ -104,7 +104,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -135,7 +135,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -166,7 +166,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -197,7 +197,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced179133135..adae88d6db67 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -102,7 +102,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc1..860c5bc43764 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java @@ -49,7 +49,7 @@ public class Pet { public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) @@ -212,7 +212,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd863..078148ba5c76 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -50,7 +50,7 @@ public class TypeHolderDefault { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4c..f4e11cfac4a6 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -54,7 +54,7 @@ public class TypeHolderExample { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c575..b5755815d572 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/XmlItem.java @@ -249,7 +249,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -372,7 +372,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -403,7 +403,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -526,7 +526,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -557,7 +557,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -680,7 +680,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -711,7 +711,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -834,7 +834,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -865,7 +865,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/build.gradle b/samples/client/petstore/java/retrofit2rx2/build.gradle index c16e188f769b..ba1901df3e95 100644 --- a/samples/client/petstore/java/retrofit2rx2/build.gradle +++ b/samples/client/petstore/java/retrofit2rx2/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { diff --git a/samples/client/petstore/java/retrofit2rx2/pom.xml b/samples/client/petstore/java/retrofit2rx2/pom.xml index 29e33941239e..81e9e053c2ea 100644 --- a/samples/client/petstore/java/retrofit2rx2/pom.xml +++ b/samples/client/petstore/java/retrofit2rx2/pom.xml @@ -137,8 +137,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -147,7 +147,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -272,7 +272,7 @@ UTF-8 - 1.7 + 1.8 ${java.version} ${java.version} 1.8.3 diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/ApiClient.java index c232fc24259b..a5e17bac2e68 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/ApiClient.java @@ -26,6 +26,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.text.DateFormat; +import java.time.format.DateTimeFormatter; import java.util.LinkedHashMap; import java.util.Map; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/JSON.java index 21ee1d248f59..5c8a24419e44 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/JSON.java @@ -35,6 +35,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/FakeApi.java index a2d7e57449e9..683324b2ef39 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -155,9 +155,9 @@ Completable testEndpointParameters( /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8dfd..5ac981425354 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -86,7 +86,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -117,7 +117,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -148,7 +148,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -179,7 +179,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -210,7 +210,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -241,7 +241,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -272,7 +272,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -303,7 +303,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70d..1b91d3c9d916 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -45,7 +45,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ffe..499f791e38d5 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -45,7 +45,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e84687..ae9e4f70f356 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -53,7 +53,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -84,7 +84,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -115,7 +115,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff9..8b7586161cf6 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -165,7 +165,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e621..a1ca8b8cf471 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -71,7 +71,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa31373..d801b4ea2fae 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java @@ -104,7 +104,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -135,7 +135,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -166,7 +166,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -197,7 +197,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced179133135..adae88d6db67 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -102,7 +102,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc1..860c5bc43764 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java @@ -49,7 +49,7 @@ public class Pet { public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) @@ -212,7 +212,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd863..078148ba5c76 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -50,7 +50,7 @@ public class TypeHolderDefault { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4c..f4e11cfac4a6 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -54,7 +54,7 @@ public class TypeHolderExample { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c575..b5755815d572 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/XmlItem.java @@ -249,7 +249,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -372,7 +372,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -403,7 +403,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -526,7 +526,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -557,7 +557,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -680,7 +680,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -711,7 +711,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -834,7 +834,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -865,7 +865,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/build.gradle b/samples/client/petstore/java/retrofit2rx3/build.gradle index 01ff7ca75bdf..f9dc847fba03 100644 --- a/samples/client/petstore/java/retrofit2rx3/build.gradle +++ b/samples/client/petstore/java/retrofit2rx3/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { diff --git a/samples/client/petstore/java/retrofit2rx3/pom.xml b/samples/client/petstore/java/retrofit2rx3/pom.xml index 671785246228..22eae53ef846 100644 --- a/samples/client/petstore/java/retrofit2rx3/pom.xml +++ b/samples/client/petstore/java/retrofit2rx3/pom.xml @@ -137,8 +137,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -147,7 +147,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -272,7 +272,7 @@ UTF-8 - 1.7 + 1.8 ${java.version} ${java.version} 1.8.3 diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/ApiClient.java index 12e7f8d4e66d..c10b5bc8b56f 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/ApiClient.java @@ -26,6 +26,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.text.DateFormat; +import java.time.format.DateTimeFormatter; import java.util.LinkedHashMap; import java.util.Map; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/JSON.java index 21ee1d248f59..5c8a24419e44 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/JSON.java @@ -35,6 +35,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/api/FakeApi.java index 983a776a3646..f932211008de 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/api/FakeApi.java @@ -155,9 +155,9 @@ Completable testEndpointParameters( /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8dfd..5ac981425354 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -86,7 +86,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -117,7 +117,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -148,7 +148,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -179,7 +179,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -210,7 +210,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -241,7 +241,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -272,7 +272,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -303,7 +303,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70d..1b91d3c9d916 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -45,7 +45,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ffe..499f791e38d5 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -45,7 +45,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e84687..ae9e4f70f356 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -53,7 +53,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -84,7 +84,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -115,7 +115,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff9..8b7586161cf6 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -165,7 +165,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e621..a1ca8b8cf471 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -71,7 +71,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa31373..d801b4ea2fae 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MapTest.java @@ -104,7 +104,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -135,7 +135,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -166,7 +166,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -197,7 +197,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced179133135..adae88d6db67 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -102,7 +102,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc1..860c5bc43764 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Pet.java @@ -49,7 +49,7 @@ public class Pet { public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) @@ -212,7 +212,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd863..078148ba5c76 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -50,7 +50,7 @@ public class TypeHolderDefault { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4c..f4e11cfac4a6 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -54,7 +54,7 @@ public class TypeHolderExample { public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c575..b5755815d572 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/XmlItem.java @@ -249,7 +249,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -372,7 +372,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -403,7 +403,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -526,7 +526,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -557,7 +557,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -680,7 +680,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -711,7 +711,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -834,7 +834,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -865,7 +865,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/README.md b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/README.md index 7bf2775d7a8c..39b3d5b842d0 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/README.md +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/README.md @@ -13,7 +13,7 @@ This specification shows how to use x-auth-id-alias extension for API keys. Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle index cac9f8ac7e34..ad2e1bcb0cc0 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -78,8 +78,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -114,8 +114,8 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" - compile "com.brsanthu:migbase64:2.2" compile 'javax.annotation:javax.annotation-api:1.3.2' testCompile "junit:junit:$junit_version" } diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt index 3fb5a17cca4b..56e92f69dc10 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt @@ -17,8 +17,8 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-core" % "2.10.4" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.4" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.4" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - "com.brsanthu" % "migbase64" % "2.2", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", "junit" % "junit" % "4.13.1" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml index d3e257263f3f..a7b633ad97c7 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml @@ -138,8 +138,8 @@ maven-compiler-plugin 3.8.1 - 1.7 - 1.7 + 1.8 + 1.8 true 128m 512m @@ -163,7 +163,7 @@ none - 1.7 + 1.8 http.response.details @@ -270,17 +270,16 @@ jackson-databind-nullable ${jackson-databind-nullable-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + com.github.joschi.jackson jackson-datatype-threetenbp ${threetenbp-version} - - - com.brsanthu - migbase64 - 2.2 - javax.annotation javax.annotation-api diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index f6ecb14f80ea..51336685ce9d 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -46,6 +46,7 @@ import java.util.Arrays; import java.util.ArrayList; import java.util.Date; +import java.time.OffsetDateTime; import java.net.URLEncoder; @@ -62,7 +63,7 @@ import org.openapitools.client.auth.ApiKeyAuth; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ApiClient { +public class ApiClient extends JavaTimeFormatter { protected Map defaultHeaderMap = new HashMap(); protected Map defaultCookieMap = new HashMap(); protected String basePath = "http://petstore.swagger.io:80/v2"; @@ -548,6 +549,8 @@ public String parameterToString(Object param) { 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) { diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java index 7997f7ec2d4e..af04d2a2137b 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import java.text.DateFormat; @@ -28,6 +29,7 @@ public JSON() { mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); mapper.setDateFormat(new RFC3339DateFormat()); + mapper.registerModule(new JavaTimeModule()); ThreeTenModule module = new ThreeTenModule(); module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index cdf367d2a505..a8faed9da09f 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -16,13 +16,13 @@ import org.openapitools.client.Pair; import org.openapitools.client.ApiException; -import com.migcomponents.migbase64.Base64; +import java.util.Base64; +import java.nio.charset.StandardCharsets; import java.net.URI; import java.util.Map; import java.util.List; -import java.io.UnsupportedEncodingException; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class HttpBasicAuth implements Authentication { @@ -51,10 +51,6 @@ public void applyToParams(List queryParams, Map headerPara return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - try { - headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); } } diff --git a/samples/server/petstore/java-msf4j/pom.xml b/samples/server/petstore/java-msf4j/pom.xml index 43c747ad0620..091a0a96258f 100644 --- a/samples/server/petstore/java-msf4j/pom.xml +++ b/samples/server/petstore/java-msf4j/pom.xml @@ -83,7 +83,7 @@ - 1.7 + 1.8 ${java.version} ${java.version} 2.5 diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApi.java index 1fd809f2be82..3dd680bf4c6f 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApi.java @@ -176,9 +176,9 @@ public Response testEndpointParameters(@ApiParam(value = "None", required=true) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) - public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray + public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray ,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString -,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("enum_query_string_array") List enumQueryStringArray +,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("enum_query_string_array") List enumQueryStringArray ,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble @@ -237,11 +237,11 @@ public Response testJsonFormData(@ApiParam(value = "field1", required=true) @Fo @io.swagger.annotations.ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) - public Response testQueryParameterCollectionFormat(@ApiParam(value = "",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("pipe") List pipe -,@ApiParam(value = "",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("ioutil") List ioutil -,@ApiParam(value = "",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("http") List http -,@ApiParam(value = "",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("url") List url -,@ApiParam(value = "",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("context") List context + public Response testQueryParameterCollectionFormat(@ApiParam(value = "",required=true, defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("pipe") List pipe +,@ApiParam(value = "",required=true, defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("ioutil") List ioutil +,@ApiParam(value = "",required=true, defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("http") List http +,@ApiParam(value = "",required=true, defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("url") List url +,@ApiParam(value = "",required=true, defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("context") List context ) throws NotFoundException { return delegate.testQueryParameterCollectionFormat(pipe,ioutil,http,url,context); diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/PetApi.java index ea62e1388617..54f4b9c44260 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/PetApi.java @@ -86,7 +86,7 @@ public Response deletePet(@ApiParam(value = "Pet id to delete",required=true) @P @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") }) - public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("status") List status + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("status") List status ) throws NotFoundException { return delegate.findPetsByStatus(status); @@ -105,7 +105,7 @@ public Response findPetsByStatus(@ApiParam(value = "Status values that need to b @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "Set") }) - public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true, defaultValue="new LinkedHashSet()") @DefaultValue("new LinkedHashSet()") @QueryParam("tags") Set tags + public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true, defaultValue="new LinkedHashSet<>()") @DefaultValue("new LinkedHashSet<>()") @QueryParam("tags") Set tags ) throws NotFoundException { return delegate.findPetsByTags(tags); diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index 23b2e2e9e622..027c1a059c78 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -55,7 +55,7 @@ public AdditionalPropertiesClass mapString(Map mapString) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { if (this.mapString == null) { - this.mapString = new HashMap(); + this.mapString = new HashMap<>(); } this.mapString.put(key, mapStringItem); return this; @@ -81,7 +81,7 @@ public AdditionalPropertiesClass mapNumber(Map mapNumber) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { if (this.mapNumber == null) { - this.mapNumber = new HashMap(); + this.mapNumber = new HashMap<>(); } this.mapNumber.put(key, mapNumberItem); return this; @@ -107,7 +107,7 @@ public AdditionalPropertiesClass mapInteger(Map mapInteger) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { if (this.mapInteger == null) { - this.mapInteger = new HashMap(); + this.mapInteger = new HashMap<>(); } this.mapInteger.put(key, mapIntegerItem); return this; @@ -133,7 +133,7 @@ public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { if (this.mapBoolean == null) { - this.mapBoolean = new HashMap(); + this.mapBoolean = new HashMap<>(); } this.mapBoolean.put(key, mapBooleanItem); return this; @@ -159,7 +159,7 @@ public AdditionalPropertiesClass mapArrayInteger(Map> mapA public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap>(); + this.mapArrayInteger = new HashMap<>(); } this.mapArrayInteger.put(key, mapArrayIntegerItem); return this; @@ -185,7 +185,7 @@ public AdditionalPropertiesClass mapArrayAnytype(Map> mapAr public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap>(); + this.mapArrayAnytype = new HashMap<>(); } this.mapArrayAnytype.put(key, mapArrayAnytypeItem); return this; @@ -211,7 +211,7 @@ public AdditionalPropertiesClass mapMapString(Map> m public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { if (this.mapMapString == null) { - this.mapMapString = new HashMap>(); + this.mapMapString = new HashMap<>(); } this.mapMapString.put(key, mapMapStringItem); return this; @@ -237,7 +237,7 @@ public AdditionalPropertiesClass mapMapAnytype(Map> public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap>(); + this.mapMapAnytype = new HashMap<>(); } this.mapMapAnytype.put(key, mapMapAnytypeItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index 0d1918e69b08..97fe7e6c1876 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -24,7 +24,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java index 653b2bf20156..ae571a3d2264 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -24,7 +24,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayTest.java index bac07348e18f..d16008230a2f 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/ArrayTest.java @@ -30,7 +30,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -56,7 +56,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -82,7 +82,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumArrays.java index 08a29d10aec3..bea4e3979b37 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumArrays.java @@ -107,7 +107,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/FileSchemaTestClass.java index 74119a1e004d..3f54a8c70397 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -44,7 +44,7 @@ public FileSchemaTestClass files(List files) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) { if (this.files == null) { - this.files = new ArrayList(); + this.files = new ArrayList<>(); } this.files.add(filesItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MapTest.java index f93af7b0d359..00ce490329b7 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MapTest.java @@ -65,7 +65,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -91,7 +91,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -117,7 +117,7 @@ public MapTest directMap(Map directMap) { public MapTest putDirectMapItem(String key, Boolean directMapItem) { if (this.directMap == null) { - this.directMap = new HashMap(); + this.directMap = new HashMap<>(); } this.directMap.put(key, directMapItem); return this; @@ -143,7 +143,7 @@ public MapTest indirectMap(Map indirectMap) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { if (this.indirectMap == null) { - this.indirectMap = new HashMap(); + this.indirectMap = new HashMap<>(); } this.indirectMap.put(key, indirectMapItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 4e28308e41d2..10d5af73214d 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -69,7 +69,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Pet.java index 8ac79a3055ea..37d41439e1f9 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Pet.java @@ -28,7 +28,7 @@ public class Pet { private String name; @JsonProperty("photoUrls") - private Set photoUrls = new LinkedHashSet(); + private Set photoUrls = new LinkedHashSet<>(); @JsonProperty("tags") private List tags = null; @@ -153,7 +153,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/TypeHolderDefault.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/TypeHolderDefault.java index 283a88d95991..5f2ce3356bfa 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/TypeHolderDefault.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/TypeHolderDefault.java @@ -27,7 +27,7 @@ public class TypeHolderDefault { private Boolean boolItem = true; @JsonProperty("array_item") - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { this.stringItem = stringItem; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/TypeHolderExample.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/TypeHolderExample.java index 7bbb66f3d8b2..a1d58394f6b4 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/TypeHolderExample.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/TypeHolderExample.java @@ -30,7 +30,7 @@ public class TypeHolderExample { private Boolean boolItem; @JsonProperty("array_item") - private List arrayItem = new ArrayList(); + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { this.stringItem = stringItem; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/XmlItem.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/XmlItem.java index bdd293d62d5d..bd878a2a8bcb 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/XmlItem.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/XmlItem.java @@ -180,7 +180,7 @@ public XmlItem wrappedArray(List wrappedArray) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList(); + this.wrappedArray = new ArrayList<>(); } this.wrappedArray.add(wrappedArrayItem); return this; @@ -278,7 +278,7 @@ public XmlItem nameArray(List nameArray) { public XmlItem addNameArrayItem(Integer nameArrayItem) { if (this.nameArray == null) { - this.nameArray = new ArrayList(); + this.nameArray = new ArrayList<>(); } this.nameArray.add(nameArrayItem); return this; @@ -304,7 +304,7 @@ public XmlItem nameWrappedArray(List nameWrappedArray) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList(); + this.nameWrappedArray = new ArrayList<>(); } this.nameWrappedArray.add(nameWrappedArrayItem); return this; @@ -402,7 +402,7 @@ public XmlItem prefixArray(List prefixArray) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { if (this.prefixArray == null) { - this.prefixArray = new ArrayList(); + this.prefixArray = new ArrayList<>(); } this.prefixArray.add(prefixArrayItem); return this; @@ -428,7 +428,7 @@ public XmlItem prefixWrappedArray(List prefixWrappedArray) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList(); + this.prefixWrappedArray = new ArrayList<>(); } this.prefixWrappedArray.add(prefixWrappedArrayItem); return this; @@ -526,7 +526,7 @@ public XmlItem namespaceArray(List namespaceArray) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList(); + this.namespaceArray = new ArrayList<>(); } this.namespaceArray.add(namespaceArrayItem); return this; @@ -552,7 +552,7 @@ public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList(); + this.namespaceWrappedArray = new ArrayList<>(); } this.namespaceWrappedArray.add(namespaceWrappedArrayItem); return this; @@ -650,7 +650,7 @@ public XmlItem prefixNsArray(List prefixNsArray) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList(); + this.prefixNsArray = new ArrayList<>(); } this.prefixNsArray.add(prefixNsArrayItem); return this; @@ -676,7 +676,7 @@ public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList(); + this.prefixNsWrappedArray = new ArrayList<>(); } this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); return this; From dc5cd513728f63d9b70701565247aab2e08c3940 Mon Sep 17 00:00:00 2001 From: Thibault Duperron Date: Sat, 24 Oct 2020 22:40:24 +0200 Subject: [PATCH 4/4] Fix for tests --- .../openapitools/codegen/DefaultCodegen.java | 8 +- .../languages/AbstractJavaCodegen.java | 100 +++++++++++++++--- .../codegen/languages/SpringCodegen.java | 75 ++++++++++++- .../codegen/java/AbstractJavaCodegenTest.java | 6 ++ .../JavaJAXRSCXFExtServerCodegenTest.java | 14 +-- 5 files changed, 178 insertions(+), 25 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index a9d86fddb07b..0df9b00a3df4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -5550,8 +5550,12 @@ public void setIgnoreFilePathOverride(final String ignoreFileOverride) { } public boolean convertPropertyToBoolean(String propertyKey) { - final Object booleanValue = additionalProperties.get(propertyKey); - Boolean result = Boolean.FALSE; + final Object value = additionalProperties.get(propertyKey); + return toBoolean(value); + } + + protected boolean toBoolean(Object booleanValue) { + boolean result = false; if (booleanValue instanceof Boolean) { result = (Boolean) booleanValue; } else if (booleanValue instanceof String) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index bff1059fee82..395109fa5db3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -160,7 +160,7 @@ public AbstractJavaCodegen() { "native", "super", "while", "null") ); - languageSpecificPrimitives = new HashSet( + languageSpecificPrimitives = new HashSet<>( Arrays.asList( "String", "boolean", @@ -237,6 +237,86 @@ public AbstractJavaCodegen() { snapShotVersion.setEnum(snapShotVersionOptions); cliOptions.add(snapShotVersion); + cliOptions.add(CliOption.newBoolean(SUPPORT_ASYNC, "", (boolean) defaultValue(SUPPORT_ASYNC))); + } + + protected Object defaultValue(String key) { + switch (key) { + case CodegenConstants.MODEL_PACKAGE: + return modelPackage; + case CodegenConstants.API_PACKAGE: + return apiPackage; + case CodegenConstants.INVOKER_PACKAGE: + return this.getInvokerPackage(); + case CodegenConstants.GROUP_ID: + return this.getGroupId(); + case CodegenConstants.ARTIFACT_ID: + return this.getArtifactId(); + case CodegenConstants.ARTIFACT_VERSION: + return ARTIFACT_VERSION_DEFAULT_VALUE; + case CodegenConstants.ARTIFACT_URL: + return this.getArtifactUrl(); + case CodegenConstants.ARTIFACT_DESCRIPTION: + return this.getArtifactDescription(); + case CodegenConstants.SCM_CONNECTION: + return this.getScmConnection(); + case CodegenConstants.SCM_DEVELOPER_CONNECTION: + return this.getScmDeveloperConnection(); + case CodegenConstants.SCM_URL: + return this.getScmUrl(); + case CodegenConstants.DEVELOPER_NAME: + return this.getDeveloperName(); + case CodegenConstants.DEVELOPER_EMAIL: + return this.getDeveloperEmail(); + case CodegenConstants.DEVELOPER_ORGANIZATION: + return this.getDeveloperOrganization(); + case CodegenConstants.DEVELOPER_ORGANIZATION_URL: + return this.getDeveloperOrganizationUrl(); + case CodegenConstants.LICENSE_NAME: + return this.getLicenseName(); + case CodegenConstants.LICENSE_URL: + return this.getLicenseUrl(); + case CodegenConstants.SOURCE_FOLDER: + return this.getSourceFolder(); + case CodegenConstants.SERIALIZABLE_MODEL: + return this.getSerializableModel(); + case CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING: + return serializeBigDecimalAsString; + case FULL_JAVA_UTIL: + return fullJavaUtil; + case DISCRIMINATOR_CASE_SENSITIVE: + return discriminatorCaseSensitive; + case CodegenConstants.HIDE_GENERATION_TIMESTAMP: + return this.isHideGenerationTimestamp(); + case WITH_XML: + return withXml; + case DATE_LIBRARY: + return this.getDateLibrary(); + case JAVA8_MODE: + return this.java8Mode; + case DISABLE_HTML_ESCAPING: + return disableHtmlEscaping; + case BOOLEAN_GETTER_PREFIX: + return this.getBooleanGetterPrefix(); + case IGNORE_ANYOF_IN_ENUM: + return ignoreAnyOfInEnum; + case ADDITIONAL_MODEL_TYPE_ANNOTATIONS: + return additionalModelTypeAnnotations; + case OPENAPI_NULLABLE: + return this.openApiNullable; + + case CodegenConstants.PARENT_GROUP_ID: + return parentGroupId; + case CodegenConstants.PARENT_ARTIFACT_ID: + return parentArtifactId; + case CodegenConstants.PARENT_VERSION: + return parentVersion; + case CodegenConstants.SNAPSHOT_VERSION: + return false; + case SUPPORT_ASYNC: + return supportAsync; + } + return null; } @Override @@ -1157,7 +1237,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) { additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); if (additionalProperties.containsKey(CodegenConstants.SNAPSHOT_VERSION)) { - if ((boolean) additionalProperties.get(CodegenConstants.SNAPSHOT_VERSION)) { + if (convertPropertyToBoolean(CodegenConstants.SNAPSHOT_VERSION)) { this.setArtifactVersion(this.buildSnapshotVersion(this.getArtifactVersion())); } } @@ -1731,25 +1811,17 @@ protected Set booleanAdditionalProperties() { DISABLE_HTML_ESCAPING, IGNORE_ANYOF_IN_ENUM, OPENAPI_NULLABLE, - CodegenConstants.SNAPSHOT_VERSION + CodegenConstants.SNAPSHOT_VERSION, + SUPPORT_ASYNC )); } protected void coerceBooleanAdditionalProperties() { booleanAdditionalProperties().forEach(prop -> { - Boolean defaultValue = cliOptions.stream() - .filter(it -> it.getOpt().equals(prop)) - .findFirst() - .map(it -> Boolean.parseBoolean(it.getDefault())) - .orElse(null); + boolean defaultValue = (boolean) defaultValue(prop); Object value = additionalProperties.getOrDefault(prop, defaultValue); if (value != null) { - if (value instanceof String) { - additionalProperties.put(prop, Boolean.valueOf((String) value)); - } - if (value instanceof Boolean) { - additionalProperties.put(prop, value); - } + additionalProperties.put(prop, toBoolean(value)); } }); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 1b7965166442..29191a922deb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -137,7 +137,7 @@ public SpringCodegen() { invokerPackage = "org.openapitools.api"; artifactId = "openapi-spring"; - // clioOptions default redefinition need to be updated + // cliOptions default redefinition need to be updated updateOption(CodegenConstants.INVOKER_PACKAGE, this.getInvokerPackage()); updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId()); updateOption(CodegenConstants.API_PACKAGE, apiPackage); @@ -190,6 +190,76 @@ private void updateJava8CliOptions() { java8ModeOptions.put("true", "Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used. IMPORTANT: This option has been deprecated as Java 8 is the default."); } + @Override + protected Object defaultValue(String key) { + switch (key) { + + // cliOptions default redefinition need to be updated + case CodegenConstants.INVOKER_PACKAGE: + return this.getInvokerPackage(); + case CodegenConstants.ARTIFACT_ID: + return this.getArtifactId(); + case CodegenConstants.API_PACKAGE: + return apiPackage; + case CodegenConstants.MODEL_PACKAGE: + return modelPackage; + + case "jackson": + return true; + case "openbrace": + return OPEN_BRACE; + case "closebrace": + return CLOSE_BRACE; + case TITLE: + return title; + case CONFIG_PACKAGE: + return this.getConfigPackage(); + case BASE_PACKAGE: + return this.getBasePackage(); + case INTERFACE_ONLY: + return interfaceOnly; + case DELEGATE_PATTERN: + return delegatePattern; + case SINGLE_CONTENT_TYPES: + return singleContentTypes; + case JAVA_8: + return java8; + case SKIP_DEFAULT_INTERFACE: + return skipDefaultInterface; + case ASYNC: + return async; + case REACTIVE: + return reactive; + case RESPONSE_WRAPPER: + return responseWrapper; + case VIRTUAL_SERVICE: + return virtualService; + case USE_TAGS: + return useTags; + case USE_BEANVALIDATION: + return useBeanValidation; + case PERFORM_BEANVALIDATION: + return performBeanValidation; + case IMPLICIT_HEADERS: + return implicitHeaders; + case OPENAPI_DOCKET_CONFIG: + return openapiDocketConfig; + case API_FIRST: + return apiFirst; + case USE_OPTIONAL: + return useOptional; + case HATEOAS: + return hateoas; + case RETURN_SUCCESS_CODE: + return returnSuccessCode; + case UNHANDLED_EXCEPTION_HANDLING: + return unhandledException; + case CodegenConstants.LIBRARY: + return library; + } + return super.defaultValue(key); + } + @Override public CodegenType getTag() { return CodegenType.SERVER; @@ -281,7 +351,8 @@ public void processOpts() { } if (additionalProperties.containsKey(REACTIVE)) { - if (!SPRING_BOOT.equals(library)) { + boolean isReactive = (boolean) additionalProperties.get(REACTIVE); + if (!SPRING_BOOT.equals(library) && isReactive) { throw new IllegalArgumentException("Currently, reactive option is only supported with Spring-boot"); } this.setReactive((boolean) additionalProperties.get(REACTIVE)); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java index 527482fcf78d..98d77200514c 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java @@ -512,6 +512,7 @@ public void processOptsBooleanTrueFromString() { final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen(); final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); codegen.additionalProperties().put(CodegenConstants.SNAPSHOT_VERSION, "true"); + codegen.processOpts(); codegen.preprocessOpenAPI(openAPI); Assert.assertTrue((boolean) codegen.additionalProperties().get(CodegenConstants.SNAPSHOT_VERSION)); } @@ -521,6 +522,7 @@ public void processOptsBooleanTrueFromBoolean() { final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen(); final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); codegen.additionalProperties().put(CodegenConstants.SNAPSHOT_VERSION, true); + codegen.processOpts(); codegen.preprocessOpenAPI(openAPI); Assert.assertTrue((boolean) codegen.additionalProperties().get(CodegenConstants.SNAPSHOT_VERSION)); } @@ -530,6 +532,7 @@ public void processOptsBooleanFalseFromString() { final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen(); final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); codegen.additionalProperties().put(CodegenConstants.SNAPSHOT_VERSION, "false"); + codegen.processOpts(); codegen.preprocessOpenAPI(openAPI); Assert.assertFalse((boolean) codegen.additionalProperties().get(CodegenConstants.SNAPSHOT_VERSION)); } @@ -539,6 +542,7 @@ public void processOptsBooleanFalseFromBoolean() { final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen(); final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); codegen.additionalProperties().put(CodegenConstants.SNAPSHOT_VERSION, false); + codegen.processOpts(); codegen.preprocessOpenAPI(openAPI); Assert.assertFalse((boolean) codegen.additionalProperties().get(CodegenConstants.SNAPSHOT_VERSION)); } @@ -548,6 +552,7 @@ public void processOptsBooleanFalseFromGarbage() { final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen(); final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); codegen.additionalProperties().put(CodegenConstants.SNAPSHOT_VERSION, "blibb"); + codegen.processOpts(); codegen.preprocessOpenAPI(openAPI); Assert.assertFalse((boolean) codegen.additionalProperties().get(CodegenConstants.SNAPSHOT_VERSION)); } @@ -557,6 +562,7 @@ public void processOptsBooleanFalseFromNumeric() { final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen(); final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); codegen.additionalProperties().put(CodegenConstants.SNAPSHOT_VERSION, 42L); + codegen.processOpts(); codegen.preprocessOpenAPI(openAPI); Assert.assertFalse((boolean) codegen.additionalProperties().get(CodegenConstants.SNAPSHOT_VERSION)); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java index 2095cbcf023f..0135edcf28a0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java @@ -503,16 +503,16 @@ public void testInitialConfigValues() throws Exception { "scm:git:git@github.com:openapitools/openapi-generator.git"); assertEquals(additionalProperties.get(CodegenConstants.SCM_URL), "https://github.com/openapitools/openapi-generator"); - assertNull(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING)); - assertEquals(additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL), Boolean.FALSE); + assertEquals(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING), false); + assertEquals(additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL), false); assertEquals(additionalProperties.get(CodegenConstants.SOURCE_FOLDER), "src/gen/java"); assertEquals(additionalProperties.get(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX), "get"); assertNull(additionalProperties.get(AbstractJavaCodegen.DATE_LIBRARY)); - assertEquals(additionalProperties.get(AbstractJavaCodegen.DISABLE_HTML_ESCAPING), Boolean.FALSE); - assertEquals(additionalProperties.get(AbstractJavaCodegen.FULL_JAVA_UTIL), Boolean.FALSE); - assertNull(additionalProperties.get(AbstractJavaCodegen.JAVA8_MODE)); - assertNull(additionalProperties.get(AbstractJavaCodegen.SUPPORT_ASYNC)); - assertEquals(additionalProperties.get(AbstractJavaCodegen.SUPPORT_JAVA6), Boolean.FALSE); + assertEquals(additionalProperties.get(AbstractJavaCodegen.DISABLE_HTML_ESCAPING), false); + assertEquals(additionalProperties.get(AbstractJavaCodegen.FULL_JAVA_UTIL), false); + assertEquals(additionalProperties.get(AbstractJavaCodegen.JAVA8_MODE), true); + assertEquals(additionalProperties.get(AbstractJavaCodegen.SUPPORT_ASYNC), false); + assertEquals(additionalProperties.get(AbstractJavaCodegen.SUPPORT_JAVA6), false); assertEquals(additionalProperties.get(AbstractJavaCodegen.WITH_XML), false); assertEquals(additionalProperties.get(AbstractJavaCodegen.OPENAPI_NULLABLE), true); // Options processed by AbstractJavaJAXRSServerCodegen