From 417dcc8a86becd63f5ec109482d9ccb7d62c2ba2 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 18 Jan 2016 11:39:32 +0800 Subject: [PATCH 01/23] update csharp configuration to avoid circular dependency, deprecate ApiClient.Default --- .../main/resources/csharp/ApiClient.mustache | 3 +- .../resources/csharp/Configuration.mustache | 59 +++++++++++------- .../csharp/IO/Swagger/Client/ApiClient.cs | 3 +- .../csharp/IO/Swagger/Client/Configuration.cs | 59 +++++++++++------- .../SwaggerClientTest.userprefs | 21 +------ .../csharp/SwaggerClientTest/TestApiClient.cs | 27 ++++++++ .../bin/Debug/SwaggerClientTest.dll | Bin 126464 -> 126464 bytes .../bin/Debug/SwaggerClientTest.dll.mdb | Bin 34926 -> 34893 bytes .../obj/Debug/SwaggerClientTest.dll | Bin 126464 -> 126464 bytes 9 files changed, 110 insertions(+), 62 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache index 049f8814fc37..3b83a33c8894 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache @@ -61,7 +61,8 @@ namespace {{packageName}}.Client /// Gets or sets the default API client for making HTTP calls. /// /// The default API client. - public static ApiClient Default = new ApiClient(Configuration.Default); + [Obsolete("ApiClient.Default is deprecated, please use 'Configuraiton.Default.ApiClient' instead.")] + public static ApiClient Default; /// /// Gets or sets the Configuration. diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache index a7e5df5179c0..e7a19003e156 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache @@ -37,10 +37,7 @@ namespace {{packageName}}.Client int timeout = 100000 ) { - if (apiClient == null) - ApiClient = ApiClient.Default == null ? new ApiClient() : ApiClient.Default; - else - ApiClient = apiClient; + setApiClientUsingDefault(apiClient); Username = username; Password = password; @@ -64,18 +61,15 @@ namespace {{packageName}}.Client /// Api client. public Configuration(ApiClient apiClient) { - if (apiClient == null) - ApiClient = ApiClient.Default; - else - ApiClient = apiClient; + setApiClientUsingDefault(apiClient); } - + /// /// Version of the package. /// /// Version of the package. public const string Version = "{{packageVersion}}"; - + /// /// Gets or sets the default Configuration. /// @@ -103,8 +97,31 @@ namespace {{packageName}}.Client /// The API client. public ApiClient ApiClient; + /// + /// Set the ApiClient using Default or ApiClient instance + /// + /// An instance of ApiClient + /// + public void setApiClientUsingDefault (ApiClient apiClient = null) + { + if (apiClient == null) + { + if (Default != null && Default.ApiClient == null) + Default.ApiClient = new ApiClient(); + + ApiClient = Default != null ? Default.ApiClient : new ApiClient(); + } + else + { + if (Default != null && Default.ApiClient == null) + Default.ApiClient = apiClient; + + ApiClient = apiClient; + } + } + private Dictionary _defaultHeaderMap = new Dictionary(); - + /// /// Gets or sets the default header. /// @@ -134,13 +151,13 @@ namespace {{packageName}}.Client /// /// The username. public String Username { get; set; } - + /// /// Gets or sets the password (HTTP basic authentication). /// /// The password. public String Password { get; set; } - + /// /// Gets or sets the access token for OAuth2 authentication. /// @@ -152,7 +169,7 @@ namespace {{packageName}}.Client /// /// The API key. public Dictionary ApiKey = new Dictionary(); - + /// /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. /// @@ -174,9 +191,9 @@ namespace {{packageName}}.Client else return apiKeyValue; } - + private string _tempFolderPath = Path.GetTempPath(); - + /// /// Gets or sets the temporary folder path to store the files downloaded from the server. /// @@ -184,19 +201,19 @@ namespace {{packageName}}.Client public String TempFolderPath { get { return _tempFolderPath; } - - set + + set { if (String.IsNullOrEmpty(value)) { _tempFolderPath = value; return; } - + // create the directory if it does not exist if (!Directory.Exists(value)) Directory.CreateDirectory(value); - + // check if the path contains directory separator at the end if (value[value.Length - 1] == Path.DirectorySeparatorChar) _tempFolderPath = value; @@ -251,7 +268,7 @@ namespace {{packageName}}.Client .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n"; report += " Version of the API: {{version}}\n"; report += " SDK Package Version: {{packageVersion}}\n"; - + return report; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs index 9ebd05fa7312..70b17804f65d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs @@ -61,7 +61,8 @@ namespace IO.Swagger.Client /// Gets or sets the default API client for making HTTP calls. /// /// The default API client. - public static ApiClient Default = new ApiClient(Configuration.Default); + [Obsolete("ApiClient.Default is deprecated, please use 'Configuraiton.Default.ApiClient' instead.")] + public static ApiClient Default; /// /// Gets or sets the Configuration. diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs index d321ad5ef82a..e55fc875f42f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs @@ -37,10 +37,7 @@ namespace IO.Swagger.Client int timeout = 100000 ) { - if (apiClient == null) - ApiClient = ApiClient.Default == null ? new ApiClient() : ApiClient.Default; - else - ApiClient = apiClient; + setApiClientUsingDefault(apiClient); Username = username; Password = password; @@ -64,18 +61,15 @@ namespace IO.Swagger.Client /// Api client. public Configuration(ApiClient apiClient) { - if (apiClient == null) - ApiClient = ApiClient.Default; - else - ApiClient = apiClient; + setApiClientUsingDefault(apiClient); } - + /// /// Version of the package. /// /// Version of the package. public const string Version = "1.0.0"; - + /// /// Gets or sets the default Configuration. /// @@ -103,8 +97,31 @@ namespace IO.Swagger.Client /// The API client. public ApiClient ApiClient; + /// + /// Set the ApiClient using Default or ApiClient instance + /// + /// An instance of ApiClient + /// + public void setApiClientUsingDefault (ApiClient apiClient = null) + { + if (apiClient == null) + { + if (Default != null && Default.ApiClient == null) + Default.ApiClient = new ApiClient(); + + ApiClient = Default != null ? Default.ApiClient : new ApiClient(); + } + else + { + if (Default != null && Default.ApiClient == null) + Default.ApiClient = apiClient; + + ApiClient = apiClient; + } + } + private Dictionary _defaultHeaderMap = new Dictionary(); - + /// /// Gets or sets the default header. /// @@ -134,13 +151,13 @@ namespace IO.Swagger.Client /// /// The username. public String Username { get; set; } - + /// /// Gets or sets the password (HTTP basic authentication). /// /// The password. public String Password { get; set; } - + /// /// Gets or sets the access token for OAuth2 authentication. /// @@ -152,7 +169,7 @@ namespace IO.Swagger.Client /// /// The API key. public Dictionary ApiKey = new Dictionary(); - + /// /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. /// @@ -174,9 +191,9 @@ namespace IO.Swagger.Client else return apiKeyValue; } - + private string _tempFolderPath = Path.GetTempPath(); - + /// /// Gets or sets the temporary folder path to store the files downloaded from the server. /// @@ -184,19 +201,19 @@ namespace IO.Swagger.Client public String TempFolderPath { get { return _tempFolderPath; } - - set + + set { if (String.IsNullOrEmpty(value)) { _tempFolderPath = value; return; } - + // create the directory if it does not exist if (!Directory.Exists(value)) Directory.CreateDirectory(value); - + // check if the path contains directory separator at the end if (value[value.Length - 1] == Path.DirectorySeparatorChar) _tempFolderPath = value; @@ -251,7 +268,7 @@ namespace IO.Swagger.Client .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n"; report += " Version of the API: 1.0.0\n"; report += " SDK Package Version: 1.0.0\n"; - + return report; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index 4a3939f70947..1b32b6e5da67 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,29 +1,14 @@  - + - + - + - - - - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs index d57627a623a5..af7c22ba0880 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using IO.Swagger.Client; +using IO.Swagger.Api; namespace SwaggerClientTest.TestApiClient { @@ -111,6 +112,32 @@ namespace SwaggerClientTest.TestApiClient Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename(".\\sun.gif")); } + + [Test ()] + public void TestApiClientInstance () + { + PetApi p1 = new PetApi (); + PetApi p2 = new PetApi (); + + Configuration c1 = new Configuration (); // using default ApiClient + PetApi p3 = new PetApi (c1); + + ApiClient a1 = new ApiClient(); + Configuration c2 = new Configuration (a1); // using default ApiClient + PetApi p4 = new PetApi (c2); + + + // ensure both using the same default ApiClient + Assert.AreSame(p1.Configuration.ApiClient, p2.Configuration.ApiClient); + Assert.AreSame(p1.Configuration.ApiClient, Configuration.Default.ApiClient); + + Assert.AreSame(p3.Configuration.ApiClient, c1.ApiClient); + Assert.AreSame(p3.Configuration.ApiClient, Configuration.Default.ApiClient); + + Assert.AreSame(p4.Configuration.ApiClient, c2.ApiClient); + Assert.AreNotSame(p4.Configuration.ApiClient, Configuration.Default.ApiClient); + + } } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll index 10b5d98d5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z?#BlmOmT+H2Rx#rc_h9sjq3EX_zU;w9&NH^nq!&=|fYM=}*&RlVT1q2b;spk!G{m zZf<5CWzII|nx~jc%yZ4l&Fjs3%?Hh=&0m>UTJ~6ewLG*uwrH%+T9d7*)?U_r)*;rH zt$Eft)+N?rTdC8wz_!#@ZhObJ!S=rGTiY$$kG5ZJ4{b_J>zHR_l4DY1dd2jM84{Bj zlN*yCvmoY3Oo!NsvBj}(#%_!~9(y(RPV8^7k7G4}poWS?(eZ$DzcVt;6F z5H~IEP~5q=dvP)Gz2hgxzZqW^Umm|Yerx>x_^S9*@t5MS$4A|dub0p~;n{@e68a_# zO&FPwoiI6JcEW;$x7=U60q?3BKNZ=+PiD(H*t)hHGGfZGq-@4CNz6-K46)Na>a z)PAcq=vL^q>c;Bl>A%x|uOAfgQRJb>&mx`Ci=#J3-;ItoBp8zM-!6MaoPWGF{*`#& zVtTTA`uZ)&y=WZ7II|oD%}DS2lrhV3LHTdp8|)YGlwXcxr}qE)O?52#fAZxwChR*J@Zm6w1 zSPoNtD$`fNbZFQ=bK)ymleA0hZ zcy{~`>F*poGw^Up!jF|FKY>zh<@R$>)X>)l2kmZh1756r;|4VJi3|$x4GYG9j^dKZ3%vgQH* E3kkQBZvX%Q diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb index 292442f3a88c23f7f170b088ce9861942ab1996d..5008263b22310a03e46f36026133deea88a58324 100644 GIT binary patch literal 34893 zcmds=2YeLO`u@+^S(4o(3#1WPq=nvL6A+Ssnt-A-MNlM)gb+%oCP4+2UIR!6DJs1P zNbexMcj-lX?;^d(|9fU1X)|YLCqYv>KgnO{VpWH5 z{<9p+w=>hA`L!qJoV_l3$JV5peS~O-tLi60WP$hh7UFYQ>5mM(Qwp&V|FmF?#y_>5 z`uCK77TBsU2{BBTu9uvUlwA6=7Oh&fh-)3+JfTgq(lKq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)du9;Bizb!Z!)JvtoD4?3XjunlxX zzYf;{ozU&!mY_5G3Y-bj(0+9po6+g$Qs_{SfnE(i3%a1~^_W-D@1kEv*8%ULcf*6g z`{;-8_n<4z}LVqbj~K! z7Z{Fy3620G&>z5WgOTWo@IWvMy$+raMx$@Q2f-M0!#5byz$fS}aBnac?f)j@26`Mi z3jGWikFE#T0u#`!;AUVV`a}3#FbO>t9ttL-m%wwt6!bQD9hi!~0v`j@&=2AJU^;rz zTg*RT26{2P0DOwx2CoG((Y$q390Rk^KJlDKpl72)(Rslf^lCT?%th~jw}N@-i|`5X z8QRp8xaj%l(&!+t09_r91`E+w;Wxk{^dtBISd7m9Hghsqg02jg0!z`&;M!mrx)a5i+rV#wRcPMVDc%RG(KBFP(J8(_H+hG1eDs&-6m%=_ z6}mUvRr%0U;E~`P^g4JESc5(Q?*(ho!<#eLqt~H7MNb3k(ci$!!3Oj(co*1+=B1Xr z>XLqi&e4MN7qA(<4lW74MIV6of-UGD;qzcC+Ao1~G4wWcS#&7aj;;yEfF0-u@LOOf zI%gv1L|_-X6dVS2qie&@f<5T=aAU9+-4pH(_MxMaXs77?=oitozyWju{02CP?hbbb zhtQMZ!Qe1@3A_*-K{sqk9??h9N$3{f7`i*04vwS8!GpmG^agk?_zryt-VaWqKS<_$ z8GQ;p1U(R(M$dyMgEQzY@E71L`X+n?oI`uH;+zzmM-PKTzycbx4>_L-_Xb5Bj6$WHhcvt^|V6DR2W2jQ$tg z734;TbYz}EhoDQMi-A1oT5vUx7o7;d4)USTj6U!o*cTp-(*nPY(+_?G`@<^;6ac3Z z$O_+tbHF_aoDW diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll index 10b5d98d5fad634730375b3da0c5a3c58207f3ab..ad3f04827de336f237615fbba44b7cd961f524e5 100755 GIT binary patch delta 13609 zcmZvi30#!b_y6yCU|>K{wwVEDhXDpuT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?Hh=&0m>UTJ~6ewLG*uwrH%+T9d7*)?U_r)*;rH zt$Eft)+N?rTdC8wz_!#@ZhObJ!S=rGTiY$$kG5ZJ4{b_J>zHR_l4DY1dd2jM84{Bj zlN*yCvmoY3Oo!NsvBj}(#%_!~9(y(RPV8^7k7G4}poWS?(eZ$DzcVt;6F z5H~IEP~5q=dvP)Gz2hgxzZqW^Umm|Yerx>x_^S9*@t5MS$4A|dub0p~;n{@e68a_# zO&FPwoiI6JcEW;$x7=U60q?3BKNZ=+PiD(H*t)hHGGfZGq-@4CNz6-K46)Na>a z)PAcq=vL^q>c;Bl>A%x|uOAfgQRJb>&mx`Ci=#J3-;ItoBp8zM-!6MaoPWGF{*`#& zVtTTA`uZ)&y=WZ7II|oD%}DS2lrhV3LHTdp8|)YGlwXcxr}qE)O?52#fAZxwChR*J@Zm6w1 zSPoNtD$`fNbZFQ=bK)ymleA0hZ zcy{~`>F*poGw^Up!jF|FKY>zh<@R$>)X>)l2kmZh1756r;|4VJi3|$x4GYG9j^dKZ3%vgQH* E3kkQBZvX%Q From d04d554e0a8f71256fbcf604ce42851ba4323b95 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 18 Jan 2016 11:45:13 +0800 Subject: [PATCH 02/23] update comment in csharp test --- .../csharp/SwaggerClientTest/TestApiClient.cs | 4 +++- .../bin/Debug/SwaggerClientTest.dll.mdb | Bin 34893 -> 34893 bytes 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs index af7c22ba0880..9d1921d8ea7c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs @@ -123,7 +123,7 @@ namespace SwaggerClientTest.TestApiClient PetApi p3 = new PetApi (c1); ApiClient a1 = new ApiClient(); - Configuration c2 = new Configuration (a1); // using default ApiClient + Configuration c2 = new Configuration (a1); // using "a1" as the ApiClient PetApi p4 = new PetApi (c2); @@ -131,9 +131,11 @@ namespace SwaggerClientTest.TestApiClient Assert.AreSame(p1.Configuration.ApiClient, p2.Configuration.ApiClient); Assert.AreSame(p1.Configuration.ApiClient, Configuration.Default.ApiClient); + // ensure both using the same default ApiClient Assert.AreSame(p3.Configuration.ApiClient, c1.ApiClient); Assert.AreSame(p3.Configuration.ApiClient, Configuration.Default.ApiClient); + // ensure it's not using the default ApiClient Assert.AreSame(p4.Configuration.ApiClient, c2.ApiClient); Assert.AreNotSame(p4.Configuration.ApiClient, Configuration.Default.ApiClient); diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb index 5008263b22310a03e46f36026133deea88a58324..9fd5b3c6f762ed5964c1fb0d75bf5f4fdd4c8a16 100644 GIT binary patch delta 50 zcmV-20L}l+kOIw+0 Date: Mon, 18 Jan 2016 21:27:29 +0800 Subject: [PATCH 03/23] update tostring to use sanitizeforserialization --- .../src/main/resources/php/ApiClient.mustache | 2 +- .../main/resources/php/ObjectSerializer.mustache | 16 ++++++++-------- .../src/main/resources/php/api.mustache | 4 ++-- .../src/main/resources/php/model.mustache | 4 ++-- .../php/SwaggerClient-php/lib/Api/PetApi.php | 16 ++++++++-------- .../php/SwaggerClient-php/lib/Api/StoreApi.php | 12 ++++++------ .../php/SwaggerClient-php/lib/Api/UserApi.php | 8 ++++---- .../php/SwaggerClient-php/lib/ApiClient.php | 2 +- .../php/SwaggerClient-php/lib/Model/Category.php | 4 ++-- .../php/SwaggerClient-php/lib/Model/Order.php | 4 ++-- .../php/SwaggerClient-php/lib/Model/Pet.php | 4 ++-- .../php/SwaggerClient-php/lib/Model/Tag.php | 4 ++-- .../php/SwaggerClient-php/lib/Model/User.php | 4 ++-- .../SwaggerClient-php/lib/ObjectSerializer.php | 16 ++++++++-------- .../php/SwaggerClient-php/tests/OrderApiTest.php | 9 +++------ 15 files changed, 53 insertions(+), 56 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache index defea63b1384..a0a0b8fcf594 100644 --- a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache @@ -150,7 +150,7 @@ class ApiClient if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) { $postData = http_build_query($postData); } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model - $postData = json_encode($this->serializer->sanitizeForSerialization($postData)); + $postData = json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($postData)); } $url = $this->config->getHost() . $resourcePath; diff --git a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache index 6cc2206b4551..263ade673a0d 100644 --- a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache @@ -46,13 +46,13 @@ class ObjectSerializer { /** - * Build a JSON POST object + * Serialize data * * @param mixed $data the data to serialize * * @return string serialized form of $data */ - public function sanitizeForSerialization($data) + public static function sanitizeForSerialization($data) { if (is_scalar($data) || null === $data) { $sanitized = $data; @@ -60,7 +60,7 @@ class ObjectSerializer $sanitized = $data->format(\DateTime::ISO8601); } elseif (is_array($data)) { foreach ($data as $property => $value) { - $data[$property] = $this->sanitizeForSerialization($value); + $data[$property] = self::sanitizeForSerialization($value); } $sanitized = $data; } elseif (is_object($data)) { @@ -68,7 +68,7 @@ class ObjectSerializer foreach (array_keys($data::$swaggerTypes) as $property) { $getter = $data::$getters[$property]; if ($data->$getter() !== null) { - $values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$getter()); + $values[$data::$attributeMap[$property]] = self::sanitizeForSerialization($data->$getter()); } } $sanitized = $values; @@ -220,7 +220,7 @@ class ObjectSerializer * * @return object an instance of $class */ - public function deserialize($data, $class, $httpHeaders=null) + public static function deserialize($data, $class, $httpHeaders=null) { if (null === $data) { $deserialized = null; @@ -231,14 +231,14 @@ class ObjectSerializer $subClass_array = explode(',', $inner, 2); $subClass = $subClass_array[1]; foreach ($data as $key => $value) { - $deserialized[$key] = $this->deserialize($value, $subClass); + $deserialized[$key] = self::deserialize($value, $subClass); } } } elseif (strcasecmp(substr($class, -2), '[]') == 0) { $subClass = substr($class, 0, -2); $values = array(); foreach ($data as $key => $value) { - $values[] = $this->deserialize($value, $subClass); + $values[] = self::deserialize($value, $subClass); } $deserialized = $values; } elseif ($class === 'ByteArray') { // byte array @@ -270,7 +270,7 @@ class ObjectSerializer $propertyValue = $data->{$instance::$attributeMap[$property]}; if (isset($propertyValue)) { - $instance->$propertySetter($this->deserialize($propertyValue, $type)); + $instance->$propertySetter(self::deserialize($propertyValue, $type)); } } $deserialized = $instance; diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 6d1a3d570f7c..d21301ee387c 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -223,14 +223,14 @@ use \{{invokerPackage}}\ObjectSerializer; return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, '{{returnType}}', $httpHeader), $statusCode, $httpHeader); + return array(\{{invokerPackage}}\ObjectSerializer::deserialize($response, '{{returnType}}', $httpHeader), $statusCode, $httpHeader); {{/returnType}}{{^returnType}} return array(null, $statusCode, $httpHeader); {{/returnType}} } catch (ApiException $e) { switch ($e->getCode()) { {{#responses}}{{#dataType}} {{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '{{dataType}}', $e->getResponseHeaders()); + $data = \{{invokerPackage}}\ObjectSerializer::deserialize($e->getResponseBody(), '{{dataType}}', $e->getResponseHeaders()); $e->setResponseObject($data); break;{{/dataType}}{{/responses}} } diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 5b486c7fa62b..75cf55bde0b0 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -176,9 +176,9 @@ class {{classname}} implements ArrayAccess public function __toString() { if (defined('JSON_PRETTY_PRINT')) { - return json_encode(get_object_vars($this), JSON_PRETTY_PRINT); + return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); } else { - return json_encode(get_object_vars($this)); + return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this)); } } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 66e8f34df094..ed06acb525e8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -341,12 +341,12 @@ class PetApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders()); $e->setResponseObject($data); break; } @@ -437,12 +437,12 @@ class PetApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders()); $e->setResponseObject($data); break; } @@ -539,12 +539,12 @@ class PetApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet', $e->getResponseHeaders()); $e->setResponseObject($data); break; } @@ -961,12 +961,12 @@ class PetApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, 'ByteArray', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'ByteArray', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'ByteArray', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'ByteArray', $e->getResponseHeaders()); $e->setResponseObject($data); break; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 2874d8f47aca..0f67fa63d157 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -165,12 +165,12 @@ class StoreApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'map[string,int]', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'map[string,int]', $e->getResponseHeaders()); $e->setResponseObject($data); break; } @@ -252,12 +252,12 @@ class StoreApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders()); $e->setResponseObject($data); break; } @@ -347,12 +347,12 @@ class StoreApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders()); $e->setResponseObject($data); break; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index b63b679aba12..595d82fffc1c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -407,12 +407,12 @@ class UserApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders()); $e->setResponseObject($data); break; } @@ -575,12 +575,12 @@ class UserApi return array(null, $statusCode, $httpHeader); } - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader); + return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\User', $e->getResponseHeaders()); + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\User', $e->getResponseHeaders()); $e->setResponseObject($data); break; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php index 310a0bdc7263..8313dc520043 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php @@ -150,7 +150,7 @@ class ApiClient if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) { $postData = http_build_query($postData); } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model - $postData = json_encode($this->serializer->sanitizeForSerialization($postData)); + $postData = json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($postData)); } $url = $this->config->getHost() . $resourcePath; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php index ae4d3e39db0a..723617198b5d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -198,9 +198,9 @@ class Category implements ArrayAccess public function __toString() { if (defined('JSON_PRETTY_PRINT')) { - return json_encode(get_object_vars($this), JSON_PRETTY_PRINT); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); } else { - return json_encode(get_object_vars($this)); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index c9f2629e31bc..f2540992e2df 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -329,9 +329,9 @@ class Order implements ArrayAccess public function __toString() { if (defined('JSON_PRETTY_PRINT')) { - return json_encode(get_object_vars($this), JSON_PRETTY_PRINT); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); } else { - return json_encode(get_object_vars($this)); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php index 543041b01150..aa8c6d67a8f5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -329,9 +329,9 @@ class Pet implements ArrayAccess public function __toString() { if (defined('JSON_PRETTY_PRINT')) { - return json_encode(get_object_vars($this), JSON_PRETTY_PRINT); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); } else { - return json_encode(get_object_vars($this)); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php index 91bfa6aece96..7288e39eff93 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -198,9 +198,9 @@ class Tag implements ArrayAccess public function __toString() { if (defined('JSON_PRETTY_PRINT')) { - return json_encode(get_object_vars($this), JSON_PRETTY_PRINT); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); } else { - return json_encode(get_object_vars($this)); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php index 8268f6da2b1e..7de225ec7442 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -390,9 +390,9 @@ class User implements ArrayAccess public function __toString() { if (defined('JSON_PRETTY_PRINT')) { - return json_encode(get_object_vars($this), JSON_PRETTY_PRINT); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); } else { - return json_encode(get_object_vars($this)); + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index 1a5a46d41283..9ee2f3c12174 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -46,13 +46,13 @@ class ObjectSerializer { /** - * Build a JSON POST object + * Serialize data * * @param mixed $data the data to serialize * * @return string serialized form of $data */ - public function sanitizeForSerialization($data) + public static function sanitizeForSerialization($data) { if (is_scalar($data) || null === $data) { $sanitized = $data; @@ -60,7 +60,7 @@ class ObjectSerializer $sanitized = $data->format(\DateTime::ISO8601); } elseif (is_array($data)) { foreach ($data as $property => $value) { - $data[$property] = $this->sanitizeForSerialization($value); + $data[$property] = self::sanitizeForSerialization($value); } $sanitized = $data; } elseif (is_object($data)) { @@ -68,7 +68,7 @@ class ObjectSerializer foreach (array_keys($data::$swaggerTypes) as $property) { $getter = $data::$getters[$property]; if ($data->$getter() !== null) { - $values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$getter()); + $values[$data::$attributeMap[$property]] = self::sanitizeForSerialization($data->$getter()); } } $sanitized = $values; @@ -220,7 +220,7 @@ class ObjectSerializer * * @return object an instance of $class */ - public function deserialize($data, $class, $httpHeaders=null) + public static function deserialize($data, $class, $httpHeaders=null) { if (null === $data) { $deserialized = null; @@ -231,14 +231,14 @@ class ObjectSerializer $subClass_array = explode(',', $inner, 2); $subClass = $subClass_array[1]; foreach ($data as $key => $value) { - $deserialized[$key] = $this->deserialize($value, $subClass); + $deserialized[$key] = self::deserialize($value, $subClass); } } } elseif (strcasecmp(substr($class, -2), '[]') == 0) { $subClass = substr($class, 0, -2); $values = array(); foreach ($data as $key => $value) { - $values[] = $this->deserialize($value, $subClass); + $values[] = self::deserialize($value, $subClass); } $deserialized = $values; } elseif ($class === 'ByteArray') { // byte array @@ -270,7 +270,7 @@ class ObjectSerializer $propertyValue = $data->{$instance::$attributeMap[$property]}; if (isset($propertyValue)) { - $instance->$propertySetter($this->deserialize($propertyValue, $type)); + $instance->$propertySetter(self::deserialize($propertyValue, $type)); } } $deserialized = $instance; diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/OrderApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/OrderApiTest.php index f92cc83c6930..51b82a695d68 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/OrderApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/OrderApiTest.php @@ -45,8 +45,7 @@ class OrderApiTest extends \PHPUnit_Framework_TestCase "complete": false } ORDER; - $serializer = new Swagger\Client\ObjectSerializer; - $order = $serializer->deserialize(json_decode($order_json), 'Swagger\Client\Model\Order'); + $order = \Swagger\Client\ObjectSerializer::deserialize(json_decode($order_json), 'Swagger\Client\Model\Order'); $this->assertInstanceOf('Swagger\Client\Model\Order', $order); $this->assertSame(10, $order->getId()); @@ -70,8 +69,7 @@ ORDER; "complete": false }]] ORDER; - $serializer = new Swagger\Client\ObjectSerializer; - $order = $serializer->deserialize(json_decode($order_json), 'Swagger\Client\Model\Order[][]'); + $order = \Swagger\Client\ObjectSerializer::deserialize(json_decode($order_json), 'Swagger\Client\Model\Order[][]'); $this->assertArrayHasKey(0, $order); $this->assertArrayHasKey(0, $order[0]); @@ -102,8 +100,7 @@ ORDER; } } ORDER; - $serializer = new Swagger\Client\ObjectSerializer; - $order = $serializer->deserialize(json_decode($order_json), 'map[string,map[string,\Swagger\Client\Model\Order]]'); + $order = \Swagger\Client\ObjectSerializer::deserialize(json_decode($order_json), 'map[string,map[string,\Swagger\Client\Model\Order]]'); $this->assertArrayHasKey('test', $order); $this->assertArrayHasKey('test2', $order['test']); From dcd2c00fe6c08ff88c70903c06e2780db917db04 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 18 Jan 2016 21:42:24 +0800 Subject: [PATCH 04/23] fix empty object serialization issue --- .../src/main/resources/php/ObjectSerializer.mustache | 2 +- .../php/SwaggerClient-php/lib/ObjectSerializer.php | 2 +- .../php/SwaggerClient-php/tests/PetApiTest.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache index 263ade673a0d..414e40650f6a 100644 --- a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache @@ -71,7 +71,7 @@ class ObjectSerializer $values[$data::$attributeMap[$property]] = self::sanitizeForSerialization($data->$getter()); } } - $sanitized = $values; + $sanitized = (object)$values; } else { $sanitized = (string)$data; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index 9ee2f3c12174..a4a1d061185f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -71,7 +71,7 @@ class ObjectSerializer $values[$data::$attributeMap[$property]] = self::sanitizeForSerialization($data->$getter()); } } - $sanitized = $values; + $sanitized = (object)$values; } else { $sanitized = (string)$data; } diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index dfc459712092..534b9d32c1aa 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -316,6 +316,16 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($json['tags'][0]['id'], $pet_id); $this->assertSame($json['tags'][0]['name'], 'test php tag'); } + + // test empty object serialization + public function testEmptyPetSerialization() + { + $new_pet = new Swagger\Client\Model\Pet; + // the empty object should be serialised to {} + $this->assertSame("{}", "$new_pet"); + + } + } ?> From 86587607e13788e42ad0df91554528c1340e108e Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 19 Jan 2016 00:51:21 +0800 Subject: [PATCH 05/23] add api test and model test files --- .../io/swagger/codegen/CodegenConfig.java | 16 +++++++ .../io/swagger/codegen/DefaultCodegen.java | 48 +++++++++++++++++++ .../io/swagger/codegen/DefaultGenerator.java | 45 +++++++++++++++++ .../codegen/languages/PhpClientCodegen.java | 19 ++++++++ 4 files changed, 128 insertions(+) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java index a74e652bb6d8..720f2f8aa676 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java @@ -19,10 +19,14 @@ public interface CodegenConfig { Map additionalProperties(); + String testPackage(); + String apiPackage(); String apiFileFolder(); + String apiTestFileFolder(); + String fileSuffix(); String outputFolder(); @@ -33,6 +37,8 @@ public interface CodegenConfig { String modelFileFolder(); + String modelTestFileFolder(); + String modelPackage(); String toApiName(String name); @@ -87,6 +93,10 @@ public interface CodegenConfig { Map modelTemplateFiles(); + Map apiTestTemplateFiles(); + + Map modelTestTemplateFiles(); + Set languageSpecificPrimitives(); void preprocessSwagger(Swagger swagger); @@ -97,6 +107,10 @@ public interface CodegenConfig { String toModelFilename(String name); + String toApiTestFilename(String name); + + String toModelTestFilename(String name); + String toModelImport(String name); String toApiImport(String name); @@ -115,6 +129,8 @@ public interface CodegenConfig { String apiFilename(String templateName, String tag); + String apiTestFilename(String templateName, String tag); + boolean shouldOverwrite(String filename); boolean isSkipOverwrite(); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index abc4d045315e..5b2c45166ac1 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -63,8 +63,11 @@ public class DefaultCodegen { protected Set languageSpecificPrimitives = new HashSet(); protected Map importMapping = new HashMap(); protected String modelPackage = "", apiPackage = "", fileSuffix; + protected String testPackage = ""; protected Map apiTemplateFiles = new HashMap(); protected Map modelTemplateFiles = new HashMap(); + protected Map apiTestTemplateFiles = new HashMap(); + protected Map modelTestTemplateFiles = new HashMap(); protected String templateDir; protected String embeddedTemplateDir; protected Map additionalProperties = new HashMap(); @@ -170,6 +173,10 @@ public class DefaultCodegen { return importMapping; } + public String testPackage() { + return testPackage; + } + public String modelPackage() { return modelPackage; } @@ -194,6 +201,14 @@ public class DefaultCodegen { } } + public Map apiTestTemplateFiles() { + return apiTestTemplateFiles; + } + + public Map modelTestTemplateFiles() { + return modelTestTemplateFiles; + } + public Map apiTemplateFiles() { return apiTemplateFiles; } @@ -210,6 +225,14 @@ public class DefaultCodegen { return outputFolder + "/" + modelPackage().replace('.', '/'); } + public String apiTestFileFolder() { + return outputFolder + "/" + testPackage().replace('.', '/'); + } + + public String modelTestFileFolder() { + return outputFolder + "/" + testPackage().replace('.', '/'); + } + public Map additionalProperties() { return additionalProperties; } @@ -260,6 +283,16 @@ public class DefaultCodegen { return toApiName(name); } + /** + * Return the file name of the Api + * + * @param name the file name of the Api + * @return the file name of the Api + */ + public String toApiTestFilename(String name) { + return toApiName(name) + "Test"; + } + /** * Return the variable name in the Api * @@ -280,6 +313,16 @@ public class DefaultCodegen { return initialCaps(name); } + /** + * Return the capitalized file name of the model + * + * @param name the model name + * @return the file name of the model + */ + public String toModelTestFilename(String name) { + return initialCaps(name) + "Test"; + } + /** * Return the operation ID (method name) * @@ -2028,6 +2071,11 @@ public class DefaultCodegen { return apiFileFolder() + '/' + toApiFilename(tag) + suffix; } + public String apiTestFilename(String templateName, String tag) { + String suffix = apiTestTemplateFiles().get(templateName); + return apiTestFileFolder() + '/' + toApiTestFilename(tag) + suffix; + } + public boolean shouldOverwrite(String filename) { return !(skipOverwrite && new File(filename).exists()); } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index 79b07f2427bd..00878ff52360 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -211,6 +211,28 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { writeToFile(filename, tmpl.execute(models)); files.add(new File(filename)); } + + // to generate model test files + for (String templateName : config.modelTestTemplateFiles().keySet()) { + String suffix = config.modelTestTemplateFiles().get(templateName); + String filename = config.modelTestFileFolder() + File.separator + config.toModelTestFilename(name) + suffix; + if (!config.shouldOverwrite(filename)) { + continue; + } + String templateFile = getFullTemplateFile(config, templateName); + String template = readTemplate(templateFile); + Template tmpl = Mustache.compiler() + .withLoader(new Mustache.TemplateLoader() { + @Override + public Reader getTemplate(String name) { + return getTemplateReader(getFullTemplateFile(config, name + ".mustache")); + } + }) + .defaultValue("") + .compile(template); + writeToFile(filename, tmpl.execute(models)); + files.add(new File(filename)); + } } catch (Exception e) { throw new RuntimeException("Could not generate model '" + name + "'", e); } @@ -288,6 +310,29 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { writeToFile(filename, tmpl.execute(operation)); files.add(new File(filename)); } + + for (String templateName : config.apiTestTemplateFiles().keySet()) { + String filename = config.apiTestFilename(templateName, tag); + if (!config.shouldOverwrite(filename) && new File(filename).exists()) { + continue; + } + + String templateFile = getFullTemplateFile(config, templateName); + String template = readTemplate(templateFile); + Template tmpl = Mustache.compiler() + .withLoader(new Mustache.TemplateLoader() { + @Override + public Reader getTemplate(String name) { + return getTemplateReader(getFullTemplateFile(config, name + ".mustache")); + } + }) + .defaultValue("") + .compile(template); + + writeToFile(filename, tmpl.execute(operation)); + files.add(new File(filename)); + } + } catch (Exception e) { throw new RuntimeException("Could not generate api file for '" + tag + "'", e); } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index 12e6b3ea8ed9..fa5451372c5d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -41,9 +41,12 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { outputFolder = "generated-code" + File.separator + "php"; modelTemplateFiles.put("model.mustache", ".php"); apiTemplateFiles.put("api.mustache", ".php"); + modelTestTemplateFiles.put("model_test.mustache", ".php"); + apiTestTemplateFiles.put("api_test.mustache", ".php"); embeddedTemplateDir = templateDir = "php"; apiPackage = invokerPackage + "\\Api"; modelPackage = invokerPackage + "\\Model"; + testPackage = invokerPackage + "\\Tests"; reservedWords = new HashSet( Arrays.asList( @@ -236,6 +239,16 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { return (outputFolder + "/" + toPackagePath(modelPackage, srcBasePath)); } + @Override + public String apiTestFileFolder() { + return (outputFolder + "/" + toPackagePath(testPackage, srcBasePath)); + } + + @Override + public String modelTestFileFolder() { + return (outputFolder + "/" + toPackagePath(testPackage, srcBasePath)); + } + @Override public String getTypeDeclaration(Property p) { if (p instanceof ArrayProperty) { @@ -364,6 +377,12 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { return toModelName(name); } + @Override + public String toModelTestFilename(String name) { + // should be the same as the model name + return toModelName(name) + "Test"; + } + @Override public String toOperationId(String operationId) { // throw exception if method name is empty From 731fd4be3301fc648b17d36f98cca0dc2c8c0545 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 19 Jan 2016 10:40:43 +0800 Subject: [PATCH 06/23] fix typo --- .../src/main/resources/csharp/ApiClient.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache index 3b83a33c8894..4fabfa4667ba 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache @@ -61,7 +61,7 @@ namespace {{packageName}}.Client /// Gets or sets the default API client for making HTTP calls. /// /// The default API client. - [Obsolete("ApiClient.Default is deprecated, please use 'Configuraiton.Default.ApiClient' instead.")] + [Obsolete("ApiClient.Default is deprecated, please use 'Configuration.Default.ApiClient' instead.")] public static ApiClient Default; /// From 3269a84632813a28cd294848c4a693cbf4d07e65 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 19 Jan 2016 10:42:17 +0800 Subject: [PATCH 07/23] fix typo Configuraiton --- .../src/main/csharp/IO/Swagger/Client/ApiClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs index 70b17804f65d..9ff8b481e144 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs @@ -61,7 +61,7 @@ namespace IO.Swagger.Client /// Gets or sets the default API client for making HTTP calls. /// /// The default API client. - [Obsolete("ApiClient.Default is deprecated, please use 'Configuraiton.Default.ApiClient' instead.")] + [Obsolete("ApiClient.Default is deprecated, please use 'Configuration.Default.ApiClient' instead.")] public static ApiClient Default; /// From 8927c1dc0f7be50d43e29c5c1e2ed192a5cabc71 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 19 Jan 2016 14:49:32 +0800 Subject: [PATCH 08/23] add test template for php --- .../src/main/resources/php/api_test.mustache | 79 ++++++++ .../main/resources/php/model_test.mustache | 74 ++++++++ .../lib/Tests/CategoryTest.php | 70 +++++++ .../SwaggerClient-php/lib/Tests/OrderTest.php | 70 +++++++ .../lib/Tests/PetApiTest.php | 178 ++++++++++++++++++ .../SwaggerClient-php/lib/Tests/PetTest.php | 70 +++++++ .../lib/Tests/StoreApiTest.php | 112 +++++++++++ .../SwaggerClient-php/lib/Tests/TagTest.php | 70 +++++++ .../lib/Tests/UserApiTest.php | 156 +++++++++++++++ .../SwaggerClient-php/lib/Tests/UserTest.php | 70 +++++++ 10 files changed, 949 insertions(+) create mode 100644 modules/swagger-codegen/src/main/resources/php/api_test.mustache create mode 100644 modules/swagger-codegen/src/main/resources/php/model_test.mustache create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/CategoryTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/OrderTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/TagTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserTest.php diff --git a/modules/swagger-codegen/src/main/resources/php/api_test.mustache b/modules/swagger-codegen/src/main/resources/php/api_test.mustache new file mode 100644 index 000000000000..ee26ec31ff21 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/php/api_test.mustache @@ -0,0 +1,79 @@ + Date: Tue, 19 Jan 2016 19:50:27 +0800 Subject: [PATCH 09/23] add comments --- .../main/java/io/swagger/codegen/DefaultCodegen.java | 12 ++++++++++-- .../java/io/swagger/codegen/DefaultGenerator.java | 1 + .../php/SwaggerClient-php/lib/Tests/PetApiTest.php | 10 ---------- .../php/SwaggerClient-php/lib/Tests/StoreApiTest.php | 4 ---- .../php/SwaggerClient-php/lib/Tests/UserApiTest.php | 8 -------- 5 files changed, 11 insertions(+), 24 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 5b2c45166ac1..f9bd468a25b8 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -284,7 +284,7 @@ public class DefaultCodegen { } /** - * Return the file name of the Api + * Return the file name of the Api Test * * @param name the file name of the Api * @return the file name of the Api @@ -314,7 +314,7 @@ public class DefaultCodegen { } /** - * Return the capitalized file name of the model + * Return the capitalized file name of the model test * * @param name the model name * @return the file name of the model @@ -2071,6 +2071,14 @@ public class DefaultCodegen { return apiFileFolder() + '/' + toApiFilename(tag) + suffix; } + /** + * Return the full path and API test file + * + * @param templateName template name + * @param tag tag + * + * @return the API test file name with full path + */ public String apiTestFilename(String templateName, String tag) { String suffix = apiTestTemplateFiles().get(templateName); return apiTestFileFolder() + '/' + toApiTestFilename(tag) + suffix; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index 00878ff52360..c08babd96c0a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -311,6 +311,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { files.add(new File(filename)); } + // to generate api test files for (String templateName : config.apiTestTemplateFiles().keySet()) { String filename = config.apiTestFilename(templateName, tag); if (!config.shouldOverwrite(filename) && new File(filename).exists()) { diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php index 75928df30d30..3df47d97be13 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php @@ -72,7 +72,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_updatePet() { - //$body = null } @@ -83,7 +82,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_addPet() { - //$body = null } @@ -94,7 +92,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_findPetsByStatus() { - //$status = null } @@ -105,7 +102,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_findPetsByTags() { - //$tags = null } @@ -116,7 +112,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_getPetById() { - //$pet_id } @@ -127,7 +122,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_updatePetWithForm() { - //$pet_id, $name = null, $status = null } @@ -138,7 +132,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_deletePet() { - //$pet_id, $api_key = null } @@ -149,7 +142,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_uploadFile() { - //$pet_id, $additional_metadata = null, $file = null } @@ -160,7 +152,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_getPetByIdWithByteArray() { - //$pet_id } @@ -171,7 +162,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase * */ public function test_addPetUsingByteArray() { - //$body = null } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php index 14cb5a682908..899f5791c8ad 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php @@ -72,7 +72,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase * */ public function test_getInventory() { - // } @@ -83,7 +82,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase * */ public function test_placeOrder() { - //$body = null } @@ -94,7 +92,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase * */ public function test_getOrderById() { - //$order_id } @@ -105,7 +102,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase * */ public function test_deleteOrder() { - //$order_id } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php index f69ccf8ef7ba..500b99c4c4ff 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php @@ -72,7 +72,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase * */ public function test_createUser() { - //$body = null } @@ -83,7 +82,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase * */ public function test_createUsersWithArrayInput() { - //$body = null } @@ -94,7 +92,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase * */ public function test_createUsersWithListInput() { - //$body = null } @@ -105,7 +102,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase * */ public function test_loginUser() { - //$username = null, $password = null } @@ -116,7 +112,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase * */ public function test_logoutUser() { - // } @@ -127,7 +122,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase * */ public function test_getUserByName() { - //$username } @@ -138,7 +132,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase * */ public function test_updateUser() { - //$username, $body = null } @@ -149,7 +142,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase * */ public function test_deleteUser() { - //$username } From 14630c763289cd1d09cd880ec6904f23849f0fcf Mon Sep 17 00:00:00 2001 From: xhh Date: Tue, 19 Jan 2016 10:46:20 +0800 Subject: [PATCH 10/23] Make JavaScript client work in both Node.js and browser * Replace jQuery with SuperAgent which works in both Node.js and browser * Use UMD pattern (returnExports.js) to make the module exporting compatible with all major systems: AMD, Node.js (CommonJS) and browser * Implement support of header and form parameters. Closes #1736 * Move HTTP requesting code to `ApiClient` and allow customizing options in it, e.g. "basePath" * Update unit tests accordingly and add some tests for `ApiClient` --- .../languages/JavascriptClientCodegen.java | 3 + .../resources/Javascript/ApiClient.mustache | 146 ++ .../main/resources/Javascript/api.mustache | 201 +-- .../main/resources/Javascript/index.mustache | 27 +- .../main/resources/Javascript/model.mustache | 144 +- .../resources/Javascript/package.mustache | 7 +- .../client/petstore/javascript/package.json | 7 +- .../petstore/javascript/src/ApiClient.js | 146 ++ .../petstore/javascript/src/api/PetApi.js | 895 +++++------ .../petstore/javascript/src/api/StoreApi.js | 442 +++--- .../petstore/javascript/src/api/UserApi.js | 775 ++++----- .../client/petstore/javascript/src/index.js | 45 +- .../petstore/javascript/src/model/Category.js | 150 +- .../petstore/javascript/src/model/Order.js | 312 ++-- .../petstore/javascript/src/model/Pet.js | 320 ++-- .../petstore/javascript/src/model/Tag.js | 150 +- .../petstore/javascript/src/model/User.js | 390 ++--- .../petstore/javascript/test/ApiClientTest.js | 69 + .../javascript/test/api/PetApiTest.js | 28 +- .../client/petstore/javascript/test/helper.js | 19 - .../petstore/javascript/test/run_tests.html | 9 +- .../petstore/javascript/test/superagent.js | 1396 +++++++++++++++++ 22 files changed, 3575 insertions(+), 2106 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache create mode 100644 samples/client/petstore/javascript/src/ApiClient.js create mode 100644 samples/client/petstore/javascript/test/ApiClientTest.js delete mode 100644 samples/client/petstore/javascript/test/helper.js create mode 100644 samples/client/petstore/javascript/test/superagent.js diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java index ac680d594632..9f76abed151b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java @@ -133,6 +133,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo typeMapping.put("double", "Number"); typeMapping.put("number", "Number"); typeMapping.put("DateTime", "Date"); + // binary not supported in JavaScript client right now, using Object as a workaround + typeMapping.put("binary", "Object"); importMapping.clear(); } @@ -205,6 +207,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo supportingFiles.add(new SupportingFile("package.mustache", "", "package.json")); supportingFiles.add(new SupportingFile("index.mustache", sourceFolder, "index.js")); + supportingFiles.add(new SupportingFile("ApiClient.mustache", sourceFolder, "ApiClient.js")); } @Override diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache new file mode 100644 index 000000000000..2f85250694d9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache @@ -0,0 +1,146 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['superagent'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('superagent')); + } else { + // Browser globals (root is window) + if (!root.{{moduleName}}) { + root.{{moduleName}} = {}; + } + root.{{moduleName}}.ApiClient = factory(root.superagent); + } +}(this, function(superagent) { + 'use strict'; + + var ApiClient = function ApiClient() { + this.basePath = '{{basePath}}'.replace(/\/+$/, ''); + }; + + ApiClient.prototype.paramToString = function paramToString(param) { + if (param == null) { + // return empty string for null and undefined + return ''; + } else { + return param.toString(); + } + }; + + /** + * Build full URL by appending the given path to base path and replacing + * path parameter placeholders with parameter values. + * NOTE: query parameters are not handled here. + */ + ApiClient.prototype.buildUrl = function buildUrl(path, pathParams) { + if (!path.match(/^\//)) { + path = '/' + path; + } + var url = this.basePath + path; + var _this = this; + url = url.replace(/\{([\w-]+)\}/g, function(fullMatch, key) { + var value; + if (pathParams.hasOwnProperty(key)) { + value = _this.paramToString(pathParams[key]); + } else { + value = fullMatch; + } + return encodeURIComponent(value); + }); + return url; + }; + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + */ + ApiClient.prototype.isJsonMime = function isJsonMime(mime) { + return Boolean(mime != null && mime.match(/^application\/json(;.*)?$/i)); + }; + + /** + * Choose a MIME from the given MIMEs with JSON preferred, + * i.e. return JSON if included, otherwise return the first one. + */ + ApiClient.prototype.jsonPreferredMime = function jsonPreferredMime(mimes) { + var len = mimes.length; + for (var i = 0; i < len; i++) { + if (this.isJsonMime(mimes[i])) { + return mimes[i]; + } + } + return mimes[0]; + }; + + /** + * Normalize parameters values: + * remove nils, + * keep files and arrays, + * format to string with `paramToString` for other cases. + */ + ApiClient.prototype.normalizeParams = function normalizeParams(params) { + var newParams = {}; + for (var key in params) { + if (params.hasOwnProperty(key) && params[key] != null) { + var value = params[key]; + if (value instanceof Blob || Array.isArray(value)) { + newParams[key] = value; + } else { + newParams[key] = this.paramToString(value); + } + } + } + return newParams; + }; + + ApiClient.prototype.callApi = function callApi(path, httpMethod, pathParams, + queryParams, headerParams, formParams, bodyParam, contentTypes, accepts, + callback) { + var url = this.buildUrl(path, pathParams); + var request = superagent(httpMethod, url); + + // set query parameters + request.query(this.normalizeParams(queryParams)); + + // set header parameters + request.set(this.normalizeParams(headerParams)); + + var contentType = this.jsonPreferredMime(contentTypes) || 'application/json'; + request.type(contentType); + + if (contentType === 'application/x-www-form-urlencoded') { + request.send(this.normalizeParams(formParams)); + } else if (contentType == 'multipart/form-data') { + var _formParams = this.normalizeParams(formParams); + for (var key in _formParams) { + if (_formParams.hasOwnProperty(key)) { + if (_formParams[key] instanceof Blob) { + // file field + request.attach(key, _formParams[key]); + } else { + request.field(key, _formParams[key]); + } + } + } + } else if (bodyParam) { + request.send(bodyParam); + } + + request.end(function(error, response) { + if (callback) { + var data = response && response.body; + callback(error, data, response); + } + }); + + return request; + }; + + ApiClient.default = new ApiClient(); + + return ApiClient; +})); diff --git a/modules/swagger-codegen/src/main/resources/Javascript/api.mustache b/modules/swagger-codegen/src/main/resources/Javascript/api.mustache index 9957fc4e2c51..a61e49125960 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/api.mustache @@ -1,125 +1,86 @@ -// require files in Node.js environment -var ${{#imports}}, {{import}}{{/imports}}; -if (typeof module === 'object' && module.exports) { - $ = require('jquery');{{#imports}} - {{import}} = require('../model/{{import}}.js');{{/imports}} -} - -// export module for AMD -if ( typeof define === "function" && define.amd ) { - define(['jquery'{{#imports}}, '{{import}}'{{/imports}}], function(${{#imports}}, {{import}}{{/imports}}) { - return {{classname}}; - }); -} - -var {{classname}} = function {{classname}}() { - var self = this; - {{#operations}} - {{#operation}} - /** - * {{summary}} - * {{notes}} -{{#allParams}} * @param {{=<% %>=}}{<% dataType %>} <%={{ }}=%> {{paramName}} {{description}} -{{/allParams}} * @param {function} callback the callback function - * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} - */ - self.{{nickname}} = function({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}callback) { - var {{localVariablePrefix}}postBody = {{#bodyParam}}{{^isBinary}}JSON.stringify({{paramName}}){{/isBinary}}{{#isBinary}}null{{/isBinary}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - var {{localVariablePrefix}}postBinaryBody = {{#bodyParam}}{{#isBinary}}{{paramName}}{{/isBinary}}{{^isBinary}}null{{/isBinary}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{paramName}} == null) { - //throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{nickname}}"); - var errorRequiredMsg = "Missing the required parameter '{{paramName}}' when calling {{nickname}}"; - throw errorRequiredMsg; - } - {{/required}}{{/allParams}} - // create path and map variables - var basePath = '{{basePath}}'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient'{{#imports}}, '../model/{{import}}'{{/imports}}], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient.js'){{#imports}}, require('../model/{{import}}.js'){{/imports}}); + } else { + // Browser globals (root is window) + if (!root.{{moduleName}}) { + root.{{moduleName}} = {}; } - - var {{localVariablePrefix}}path = basePath + replaceAll(replaceAll("{{{path}}}", "\\{format\\}","json"){{#pathParams}} -, "\\{" + "{{baseName}}" + "\\}", encodeURIComponent({{{paramName}}}.toString()){{/pathParams}}); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - {{#queryParams}} - queryParams.{{baseName}} = {{paramName}}; - {{/queryParams}} - {{#headerParams}}if ({{paramName}} != null) - {{localVariablePrefix}}headerParams.put("{{baseName}}", {{paramName}}); - {{/headerParams}} - {{#formParams}}if ({{paramName}} != null) - {{localVariablePrefix}}formParams.put("{{baseName}}", {{paramName}}); - {{/formParams}} - - path += createQueryString(queryParams); - - var options = {type: "{{httpMethod}}", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ - {{#returnType}} - /** - * @returns {{{returnType}}} - */ - {{#returnTypeIsPrimitive}}var myResponse = response;{{/returnTypeIsPrimitive}} - {{^returnTypeIsPrimitive}}var myResponse = new {{{returnType}}}(); - myResponse.constructFromObject(response);{{/returnTypeIsPrimitive}} - if (callback) { - callback(myResponse, textStatus, jqXHR); - } - {{/returnType}}{{^returnType}} - if (callback) { - callback(response, textStatus, jqXHR); - } - {{/returnType}} - }); - - return request; + root.{{moduleName}}.{{classname}} = factory(root.{{moduleName}}.ApiClient{{#imports}}, root.{{moduleName}}.{{import}}{{/imports}}); } - {{/operation}} - {{/operations}} +}(this, function(ApiClient{{#imports}}, {{import}}{{/imports}}) { + 'use strict'; - function replaceAll (haystack, needle, replace) { - var result= haystack; - if (needle !=null && replace!=null) { - result= haystack.replace(new RegExp(needle, 'g'), replace); - } - return result; - } + var {{classname}} = function {{classname}}(apiClient) { + this.apiClient = apiClient || ApiClient.default; - function createQueryString (queryParams) { - var queryString =''; - var i = 0; - for (var queryParamName in queryParams) { - if (i==0) { - queryString += '?' ; - } else { - queryString += '&' ; - } - - queryString += queryParamName + '=' + encodeURIComponent(queryParams[queryParamName]); - i++; - } - - return queryString; - } -} + var self = this; + {{#operations}} + {{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} * @param {{=<% %>=}}{<% dataType %>} <%={{ }}=%> {{paramName}} {{description}} + {{/allParams}} * @param {function} callback the callback function, accepting three arguments: error, data, response{{#returnType}} + * data is of type: {{{returnType}}}{{/returnType}} + */ + self.{{nickname}} = function({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}callback) { + var postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw "Missing the required parameter '{{paramName}}' when calling {{nickname}}"; + } + {{/required}}{{/allParams}} -// export module for Node.js -if (typeof module === 'object' && module.exports) { - module.exports = {{classname}}; -} + {{=< >=}} + var pathParams = {<#pathParams> + '': <#hasMore>, + }; + var queryParams = {<#queryParams> + '': <#hasMore>, + }; + var headerParams = {<#headerParams> + '': <#hasMore>, + }; + var formParams = {<#formParams> + '': <#hasMore>, + }; + + var contentTypes = [<#consumes>''<#hasMore>, ]; + var accepts = [<#produces>''<#hasMore>, ]; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) {<#returnType><#returnTypeIsPrimitive> + callback(error, data, response);<^returnTypeIsPrimitive><#isListContainer> + // TODO: support deserializing array of models + callback(error, data, response);<^isListContainer> + if (!error && data) { + var result = new <&returnType>(); + result.constructFromObject(data); + callback(error, result, response); + } else { + callback(error, data, response); + }<^returnType> + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '<&path>', '', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + <={{ }}=> + } + {{/operation}} + {{/operations}} + }; + + return {{classname}}; +})); diff --git a/modules/swagger-codegen/src/main/resources/Javascript/index.mustache b/modules/swagger-codegen/src/main/resources/Javascript/index.mustache index a0207a6cc916..7bb0329fa01f 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/index.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/index.mustache @@ -1,10 +1,17 @@ -if (typeof module === 'object' && module.exports) { - var {{moduleName}} = {}; - {{#models}} - {{moduleName}}.{{importPath}} = require('./model/{{importPath}}.js'); - {{/models}} - {{#apiInfo}}{{#apis}} - {{moduleName}}.{{importPath}} = require('./api/{{importPath}}.js'); - {{/apis}}{{/apiInfo}} - module.exports = {{moduleName}}; -} \ No newline at end of file +(function(factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['./ApiClient'{{#models}}, './model/{{importPath}}'{{/models}}{{#apiInfo}}{{#apis}}, './api/{{importPath}}'{{/apis}}{{/apiInfo}}], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('./ApiClient.js'){{#models}}, require('./model/{{importPath}}.js'){{/models}}{{#apiInfo}}{{#apis}}, require('./api/{{importPath}}.js'){{/apis}}{{/apiInfo}}); + } +}(function(ApiClient{{#models}}, {{importPath}}{{/models}}{{#apiInfo}}{{#apis}}, {{importPath}}{{/apis}}{{/apiInfo}}) { + 'use strict'; + + return { + ApiClient: ApiClient{{#models}}, + {{importPath}}: {{importPath}}{{/models}}{{#apiInfo}}{{#apis}}, + {{importPath}}: {{importPath}}{{/apis}}{{/apiInfo}} + }; +})); diff --git a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache index 0588d03a8c13..9f265c89cf70 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache @@ -1,75 +1,79 @@ -// require files in Node.js environment -{{#imports}} -var {{import}};{{/imports}} -if (typeof module === 'object' && module.exports) { - {{#imports}} - {{import}} = require('./{{import}}.js');{{/imports}} -} - -{{#models}}{{#model}} -{{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} -{{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}} - -//export module -if ( typeof define === "function" && define.amd ) { - define('{{classname}}', ['jquery'{{#vars}}{{^isPrimitiveType}}{{^-last}}, {{/-last}}'{{datatypeWithEnum}}'{{/isPrimitiveType}}{{/vars}}], - function(${{#vars}}{{^isPrimitiveType}}{{^-last}}, {{/-last}}{{datatypeWithEnum}}{{/isPrimitiveType}}{{/vars}}) { - return {{classname}}; - }); -} - -{{#description}}/** - * {{description}} - **/{{/description}} -var {{classname}} = function {{classname}}({{#mandatory}}{{this}}{{^-last}}, {{/-last}}{{/mandatory}}) { {{#parent}}/* extends {{{parent}}}*/{{/parent}} - var self = this; - {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}} - * datatype: {{{datatypeWithEnum}}}{{#required}} - * required{{/required}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} - **/ - self.{{name}} = {{#required}}{{name}}{{/required}}{{^required}}{{{defaultValue}}}{{/required}}; - {{/vars}} - - self.constructFromObject = function(data) { - if (!data) { - return; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([undefined{{#imports}}, './{{import}}'{{/imports}}], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(undefined{{#imports}}, require('./{{import}}.js'){{/imports}}); + } else { + // Browser globals (root is window) + if (!root.{{moduleName}}) { + root.{{moduleName}} = {}; } + factory(root.{{moduleName}}{{#imports}}, root.{{moduleName}}.{{import}}{{/imports}}); + } +}(this, function(module{{#imports}}, {{import}}{{/imports}}) { + 'use strict'; + + {{#models}}{{#model}} + {{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} + {{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}} + + {{#description}}/** + * {{description}} + **/{{/description}} + var {{classname}} = function {{classname}}({{#mandatory}}{{this}}{{^-last}}, {{/-last}}{{/mandatory}}) { {{#parent}}/* extends {{{parent}}}*/{{/parent}} + var self = this; {{#vars}} - self.{{name}}{{{defaultValueWithParam}}} + /**{{#description}} + * {{{description}}}{{/description}} + * datatype: {{{datatypeWithEnum}}}{{#required}} + * required{{/required}}{{#minimum}} + * minimum: {{minimum}}{{/minimum}}{{#maximum}} + * maximum: {{maximum}}{{/maximum}} + **/ + self.{{name}} = {{#required}}{{name}}{{/required}}{{^required}}{{{defaultValue}}}{{/required}}; {{/vars}} + + self.constructFromObject = function(data) { + if (!data) { + return; + } + {{#vars}} + self.{{name}}{{{defaultValueWithParam}}} + {{/vars}} + } + + {{#vars}} + /**{{#description}} + * get {{{description}}}{{/description}}{{#minimum}} + * minimum: {{minimum}}{{/minimum}}{{#maximum}} + * maximum: {{maximum}}{{/maximum}} + * @return {{=<% %>=}}{<% datatypeWithEnum %>}<%={{ }}=%> + **/ + self.{{getter}} = function() { + return self.{{name}}; + } + + /**{{#description}} + * set {{{description}}}{{/description}} + * @param {{=<% %>=}}{<% datatypeWithEnum %>}<%={{ }}=%> {{name}} + **/ + self.{{setter}} = function ({{name}}) { + self.{{name}} = {{name}}; + } + {{/vars}} + + self.toJson = function () { + return JSON.stringify(self); + } + }; + + if (module) { + module.{{classname}} = {{classname}}; } - {{#vars}} - /**{{#description}} - * get {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} - * @return {{=<% %>=}}{<% datatypeWithEnum %>}<%={{ }}=%> - **/ - self.{{getter}} = function() { - return self.{{name}}; - } - - /**{{#description}} - * set {{{description}}}{{/description}} - * @param {{=<% %>=}}{<% datatypeWithEnum %>}<%={{ }}=%> {{name}} - **/ - self.{{setter}} = function ({{name}}) { - self.{{name}} = {{name}}; - } - {{/vars}} - - self.toJson = function () { - return JSON.stringify(self); - } -} - -if (typeof module === 'object' && module.exports) { - module.exports = {{classname}}; -} -{{/model}} -{{/models}} + return {{classname}}; + {{/model}} + {{/models}} +})); diff --git a/modules/swagger-codegen/src/main/resources/Javascript/package.mustache b/modules/swagger-codegen/src/main/resources/Javascript/package.mustache index c77ee835709e..1e7650a1ba19 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/package.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/package.mustache @@ -8,13 +8,10 @@ "test": "./node_modules/mocha/bin/mocha --recursive" }, "dependencies": { - "jquery": "~2.1.4" + "superagent": "^1.6.1" }, "devDependencies": { "mocha": "~2.3.4", - "expect.js": "~0.3.1", - "mockrequire": "~0.0.5", - "domino": "~1.0.20", - "xmlhttprequest": "~1.8.0" + "expect.js": "~0.3.1" } } diff --git a/samples/client/petstore/javascript/package.json b/samples/client/petstore/javascript/package.json index 6810fd633de5..fe470da8b271 100644 --- a/samples/client/petstore/javascript/package.json +++ b/samples/client/petstore/javascript/package.json @@ -8,13 +8,10 @@ "test": "./node_modules/mocha/bin/mocha --recursive" }, "dependencies": { - "jquery": "~2.1.4" + "superagent": "^1.6.1" }, "devDependencies": { "mocha": "~2.3.4", - "expect.js": "~0.3.1", - "mockrequire": "~0.0.5", - "domino": "~1.0.20", - "xmlhttprequest": "~1.8.0" + "expect.js": "~0.3.1" } } diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js new file mode 100644 index 000000000000..8138225e2b20 --- /dev/null +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -0,0 +1,146 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['superagent'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('superagent')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.ApiClient = factory(root.superagent); + } +}(this, function(superagent) { + 'use strict'; + + var ApiClient = function ApiClient() { + this.basePath = 'http://petstore.swagger.io/v2'.replace(/\/+$/, ''); + }; + + ApiClient.prototype.paramToString = function paramToString(param) { + if (param == null) { + // return empty string for null and undefined + return ''; + } else { + return param.toString(); + } + }; + + /** + * Build full URL by appending the given path to base path and replacing + * path parameter placeholders with parameter values. + * NOTE: query parameters are not handled here. + */ + ApiClient.prototype.buildUrl = function buildUrl(path, pathParams) { + if (!path.match(/^\//)) { + path = '/' + path; + } + var url = this.basePath + path; + var _this = this; + url = url.replace(/\{([\w-]+)\}/g, function(fullMatch, key) { + var value; + if (pathParams.hasOwnProperty(key)) { + value = _this.paramToString(pathParams[key]); + } else { + value = fullMatch; + } + return encodeURIComponent(value); + }); + return url; + }; + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + */ + ApiClient.prototype.isJsonMime = function isJsonMime(mime) { + return Boolean(mime != null && mime.match(/^application\/json(;.*)?$/i)); + }; + + /** + * Choose a MIME from the given MIMEs with JSON preferred, + * i.e. return JSON if included, otherwise return the first one. + */ + ApiClient.prototype.jsonPreferredMime = function jsonPreferredMime(mimes) { + var len = mimes.length; + for (var i = 0; i < len; i++) { + if (this.isJsonMime(mimes[i])) { + return mimes[i]; + } + } + return mimes[0]; + }; + + /** + * Normalize parameters values: + * remove nils, + * keep files and arrays, + * format to string with `paramToString` for other cases. + */ + ApiClient.prototype.normalizeParams = function normalizeParams(params) { + var newParams = {}; + for (var key in params) { + if (params.hasOwnProperty(key) && params[key] != null) { + var value = params[key]; + if (value instanceof Blob || Array.isArray(value)) { + newParams[key] = value; + } else { + newParams[key] = this.paramToString(value); + } + } + } + return newParams; + }; + + ApiClient.prototype.callApi = function callApi(path, httpMethod, pathParams, + queryParams, headerParams, formParams, bodyParam, contentTypes, accepts, + callback) { + var url = this.buildUrl(path, pathParams); + var request = superagent(httpMethod, url); + + // set query parameters + request.query(this.normalizeParams(queryParams)); + + // set header parameters + request.set(this.normalizeParams(headerParams)); + + var contentType = this.jsonPreferredMime(contentTypes) || 'application/json'; + request.type(contentType); + + if (contentType === 'application/x-www-form-urlencoded') { + request.send(this.normalizeParams(formParams)); + } else if (contentType == 'multipart/form-data') { + var _formParams = this.normalizeParams(formParams); + for (var key in _formParams) { + if (_formParams.hasOwnProperty(key)) { + if (_formParams[key] instanceof Blob) { + // file field + request.attach(key, _formParams[key]); + } else { + request.field(key, _formParams[key]); + } + } + } + } else if (bodyParam) { + request.send(bodyParam); + } + + request.end(function(error, response) { + if (callback) { + var data = response && response.body; + callback(error, data, response); + } + }); + + return request; + }; + + ApiClient.default = new ApiClient(); + + return ApiClient; +})); diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index 3b6d9c5b4c62..b6c1163111fa 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -1,527 +1,462 @@ -// require files in Node.js environment -var $, Pet; -if (typeof module === 'object' && module.exports) { - $ = require('jquery'); - Pet = require('../model/Pet.js'); -} +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient', '../model/Pet'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient.js'), require('../model/Pet.js')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet); + } +}(this, function(ApiClient, Pet) { + 'use strict'; -// export module for AMD -if ( typeof define === "function" && define.amd ) { - define(['jquery', 'Pet'], function($, Pet) { - return PetApi; - }); -} + var PetApi = function PetApi(apiClient) { + this.apiClient = apiClient || ApiClient.default; -var PetApi = function PetApi() { - var self = this; - - - /** - * Update an existing pet - * - * @param {Pet} body Pet object that needs to be added to the store - * @param {function} callback the callback function - * @return void - */ - self.updatePet = function(body, callback) { - var postBody = JSON.stringify(body); - var postBinaryBody = null; + var self = this; - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + /** + * Update an existing pet + * + * @param {Pet} body Pet object that needs to be added to the store + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.updatePet = function(body, callback) { + var postBody = body; + + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = ['application/json', 'application/xml']; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/pet', 'PUT', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/pet", "\\{format\\}","json")); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "PUT", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Add a new pet to the store + * + * @param {Pet} body Pet object that needs to be added to the store + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.addPet = function(body, callback) { + var postBody = body; - if (callback) { - callback(response, textStatus, jqXHR); - } + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = ['application/json', 'application/xml']; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/pet', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); - }); - - return request; - } - - /** - * Add a new pet to the store - * - * @param {Pet} body Pet object that needs to be added to the store - * @param {function} callback the callback function - * @return void - */ - self.addPet = function(body, callback) { - var postBody = JSON.stringify(body); - var postBinaryBody = null; - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); } - var path = basePath + replaceAll(replaceAll("/pet", "\\{format\\}","json")); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "POST", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Finds Pets by status + * Multiple status values can be provided with comma seperated strings + * @param {Array} status Status values that need to be considered for filter + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: Array + */ + self.findPetsByStatus = function(status, callback) { + var postBody = null; - if (callback) { - callback(response, textStatus, jqXHR); - } + + + var pathParams = { + }; + var queryParams = { + 'status': status + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + // TODO: support deserializing array of models + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/pet/findByStatus', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); - }); - - return request; - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma seperated strings - * @param {Array} status Status values that need to be considered for filter - * @param {function} callback the callback function - * @return Array - */ - self.findPetsByStatus = function(status, callback) { - var postBody = null; - var postBinaryBody = null; - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); } - var path = basePath + replaceAll(replaceAll("/pet/findByStatus", "\\{format\\}","json")); + /** + * Finds Pets by tags + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param {Array} tags Tags to filter by + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: Array + */ + self.findPetsByTags = function(tags, callback) { + var postBody = null; + - var queryParams = {}; - var headerParams = {}; - var formParams = {}; + + var pathParams = { + }; + var queryParams = { + 'tags': tags + }; + var headerParams = { + }; + var formParams = { + }; - - queryParams.status = status; - - - + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; - path += createQueryString(queryParams); - - var options = {type: "GET", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ + var handleResponse = null; if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); + handleResponse = function(error, data, response) { + // TODO: support deserializing array of models + callback(error, data, response); + }; } - }); - - request.done(function(response, textStatus, jqXHR){ + + return this.apiClient.callApi( + '/pet/findByTags', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); - /** - * @returns Array - */ - - var myResponse = new Array(); - myResponse.constructFromObject(response); - if (callback) { - callback(myResponse, textStatus, jqXHR); - } - - }); - - return request; - } - - /** - * Finds Pets by tags - * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param {Array} tags Tags to filter by - * @param {function} callback the callback function - * @return Array - */ - self.findPetsByTags = function(tags, callback) { - var postBody = null; - var postBinaryBody = null; - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); } - var path = basePath + replaceAll(replaceAll("/pet/findByTags", "\\{format\\}","json")); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - queryParams.tags = tags; - - - - - path += createQueryString(queryParams); - - var options = {type: "GET", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Find pet by ID + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param {Integer} petId ID of pet that needs to be fetched + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: Pet + */ + self.getPetById = function(petId, callback) { + var postBody = null; - /** - * @returns Array - */ - - var myResponse = new Array(); - myResponse.constructFromObject(response); - if (callback) { - callback(myResponse, textStatus, jqXHR); + // verify the required parameter 'petId' is set + if (petId == null) { + throw "Missing the required parameter 'petId' when calling getPetById"; } - }); - - return request; - } - - /** - * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param {Integer} petId ID of pet that needs to be fetched - * @param {function} callback the callback function - * @return Pet - */ - self.getPetById = function(petId, callback) { - var postBody = null; - var postBinaryBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - //throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); - var errorRequiredMsg = "Missing the required parameter 'petId' when calling getPetById"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'petId': petId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + if (!error && data) { + var result = new Pet(); + result.constructFromObject(data); + callback(error, result, response); + } else { + callback(error, data, response); + } + }; + } + + return this.apiClient.callApi( + '/pet/{petId}', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/pet/{petId}", "\\{format\\}","json") -, "\\{" + "petId" + "\\}", encodeURIComponent(petId.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "GET", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Updates a pet in the store with form data + * + * @param {String} petId ID of pet that needs to be updated + * @param {String} name Updated name of the pet + * @param {String} status Updated status of the pet + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.updatePetWithForm = function(petId, name, status, callback) { + var postBody = null; - /** - * @returns Pet - */ - - var myResponse = new Pet(); - myResponse.constructFromObject(response); - if (callback) { - callback(myResponse, textStatus, jqXHR); + // verify the required parameter 'petId' is set + if (petId == null) { + throw "Missing the required parameter 'petId' when calling updatePetWithForm"; } - }); - - return request; - } - - /** - * Updates a pet in the store with form data - * - * @param {String} petId ID of pet that needs to be updated - * @param {String} name Updated name of the pet - * @param {String} status Updated status of the pet - * @param {function} callback the callback function - * @return void - */ - self.updatePetWithForm = function(petId, name, status, callback) { - var postBody = null; - var postBinaryBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - //throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); - var errorRequiredMsg = "Missing the required parameter 'petId' when calling updatePetWithForm"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'petId': petId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + 'name': name, + 'status': status + }; + + var contentTypes = ['application/x-www-form-urlencoded']; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/pet/{petId}', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/pet/{petId}", "\\{format\\}","json") -, "\\{" + "petId" + "\\}", encodeURIComponent(petId.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - if (name != null) - formParams.put("name", name); - if (status != null) - formParams.put("status", status); - - - path += createQueryString(queryParams); - - var options = {type: "POST", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Deletes a pet + * + * @param {Integer} petId Pet id to delete + * @param {String} apiKey + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.deletePet = function(petId, apiKey, callback) { + var postBody = null; - if (callback) { - callback(response, textStatus, jqXHR); + // verify the required parameter 'petId' is set + if (petId == null) { + throw "Missing the required parameter 'petId' when calling deletePet"; } - }); - - return request; - } - - /** - * Deletes a pet - * - * @param {Integer} petId Pet id to delete - * @param {String} apiKey - * @param {function} callback the callback function - * @return void - */ - self.deletePet = function(petId, apiKey, callback) { - var postBody = null; - var postBinaryBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - //throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); - var errorRequiredMsg = "Missing the required parameter 'petId' when calling deletePet"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'petId': petId + }; + var queryParams = { + }; + var headerParams = { + 'api_key': apiKey + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/pet/{petId}', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/pet/{petId}", "\\{format\\}","json") -, "\\{" + "petId" + "\\}", encodeURIComponent(petId.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - if (apiKey != null) - headerParams.put("api_key", apiKey); - - - - path += createQueryString(queryParams); - - var options = {type: "DELETE", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * uploads an image + * + * @param {Integer} petId ID of pet to update + * @param {String} additionalMetadata Additional data to pass to server + * @param {File} file file to upload + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.uploadFile = function(petId, additionalMetadata, file, callback) { + var postBody = null; - if (callback) { - callback(response, textStatus, jqXHR); + // verify the required parameter 'petId' is set + if (petId == null) { + throw "Missing the required parameter 'petId' when calling uploadFile"; } - }); - - return request; - } - - /** - * uploads an image - * - * @param {Integer} petId ID of pet to update - * @param {String} additionalMetadata Additional data to pass to server - * @param {File} file file to upload - * @param {function} callback the callback function - * @return void - */ - self.uploadFile = function(petId, additionalMetadata, file, callback) { - var postBody = null; - var postBinaryBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - //throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); - var errorRequiredMsg = "Missing the required parameter 'petId' when calling uploadFile"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'petId': petId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + 'additionalMetadata': additionalMetadata, + 'file': file + }; + + var contentTypes = ['multipart/form-data']; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/pet/{petId}/uploadImage', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/pet/{petId}/uploadImage", "\\{format\\}","json") -, "\\{" + "petId" + "\\}", encodeURIComponent(petId.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - if (additionalMetadata != null) - formParams.put("additionalMetadata", additionalMetadata); - if (file != null) - formParams.put("file", file); - - - path += createQueryString(queryParams); - - var options = {type: "POST", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Fake endpoint to test byte array return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param {Integer} petId ID of pet that needs to be fetched + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: Object + */ + self.getPetByIdWithByteArray = function(petId, callback) { + var postBody = null; - if (callback) { - callback(response, textStatus, jqXHR); + // verify the required parameter 'petId' is set + if (petId == null) { + throw "Missing the required parameter 'petId' when calling getPetByIdWithByteArray"; } - }); - - return request; - } - - - function replaceAll (haystack, needle, replace) { - var result= haystack; - if (needle !=null && replace!=null) { - result= haystack.replace(new RegExp(needle, 'g'), replace); - } - return result; - } + + var pathParams = { + 'petId': petId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; - function createQueryString (queryParams) { - var queryString =''; - var i = 0; - for (var queryParamName in queryParams) { - if (i==0) { - queryString += '?' ; - } else { - queryString += '&' ; - } - - queryString += queryParamName + '=' + encodeURIComponent(queryParams[queryParamName]); - i++; - } - - return queryString; - } -} + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; -// export module for Node.js -if (typeof module === 'object' && module.exports) { - module.exports = PetApi; -} + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/pet/{petId}?testing_byte_array=true', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + + } + + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param {Object} body Pet object in the form of byte array + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.addPetUsingByteArray = function(body, callback) { + var postBody = body; + + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = ['application/json', 'application/xml']; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/pet?testing_byte_array=true', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + + } + + + }; + + return PetApi; +})); diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index e52a31059645..28928fd40c2a 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -1,286 +1,206 @@ -// require files in Node.js environment -var $, Order; -if (typeof module === 'object' && module.exports) { - $ = require('jquery'); - Order = require('../model/Order.js'); -} +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient', '../model/Order'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient.js'), require('../model/Order.js')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.StoreApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Order); + } +}(this, function(ApiClient, Order) { + 'use strict'; -// export module for AMD -if ( typeof define === "function" && define.amd ) { - define(['jquery', 'Order'], function($, Order) { - return StoreApi; - }); -} + var StoreApi = function StoreApi(apiClient) { + this.apiClient = apiClient || ApiClient.default; -var StoreApi = function StoreApi() { - var self = this; - - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @param {function} callback the callback function - * @return Object - */ - self.getInventory = function(callback) { - var postBody = null; - var postBinaryBody = null; + var self = this; - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: Object + */ + self.getInventory = function(callback) { + var postBody = null; + + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/store/inventory', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/store/inventory", "\\{format\\}","json")); + /** + * Place an order for a pet + * + * @param {Order} body order placed for purchasing the pet + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: Order + */ + self.placeOrder = function(body, callback) { + var postBody = body; + - var queryParams = {}; - var headerParams = {}; - var formParams = {}; + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; - - - + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; - path += createQueryString(queryParams); - - var options = {type: "GET", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ + var handleResponse = null; if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); + handleResponse = function(error, data, response) { + if (!error && data) { + var result = new Order(); + result.constructFromObject(data); + callback(error, result, response); + } else { + callback(error, data, response); + } + }; } - }); - - request.done(function(response, textStatus, jqXHR){ + + return this.apiClient.callApi( + '/store/order', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); - /** - * @returns Object - */ - var myResponse = response; - - if (callback) { - callback(myResponse, textStatus, jqXHR); - } - - }); - - return request; - } - - /** - * Place an order for a pet - * - * @param {Order} body order placed for purchasing the pet - * @param {function} callback the callback function - * @return Order - */ - self.placeOrder = function(body, callback) { - var postBody = JSON.stringify(body); - var postBinaryBody = null; - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); } - var path = basePath + replaceAll(replaceAll("/store/order", "\\{format\\}","json")); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "POST", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param {String} orderId ID of pet that needs to be fetched + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: Order + */ + self.getOrderById = function(orderId, callback) { + var postBody = null; - /** - * @returns Order - */ - - var myResponse = new Order(); - myResponse.constructFromObject(response); - if (callback) { - callback(myResponse, textStatus, jqXHR); + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw "Missing the required parameter 'orderId' when calling getOrderById"; } - }); - - return request; - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param {String} orderId ID of pet that needs to be fetched - * @param {function} callback the callback function - * @return Order - */ - self.getOrderById = function(orderId, callback) { - var postBody = null; - var postBinaryBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - //throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); - var errorRequiredMsg = "Missing the required parameter 'orderId' when calling getOrderById"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'orderId': orderId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + if (!error && data) { + var result = new Order(); + result.constructFromObject(data); + callback(error, result, response); + } else { + callback(error, data, response); + } + }; + } + + return this.apiClient.callApi( + '/store/order/{orderId}', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/store/order/{orderId}", "\\{format\\}","json") -, "\\{" + "orderId" + "\\}", encodeURIComponent(orderId.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "GET", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param {String} orderId ID of the order that needs to be deleted + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.deleteOrder = function(orderId, callback) { + var postBody = null; - /** - * @returns Order - */ - - var myResponse = new Order(); - myResponse.constructFromObject(response); - if (callback) { - callback(myResponse, textStatus, jqXHR); + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw "Missing the required parameter 'orderId' when calling deleteOrder"; } - }); - - return request; - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param {String} orderId ID of the order that needs to be deleted - * @param {function} callback the callback function - * @return void - */ - self.deleteOrder = function(orderId, callback) { - var postBody = null; - var postBinaryBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - //throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); - var errorRequiredMsg = "Missing the required parameter 'orderId' when calling deleteOrder"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'orderId': orderId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/store/order/{orderId}', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/store/order/{orderId}", "\\{format\\}","json") -, "\\{" + "orderId" + "\\}", encodeURIComponent(orderId.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - + }; - path += createQueryString(queryParams); - - var options = {type: "DELETE", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ - - if (callback) { - callback(response, textStatus, jqXHR); - } - - }); - - return request; - } - - - - function replaceAll (haystack, needle, replace) { - var result= haystack; - if (needle !=null && replace!=null) { - result= haystack.replace(new RegExp(needle, 'g'), replace); - } - return result; - } - - function createQueryString (queryParams) { - var queryString =''; - var i = 0; - for (var queryParamName in queryParams) { - if (i==0) { - queryString += '?' ; - } else { - queryString += '&' ; - } - - queryString += queryParamName + '=' + encodeURIComponent(queryParams[queryParamName]); - i++; - } - - return queryString; - } -} - -// export module for Node.js -if (typeof module === 'object' && module.exports) { - module.exports = StoreApi; -} + return StoreApi; +})); diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index 148e6171ed40..656bf56dd861 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -1,498 +1,361 @@ -// require files in Node.js environment -var $, User; -if (typeof module === 'object' && module.exports) { - $ = require('jquery'); - User = require('../model/User.js'); -} +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient', '../model/User'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient.js'), require('../model/User.js')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.UserApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.User); + } +}(this, function(ApiClient, User) { + 'use strict'; -// export module for AMD -if ( typeof define === "function" && define.amd ) { - define(['jquery', 'User'], function($, User) { - return UserApi; - }); -} + var UserApi = function UserApi(apiClient) { + this.apiClient = apiClient || ApiClient.default; -var UserApi = function UserApi() { - var self = this; - - - /** - * Create user - * This can only be done by the logged in user. - * @param {User} body Created user object - * @param {function} callback the callback function - * @return void - */ - self.createUser = function(body, callback) { - var postBody = JSON.stringify(body); - var postBinaryBody = null; + var self = this; - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + /** + * Create user + * This can only be done by the logged in user. + * @param {User} body Created user object + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.createUser = function(body, callback) { + var postBody = body; + + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/user', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/user", "\\{format\\}","json")); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "POST", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Creates list of users with given input array + * + * @param {Array} body List of user object + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.createUsersWithArrayInput = function(body, callback) { + var postBody = body; - if (callback) { - callback(response, textStatus, jqXHR); - } + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/user/createWithArray', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); - }); - - return request; - } - - /** - * Creates list of users with given input array - * - * @param {Array} body List of user object - * @param {function} callback the callback function - * @return void - */ - self.createUsersWithArrayInput = function(body, callback) { - var postBody = JSON.stringify(body); - var postBinaryBody = null; - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); } - var path = basePath + replaceAll(replaceAll("/user/createWithArray", "\\{format\\}","json")); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "POST", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Creates list of users with given input array + * + * @param {Array} body List of user object + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.createUsersWithListInput = function(body, callback) { + var postBody = body; - if (callback) { - callback(response, textStatus, jqXHR); - } + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/user/createWithList', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); - }); - - return request; - } - - /** - * Creates list of users with given input array - * - * @param {Array} body List of user object - * @param {function} callback the callback function - * @return void - */ - self.createUsersWithListInput = function(body, callback) { - var postBody = JSON.stringify(body); - var postBinaryBody = null; - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); } - var path = basePath + replaceAll(replaceAll("/user/createWithList", "\\{format\\}","json")); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "POST", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Logs user into the system + * + * @param {String} username The user name for login + * @param {String} password The password for login in clear text + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: String + */ + self.loginUser = function(username, password, callback) { + var postBody = null; - if (callback) { - callback(response, textStatus, jqXHR); - } + + + var pathParams = { + }; + var queryParams = { + 'username': username, + 'password': password + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/user/login', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); - }); - - return request; - } - - /** - * Logs user into the system - * - * @param {String} username The user name for login - * @param {String} password The password for login in clear text - * @param {function} callback the callback function - * @return String - */ - self.loginUser = function(username, password, callback) { - var postBody = null; - var postBinaryBody = null; - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); } - var path = basePath + replaceAll(replaceAll("/user/login", "\\{format\\}","json")); + /** + * Logs out current logged in user session + * + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.logoutUser = function(callback) { + var postBody = null; + - var queryParams = {}; - var headerParams = {}; - var formParams = {}; + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; - - queryParams.username = username; - - queryParams.password = password; - - - + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; - path += createQueryString(queryParams); - - var options = {type: "GET", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ + var handleResponse = null; if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); + handleResponse = function(error, data, response) { + callback(error, data, response); + }; } - }); - - request.done(function(response, textStatus, jqXHR){ + + return this.apiClient.callApi( + '/user/logout', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); - /** - * @returns String - */ - var myResponse = response; - - if (callback) { - callback(myResponse, textStatus, jqXHR); - } - - }); - - return request; - } - - /** - * Logs out current logged in user session - * - * @param {function} callback the callback function - * @return void - */ - self.logoutUser = function(callback) { - var postBody = null; - var postBinaryBody = null; - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); } - var path = basePath + replaceAll(replaceAll("/user/logout", "\\{format\\}","json")); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "GET", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Get user by user name + * + * @param {String} username The name that needs to be fetched. Use user1 for testing. + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: User + */ + self.getUserByName = function(username, callback) { + var postBody = null; - if (callback) { - callback(response, textStatus, jqXHR); + // verify the required parameter 'username' is set + if (username == null) { + throw "Missing the required parameter 'username' when calling getUserByName"; } - }); - - return request; - } - - /** - * Get user by user name - * - * @param {String} username The name that needs to be fetched. Use user1 for testing. - * @param {function} callback the callback function - * @return User - */ - self.getUserByName = function(username, callback) { - var postBody = null; - var postBinaryBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - //throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); - var errorRequiredMsg = "Missing the required parameter 'username' when calling getUserByName"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'username': username + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + if (!error && data) { + var result = new User(); + result.constructFromObject(data); + callback(error, result, response); + } else { + callback(error, data, response); + } + }; + } + + return this.apiClient.callApi( + '/user/{username}', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/user/{username}", "\\{format\\}","json") -, "\\{" + "username" + "\\}", encodeURIComponent(username.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "GET", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Updated user + * This can only be done by the logged in user. + * @param {String} username name that need to be deleted + * @param {User} body Updated user object + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.updateUser = function(username, body, callback) { + var postBody = body; - /** - * @returns User - */ - - var myResponse = new User(); - myResponse.constructFromObject(response); - if (callback) { - callback(myResponse, textStatus, jqXHR); + // verify the required parameter 'username' is set + if (username == null) { + throw "Missing the required parameter 'username' when calling updateUser"; } - }); - - return request; - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param {String} username name that need to be deleted - * @param {User} body Updated user object - * @param {function} callback the callback function - * @return void - */ - self.updateUser = function(username, body, callback) { - var postBody = JSON.stringify(body); - var postBinaryBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - //throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); - var errorRequiredMsg = "Missing the required parameter 'username' when calling updateUser"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'username': username + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/user/{username}', 'PUT', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/user/{username}", "\\{format\\}","json") -, "\\{" + "username" + "\\}", encodeURIComponent(username.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - - - - path += createQueryString(queryParams); - - var options = {type: "PUT", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ + /** + * Delete user + * This can only be done by the logged in user. + * @param {String} username The name that needs to be deleted + * @param {function} callback the callback function, accepting three arguments: error, data, response + */ + self.deleteUser = function(username, callback) { + var postBody = null; - if (callback) { - callback(response, textStatus, jqXHR); + // verify the required parameter 'username' is set + if (username == null) { + throw "Missing the required parameter 'username' when calling deleteUser"; } - }); - - return request; - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param {String} username The name that needs to be deleted - * @param {function} callback the callback function - * @return void - */ - self.deleteUser = function(username, callback) { - var postBody = null; - var postBinaryBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - //throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); - var errorRequiredMsg = "Missing the required parameter 'username' when calling deleteUser"; - throw errorRequiredMsg; - } - - // create path and map variables - var basePath = 'http://petstore.swagger.io/v2'; - // if basePath ends with a /, remove it as path starts with a leading / - if (basePath.substring(basePath.length-1, basePath.length)=='/') { - basePath = basePath.substring(0, basePath.length-1); + + + var pathParams = { + 'username': username + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + + var handleResponse = null; + if (callback) { + handleResponse = function(error, data, response) { + callback(error, data, response); + }; + } + + return this.apiClient.callApi( + '/user/{username}', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts, handleResponse + ); + } - var path = basePath + replaceAll(replaceAll("/user/{username}", "\\{format\\}","json") -, "\\{" + "username" + "\\}", encodeURIComponent(username.toString())); - - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - - - + }; - path += createQueryString(queryParams); - - var options = {type: "DELETE", async: true, contentType: "application/json", dataType: "json", data: postBody}; - var request = $.ajax(path, options); - - request.fail(function(jqXHR, textStatus, errorThrown){ - if (callback) { - var error = errorThrown || textStatus || jqXHR.statusText || 'error'; - callback(null, textStatus, jqXHR, error); - } - }); - - request.done(function(response, textStatus, jqXHR){ - - if (callback) { - callback(response, textStatus, jqXHR); - } - - }); - - return request; - } - - - - function replaceAll (haystack, needle, replace) { - var result= haystack; - if (needle !=null && replace!=null) { - result= haystack.replace(new RegExp(needle, 'g'), replace); - } - return result; - } - - function createQueryString (queryParams) { - var queryString =''; - var i = 0; - for (var queryParamName in queryParams) { - if (i==0) { - queryString += '?' ; - } else { - queryString += '&' ; - } - - queryString += queryParamName + '=' + encodeURIComponent(queryParams[queryParamName]); - i++; - } - - return queryString; - } -} - -// export module for Node.js -if (typeof module === 'object' && module.exports) { - module.exports = UserApi; -} + return UserApi; +})); diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index b772f6024dca..725eb486075c 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,22 +1,23 @@ -if (typeof module === 'object' && module.exports) { - var SwaggerPetstore = {}; - - SwaggerPetstore.User = require('./model/User.js'); - - SwaggerPetstore.Category = require('./model/Category.js'); - - SwaggerPetstore.Pet = require('./model/Pet.js'); - - SwaggerPetstore.Tag = require('./model/Tag.js'); - - SwaggerPetstore.Order = require('./model/Order.js'); - - - SwaggerPetstore.UserApi = require('./api/UserApi.js'); - - SwaggerPetstore.StoreApi = require('./api/StoreApi.js'); - - SwaggerPetstore.PetApi = require('./api/PetApi.js'); - - module.exports = SwaggerPetstore; -} \ No newline at end of file +(function(factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['./ApiClient', './model/User', './model/Category', './model/Pet', './model/Tag', './model/Order', './api/UserApi', './api/StoreApi', './api/PetApi'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('./ApiClient.js'), require('./model/User.js'), require('./model/Category.js'), require('./model/Pet.js'), require('./model/Tag.js'), require('./model/Order.js'), require('./api/UserApi.js'), require('./api/StoreApi.js'), require('./api/PetApi.js')); + } +}(function(ApiClient, User, Category, Pet, Tag, Order, UserApi, StoreApi, PetApi) { + 'use strict'; + + return { + ApiClient: ApiClient, + User: User, + Category: Category, + Pet: Pet, + Tag: Tag, + Order: Order, + UserApi: UserApi, + StoreApi: StoreApi, + PetApi: PetApi + }; +})); diff --git a/samples/client/petstore/javascript/src/model/Category.js b/samples/client/petstore/javascript/src/model/Category.js index ff40497a61a0..6b302a32f302 100644 --- a/samples/client/petstore/javascript/src/model/Category.js +++ b/samples/client/petstore/javascript/src/model/Category.js @@ -1,81 +1,89 @@ -// require files in Node.js environment +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([undefined], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(undefined); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + factory(root.SwaggerPetstore); + } +}(this, function(module) { + 'use strict'; -if (typeof module === 'object' && module.exports) { - -} - - - - -//export module -if ( typeof define === "function" && define.amd ) { - define('Category', ['jquery'], - function($) { - return Category; - }); -} - - -var Category = function Category() { - var self = this; - - /** - * datatype: Integer - **/ - self.id = null; - - /** - * datatype: String - **/ - self.name = null; - self.constructFromObject = function(data) { - if (!data) { - return; + + + var Category = function Category() { + var self = this; + + /** + * datatype: Integer + **/ + self.id = null; + + /** + * datatype: String + **/ + self.name = null; + + + self.constructFromObject = function(data) { + if (!data) { + return; + } + + self.id = data.id; + + self.name = data.name; + + } + + + /** + * @return {Integer} + **/ + self.getId = function() { + return self.id; + } + + /** + * @param {Integer} id + **/ + self.setId = function (id) { + self.id = id; } - self.id = data.id; - - self.name = data.name; + /** + * @return {String} + **/ + self.getName = function() { + return self.name; + } + + /** + * @param {String} name + **/ + self.setName = function (name) { + self.name = name; + } + + self.toJson = function () { + return JSON.stringify(self); + } + }; + + if (module) { + module.Category = Category; } + return Category; - /** - * @return {Integer} - **/ - self.getId = function() { - return self.id; - } - - /** - * @param {Integer} id - **/ - self.setId = function (id) { - self.id = id; - } - /** - * @return {String} - **/ - self.getName = function() { - return self.name; - } - - /** - * @param {String} name - **/ - self.setName = function (name) { - self.name = name; - } - - - self.toJson = function () { - return JSON.stringify(self); - } -} - -if (typeof module === 'object' && module.exports) { - module.exports = Category; -} +})); diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index 3cf2335b5356..9f641242bf86 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -1,11 +1,22 @@ -// require files in Node.js environment +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([undefined], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(undefined); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + factory(root.SwaggerPetstore); + } +}(this, function(module) { + 'use strict'; -if (typeof module === 'object' && module.exports) { -} - - - + //export module if ( typeof define === "function" && define.amd ) { define('StatusEnum', ['jquery'], function($) { @@ -35,162 +46,159 @@ var StatusEnum = function StatusEnum() { } -//export module -if ( typeof define === "function" && define.amd ) { - define('Order', ['jquery'], - function($) { - return Order; - }); -} + + var Order = function Order() { + var self = this; + + /** + * datatype: Integer + **/ + self.id = null; + + /** + * datatype: Integer + **/ + self.petId = null; + + /** + * datatype: Integer + **/ + self.quantity = null; + + /** + * datatype: Date + **/ + self.shipDate = null; + + /** + * Order Status + * datatype: StatusEnum + **/ + self.status = null; + + /** + * datatype: Boolean + **/ + self.complete = null; + + self.constructFromObject = function(data) { + if (!data) { + return; + } + + self.id = data.id; + + self.petId = data.petId; + + self.quantity = data.quantity; + + self.shipDate = data.shipDate; + + self.status = data.status; + + self.complete = data.complete; + + } -var Order = function Order() { - var self = this; - - /** - * datatype: Integer - **/ - self.id = null; - - /** - * datatype: Integer - **/ - self.petId = null; - - /** - * datatype: Integer - **/ - self.quantity = null; - - /** - * datatype: Date - **/ - self.shipDate = null; - - /** - * Order Status - * datatype: StatusEnum - **/ - self.status = null; - - /** - * datatype: Boolean - **/ - self.complete = null; - - - self.constructFromObject = function(data) { - if (!data) { - return; + + /** + * @return {Integer} + **/ + self.getId = function() { + return self.id; + } + + /** + * @param {Integer} id + **/ + self.setId = function (id) { + self.id = id; } - self.id = data.id; + /** + * @return {Integer} + **/ + self.getPetId = function() { + return self.petId; + } + + /** + * @param {Integer} petId + **/ + self.setPetId = function (petId) { + self.petId = petId; + } - self.petId = data.petId; + /** + * @return {Integer} + **/ + self.getQuantity = function() { + return self.quantity; + } + + /** + * @param {Integer} quantity + **/ + self.setQuantity = function (quantity) { + self.quantity = quantity; + } - self.quantity = data.quantity; + /** + * @return {Date} + **/ + self.getShipDate = function() { + return self.shipDate; + } + + /** + * @param {Date} shipDate + **/ + self.setShipDate = function (shipDate) { + self.shipDate = shipDate; + } - self.shipDate = data.shipDate; + /** + * get Order Status + * @return {StatusEnum} + **/ + self.getStatus = function() { + return self.status; + } + + /** + * set Order Status + * @param {StatusEnum} status + **/ + self.setStatus = function (status) { + self.status = status; + } - self.status = data.status; - - self.complete = data.complete; + /** + * @return {Boolean} + **/ + self.getComplete = function() { + return self.complete; + } + + /** + * @param {Boolean} complete + **/ + self.setComplete = function (complete) { + self.complete = complete; + } + + self.toJson = function () { + return JSON.stringify(self); + } + }; + + if (module) { + module.Order = Order; } + return Order; - /** - * @return {Integer} - **/ - self.getId = function() { - return self.id; - } - - /** - * @param {Integer} id - **/ - self.setId = function (id) { - self.id = id; - } - /** - * @return {Integer} - **/ - self.getPetId = function() { - return self.petId; - } - - /** - * @param {Integer} petId - **/ - self.setPetId = function (petId) { - self.petId = petId; - } - - /** - * @return {Integer} - **/ - self.getQuantity = function() { - return self.quantity; - } - - /** - * @param {Integer} quantity - **/ - self.setQuantity = function (quantity) { - self.quantity = quantity; - } - - /** - * @return {Date} - **/ - self.getShipDate = function() { - return self.shipDate; - } - - /** - * @param {Date} shipDate - **/ - self.setShipDate = function (shipDate) { - self.shipDate = shipDate; - } - - /** - * get Order Status - * @return {StatusEnum} - **/ - self.getStatus = function() { - return self.status; - } - - /** - * set Order Status - * @param {StatusEnum} status - **/ - self.setStatus = function (status) { - self.status = status; - } - - /** - * @return {Boolean} - **/ - self.getComplete = function() { - return self.complete; - } - - /** - * @param {Boolean} complete - **/ - self.setComplete = function (complete) { - self.complete = complete; - } - - - self.toJson = function () { - return JSON.stringify(self); - } -} - -if (typeof module === 'object' && module.exports) { - module.exports = Order; -} +})); diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index 25ae2e951c80..21de32650765 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -1,13 +1,22 @@ -// require files in Node.js environment -var Category;var Tag; -if (typeof module === 'object' && module.exports) { +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([undefined, './Category', './Tag'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(undefined, require('./Category.js'), require('./Tag.js')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + factory(root.SwaggerPetstore, root.SwaggerPetstore.Category, root.SwaggerPetstore.Tag); + } +}(this, function(module, Category, Tag) { + 'use strict'; + + - Category = require('./Category.js'); - Tag = require('./Tag.js'); -} - - - //export module if ( typeof define === "function" && define.amd ) { define('StatusEnum', ['jquery'], function($) { @@ -37,164 +46,161 @@ var StatusEnum = function StatusEnum() { } -//export module -if ( typeof define === "function" && define.amd ) { - define('Pet', ['jquery', 'Category', 'Array'], - function($, Category, Array) { - return Pet; - }); -} + + var Pet = function Pet(photoUrls, name) { + var self = this; + + /** + * datatype: Integer + **/ + self.id = null; + + /** + * datatype: Category + **/ + self.category = new Category(); + + /** + * datatype: String + * required + **/ + self.name = name; + + /** + * datatype: Array + * required + **/ + self.photoUrls = photoUrls; + + /** + * datatype: Array + **/ + self.tags = []; + + /** + * pet status in the store + * datatype: StatusEnum + **/ + self.status = null; + + self.constructFromObject = function(data) { + if (!data) { + return; + } + + self.id = data.id; + + self.category.constructFromObject(data.category); + + self.name = data.name; + + self.photoUrls = new Array(); + + self.tags = new Array(); + + self.status = data.status; + + } -var Pet = function Pet(photoUrls, name) { - var self = this; - - /** - * datatype: Integer - **/ - self.id = null; - - /** - * datatype: Category - **/ - self.category = new Category(); - - /** - * datatype: String - * required - **/ - self.name = name; - - /** - * datatype: Array - * required - **/ - self.photoUrls = photoUrls; - - /** - * datatype: Array - **/ - self.tags = []; - - /** - * pet status in the store - * datatype: StatusEnum - **/ - self.status = null; - - - self.constructFromObject = function(data) { - if (!data) { - return; + + /** + * @return {Integer} + **/ + self.getId = function() { + return self.id; + } + + /** + * @param {Integer} id + **/ + self.setId = function (id) { + self.id = id; } - self.id = data.id; + /** + * @return {Category} + **/ + self.getCategory = function() { + return self.category; + } + + /** + * @param {Category} category + **/ + self.setCategory = function (category) { + self.category = category; + } - self.category.constructFromObject(data.category); + /** + * @return {String} + **/ + self.getName = function() { + return self.name; + } + + /** + * @param {String} name + **/ + self.setName = function (name) { + self.name = name; + } - self.name = data.name; + /** + * @return {Array} + **/ + self.getPhotoUrls = function() { + return self.photoUrls; + } + + /** + * @param {Array} photoUrls + **/ + self.setPhotoUrls = function (photoUrls) { + self.photoUrls = photoUrls; + } - self.photoUrls = new Array(); + /** + * @return {Array} + **/ + self.getTags = function() { + return self.tags; + } + + /** + * @param {Array} tags + **/ + self.setTags = function (tags) { + self.tags = tags; + } - self.tags = new Array(); - - self.status = data.status; + /** + * get pet status in the store + * @return {StatusEnum} + **/ + self.getStatus = function() { + return self.status; + } + + /** + * set pet status in the store + * @param {StatusEnum} status + **/ + self.setStatus = function (status) { + self.status = status; + } + + self.toJson = function () { + return JSON.stringify(self); + } + }; + + if (module) { + module.Pet = Pet; } + return Pet; - /** - * @return {Integer} - **/ - self.getId = function() { - return self.id; - } - - /** - * @param {Integer} id - **/ - self.setId = function (id) { - self.id = id; - } - /** - * @return {Category} - **/ - self.getCategory = function() { - return self.category; - } - - /** - * @param {Category} category - **/ - self.setCategory = function (category) { - self.category = category; - } - - /** - * @return {String} - **/ - self.getName = function() { - return self.name; - } - - /** - * @param {String} name - **/ - self.setName = function (name) { - self.name = name; - } - - /** - * @return {Array} - **/ - self.getPhotoUrls = function() { - return self.photoUrls; - } - - /** - * @param {Array} photoUrls - **/ - self.setPhotoUrls = function (photoUrls) { - self.photoUrls = photoUrls; - } - - /** - * @return {Array} - **/ - self.getTags = function() { - return self.tags; - } - - /** - * @param {Array} tags - **/ - self.setTags = function (tags) { - self.tags = tags; - } - - /** - * get pet status in the store - * @return {StatusEnum} - **/ - self.getStatus = function() { - return self.status; - } - - /** - * set pet status in the store - * @param {StatusEnum} status - **/ - self.setStatus = function (status) { - self.status = status; - } - - - self.toJson = function () { - return JSON.stringify(self); - } -} - -if (typeof module === 'object' && module.exports) { - module.exports = Pet; -} +})); diff --git a/samples/client/petstore/javascript/src/model/Tag.js b/samples/client/petstore/javascript/src/model/Tag.js index 0fa97bd8c78a..2dbf932f300a 100644 --- a/samples/client/petstore/javascript/src/model/Tag.js +++ b/samples/client/petstore/javascript/src/model/Tag.js @@ -1,81 +1,89 @@ -// require files in Node.js environment +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([undefined], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(undefined); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + factory(root.SwaggerPetstore); + } +}(this, function(module) { + 'use strict'; -if (typeof module === 'object' && module.exports) { - -} - - - - -//export module -if ( typeof define === "function" && define.amd ) { - define('Tag', ['jquery'], - function($) { - return Tag; - }); -} - - -var Tag = function Tag() { - var self = this; - - /** - * datatype: Integer - **/ - self.id = null; - - /** - * datatype: String - **/ - self.name = null; - self.constructFromObject = function(data) { - if (!data) { - return; + + + var Tag = function Tag() { + var self = this; + + /** + * datatype: Integer + **/ + self.id = null; + + /** + * datatype: String + **/ + self.name = null; + + + self.constructFromObject = function(data) { + if (!data) { + return; + } + + self.id = data.id; + + self.name = data.name; + + } + + + /** + * @return {Integer} + **/ + self.getId = function() { + return self.id; + } + + /** + * @param {Integer} id + **/ + self.setId = function (id) { + self.id = id; } - self.id = data.id; - - self.name = data.name; + /** + * @return {String} + **/ + self.getName = function() { + return self.name; + } + + /** + * @param {String} name + **/ + self.setName = function (name) { + self.name = name; + } + + self.toJson = function () { + return JSON.stringify(self); + } + }; + + if (module) { + module.Tag = Tag; } + return Tag; - /** - * @return {Integer} - **/ - self.getId = function() { - return self.id; - } - - /** - * @param {Integer} id - **/ - self.setId = function (id) { - self.id = id; - } - /** - * @return {String} - **/ - self.getName = function() { - return self.name; - } - - /** - * @param {String} name - **/ - self.setName = function (name) { - self.name = name; - } - - - self.toJson = function () { - return JSON.stringify(self); - } -} - -if (typeof module === 'object' && module.exports) { - module.exports = Tag; -} +})); diff --git a/samples/client/petstore/javascript/src/model/User.js b/samples/client/petstore/javascript/src/model/User.js index 632208a523c8..a76ccf19013b 100644 --- a/samples/client/petstore/javascript/src/model/User.js +++ b/samples/client/petstore/javascript/src/model/User.js @@ -1,210 +1,218 @@ -// require files in Node.js environment +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([undefined], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(undefined); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + factory(root.SwaggerPetstore); + } +}(this, function(module) { + 'use strict'; -if (typeof module === 'object' && module.exports) { -} + + + var User = function User() { + var self = this; + + /** + * datatype: Integer + **/ + self.id = null; + + /** + * datatype: String + **/ + self.username = null; + + /** + * datatype: String + **/ + self.firstName = null; + + /** + * datatype: String + **/ + self.lastName = null; + + /** + * datatype: String + **/ + self.email = null; + + /** + * datatype: String + **/ + self.password = null; + + /** + * datatype: String + **/ + self.phone = null; + + /** + * User Status + * datatype: Integer + **/ + self.userStatus = null; + + self.constructFromObject = function(data) { + if (!data) { + return; + } + + self.id = data.id; + + self.username = data.username; + + self.firstName = data.firstName; + + self.lastName = data.lastName; + + self.email = data.email; + + self.password = data.password; + + self.phone = data.phone; + + self.userStatus = data.userStatus; + + } + + /** + * @return {Integer} + **/ + self.getId = function() { + return self.id; + } -//export module -if ( typeof define === "function" && define.amd ) { - define('User', ['jquery'], - function($) { - return User; - }); -} - - -var User = function User() { - var self = this; - - /** - * datatype: Integer - **/ - self.id = null; - - /** - * datatype: String - **/ - self.username = null; - - /** - * datatype: String - **/ - self.firstName = null; - - /** - * datatype: String - **/ - self.lastName = null; - - /** - * datatype: String - **/ - self.email = null; - - /** - * datatype: String - **/ - self.password = null; - - /** - * datatype: String - **/ - self.phone = null; - - /** - * User Status - * datatype: Integer - **/ - self.userStatus = null; - - - self.constructFromObject = function(data) { - if (!data) { - return; + /** + * @param {Integer} id + **/ + self.setId = function (id) { + self.id = id; } - self.id = data.id; + /** + * @return {String} + **/ + self.getUsername = function() { + return self.username; + } + + /** + * @param {String} username + **/ + self.setUsername = function (username) { + self.username = username; + } - self.username = data.username; + /** + * @return {String} + **/ + self.getFirstName = function() { + return self.firstName; + } + + /** + * @param {String} firstName + **/ + self.setFirstName = function (firstName) { + self.firstName = firstName; + } - self.firstName = data.firstName; + /** + * @return {String} + **/ + self.getLastName = function() { + return self.lastName; + } + + /** + * @param {String} lastName + **/ + self.setLastName = function (lastName) { + self.lastName = lastName; + } - self.lastName = data.lastName; + /** + * @return {String} + **/ + self.getEmail = function() { + return self.email; + } + + /** + * @param {String} email + **/ + self.setEmail = function (email) { + self.email = email; + } - self.email = data.email; + /** + * @return {String} + **/ + self.getPassword = function() { + return self.password; + } + + /** + * @param {String} password + **/ + self.setPassword = function (password) { + self.password = password; + } - self.password = data.password; + /** + * @return {String} + **/ + self.getPhone = function() { + return self.phone; + } + + /** + * @param {String} phone + **/ + self.setPhone = function (phone) { + self.phone = phone; + } - self.phone = data.phone; - - self.userStatus = data.userStatus; + /** + * get User Status + * @return {Integer} + **/ + self.getUserStatus = function() { + return self.userStatus; + } + + /** + * set User Status + * @param {Integer} userStatus + **/ + self.setUserStatus = function (userStatus) { + self.userStatus = userStatus; + } + + self.toJson = function () { + return JSON.stringify(self); + } + }; + + if (module) { + module.User = User; } + return User; - /** - * @return {Integer} - **/ - self.getId = function() { - return self.id; - } - - /** - * @param {Integer} id - **/ - self.setId = function (id) { - self.id = id; - } - /** - * @return {String} - **/ - self.getUsername = function() { - return self.username; - } - - /** - * @param {String} username - **/ - self.setUsername = function (username) { - self.username = username; - } - - /** - * @return {String} - **/ - self.getFirstName = function() { - return self.firstName; - } - - /** - * @param {String} firstName - **/ - self.setFirstName = function (firstName) { - self.firstName = firstName; - } - - /** - * @return {String} - **/ - self.getLastName = function() { - return self.lastName; - } - - /** - * @param {String} lastName - **/ - self.setLastName = function (lastName) { - self.lastName = lastName; - } - - /** - * @return {String} - **/ - self.getEmail = function() { - return self.email; - } - - /** - * @param {String} email - **/ - self.setEmail = function (email) { - self.email = email; - } - - /** - * @return {String} - **/ - self.getPassword = function() { - return self.password; - } - - /** - * @param {String} password - **/ - self.setPassword = function (password) { - self.password = password; - } - - /** - * @return {String} - **/ - self.getPhone = function() { - return self.phone; - } - - /** - * @param {String} phone - **/ - self.setPhone = function (phone) { - self.phone = phone; - } - - /** - * get User Status - * @return {Integer} - **/ - self.getUserStatus = function() { - return self.userStatus; - } - - /** - * set User Status - * @param {Integer} userStatus - **/ - self.setUserStatus = function (userStatus) { - self.userStatus = userStatus; - } - - - self.toJson = function () { - return JSON.stringify(self); - } -} - -if (typeof module === 'object' && module.exports) { - module.exports = User; -} +})); diff --git a/samples/client/petstore/javascript/test/ApiClientTest.js b/samples/client/petstore/javascript/test/ApiClientTest.js new file mode 100644 index 000000000000..f577a3ec7b65 --- /dev/null +++ b/samples/client/petstore/javascript/test/ApiClientTest.js @@ -0,0 +1,69 @@ +if (typeof module === 'object' && module.exports) { + var expect = require('expect.js'); + var SwaggerPetstore = require('../src/index'); +} + +var apiClient = SwaggerPetstore.ApiClient.default; + +describe('ApiClient', function() { + describe('defaults', function() { + it('should have correct default values with the default API client', function() { + expect(apiClient).to.be.ok(); + expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2'); + }); + + it('should have correct default values with new API client and can customize it', function() { + var newClient = new SwaggerPetstore.ApiClient; + expect(newClient.basePath).to.be('http://petstore.swagger.io/v2'); + expect(newClient.buildUrl('/abc', {})).to.be('http://petstore.swagger.io/v2/abc'); + + newClient.basePath = 'http://example.com'; + expect(newClient.basePath).to.be('http://example.com'); + expect(newClient.buildUrl('/abc', {})).to.be('http://example.com/abc'); + }); + }); + + describe('#paramToString', function() { + it('should return empty string for null and undefined', function() { + expect(apiClient.paramToString(null)).to.be(''); + expect(apiClient.paramToString(undefined)).to.be(''); + }); + + it('should return string', function() { + expect(apiClient.paramToString('')).to.be(''); + expect(apiClient.paramToString('abc')).to.be('abc'); + expect(apiClient.paramToString(123)).to.be('123'); + }); + }); + + describe('#buildUrl', function() { + it('should work without path parameters in the path', function() { + expect(apiClient.buildUrl('/abc', {})).to + .be('http://petstore.swagger.io/v2/abc'); + expect(apiClient.buildUrl('/abc/def?ok', {id: 123})).to + .be('http://petstore.swagger.io/v2/abc/def?ok'); + }); + + it('should work with path parameters in the path', function() { + expect(apiClient.buildUrl('/{id}', {id: 123})).to + .be('http://petstore.swagger.io/v2/123'); + expect(apiClient.buildUrl('/abc/{id}/{name}?ok', {id: 456, name: 'a b'})).to. + be('http://petstore.swagger.io/v2/abc/456/a%20b?ok'); + }); + }); + + describe('#isJsonMime', function() { + it('should return true for JSON MIME', function() { + expect(apiClient.isJsonMime('application/json')).to.be(true); + expect(apiClient.isJsonMime('application/json; charset=UTF8')).to.be(true); + expect(apiClient.isJsonMime('APPLICATION/JSON')).to.be(true); + }); + + it('should return false for non-JSON MIME', function() { + expect(apiClient.isJsonMime('')).to.be(false); + expect(apiClient.isJsonMime('text/plain')).to.be(false); + expect(apiClient.isJsonMime('application/xml')).to.be(false); + expect(apiClient.isJsonMime('application/jsonp')).to.be(false); + }); + }); +}); diff --git a/samples/client/petstore/javascript/test/api/PetApiTest.js b/samples/client/petstore/javascript/test/api/PetApiTest.js index 325cc16b616a..f2c72bb80110 100644 --- a/samples/client/petstore/javascript/test/api/PetApiTest.js +++ b/samples/client/petstore/javascript/test/api/PetApiTest.js @@ -1,25 +1,21 @@ if (typeof module === 'object' && module.exports) { var expect = require('expect.js'); - var requireApiWithMocks = require('../helper.js').requireApiWithMocks; - var PetApi = requireApiWithMocks('PetApi'); - var Pet = require('../../src/model/Pet'); - var Category = require('../../src/model/Category'); - var Tag = require('../../src/model/Tag'); + var SwaggerPetstore = require('../../src/index'); } var api; beforeEach(function() { - api = new PetApi(); + api = new SwaggerPetstore.PetApi(); }); var createRandomPet = function() { var id = new Date().getTime(); - var pet = new Pet(); + var pet = new SwaggerPetstore.Pet(); pet.setId(id); pet.setName("gorilla" + id); - var category = new Category(); + var category = new SwaggerPetstore.Category(); category.setName("really-happy"); pet.setCategory(category); @@ -31,13 +27,17 @@ var createRandomPet = function() { }; describe('PetApi', function() { - it('should create and get pet', function (done) { + it('should create and get pet', function(done) { var pet = createRandomPet(); - api.addPet(pet).then(function() { - api.getPetById(pet.id, function(fetched, textStatus, jqXHR, error) { - if (error) throw error; + api.addPet(pet, function(error) { + if (error) throw error; + + api.getPetById(pet.id, function(error, fetched, response) { + if (error) throw error; + expect(response.status).to.be(200); + expect(response.ok).to.be(true); + expect(response.get('Content-Type')).to.be('application/json'); - expect(textStatus).to.be('success'); expect(fetched).to.be.ok(); expect(fetched.id).to.be(pet.id); expect(fetched.getCategory()).to.be.ok(); @@ -46,8 +46,6 @@ describe('PetApi', function() { api.deletePet(pet.id); done(); }); - }, function(jqXHR, textStatus, errorThrown) { - throw errorThrown || textStatus; }); }); }); diff --git a/samples/client/petstore/javascript/test/helper.js b/samples/client/petstore/javascript/test/helper.js deleted file mode 100644 index 018b6428af66..000000000000 --- a/samples/client/petstore/javascript/test/helper.js +++ /dev/null @@ -1,19 +0,0 @@ -var mockrequire = require('mockrequire'); - -var jquery = require('jquery'); -var domino = require('domino'); -var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; -var window = domino.createWindow(); -var $ = jquery(window); -$.support.cors = true; -$.ajaxSettings.xhr = function() { - return new XMLHttpRequest(); -}; - -var requireApiWithMocks = function(path) { - return mockrequire('../src/api/' + path, { - 'jquery': $ - }); -}; - -exports.requireApiWithMocks = requireApiWithMocks; diff --git a/samples/client/petstore/javascript/test/run_tests.html b/samples/client/petstore/javascript/test/run_tests.html index c5655275cc52..58118d8d7d40 100644 --- a/samples/client/petstore/javascript/test/run_tests.html +++ b/samples/client/petstore/javascript/test/run_tests.html @@ -10,7 +10,6 @@ - + + + + + + + +