From 83ce3a1f0ef3d489c49ac80cf5ac78f17b8261fb Mon Sep 17 00:00:00 2001
From: Jeremie Bresson <dev@jmini.fr>
Date: Thu, 10 Jan 2019 08:54:40 +0100
Subject: [PATCH 1/2] Fix Javadoc error

---
 .../src/main/java/org/openapitools/codegen/DefaultCodegen.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 a3e844df37b..a41e57378aa 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
@@ -1508,7 +1508,7 @@ public class DefaultCodegen implements CodegenConfig {
      *
      * @param name string to be capitalized
      * @return capitalized string
-     * @deprecated
+     * @deprecated use {@link org.openapitools.codegen.utils.StringUtils#camelize(String)} instead
      */
     @SuppressWarnings("static-method")
     public String initialCaps(String name) {
-- 
GitLab


From e802d9f697bac39b7d417253e6568f4f2b887eff Mon Sep 17 00:00:00 2001
From: Jeremie Bresson <dev@jmini.fr>
Date: Thu, 10 Jan 2019 09:50:32 +0100
Subject: [PATCH 2/2] [java-client][okhttp-gson] no oauth2 usage when
 hasOAuthMethods is false

---
 .../Java/libraries/okhttp-gson/ApiClient.mustache         | 8 ++++++++
 .../libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache | 2 ++
 .../libraries/okhttp-gson/auth/RetryingOAuth.mustache     | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache
index 33081f30a0c..14f55484815 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache
@@ -53,9 +53,11 @@ import java.util.regex.Pattern;
 import {{invokerPackage}}.auth.Authentication;
 import {{invokerPackage}}.auth.HttpBasicAuth;
 import {{invokerPackage}}.auth.ApiKeyAuth;
+{{#hasOAuthMethods}}
 import {{invokerPackage}}.auth.OAuth;
 import {{invokerPackage}}.auth.RetryingOAuth;
 import {{invokerPackage}}.auth.OAuthFlow;
+{{/hasOAuthMethods}}
 
 public class ApiClient {
 
@@ -117,12 +119,14 @@ public class ApiClient {
     public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
         init();
 
+{{#hasOAuthMethods}}
         RetryingOAuth retryingOAuth = new RetryingOAuth("{{tokenUrl}}", clientId, OAuthFlow.{{flow}}, clientSecret, parameters);
         authentications.put(
                 "{{name}}",
                 retryingOAuth
         );
         httpClient.interceptors().add(retryingOAuth);
+{{/hasOAuthMethods}}
 
         // Prevent the authentications from being modified.
         authentications = Collections.unmodifiableMap(authentications);
@@ -399,12 +403,14 @@ public class ApiClient {
      * @param accessToken Access token
      */
     public void setAccessToken(String accessToken) {
+        {{#hasOAuthMethods}}
         for (Authentication auth : authentications.values()) {
             if (auth instanceof OAuth) {
                 ((OAuth) auth).setAccessToken(accessToken);
                 return;
             }
         }
+        {{/hasOAuthMethods}}
         throw new RuntimeException("No OAuth2 authentication configured!");
     }
 
@@ -550,6 +556,7 @@ public class ApiClient {
         return this;
     }
 
+    {{#hasOAuthMethods}}
     /**
      * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
      * @return Token request builder
@@ -563,6 +570,7 @@ public class ApiClient {
         }
         return null;
     }
+    {{/hasOAuthMethods}}
 
     /**
      * Format the given parameter object into string.
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache
index 6886c2fc358..5460132cdb1 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache
@@ -1,3 +1,4 @@
+{{#hasOAuthMethods}}
 package {{invokerPackage}}.auth;
 
 import com.squareup.okhttp.OkHttpClient;
@@ -66,3 +67,4 @@ public class OAuthOkHttpClient implements HttpClient {
         // Nothing to do here
     }
 }
+{{/hasOAuthMethods}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache
index 11ef3c3ca61..5cf6fe7e294 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache
@@ -1,3 +1,4 @@
+{{#hasOAuthMethods}}
 package {{invokerPackage}}.auth;
 
 import {{invokerPackage}}.Pair;
@@ -172,3 +173,4 @@ public class RetryingOAuth extends OAuth implements Interceptor {
         // No implementation necessary
     }
 }
+{{/hasOAuthMethods}}
\ No newline at end of file
-- 
GitLab