diff --git a/modules/openapi-generator/src/main/resources/Java/README.mustache b/modules/openapi-generator/src/main/resources/Java/README.mustache index a462368db62..45cf63f7b6a 100644 --- a/modules/openapi-generator/src/main/resources/Java/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/README.mustache @@ -18,7 +18,7 @@ ## Requirements Building the API client library requires: -1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ +1. Java {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}}+ 2. Maven/Gradle ## Installation diff --git a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache index 575811da812..192ac3cbbbc 100644 --- a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache @@ -31,6 +31,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -39,6 +44,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -83,6 +89,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -91,6 +102,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache index 0074c0e38a2..32254e52506 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -32,6 +32,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -40,6 +45,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -84,8 +90,20 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_{{^java8}}1_7{{/java8}}{{#java8}}1_8{{/java8}} - targetCompatibility = JavaVersion.VERSION_{{^java8}}1_7{{/java8}}{{#java8}}1_8{{/java8}} + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} + {{#java8}} + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + {{/java8}} + {{^java8}} + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache index ad255c13ea4..a616e68bcff 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache @@ -291,7 +291,7 @@ UTF-8 - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}} ${java.version} ${java.version} 1.5.18 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache index e6197b08f7a..1a2b2afc6cd 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache @@ -32,6 +32,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -40,6 +45,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -84,6 +90,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -92,6 +103,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache index e8605bbac61..2fff29a15b5 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache @@ -139,6 +139,11 @@ maven-compiler-plugin 3.6.1 + {{#supportJava6}} + 1.6 + 1.6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -147,6 +152,7 @@ 1.7 1.7 {{/java8}} + {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache index e70b34ad0dc..da375a01057 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache @@ -709,12 +709,12 @@ public class ApiClient { Map> responseHeaders = buildResponseHeaders(response); if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { - return new ApiResponse<>(statusCode, responseHeaders); + return new ApiResponse<{{#supportJava6}}T{{/supportJava6}}>(statusCode, responseHeaders); } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { if (returnType == null) - return new ApiResponse<>(statusCode, responseHeaders); + return new ApiResponse<{{#supportJava6}}T{{/supportJava6}}>(statusCode, responseHeaders); else - return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); + return new ApiResponse<{{#supportJava6}}T{{/supportJava6}}>(statusCode, responseHeaders, deserialize(response, returnType)); } else { String message = "error"; String respBody = null; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index 19d8c2c6d84..9da2a053e84 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -32,6 +32,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -40,6 +45,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -83,6 +89,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -91,6 +102,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index 85f38605dd8..ebdd3f9d925 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -139,6 +139,11 @@ maven-compiler-plugin 3.6.1 + {{#supportJava6}} + 1.6 + 1.6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -147,6 +152,7 @@ 1.7 1.7 {{/java8}} + {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache index 27fe1caaf25..69621c1a6bd 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache @@ -32,6 +32,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -40,6 +45,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -84,8 +90,20 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_{{^java8}}1_7{{/java8}}{{#java8}}1_8{{/java8}} - targetCompatibility = JavaVersion.VERSION_{{^java8}}1_7{{/java8}}{{#java8}}1_8{{/java8}} + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} + {{#java8}} + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + {{/java8}} + {{^java8}} + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index b5119774a05..0b0903d617b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -267,7 +267,7 @@ - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}} ${java.version} ${java.version} 1.8.0 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache index fc42da3e68c..fc2cd18dbea 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache @@ -32,6 +32,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 23 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -40,6 +45,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -83,6 +89,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -91,6 +102,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache index e6aae545c91..479c22ba75c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache @@ -120,6 +120,11 @@ maven-compiler-plugin 2.5.1 + {{#supportJava6}} + 1.6 + 1.6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -128,6 +133,7 @@ 1.7 1.7 {{/java8}} + {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache index e4fc1caa4f0..9925cc43daf 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache @@ -32,6 +32,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -40,6 +45,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -84,6 +90,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -92,6 +103,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache index 01abe39efb5..0d371de6ea1 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache @@ -139,6 +139,11 @@ maven-compiler-plugin 3.6.1 + {{#supportJava6}} + 1.6 + 1.6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -147,6 +152,7 @@ 1.7 1.7 {{/java8}} + {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache index 6befe74db7c..f0c1cbe4c88 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache @@ -32,6 +32,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -40,6 +45,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache index 0921ab21ac4..adbd6e99e50 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache @@ -139,8 +139,20 @@ maven-compiler-plugin 3.6.1 - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + {{#supportJava6}} + 1.6 + 1.6 + {{/supportJava6}} + {{^supportJava6}} + {{#java8}} + 1.8 + 1.8 + {{/java8}} + {{^java8}} + 1.7 + 1.7 + {{/java8}} + {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index f341375f821..858b88971b2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -32,6 +32,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -40,6 +45,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -84,8 +90,20 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_{{^java8}}1_7{{/java8}}{{#java8}}1_8{{/java8}} - targetCompatibility = JavaVersion.VERSION_{{^java8}}1_7{{/java8}}{{#java8}}1_8{{/java8}} + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} + {{#java8}} + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + {{/java8}} + {{^java8}} + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play24/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play24/ApiClient.mustache index 5c871c62073..8683ccc5f22 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play24/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play24/ApiClient.mustache @@ -40,7 +40,7 @@ public class ApiClient { public ApiClient() { // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap<>();{{#authMethods}}{{#isBasic}} + authentications = new HashMap<{{#supportJava6}}String, Authentication{{/supportJava6}}>();{{#authMethods}}{{#isBasic}} // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} @@ -57,8 +57,8 @@ public class ApiClient { basePath = basePath + "/"; } - Map extraHeaders = new HashMap<>(); - List extraQueryParams = new ArrayList<>(); + Map extraHeaders = new HashMap<{{#supportJava6}}String, String{{/supportJava6}}>(); + List extraQueryParams = new ArrayList<{{#supportJava6}}Pair{{/supportJava6}}>(); for (String authName : authentications.keySet()) { Authentication auth = authentications.get(authName); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play25/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play25/ApiClient.mustache index 163afd670c1..7d3dbd1e28c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play25/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play25/ApiClient.mustache @@ -40,7 +40,7 @@ public class ApiClient { public ApiClient() { // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap<>();{{#authMethods}}{{#isBasic}} + authentications = new HashMap<{{#supportJava6}}String, Authentication{{/supportJava6}}>();{{#authMethods}}{{#isBasic}} // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} @@ -57,8 +57,8 @@ public class ApiClient { basePath = basePath + "/"; } - Map extraHeaders = new HashMap<>(); - List extraQueryParams = new ArrayList<>(); + Map extraHeaders = new HashMap<{{#supportJava6}}String, String{{/supportJava6}}>(); + List extraQueryParams = new ArrayList<{{#supportJava6}}Pair{{/supportJava6}}>(); for (String authName : authentications.keySet()) { Authentication auth = authentications.get(authName); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache index 3adfab68fe7..f23642e46bb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -327,7 +327,7 @@ UTF-8 - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}} ${java.version} ${java.version} 1.8.0 diff --git a/modules/openapi-generator/src/main/resources/Java/pom.mustache b/modules/openapi-generator/src/main/resources/Java/pom.mustache index 7e61c4c05ad..0c1501e115c 100644 --- a/modules/openapi-generator/src/main/resources/Java/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pom.mustache @@ -139,6 +139,11 @@ maven-compiler-plugin 3.6.1 + {{#supportJava6}} + 1.6 + 1.6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -147,6 +152,7 @@ 1.7 1.7 {{/java8}} + {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/android/build.mustache b/modules/openapi-generator/src/main/resources/android/build.mustache index 2900eaf0bcd..2b93de842ac 100644 --- a/modules/openapi-generator/src/main/resources/android/build.mustache +++ b/modules/openapi-generator/src/main/resources/android/build.mustache @@ -56,6 +56,11 @@ android { {{/androidSdkVersion}} } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -64,6 +69,7 @@ android { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly diff --git a/modules/openapi-generator/src/main/resources/android/libraries/volley/build.mustache b/modules/openapi-generator/src/main/resources/android/libraries/volley/build.mustache index 45a83a6af50..8f2127fb5d1 100644 --- a/modules/openapi-generator/src/main/resources/android/libraries/volley/build.mustache +++ b/modules/openapi-generator/src/main/resources/android/libraries/volley/build.mustache @@ -35,6 +35,11 @@ android { targetSdkVersion 25 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -43,6 +48,7 @@ android { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly diff --git a/modules/openapi-generator/src/test/resources/2_0/templates/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/test/resources/2_0/templates/Java/libraries/jersey2/build.gradle.mustache index b6d2dd8ec39..e31fd0f0677 100644 --- a/modules/openapi-generator/src/test/resources/2_0/templates/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/test/resources/2_0/templates/Java/libraries/jersey2/build.gradle.mustache @@ -34,6 +34,11 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 23 } compileOptions { + {{#supportJava6}} + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -42,6 +47,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} } // Rename the aar correctly @@ -85,6 +91,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' + {{#supportJava6}} + sourceCompatibility = JavaVersion.VERSION_1_6 + targetCompatibility = JavaVersion.VERSION_1_6 + {{/supportJava6}} + {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -93,6 +104,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} + {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/samples/client/petstore/java/jersey2-java6/README.md b/samples/client/petstore/java/jersey2-java6/README.md index 43a4c27ae42..ba58700f55e 100644 --- a/samples/client/petstore/java/jersey2-java6/README.md +++ b/samples/client/petstore/java/jersey2-java6/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.6+ 2. Maven/Gradle ## Installation @@ -108,6 +108,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description *PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet *PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -154,6 +156,7 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [FormatTest](docs/FormatTest.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [MapTest](docs/MapTest.md) @@ -169,6 +172,7 @@ Class | Method | HTTP request | Description - [Pet](docs/Pet.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [SpecialModelName](docs/SpecialModelName.md) + - [StringBooleanMap](docs/StringBooleanMap.md) - [Tag](docs/Tag.md) - [User](docs/User.md) diff --git a/samples/client/petstore/java/jersey2-java6/build.gradle b/samples/client/petstore/java/jersey2-java6/build.gradle index 2676ce5ac1e..13b7df4820b 100644 --- a/samples/client/petstore/java/jersey2-java6/build.gradle +++ b/samples/client/petstore/java/jersey2-java6/build.gradle @@ -32,8 +32,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 } // Rename the aar correctly @@ -77,8 +77,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_6 + targetCompatibility = JavaVersion.VERSION_1_6 install { repositories.mavenInstaller { diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index a61c7c12307..02988034f06 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -139,8 +139,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.6 + 1.6 diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java index 277483ebd51..5893b2b206a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java @@ -698,12 +698,12 @@ public class ApiClient { Map> responseHeaders = buildResponseHeaders(response); if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { - return new ApiResponse<>(statusCode, responseHeaders); + return new ApiResponse(statusCode, responseHeaders); } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { if (returnType == null) - return new ApiResponse<>(statusCode, responseHeaders); + return new ApiResponse(statusCode, responseHeaders); else - return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); + return new ApiResponse(statusCode, responseHeaders, deserialize(response, returnType)); } else { String message = "error"; String respBody = null; diff --git a/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/api/FakeApiTest.java index f23eef8b585..11916028aac 100644 --- a/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -17,6 +17,7 @@ import org.openapitools.client.ApiException; import java.math.BigDecimal; import org.openapitools.client.model.Client; import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.OuterComposite; @@ -102,6 +103,22 @@ public class FakeApiTest { // TODO: test validations } + /** + * + * + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + FileSchemaTestClass fileSchemaTestClass = null; + api.testBodyWithFileSchema(fileSchemaTestClass); + + // TODO: test validations + } + /** * * diff --git a/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/api/PetApiTest.java index d3fbe90a5a6..f31cc07244e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -167,4 +167,22 @@ public class PetApiTest { // TODO: test validations } + /** + * uploads an image (required) + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + + // TODO: test validations + } + }