From 58c5ecf13ce93ea706ad0eb5349e0f7aeb08a20b Mon Sep 17 00:00:00 2001 From: Yissachar Radcliffe Date: Sun, 6 Sep 2015 19:58:28 -0400 Subject: [PATCH] Generate auth files to correct location --- .../codegen/languages/DartClientCodegen.java | 2 +- .../petstore/dart/auth/api_key_auth.dart | 28 ------------------- .../petstore/dart/auth/authentication.dart | 7 ----- .../petstore/dart/auth/http_basic_auth.dart | 14 ---------- samples/client/petstore/dart/auth/oauth.dart | 9 ------ .../dart/lib/auth/authentication.dart | 5 ++-- 6 files changed, 4 insertions(+), 61 deletions(-) delete mode 100644 samples/client/petstore/dart/auth/api_key_auth.dart delete mode 100644 samples/client/petstore/dart/auth/authentication.dart delete mode 100644 samples/client/petstore/dart/auth/http_basic_auth.dart delete mode 100644 samples/client/petstore/dart/auth/oauth.dart diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java index c22e7969e28..ede4505d4dd 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java @@ -133,7 +133,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("apiException.mustache", libFolder, "api_exception.dart")); supportingFiles.add(new SupportingFile("apilib.mustache", libFolder, "api.dart")); - final String authFolder = sourceFolder + File.separator + "auth"; + final String authFolder = sourceFolder + File.separator + "lib" + File.separator + "auth"; supportingFiles.add(new SupportingFile("auth/authentication.mustache", authFolder, "authentication.dart")); supportingFiles.add(new SupportingFile("auth/http_basic_auth.mustache", authFolder, "http_basic_auth.dart")); supportingFiles.add(new SupportingFile("auth/api_key_auth.mustache", authFolder, "api_key_auth.dart")); diff --git a/samples/client/petstore/dart/auth/api_key_auth.dart b/samples/client/petstore/dart/auth/api_key_auth.dart deleted file mode 100644 index 6e728ae916b..00000000000 --- a/samples/client/petstore/dart/auth/api_key_auth.dart +++ /dev/null @@ -1,28 +0,0 @@ -part of api; - -class ApiKeyAuth implements Authentication { - - final String location; - final String paramName; - String apiKey; - String apiKeyPrefix; - - ApiKeyAuth(this.location, this.paramName); - - @override - void applyToParams(Map queryParams, Map headerParams) { - String value; - if (apiKeyPrefix != null) { - value = '$apiKeyPrefix $apiKey'; - } else { - value = apiKey; - } - - if (location == 'query' && value != null) { - queryParams[paramName] = value; - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } - } - -} \ No newline at end of file diff --git a/samples/client/petstore/dart/auth/authentication.dart b/samples/client/petstore/dart/auth/authentication.dart deleted file mode 100644 index 4833af90ec0..00000000000 --- a/samples/client/petstore/dart/auth/authentication.dart +++ /dev/null @@ -1,7 +0,0 @@ -part of api; - -abstract class Authentication { - - /// Apply authentication settings to header and query params. - void applyToParams(Map queryParams, Map headerParams); -} \ No newline at end of file diff --git a/samples/client/petstore/dart/auth/http_basic_auth.dart b/samples/client/petstore/dart/auth/http_basic_auth.dart deleted file mode 100644 index e681c25653d..00000000000 --- a/samples/client/petstore/dart/auth/http_basic_auth.dart +++ /dev/null @@ -1,14 +0,0 @@ -part of api; - -class HttpBasicAuth implements Authentication { - - String username; - String password; - - @override - void applyToParams(Map queryParams, Map headerParams) { - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - headerParams["Authorization"] = "Basic " + CryptoUtils.bytesToBase64(UTF8.encode(str)); - } - -} \ No newline at end of file diff --git a/samples/client/petstore/dart/auth/oauth.dart b/samples/client/petstore/dart/auth/oauth.dart deleted file mode 100644 index 5e3e2c8b260..00000000000 --- a/samples/client/petstore/dart/auth/oauth.dart +++ /dev/null @@ -1,9 +0,0 @@ -part of api; - -class OAuth implements Authentication { - - @override - void applyToParams(Map queryParams, Map headerParams) { - // TODO: support oauth - } -} \ No newline at end of file diff --git a/samples/client/petstore/dart/lib/auth/authentication.dart b/samples/client/petstore/dart/lib/auth/authentication.dart index b4aa90651f6..4833af90ec0 100644 --- a/samples/client/petstore/dart/lib/auth/authentication.dart +++ b/samples/client/petstore/dart/lib/auth/authentication.dart @@ -1,6 +1,7 @@ part of api; abstract class Authentication { - - void applyToParams(Map queryParams, Map headerParams); + + /// Apply authentication settings to header and query params. + void applyToParams(Map queryParams, Map headerParams); } \ No newline at end of file