diff --git a/README.md b/README.md index 05ae20b06b..79ee9a6975 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ To build from source, you need the following installed and available in your $PA * [Java 7 or 8](http://java.oracle.com) -* [Apache maven 3.0.3 or greater](http://maven.apache.org/) +* [Apache maven 3.3.3 or greater](http://maven.apache.org/) #### OS X Users Don't forget to install Java 7 or 8. You probably have 1.6. @@ -740,6 +740,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [FH Münster - University of Applied Sciences](http://www.fh-muenster.de) - [LANDR Audio](https://www.landr.com/) - [LiveAgent](https://www.ladesk.com/) +- [Kuary](https://kuary.com/) - [nViso](http://www.nviso.ch/) - [Okiok](https://www.okiok.com) - [OSDN](https://osdn.jp) diff --git a/modules/swagger-codegen/src/main/resources/Java/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/pom.mustache index 42d6a1299e..f0dd8c213b 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pom.mustache @@ -171,7 +171,7 @@ UTF-8 - 1.5.4 + 1.5.8 1.18 2.4.2 2.3 diff --git a/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache index 491d800923..a46b1960a6 100644 --- a/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache @@ -111,7 +111,7 @@ 1.0.0 - 1.0.4-SNAPSHOT + 1.0.4 9.2.9.v20150224 1.0.1 4.8.2 diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pom.mustache index 14bbfaecb9..180450ce73 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pom.mustache @@ -168,7 +168,7 @@ - 1.5.7 + 1.5.8 9.2.9.v20150224 1.18.1 1.6.3 diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/pom.mustache index ad4c4e7655..3373c53b2c 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/pom.mustache @@ -145,7 +145,7 @@ - 1.5.7 + 1.5.8 9.2.9.v20150224 3.0.11.Final 1.6.3 diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom-j8-async.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom-j8-async.mustache index dc18ee3b7f..257a4611db 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom-j8-async.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom-j8-async.mustache @@ -159,7 +159,7 @@ - 1.5.7 + 1.5.8 9.2.9.v20150224 1.13 1.6.3 diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache index 4d5bceecc6..8cb969102e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache @@ -118,7 +118,7 @@ - 1.5.7 + 1.5.8 9.2.9.v20150224 1.13 1.6.3 diff --git a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache index 767e2a849f..633f2f0aeb 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache @@ -6,7 +6,7 @@ {{/appDescription}} This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: {{appVersion}} +- API version: {{appVersion}} - Package version: {{projectVersion}} - Build date: {{generatedDate}} - Build package: {{generatorClass}} diff --git a/modules/swagger-codegen/src/main/resources/akka-scala/pom.mustache b/modules/swagger-codegen/src/main/resources/akka-scala/pom.mustache index a547542ff2..b7bd04afff 100644 --- a/modules/swagger-codegen/src/main/resources/akka-scala/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/akka-scala/pom.mustache @@ -217,7 +217,7 @@ 2.3.9 1.2 2.2 - 1.5.7 + 1.5.8 1.0.0 4.8.1 diff --git a/modules/swagger-codegen/src/main/resources/android/build.mustache b/modules/swagger-codegen/src/main/resources/android/build.mustache index dff1897046..41c9a2dfbb 100644 --- a/modules/swagger-codegen/src/main/resources/android/build.mustache +++ b/modules/swagger-codegen/src/main/resources/android/build.mustache @@ -8,9 +8,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' + classpath 'com.android.tools.build:gradle:1.5.+' {{#useAndroidMavenGradlePlugin}} - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' {{/useAndroidMavenGradlePlugin}} } } @@ -28,11 +28,12 @@ apply plugin: 'com.github.dcendents.android-maven' {{/useAndroidMavenGradlePlugin}} android { - compileSdkVersion 22 - buildToolsVersion '22.0.0' + compileSdkVersion 23 + buildToolsVersion '23.0.2' + useLibrary 'org.apache.http.legacy' defaultConfig { minSdkVersion 14 - targetSdkVersion 22 + targetSdkVersion 23 } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 @@ -55,16 +56,17 @@ android { ext { swagger_annotations_version = "1.5.0" gson_version = "2.3.1" - httpclient_version = "4.3.3" - junit_version = "4.8.1" + httpclient_version = "4.5.2" + httpcore_version = "4.4.4" + junit_version = "4.12" } dependencies { compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "com.google.code.gson:gson:$gson_version" - compile "org.apache.httpcomponents:httpcore:$httpclient_version" + compile "org.apache.httpcomponents:httpcore:$httpcore_version" compile "org.apache.httpcomponents:httpclient:$httpclient_version" - compile ("org.apache.httpcomponents:httpcore:$httpclient_version") { + compile ("org.apache.httpcomponents:httpcore:$httpcore_version") { exclude(group: 'org.apache.httpcomponents', module: 'httpclient') } compile ("org.apache.httpcomponents:httpmime:$httpclient_version") { diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache index 4369613449..e76bf1357e 100644 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache @@ -197,7 +197,8 @@ public class ApiInvoker { INSTANCE.authentications.put("{{name}}", new HttpBasicAuth()); {{/isBasic}} {{#isOAuth}} - INSTANCE.authentications.put("{{name}}", new OAuth()); + // TODO: comment out below as OAuth does not exist + //INSTANCE.authentications.put("{{name}}", new OAuth()); {{/isOAuth}} {{/authMethods}} // Prevent the authentications from being modified. diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache index 197dd32b7c..fabdd14a6d 100644 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache @@ -8,9 +8,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' + classpath 'com.android.tools.build:gradle:1.5.+' {{#useAndroidMavenGradlePlugin}} - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' {{/useAndroidMavenGradlePlugin}} } } @@ -59,9 +59,10 @@ android { ext { swagger_annotations_version = "1.5.0" gson_version = "2.3.1" - httpclient_version = "4.3.3" + httpclient_version = "4.5.2" + httpcore_version = "4.4.4" volley_version = "1.0.19" - junit_version = "4.8.1" + junit_version = "4.12" robolectric_version = "3.0" concurrent_unit_version = "0.4.2" } diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache index c9636d2ffd..f9c492a28e 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache @@ -25,6 +25,7 @@ namespace {{packageName}}.Client /// Temp folder path /// DateTime format string /// HTTP connection timeout (in milliseconds) + /// HTTP user agent public Configuration(ApiClient apiClient = null, Dictionary defaultHeader = null, string username = null, diff --git a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache index 3a2a93cd10..d882e33595 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache @@ -1,6 +1,6 @@ -public enum {{vendorExtensions.plainDatatypeWithEnum}} { + public enum {{vendorExtensions.plainDatatypeWithEnum}} { {{#allowableValues}}{{#enumVars}} [EnumMember(Value = "{{jsonname}}")] {{name}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}} - } \ No newline at end of file + } diff --git a/modules/swagger-codegen/src/main/resources/csharp/model.mustache b/modules/swagger-codegen/src/main/resources/csharp/model.mustache index f1f9b7c975..347834f329 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/model.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/model.mustache @@ -20,9 +20,13 @@ namespace {{packageName}}.Model public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}> { {{#vars}}{{#isEnum}} + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + /// {{#description}} + /// {{{description}}}{{/description}} [JsonConverter(typeof(StringEnumConverter))] - {{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} - {{>enumClass}}{{/items}}{{/items.isEnum}}{{/vars}} +{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} +{{>enumClass}}{{/items}}{{/items.isEnum}}{{/vars}} {{#vars}}{{#isEnum}} /// /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} diff --git a/modules/swagger-codegen/src/main/resources/perl/README.mustache b/modules/swagger-codegen/src/main/resources/perl/README.mustache index 185859ec4a..630a0a5979 100644 --- a/modules/swagger-codegen/src/main/resources/perl/README.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/README.mustache @@ -8,7 +8,7 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: {{appVersion}} +- API version: {{appVersion}} - Package version: {{moduleVersion}} - Build date: {{generatedDate}} - Build package: {{generatorClass}} diff --git a/modules/swagger-codegen/src/main/resources/php/README.mustache b/modules/swagger-codegen/src/main/resources/php/README.mustache index 4088ddf1fb..8275c4c9d7 100644 --- a/modules/swagger-codegen/src/main/resources/php/README.mustache +++ b/modules/swagger-codegen/src/main/resources/php/README.mustache @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: {{appVersion}} +- API version: {{appVersion}} - Package version: {{artifactVersion}} - Build date: {{generatedDate}} - Build package: {{generatorClass}} diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 0793335193..b58af994c2 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -114,6 +114,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA */ public function __construct(array $data = null) { + {{#parent}}parent::__construct($data);{{/parent}} if ($data != null) { {{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}} {{/hasMore}}{{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/ruby/README.mustache b/modules/swagger-codegen/src/main/resources/ruby/README.mustache index 3566329c24..164285e153 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/README.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/README.mustache @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: {{appVersion}} +- API version: {{appVersion}} - Package version: {{gemVersion}} - Build date: {{generatedDate}} - Build package: {{generatorClass}} diff --git a/modules/swagger-codegen/src/main/resources/scala/pom.mustache b/modules/swagger-codegen/src/main/resources/scala/pom.mustache index b3260b9fd6..51256c4249 100644 --- a/modules/swagger-codegen/src/main/resources/scala/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/scala/pom.mustache @@ -210,7 +210,7 @@ 1.2 2.2 1.19 - 1.5.7 + 1.5.8 1.0.5 1.0.0 2.4.2 diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.json b/modules/swagger-codegen/src/test/resources/2_0/petstore.json index ad042ee387..f248a42a49 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -1339,6 +1339,42 @@ "xml": { "name": "Name" } + }, + "Dog" : { + "allOf" : [ { + "$ref" : "#/definitions/Animal" + }, { + "type" : "object", + "properties" : { + "breed" : { + "type" : "string" + } + } + } ] + }, + "Cat" : { + "allOf" : [ { + "$ref" : "#/definitions/Animal" + }, { + "type" : "object", + "properties" : { + "declawed" : { + "type" : "boolean" + } + } + } ] + }, + "Animal" : { + "type" : "object", + "discriminator": "className", + "required": [ + "className" + ], + "properties" : { + "className" : { + "type" : "string" + } + } } } } diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/online/Generator.java b/modules/swagger-generator/src/main/java/io/swagger/generator/online/Generator.java index 9b721d36a4..0ecd2756fb 100644 --- a/modules/swagger-generator/src/main/java/io/swagger/generator/online/Generator.java +++ b/modules/swagger-generator/src/main/java/io/swagger/generator/online/Generator.java @@ -90,10 +90,19 @@ public class Generator { throw new BadRequestException("The swagger specification supplied was not valid"); } + String destPath = null; + + if(opts != null && opts.getOptions() != null) { + destPath = opts.getOptions().get("outputFolder"); + } + if(destPath == null) { + destPath = language + "-" + + type.getTypeName(); + } + ClientOptInput clientOptInput = new ClientOptInput(); ClientOpts clientOpts = new ClientOpts(); - String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + language + "-" - + type.getTypeName(); + String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + destPath; String outputFilename = outputFolder + "-bundle.zip"; clientOptInput diff --git a/pom.xml b/pom.xml index f7342ca314..c308b2dfac 100644 --- a/pom.xml +++ b/pom.xml @@ -559,7 +559,7 @@ - 1.0.18-SNAPSHOT + 1.0.18 2.11.1 2.3.4 1.5.8 diff --git a/samples/client/petstore/android/default/build.gradle b/samples/client/petstore/android/default/build.gradle index 417503cb51..e48f72b313 100644 --- a/samples/client/petstore/android/default/build.gradle +++ b/samples/client/petstore/android/default/build.gradle @@ -6,9 +6,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' + classpath 'com.android.tools.build:gradle:1.5.+' - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' } } @@ -24,11 +24,12 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 22 - buildToolsVersion '22.0.0' + compileSdkVersion 23 + buildToolsVersion '23.0.2' + useLibrary 'org.apache.http.legacy' defaultConfig { minSdkVersion 14 - targetSdkVersion 22 + targetSdkVersion 23 } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 @@ -51,16 +52,17 @@ android { ext { swagger_annotations_version = "1.5.0" gson_version = "2.3.1" - httpclient_version = "4.3.3" - junit_version = "4.8.1" + httpclient_version = "4.5.2" + httpcore_version = "4.4.4" + junit_version = "4.12" } dependencies { compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "com.google.code.gson:gson:$gson_version" - compile "org.apache.httpcomponents:httpcore:$httpclient_version" + compile "org.apache.httpcomponents:httpcore:$httpcore_version" compile "org.apache.httpcomponents:httpclient:$httpclient_version" - compile ("org.apache.httpcomponents:httpcore:$httpclient_version") { + compile ("org.apache.httpcomponents:httpcore:$httpcore_version") { exclude(group: 'org.apache.httpcomponents', module: 'httpclient') } compile ("org.apache.httpcomponents:httpmime:$httpclient_version") { diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java index 5c308de749..9763aca7b3 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java @@ -10,6 +10,8 @@ public class Name { @SerializedName("name") private Integer name = null; + @SerializedName("snake_case") + private Integer snakeCase = null; /** @@ -23,6 +25,17 @@ public class Name { } + /** + **/ + @ApiModelProperty(value = "") + public Integer getSnakeCase() { + return snakeCase; + } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + @Override public String toString() { @@ -30,6 +43,7 @@ public class Name { sb.append("class Name {\n"); sb.append(" name: ").append(name).append("\n"); + sb.append(" snakeCase: ").append(snakeCase).append("\n"); sb.append("}\n"); return sb.toString(); } diff --git a/samples/client/petstore/android/volley/build.gradle b/samples/client/petstore/android/volley/build.gradle index 799f9309a2..e678620cb0 100644 --- a/samples/client/petstore/android/volley/build.gradle +++ b/samples/client/petstore/android/volley/build.gradle @@ -6,9 +6,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' + classpath 'com.android.tools.build:gradle:1.5.0' - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' } } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java index 86a0d6cb2d..21ee5f3628 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java @@ -229,7 +229,8 @@ public class ApiInvoker { - INSTANCE.authentications.put("petstore_auth", new OAuth()); + // TODO: comment out below as OAuth does not exist + //INSTANCE.authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java index 5c308de749..9763aca7b3 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java @@ -10,6 +10,8 @@ public class Name { @SerializedName("name") private Integer name = null; + @SerializedName("snake_case") + private Integer snakeCase = null; /** @@ -23,6 +25,17 @@ public class Name { } + /** + **/ + @ApiModelProperty(value = "") + public Integer getSnakeCase() { + return snakeCase; + } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + @Override public String toString() { @@ -30,6 +43,7 @@ public class Name { sb.append("class Name {\n"); sb.append(" name: ").append(name).append("\n"); + sb.append(" snakeCase: ").append(snakeCase).append("\n"); sb.append("}\n"); return sb.toString(); } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs index 4937b2affa..561197ab9f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs @@ -60,6 +60,15 @@ namespace IO.Swagger.Test // TODO: unit test for the property '_Name' } + /// + /// Test the property 'SnakeCase' + /// + [Test] + public void SnakeCaseTest() + { + // TODO: unit test for the property 'SnakeCase' + } + } 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 3e9ea2c036..4d04d5770e 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 @@ -25,6 +25,7 @@ namespace IO.Swagger.Client /// Temp folder path /// DateTime format string /// HTTP connection timeout (in milliseconds) + /// HTTP user agent public Configuration(ApiClient apiClient = null, Dictionary defaultHeader = null, string username = null, diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs new file mode 100644 index 0000000000..0d5bbd4aa6 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs @@ -0,0 +1,121 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// + /// + [DataContract] + public partial class Animal : IEquatable + { + + /// + /// Initializes a new instance of the class. + /// Initializes a new instance of the class. + /// + /// ClassName (required). + + public Animal(string ClassName = null) + { + // to ensure "ClassName" is required (not null) + if (ClassName == null) + { + throw new InvalidDataException("ClassName is a required property for Animal and cannot be null"); + } + else + { + this.ClassName = ClassName; + } + + } + + + /// + /// Gets or Sets ClassName + /// + [DataMember(Name="className", EmitDefaultValue=false)] + public string ClassName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Animal {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as Animal); + } + + /// + /// Returns true if Animal instances are equal + /// + /// Instance of Animal to be compared + /// Boolean + public bool Equals(Animal other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.ClassName == other.ClassName || + this.ClassName != null && + this.ClassName.Equals(other.ClassName) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this.ClassName != null) + hash = hash * 59 + this.ClassName.GetHashCode(); + + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs new file mode 100644 index 0000000000..8d62273892 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs @@ -0,0 +1,138 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// + /// + [DataContract] + public partial class Cat : Animal, IEquatable + { + + /// + /// Initializes a new instance of the class. + /// Initializes a new instance of the class. + /// + /// ClassName (required). + /// Declawed. + + public Cat(string ClassName = null, bool? Declawed = null) + { + // to ensure "ClassName" is required (not null) + if (ClassName == null) + { + throw new InvalidDataException("ClassName is a required property for Cat and cannot be null"); + } + else + { + this.ClassName = ClassName; + } + this.Declawed = Declawed; + + } + + + /// + /// Gets or Sets ClassName + /// + [DataMember(Name="className", EmitDefaultValue=false)] + public string ClassName { get; set; } + + /// + /// Gets or Sets Declawed + /// + [DataMember(Name="declawed", EmitDefaultValue=false)] + public bool? Declawed { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Cat {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public new string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as Cat); + } + + /// + /// Returns true if Cat instances are equal + /// + /// Instance of Cat to be compared + /// Boolean + public bool Equals(Cat other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.ClassName == other.ClassName || + this.ClassName != null && + this.ClassName.Equals(other.ClassName) + ) && + ( + this.Declawed == other.Declawed || + this.Declawed != null && + this.Declawed.Equals(other.Declawed) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this.ClassName != null) + hash = hash * 59 + this.ClassName.GetHashCode(); + + if (this.Declawed != null) + hash = hash * 59 + this.Declawed.GetHashCode(); + + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs new file mode 100644 index 0000000000..2308b7488f --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs @@ -0,0 +1,138 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// + /// + [DataContract] + public partial class Dog : Animal, IEquatable + { + + /// + /// Initializes a new instance of the class. + /// Initializes a new instance of the class. + /// + /// ClassName (required). + /// Breed. + + public Dog(string ClassName = null, string Breed = null) + { + // to ensure "ClassName" is required (not null) + if (ClassName == null) + { + throw new InvalidDataException("ClassName is a required property for Dog and cannot be null"); + } + else + { + this.ClassName = ClassName; + } + this.Breed = Breed; + + } + + + /// + /// Gets or Sets ClassName + /// + [DataMember(Name="className", EmitDefaultValue=false)] + public string ClassName { get; set; } + + /// + /// Gets or Sets Breed + /// + [DataMember(Name="breed", EmitDefaultValue=false)] + public string Breed { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Dog {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" Breed: ").Append(Breed).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public new string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as Dog); + } + + /// + /// Returns true if Dog instances are equal + /// + /// Instance of Dog to be compared + /// Boolean + public bool Equals(Dog other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.ClassName == other.ClassName || + this.ClassName != null && + this.ClassName.Equals(other.ClassName) + ) && + ( + this.Breed == other.Breed || + this.Breed != null && + this.Breed.Equals(other.Breed) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this.ClassName != null) + hash = hash * 59 + this.ClassName.GetHashCode(); + + if (this.Breed != null) + hash = hash * 59 + this.Breed.GetHashCode(); + + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs index 53d161c1ab..8889cdae0a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs @@ -18,6 +18,10 @@ namespace IO.Swagger.Model public partial class InlineResponse200 : IEquatable { + /// + /// pet status in the store + /// + /// pet status in the store [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { @@ -30,6 +34,7 @@ namespace IO.Swagger.Model [EnumMember(Value = "sold")] Sold } + /// /// pet status in the store diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs index 3c8ccadced..55fd01dfb9 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs @@ -23,10 +23,12 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// /// _Name. + /// SnakeCase. - public Name(int? _Name = null) + public Name(int? _Name = null, int? SnakeCase = null) { this._Name = _Name; + this.SnakeCase = SnakeCase; } @@ -37,6 +39,12 @@ namespace IO.Swagger.Model [DataMember(Name="name", EmitDefaultValue=false)] public int? _Name { get; set; } + /// + /// Gets or Sets SnakeCase + /// + [DataMember(Name="snake_case", EmitDefaultValue=false)] + public int? SnakeCase { get; set; } + /// /// Returns the string presentation of the object /// @@ -46,6 +54,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Name {\n"); sb.Append(" _Name: ").Append(_Name).Append("\n"); + sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -87,6 +96,11 @@ namespace IO.Swagger.Model this._Name == other._Name || this._Name != null && this._Name.Equals(other._Name) + ) && + ( + this.SnakeCase == other.SnakeCase || + this.SnakeCase != null && + this.SnakeCase.Equals(other.SnakeCase) ); } @@ -105,6 +119,9 @@ namespace IO.Swagger.Model if (this._Name != null) hash = hash * 59 + this._Name.GetHashCode(); + if (this.SnakeCase != null) + hash = hash * 59 + this.SnakeCase.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs index 4fc561c678..db712c9818 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs @@ -18,6 +18,10 @@ namespace IO.Swagger.Model public partial class Order : IEquatable { + /// + /// Order Status + /// + /// Order Status [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { @@ -30,6 +34,7 @@ namespace IO.Swagger.Model [EnumMember(Value = "delivered")] Delivered } + /// /// Order Status diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs index b206c3fa55..5d30c24af7 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs @@ -18,6 +18,10 @@ namespace IO.Swagger.Model public partial class Pet : IEquatable { + /// + /// pet status in the store + /// + /// pet status in the store [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { @@ -30,6 +34,7 @@ namespace IO.Swagger.Model [EnumMember(Value = "sold")] Sold } + /// /// pet status in the store diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index e92a0ffc06..c507559e57 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -2,7 +2,7 @@ - + diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index 2c2f6f169b..3fc0c158a2 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -1,69 +1,76 @@ # swagger-petstore SwaggerPetstore - JavaScript client for swagger-petstore +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -Version: 1.0.0 - -Automatically generated by the JavaScript Swagger Codegen project: - -- Build date: 2016-03-18T15:44:17.513Z +- API version: 1.0.0 +- Package version: 1.0.0 +- Build date: 2016-03-30T20:58:13.565+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation -### Use in [Node.js](https://nodejs.org/) +### For [Node.js](https://nodejs.org/) -The generated client is valid [npm](https://www.npmjs.com/) package, you can publish it as described -in [Publishing npm packages](https://docs.npmjs.com/getting-started/publishing-npm-packages). +#### npm -After that, you can install it into your project via: +To publish the library as a [npm](https://www.npmjs.com/), +please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages). + +Then install it via: ```shell npm install swagger-petstore --save ``` -You can also host the generated client as a git repository on github, e.g. -https://github.com/YOUR_USERNAME/swagger-petstore - -Then you can install it via: +#### git +# +If the library is hosted at a git repository, e.g. +https://github.com/YOUR_USERNAME/YOUR_GIT_REPO_ID +then install it via: ```shell -npm install YOUR_USERNAME/swagger-petstore --save +npm install YOUR_USERNAME/YOUR_GIT_REPO_ID --save ``` -### Use in browser with [browserify](http://browserify.org/) +### For browser -The client also works in browser environment via npm and browserify. After following +The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following the above steps with Node.js and installing browserify with `npm install -g browserify`, -you can do this in your project (assuming *main.js* is your entry file): +perform the following (assuming *main.js* is your entry file): ```shell browserify main.js > bundle.js ``` -The generated *bundle.js* can now be included in your HTML pages. +Then include *bundle.js* in the HTML pages. ## Getting Started +Please follow the [installation](#installation) instruction and execute the following JS code: + ```javascript var SwaggerPetstore = require('swagger-petstore'); var defaultClient = SwaggerPetstore.ApiClient.default; -defaultClient.timeout = 10 * 1000; -defaultClient.defaultHeaders['Test-Header'] = 'test_value'; -// Assuming there's a `PetApi` containing a `getPetById` method -// which returns a model object: -var api = new SwaggerPetstore.PetApi(); -api.getPetById(2, function(err, pet, resp) { - console.log('HTTP status code: ' + resp.status); - console.log('Response Content-Type: ' + resp.get('Content-Type')); - if (err) { - console.error(err); - } else { - console.log(pet); - } +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var opts = { + 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store +}; +api.addPet(opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); }); + + ``` ## Documentation for API Endpoints @@ -101,7 +108,10 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [SwaggerPetstore.Animal](docs/Animal.md) + - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) + - [SwaggerPetstore.Dog](docs/Dog.md) - [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md) - [SwaggerPetstore.Model200Response](docs/Model200Response.md) - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) diff --git a/samples/client/petstore/javascript-promise/docs/Animal.md b/samples/client/petstore/javascript-promise/docs/Animal.md new file mode 100644 index 0000000000..c37d95695a --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Animal.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | + + diff --git a/samples/client/petstore/javascript-promise/docs/Cat.md b/samples/client/petstore/javascript-promise/docs/Cat.md new file mode 100644 index 0000000000..8cd391bc91 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Cat.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Boolean** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/Dog.md b/samples/client/petstore/javascript-promise/docs/Dog.md new file mode 100644 index 0000000000..9253eace01 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Dog.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/InlineResponse200.md b/samples/client/petstore/javascript-promise/docs/InlineResponse200.md index 66a4605e2c..bbb11067e9 100644 --- a/samples/client/petstore/javascript-promise/docs/InlineResponse200.md +++ b/samples/client/petstore/javascript-promise/docs/InlineResponse200.md @@ -1,4 +1,3 @@ - # SwaggerPetstore.InlineResponse200 ## Properties diff --git a/samples/client/petstore/javascript-promise/docs/Name.md b/samples/client/petstore/javascript-promise/docs/Name.md index 114d6dc980..5086f6c5a3 100644 --- a/samples/client/petstore/javascript-promise/docs/Name.md +++ b/samples/client/petstore/javascript-promise/docs/Name.md @@ -4,5 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | [optional] +**snakeCase** | **Integer** | | [optional] diff --git a/samples/client/petstore/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md index 9e14ea0c81..77d9630f88 100644 --- a/samples/client/petstore/javascript-promise/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise/docs/PetApi.md @@ -1,4 +1,3 @@ - # SwaggerPetstore.PetApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -35,12 +34,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var opts = { 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store }; -api.addPet(opts).then(function() { +apiInstance.addPet(opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -84,12 +83,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var opts = { 'body': "B" // {String} Pet object in the form of byte array }; -api.addPetUsingByteArray(opts).then(function() { +apiInstance.addPetUsingByteArray(opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -133,14 +132,14 @@ var defaultClient = SwaggerPetstore.ApiClient.default; var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var petId = 789; // {Integer} Pet id to delete var opts = { 'apiKey': "apiKey_example" // {String} }; -api.deletePet(petId, opts).then(function() { +apiInstance.deletePet(petId, opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -185,12 +184,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var opts = { 'status': ["available"] // {[String]} Status values that need to be considered for query }; -api.findPetsByStatus(opts).then(function(data) { +apiInstance.findPetsByStatus(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -234,12 +233,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var opts = { 'tags': ["tags_example"] // {[String]} Tags to filter by }; -api.findPetsByTags(opts).then(function(data) { +apiInstance.findPetsByTags(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -289,11 +288,11 @@ api_key.apiKey = "YOUR API KEY" var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var petId = 789; // {Integer} ID of pet that needs to be fetched -api.getPetById(petId).then(function(data) { +apiInstance.getPetById(petId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -343,11 +342,11 @@ api_key.apiKey = "YOUR API KEY" var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var petId = 789; // {Integer} ID of pet that needs to be fetched -api.getPetByIdInObject(petId).then(function(data) { +apiInstance.getPetByIdInObject(petId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -397,11 +396,11 @@ api_key.apiKey = "YOUR API KEY" var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var petId = 789; // {Integer} ID of pet that needs to be fetched -api.petPetIdtestingByteArraytrueGet(petId).then(function(data) { +apiInstance.petPetIdtestingByteArraytrueGet(petId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -445,12 +444,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var opts = { 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store }; -api.updatePet(opts).then(function() { +apiInstance.updatePet(opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -494,7 +493,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default; var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var petId = "petId_example"; // {String} ID of pet that needs to be updated @@ -502,7 +501,7 @@ var opts = { 'name': "name_example", // {String} Updated name of the pet 'status': "status_example" // {String} Updated status of the pet }; -api.updatePetWithForm(petId, opts).then(function() { +apiInstance.updatePetWithForm(petId, opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -548,7 +547,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default; var petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = "YOUR ACCESS TOKEN" -var api = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi() var petId = 789; // {Integer} ID of pet to update @@ -556,7 +555,7 @@ var opts = { 'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server 'file': "/path/to/file.txt" // {File} file to upload }; -api.uploadFile(petId, opts).then(function() { +apiInstance.uploadFile(petId, opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); diff --git a/samples/client/petstore/javascript-promise/docs/StoreApi.md b/samples/client/petstore/javascript-promise/docs/StoreApi.md index 53e4ffd5bc..930586a96f 100644 --- a/samples/client/petstore/javascript-promise/docs/StoreApi.md +++ b/samples/client/petstore/javascript-promise/docs/StoreApi.md @@ -1,4 +1,3 @@ - # SwaggerPetstore.StoreApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -25,11 +24,11 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```javascript var SwaggerPetstore = require('swagger-petstore'); -var api = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi() var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted -api.deleteOrder(orderId).then(function() { +apiInstance.deleteOrder(orderId).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -81,12 +80,12 @@ test_api_client_secret.apiKey = "YOUR API KEY" // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" -var api = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi() var opts = { 'status': "placed" // {String} Status value that needs to be considered for query }; -api.findOrdersByStatus(opts).then(function(data) { +apiInstance.findOrdersByStatus(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -132,8 +131,8 @@ api_key.apiKey = "YOUR API KEY" // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.apiKeyPrefix['api_key'] = "Token" -var api = new SwaggerPetstore.StoreApi() -api.getInventory().then(function(data) { +var apiInstance = new SwaggerPetstore.StoreApi() +apiInstance.getInventory().then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -176,8 +175,8 @@ api_key.apiKey = "YOUR API KEY" // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.apiKeyPrefix['api_key'] = "Token" -var api = new SwaggerPetstore.StoreApi() -api.getInventoryInObject().then(function(data) { +var apiInstance = new SwaggerPetstore.StoreApi() +apiInstance.getInventoryInObject().then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -226,11 +225,11 @@ test_api_key_query.apiKey = "YOUR API KEY" // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token" -var api = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi() var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched -api.getOrderById(orderId).then(function(data) { +apiInstance.getOrderById(orderId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -282,12 +281,12 @@ test_api_client_secret.apiKey = "YOUR API KEY" // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" -var api = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi() var opts = { 'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet }; -api.placeOrder(opts).then(function(data) { +apiInstance.placeOrder(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md index 1a401b698d..1c14b70823 100644 --- a/samples/client/petstore/javascript-promise/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -26,12 +26,12 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var api = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi() var opts = { 'body': new SwaggerPetstore.User() // {User} Created user object }; -api.createUser(opts).then(function() { +apiInstance.createUser(opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -70,12 +70,12 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var api = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi() var opts = { 'body': [new SwaggerPetstore.User()] // {[User]} List of user object }; -api.createUsersWithArrayInput(opts).then(function() { +apiInstance.createUsersWithArrayInput(opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -114,12 +114,12 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var api = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi() var opts = { 'body': [new SwaggerPetstore.User()] // {[User]} List of user object }; -api.createUsersWithListInput(opts).then(function() { +apiInstance.createUsersWithListInput(opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -164,11 +164,11 @@ var test_http_basic = defaultClient.authentications['test_http_basic']; test_http_basic.username = 'YOUR USERNAME' test_http_basic.password = 'YOUR PASSWORD' -var api = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi() var username = "username_example"; // {String} The name that needs to be deleted -api.deleteUser(username).then(function() { +apiInstance.deleteUser(username).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -207,11 +207,11 @@ Get user by user name ```javascript var SwaggerPetstore = require('swagger-petstore'); -var api = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi() var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing. -api.getUserByName(username).then(function(data) { +apiInstance.getUserByName(username).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -250,13 +250,13 @@ Logs user into the system ```javascript var SwaggerPetstore = require('swagger-petstore'); -var api = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi() var opts = { 'username': "username_example", // {String} The user name for login 'password': "password_example" // {String} The password for login in clear text }; -api.loginUser(opts).then(function(data) { +apiInstance.loginUser(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -296,8 +296,8 @@ Logs out current logged in user session ```javascript var SwaggerPetstore = require('swagger-petstore'); -var api = new SwaggerPetstore.UserApi() -api.logoutUser().then(function() { +var apiInstance = new SwaggerPetstore.UserApi() +apiInstance.logoutUser().then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -333,14 +333,14 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var api = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi() var username = "username_example"; // {String} name that need to be deleted var opts = { 'body': new SwaggerPetstore.User() // {User} Updated user object }; -api.updateUser(username, opts).then(function() { +apiInstance.updateUser(username, opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 6166cf35cb..520791b3f0 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -25,7 +25,7 @@ * Constructs a new PetApi. * @alias module:api/PetApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance} + * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} * if unspecified. */ var exports = function(apiClient) { @@ -144,7 +144,7 @@ * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param {Object} opts Optional parameters - * @param {Array.} opts.status Status values that need to be considered for query + * @param {Array.} opts.status Status values that need to be considered for query (default to available) * data is of type: {Array.} */ this.findPetsByStatus = function(opts) { diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index c94b6c8169..32a6dce47e 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -25,7 +25,7 @@ * Constructs a new StoreApi. * @alias module:api/StoreApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance} + * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} * if unspecified. */ var exports = function(apiClient) { @@ -40,11 +40,6 @@ */ this.deleteOrder = function(orderId) { var postBody = null; - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw "Missing the required parameter 'orderId' when calling deleteOrder"; - } - // verify the required parameter 'orderId' is set if (orderId == undefined || orderId == null) { @@ -79,7 +74,7 @@ * Finds orders by status * A single status value can be provided as a string * @param {Object} opts Optional parameters - * @param {module:model/String} opts.status Status value that needs to be considered for query + * @param {module:model/String} opts.status Status value that needs to be considered for query (default to placed) * data is of type: {Array.} */ this.findOrdersByStatus = function(opts) { diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index b869274285..8914d9c883 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -25,7 +25,7 @@ * Constructs a new UserApi. * @alias module:api/UserApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance} + * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} * if unspecified. */ var exports = function(apiClient) { @@ -139,11 +139,6 @@ */ this.deleteUser = function(username) { var postBody = null; - // verify the required parameter 'username' is set - if (username == null) { - throw "Missing the required parameter 'username' when calling deleteUser"; - } - // verify the required parameter 'username' is set if (username == undefined || username == null) { @@ -182,11 +177,6 @@ */ this.getUserByName = function(username) { var postBody = null; - // verify the required parameter 'username' is set - if (username == null) { - throw "Missing the required parameter 'username' when calling getUserByName"; - } - // verify the required parameter 'username' is set if (username == undefined || username == null) { diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index 4c0cd3040c..da193f80e4 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -1,12 +1,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['./ApiClient', './model/Animal', './model/Cat', './model/Category', './model/Dog', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Category, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Animal, Cat, Category, Dog, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -46,11 +46,26 @@ * @property {module:ApiClient} */ ApiClient: ApiClient, + /** + * The Animal model constructor. + * @property {module:model/Animal} + */ + Animal: Animal, + /** + * The Cat model constructor. + * @property {module:model/Cat} + */ + Cat: Cat, /** * The Category model constructor. * @property {module:model/Category} */ Category: Category, + /** + * The Dog model constructor. + * @property {module:model/Dog} + */ + Dog: Dog, /** * The InlineResponse200 model constructor. * @property {module:model/InlineResponse200} diff --git a/samples/client/petstore/javascript-promise/src/model/Animal.js b/samples/client/petstore/javascript-promise/src/model/Animal.js new file mode 100644 index 0000000000..674471a30e --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/Animal.js @@ -0,0 +1,63 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Animal = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + /** + * The Animal model module. + * @module model/Animal + * @version 1.0.0 + */ + + /** + * Constructs a new Animal. + * @alias module:model/Animal + * @class + * @param className + */ + var exports = function(className) { + + this['className'] = className; + }; + + /** + * Constructs a Animal from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Animal} obj Optional instance to populate. + * @return {module:model/Animal} The populated Animal instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + if (data.hasOwnProperty('className')) { + obj['className'] = ApiClient.convertToType(data['className'], 'String'); + } + } + return obj; + } + + + /** + * @member {String} className + */ + exports.prototype['className'] = undefined; + + + + + return exports; +})); diff --git a/samples/client/petstore/javascript-promise/src/model/Cat.js b/samples/client/petstore/javascript-promise/src/model/Cat.js new file mode 100644 index 0000000000..c878af6ede --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/Cat.js @@ -0,0 +1,67 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient', './Animal'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./Animal')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Cat = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); + } +}(this, function(ApiClient, Animal) { + 'use strict'; + + /** + * The Cat model module. + * @module model/Cat + * @version 1.0.0 + */ + + /** + * Constructs a new Cat. + * @alias module:model/Cat + * @class + * @extends module:model/Animal + * @param className + */ + var exports = function(className) { + Animal.call(this, className); + + }; + + /** + * Constructs a Cat from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Cat} obj Optional instance to populate. + * @return {module:model/Cat} The populated Cat instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + Animal.constructFromObject(data, obj); + if (data.hasOwnProperty('declawed')) { + obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean'); + } + } + return obj; + } + + exports.prototype = Object.create(Animal.prototype); + exports.prototype.constructor = exports; + + + /** + * @member {Boolean} declawed + */ + exports.prototype['declawed'] = undefined; + + + + + return exports; +})); diff --git a/samples/client/petstore/javascript-promise/src/model/Dog.js b/samples/client/petstore/javascript-promise/src/model/Dog.js new file mode 100644 index 0000000000..e5e55581a7 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/Dog.js @@ -0,0 +1,67 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient', './Animal'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./Animal')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Dog = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); + } +}(this, function(ApiClient, Animal) { + 'use strict'; + + /** + * The Dog model module. + * @module model/Dog + * @version 1.0.0 + */ + + /** + * Constructs a new Dog. + * @alias module:model/Dog + * @class + * @extends module:model/Animal + * @param className + */ + var exports = function(className) { + Animal.call(this, className); + + }; + + /** + * Constructs a Dog from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Dog} obj Optional instance to populate. + * @return {module:model/Dog} The populated Dog instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + Animal.constructFromObject(data, obj); + if (data.hasOwnProperty('breed')) { + obj['breed'] = ApiClient.convertToType(data['breed'], 'String'); + } + } + return obj; + } + + exports.prototype = Object.create(Animal.prototype); + exports.prototype.constructor = exports; + + + /** + * @member {String} breed + */ + exports.prototype['breed'] = undefined; + + + + + return exports; +})); diff --git a/samples/client/petstore/javascript-promise/src/model/Name.js b/samples/client/petstore/javascript-promise/src/model/Name.js index 20aa186bd9..a5a070025f 100644 --- a/samples/client/petstore/javascript-promise/src/model/Name.js +++ b/samples/client/petstore/javascript-promise/src/model/Name.js @@ -29,6 +29,7 @@ var exports = function() { + }; /** @@ -45,6 +46,9 @@ if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'Integer'); } + if (data.hasOwnProperty('snake_case')) { + obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Integer'); + } } return obj; } @@ -55,6 +59,11 @@ */ exports.prototype['name'] = undefined; + /** + * @member {Integer} snake_case + */ + exports.prototype['snake_case'] = undefined; + diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 268b09738f..0867d3ec1d 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -4,9 +4,9 @@ SwaggerPetstore - JavaScript client for swagger-petstore This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: 1.0.0 +- API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-03-18T18:26:17.121+08:00 +- Build date: 2016-03-30T20:58:07.996+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -111,7 +111,10 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [SwaggerPetstore.Animal](docs/Animal.md) + - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) + - [SwaggerPetstore.Dog](docs/Dog.md) - [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md) - [SwaggerPetstore.Model200Response](docs/Model200Response.md) - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) diff --git a/samples/client/petstore/javascript/docs/Animal.md b/samples/client/petstore/javascript/docs/Animal.md new file mode 100644 index 0000000000..c37d95695a --- /dev/null +++ b/samples/client/petstore/javascript/docs/Animal.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | + + diff --git a/samples/client/petstore/javascript/docs/Cat.md b/samples/client/petstore/javascript/docs/Cat.md new file mode 100644 index 0000000000..8cd391bc91 --- /dev/null +++ b/samples/client/petstore/javascript/docs/Cat.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Boolean** | | [optional] + + diff --git a/samples/client/petstore/javascript/docs/Dog.md b/samples/client/petstore/javascript/docs/Dog.md new file mode 100644 index 0000000000..9253eace01 --- /dev/null +++ b/samples/client/petstore/javascript/docs/Dog.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + + diff --git a/samples/client/petstore/javascript/docs/Name.md b/samples/client/petstore/javascript/docs/Name.md index 114d6dc980..5086f6c5a3 100644 --- a/samples/client/petstore/javascript/docs/Name.md +++ b/samples/client/petstore/javascript/docs/Name.md @@ -4,5 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | [optional] +**snakeCase** | **Integer** | | [optional] diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index dc847f464c..3bfc6ffd4f 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -25,11 +25,7 @@ * Constructs a new PetApi. * @alias module:api/PetApi * @class -<<<<<<< HEAD - * @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance} -======= * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} ->>>>>>> update js doc * if unspecified. */ var exports = function(apiClient) { @@ -179,11 +175,7 @@ * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param {Object} opts Optional parameters -<<<<<<< HEAD - * @param {Array.} opts.status Status values that need to be considered for query -======= * @param {Array.} opts.status Status values that need to be considered for query (default to available) ->>>>>>> update js doc * @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {Array.} */ diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index 4c0cd3040c..da193f80e4 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,12 +1,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['./ApiClient', './model/Animal', './model/Cat', './model/Category', './model/Dog', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Category, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Animal, Cat, Category, Dog, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -46,11 +46,26 @@ * @property {module:ApiClient} */ ApiClient: ApiClient, + /** + * The Animal model constructor. + * @property {module:model/Animal} + */ + Animal: Animal, + /** + * The Cat model constructor. + * @property {module:model/Cat} + */ + Cat: Cat, /** * The Category model constructor. * @property {module:model/Category} */ Category: Category, + /** + * The Dog model constructor. + * @property {module:model/Dog} + */ + Dog: Dog, /** * The InlineResponse200 model constructor. * @property {module:model/InlineResponse200} diff --git a/samples/client/petstore/javascript/src/model/Animal.js b/samples/client/petstore/javascript/src/model/Animal.js new file mode 100644 index 0000000000..674471a30e --- /dev/null +++ b/samples/client/petstore/javascript/src/model/Animal.js @@ -0,0 +1,63 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Animal = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + /** + * The Animal model module. + * @module model/Animal + * @version 1.0.0 + */ + + /** + * Constructs a new Animal. + * @alias module:model/Animal + * @class + * @param className + */ + var exports = function(className) { + + this['className'] = className; + }; + + /** + * Constructs a Animal from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Animal} obj Optional instance to populate. + * @return {module:model/Animal} The populated Animal instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + if (data.hasOwnProperty('className')) { + obj['className'] = ApiClient.convertToType(data['className'], 'String'); + } + } + return obj; + } + + + /** + * @member {String} className + */ + exports.prototype['className'] = undefined; + + + + + return exports; +})); diff --git a/samples/client/petstore/javascript/src/model/Cat.js b/samples/client/petstore/javascript/src/model/Cat.js new file mode 100644 index 0000000000..c878af6ede --- /dev/null +++ b/samples/client/petstore/javascript/src/model/Cat.js @@ -0,0 +1,67 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient', './Animal'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./Animal')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Cat = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); + } +}(this, function(ApiClient, Animal) { + 'use strict'; + + /** + * The Cat model module. + * @module model/Cat + * @version 1.0.0 + */ + + /** + * Constructs a new Cat. + * @alias module:model/Cat + * @class + * @extends module:model/Animal + * @param className + */ + var exports = function(className) { + Animal.call(this, className); + + }; + + /** + * Constructs a Cat from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Cat} obj Optional instance to populate. + * @return {module:model/Cat} The populated Cat instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + Animal.constructFromObject(data, obj); + if (data.hasOwnProperty('declawed')) { + obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean'); + } + } + return obj; + } + + exports.prototype = Object.create(Animal.prototype); + exports.prototype.constructor = exports; + + + /** + * @member {Boolean} declawed + */ + exports.prototype['declawed'] = undefined; + + + + + return exports; +})); diff --git a/samples/client/petstore/javascript/src/model/Dog.js b/samples/client/petstore/javascript/src/model/Dog.js new file mode 100644 index 0000000000..e5e55581a7 --- /dev/null +++ b/samples/client/petstore/javascript/src/model/Dog.js @@ -0,0 +1,67 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient', './Animal'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./Animal')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Dog = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); + } +}(this, function(ApiClient, Animal) { + 'use strict'; + + /** + * The Dog model module. + * @module model/Dog + * @version 1.0.0 + */ + + /** + * Constructs a new Dog. + * @alias module:model/Dog + * @class + * @extends module:model/Animal + * @param className + */ + var exports = function(className) { + Animal.call(this, className); + + }; + + /** + * Constructs a Dog from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Dog} obj Optional instance to populate. + * @return {module:model/Dog} The populated Dog instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + Animal.constructFromObject(data, obj); + if (data.hasOwnProperty('breed')) { + obj['breed'] = ApiClient.convertToType(data['breed'], 'String'); + } + } + return obj; + } + + exports.prototype = Object.create(Animal.prototype); + exports.prototype.constructor = exports; + + + /** + * @member {String} breed + */ + exports.prototype['breed'] = undefined; + + + + + return exports; +})); diff --git a/samples/client/petstore/javascript/src/model/Name.js b/samples/client/petstore/javascript/src/model/Name.js index 20aa186bd9..a5a070025f 100644 --- a/samples/client/petstore/javascript/src/model/Name.js +++ b/samples/client/petstore/javascript/src/model/Name.js @@ -29,6 +29,7 @@ var exports = function() { + }; /** @@ -45,6 +46,9 @@ if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'Integer'); } + if (data.hasOwnProperty('snake_case')) { + obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Integer'); + } } return obj; } @@ -55,6 +59,11 @@ */ exports.prototype['name'] = undefined; + /** + * @member {Integer} snake_case + */ + exports.prototype['snake_case'] = undefined; + diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 138e62684a..72fc2e2642 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -8,9 +8,9 @@ This is a sample server Petstore server. You can find out more about Swagger at Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: 1.0.0 +- API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-03-19T17:46:21.048+08:00 +- Build date: 2016-03-30T20:57:51.908+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen ## A note on Moose @@ -231,7 +231,10 @@ use WWW::SwaggerClient::UserApi; To load the models: ```perl +use WWW::SwaggerClient::Object::Animal; +use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; +use WWW::SwaggerClient::Object::Dog; use WWW::SwaggerClient::Object::InlineResponse200; use WWW::SwaggerClient::Object::Model200Response; use WWW::SwaggerClient::Object::ModelReturn; @@ -257,7 +260,10 @@ use WWW::SwaggerClient::StoreApi; use WWW::SwaggerClient::UserApi; # load the models +use WWW::SwaggerClient::Object::Animal; +use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; +use WWW::SwaggerClient::Object::Dog; use WWW::SwaggerClient::Object::InlineResponse200; use WWW::SwaggerClient::Object::Model200Response; use WWW::SwaggerClient::Object::ModelReturn; @@ -320,7 +326,10 @@ Class | Method | HTTP request | Description # DOCUMENTATION FOR MODELS + - [WWW::SwaggerClient::Object::Animal](docs/Animal.md) + - [WWW::SwaggerClient::Object::Cat](docs/Cat.md) - [WWW::SwaggerClient::Object::Category](docs/Category.md) + - [WWW::SwaggerClient::Object::Dog](docs/Dog.md) - [WWW::SwaggerClient::Object::InlineResponse200](docs/InlineResponse200.md) - [WWW::SwaggerClient::Object::Model200Response](docs/Model200Response.md) - [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md) diff --git a/samples/client/petstore/perl/docs/Animal.md b/samples/client/petstore/perl/docs/Animal.md new file mode 100644 index 0000000000..d243a90905 --- /dev/null +++ b/samples/client/petstore/perl/docs/Animal.md @@ -0,0 +1,15 @@ +# WWW::SwaggerClient::Object::Animal + +## Load the model package +```perl +use WWW::SwaggerClient::Object::Animal; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **string** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/Cat.md b/samples/client/petstore/perl/docs/Cat.md new file mode 100644 index 0000000000..978e420239 --- /dev/null +++ b/samples/client/petstore/perl/docs/Cat.md @@ -0,0 +1,16 @@ +# WWW::SwaggerClient::Object::Cat + +## Load the model package +```perl +use WWW::SwaggerClient::Object::Cat; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **string** | | +**declawed** | **boolean** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/Dog.md b/samples/client/petstore/perl/docs/Dog.md new file mode 100644 index 0000000000..16e399c3aa --- /dev/null +++ b/samples/client/petstore/perl/docs/Dog.md @@ -0,0 +1,16 @@ +# WWW::SwaggerClient::Object::Dog + +## Load the model package +```perl +use WWW::SwaggerClient::Object::Dog; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **string** | | +**breed** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Animal.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Animal.pm new file mode 100644 index 0000000000..c2e124ad8b --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Animal.pm @@ -0,0 +1,127 @@ +package WWW::SwaggerClient::Object::Animal; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# + +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'Animal', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'class_name' => { + datatype => 'string', + base_name => 'className', + description => '', + format => '', + read_only => '', + }, + +}); + +__PACKAGE__->swagger_types( { + 'class_name' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'class_name' => 'className' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Cat.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Cat.pm new file mode 100644 index 0000000000..05500d61ad --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Cat.pm @@ -0,0 +1,136 @@ +package WWW::SwaggerClient::Object::Cat; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# + +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'Cat', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'class_name' => { + datatype => 'string', + base_name => 'className', + description => '', + format => '', + read_only => '', + }, + 'declawed' => { + datatype => 'boolean', + base_name => 'declawed', + description => '', + format => '', + read_only => '', + }, + +}); + +__PACKAGE__->swagger_types( { + 'class_name' => 'string', + 'declawed' => 'boolean' +} ); + +__PACKAGE__->attribute_map( { + 'class_name' => 'className', + 'declawed' => 'declawed' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Dog.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Dog.pm new file mode 100644 index 0000000000..b4192ec71c --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Dog.pm @@ -0,0 +1,136 @@ +package WWW::SwaggerClient::Object::Dog; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# + +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'Dog', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'class_name' => { + datatype => 'string', + base_name => 'className', + description => '', + format => '', + read_only => '', + }, + 'breed' => { + datatype => 'string', + base_name => 'breed', + description => '', + format => '', + read_only => '', + }, + +}); + +__PACKAGE__->swagger_types( { + 'class_name' => 'string', + 'breed' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'class_name' => 'className', + 'breed' => 'breed' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index 15fb410e8a..4b1f63cbb2 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -37,7 +37,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-03-19T17:46:21.048+08:00', + generated_date => '2016-03-30T20:57:51.908+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-03-19T17:46:21.048+08:00 +=item Build date: 2016-03-30T20:57:51.908+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen diff --git a/samples/client/petstore/perl/t/AnimalTest.t b/samples/client/petstore/perl/t/AnimalTest.t new file mode 100644 index 0000000000..7d608e3080 --- /dev/null +++ b/samples/client/petstore/perl/t/AnimalTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::Animal'); + +my $instance = WWW::SwaggerClient::Object::Animal->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::Animal'); + diff --git a/samples/client/petstore/perl/t/CatTest.t b/samples/client/petstore/perl/t/CatTest.t new file mode 100644 index 0000000000..cc1569cab4 --- /dev/null +++ b/samples/client/petstore/perl/t/CatTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::Cat'); + +my $instance = WWW::SwaggerClient::Object::Cat->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::Cat'); + diff --git a/samples/client/petstore/perl/t/DogTest.t b/samples/client/petstore/perl/t/DogTest.t new file mode 100644 index 0000000000..d99225a059 --- /dev/null +++ b/samples/client/petstore/perl/t/DogTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::Dog'); + +my $instance = WWW::SwaggerClient::Object::Dog->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::Dog'); + diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 7fe80fb8a0..79dbf6ee5b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -3,9 +3,9 @@ This is a sample server Petstore server. You can find out more about Swagger at This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: 1.0.0 +- API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-03-19T16:11:03.465+08:00 +- Build date: 2016-03-30T20:57:56.803+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -108,7 +108,10 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [Animal](docs/Animal.md) + - [Cat](docs/Cat.md) - [Category](docs/Category.md) + - [Dog](docs/Dog.md) - [InlineResponse200](docs/InlineResponse200.md) - [Model200Response](docs/Model200Response.md) - [ModelReturn](docs/ModelReturn.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/200Response.md b/samples/client/petstore/php/SwaggerClient-php/docs/200Response.md new file mode 100644 index 0000000000..284a8795c6 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/200Response.md @@ -0,0 +1,10 @@ +# 200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md b/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md new file mode 100644 index 0000000000..948a992f50 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md @@ -0,0 +1,10 @@ +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **string** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Cat.md b/samples/client/petstore/php/SwaggerClient-php/docs/Cat.md new file mode 100644 index 0000000000..8d30565d01 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Cat.md @@ -0,0 +1,10 @@ +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Dog.md b/samples/client/petstore/php/SwaggerClient-php/docs/Dog.md new file mode 100644 index 0000000000..3c04bdf4cf --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Dog.md @@ -0,0 +1,10 @@ +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php new file mode 100644 index 0000000000..eaaa566f3b --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -0,0 +1,191 @@ + 'string' + ); + + static function swaggerTypes() { + return self::$swaggerTypes; + } + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + static $attributeMap = array( + 'class_name' => 'className' + ); + + static function attributeMap() { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'class_name' => 'setClassName' + ); + + static function setters() { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'class_name' => 'getClassName' + ); + + static function getters() { + return self::$getters; + } + + + /** + * $class_name + * @var string + */ + protected $class_name; + + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + + if ($data != null) { + $this->class_name = $data["class_name"]; + } + } + + /** + * Gets class_name + * @return string + */ + public function getClassName() + { + return $this->class_name; + } + + /** + * Sets class_name + * @param string $class_name + * @return $this + */ + public function setClassName($class_name) + { + + $this->class_name = $class_name; + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->$offset); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->$offset; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + $this->$offset = $value; + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->$offset); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } else { + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php new file mode 100644 index 0000000000..962f8ec00b --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -0,0 +1,191 @@ + 'bool' + ); + + static function swaggerTypes() { + return self::$swaggerTypes + parent::swaggerTypes(); + } + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + static $attributeMap = array( + 'declawed' => 'declawed' + ); + + static function attributeMap() { + return parent::attributeMap() + self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'declawed' => 'setDeclawed' + ); + + static function setters() { + return parent::setters() + self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'declawed' => 'getDeclawed' + ); + + static function getters() { + return parent::getters() + self::$getters; + } + + + /** + * $declawed + * @var bool + */ + protected $declawed; + + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + parent::__construct($data); + if ($data != null) { + $this->declawed = $data["declawed"]; + } + } + + /** + * Gets declawed + * @return bool + */ + public function getDeclawed() + { + return $this->declawed; + } + + /** + * Sets declawed + * @param bool $declawed + * @return $this + */ + public function setDeclawed($declawed) + { + + $this->declawed = $declawed; + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->$offset); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->$offset; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + $this->$offset = $value; + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->$offset); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } else { + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } + } +} 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 7730aeca6f..65d736ce9d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -118,6 +118,7 @@ class Category implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->name = $data["name"]; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php new file mode 100644 index 0000000000..2aef5757fe --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -0,0 +1,191 @@ + 'string' + ); + + static function swaggerTypes() { + return self::$swaggerTypes + parent::swaggerTypes(); + } + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + static $attributeMap = array( + 'breed' => 'breed' + ); + + static function attributeMap() { + return parent::attributeMap() + self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'breed' => 'setBreed' + ); + + static function setters() { + return parent::setters() + self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'breed' => 'getBreed' + ); + + static function getters() { + return parent::getters() + self::$getters; + } + + + /** + * $breed + * @var string + */ + protected $breed; + + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + parent::__construct($data); + if ($data != null) { + $this->breed = $data["breed"]; + } + } + + /** + * Gets breed + * @return string + */ + public function getBreed() + { + return $this->breed; + } + + /** + * Sets breed + * @param string $breed + * @return $this + */ + public function setBreed($breed) + { + + $this->breed = $breed; + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->$offset); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->$offset; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + $this->$offset = $value; + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->$offset); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } else { + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php index 6d3fc1259b..8efea4018b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -158,6 +158,7 @@ class InlineResponse200 implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->tags = $data["tags"]; $this->id = $data["id"]; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php index 409ad91987..57cb31c084 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -108,6 +108,7 @@ class Model200Response implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->name = $data["name"]; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php index 810de6aa85..fd8d1479ca 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -108,6 +108,7 @@ class ModelReturn implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->return = $data["return"]; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php index ee1b6097ea..9b52f9a6c0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -118,6 +118,7 @@ class Name implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->name = $data["name"]; $this->snake_case = $data["snake_case"]; 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 b99f8a9060..1c114a8392 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -158,6 +158,7 @@ class Order implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->pet_id = $data["pet_id"]; 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 8817c7e6e0..39735aaa42 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -158,6 +158,7 @@ class Pet implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->category = $data["category"]; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php index 843eb09c2d..0ce073a43a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -108,6 +108,7 @@ class SpecialModelName implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->special_property_name = $data["special_property_name"]; } 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 718f2331c2..129206e965 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -118,6 +118,7 @@ class Tag implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->name = $data["name"]; 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 aa2d62af13..662983d61b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -178,6 +178,7 @@ class User implements ArrayAccess */ public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->username = $data["username"]; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalTest.php new file mode 100644 index 0000000000..f66fc54f21 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalTest.php @@ -0,0 +1,70 @@ +assertInstanceOf('Swagger\Client\Model\Dog', $new_dog); + // the object should also be an instance of the parent class + $this->assertInstanceOf('Swagger\Client\Model\Animal', $new_dog); + } + + // test inheritance constructor is working with data + // initialization + public function testInheritanceConstructorDataInitialization() + { + // initialize the object with data in the constructor + $data = array( + 'class_name' => 'Dog', + 'breed' => 'Great Dane' + ); + $new_dog = new Swagger\Client\Model\Dog($data); + + // the property on the derived class should be set + $this->assertSame('Great Dane', $new_dog->getBreed()); + // the property on the parent class should be set + $this->assertSame('Dog', $new_dog->getClassName()); + } + } ?> diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index fceba1fc08..9f04158f43 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -6,9 +6,9 @@ This is a sample server Petstore server. You can find out more about Swagger at This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: 1.0.0 +- API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-03-19T11:13:14.822+08:00 +- Build date: 2016-03-30T20:58:00.549+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -110,7 +110,10 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [Petstore::Animal](docs/Animal.md) + - [Petstore::Cat](docs/Cat.md) - [Petstore::Category](docs/Category.md) + - [Petstore::Dog](docs/Dog.md) - [Petstore::InlineResponse200](docs/InlineResponse200.md) - [Petstore::Model200Response](docs/Model200Response.md) - [Petstore::ModelReturn](docs/ModelReturn.md) diff --git a/samples/client/petstore/ruby/docs/Animal.md b/samples/client/petstore/ruby/docs/Animal.md new file mode 100644 index 0000000000..0e262c7872 --- /dev/null +++ b/samples/client/petstore/ruby/docs/Animal.md @@ -0,0 +1,8 @@ +# Petstore::Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **String** | | + + diff --git a/samples/client/petstore/ruby/docs/Cat.md b/samples/client/petstore/ruby/docs/Cat.md new file mode 100644 index 0000000000..6b7dfb710d --- /dev/null +++ b/samples/client/petstore/ruby/docs/Cat.md @@ -0,0 +1,9 @@ +# Petstore::Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **String** | | +**declawed** | **BOOLEAN** | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/Dog.md b/samples/client/petstore/ruby/docs/Dog.md new file mode 100644 index 0000000000..7af6f549d5 --- /dev/null +++ b/samples/client/petstore/ruby/docs/Dog.md @@ -0,0 +1,9 @@ +# Petstore::Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **String** | | +**breed** | **String** | | [optional] + + diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index cb1abccf30..4b848d0c3a 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -21,7 +21,10 @@ require 'petstore/version' require 'petstore/configuration' # Models +require 'petstore/models/animal' +require 'petstore/models/cat' require 'petstore/models/category' +require 'petstore/models/dog' require 'petstore/models/inline_response_200' require 'petstore/models/model_200_response' require 'petstore/models/model_return' diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb new file mode 100644 index 0000000000..cf5fa7c1c9 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -0,0 +1,165 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'date' + +module Petstore + class Animal + attr_accessor :class_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + + :'class_name' => :'className' + + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'class_name' => :'String' + + } + end + + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} + + + if attributes[:'className'] + self.class_name = attributes[:'className'] + end + + end + + # Check equality by comparing each attribute. + def ==(o) + return true if self.equal?(o) + self.class == o.class && + class_name == o.class_name + end + + # @see the `==` method + def eql?(o) + self == o + end + + # Calculate hash code according to all attributes. + def hash + [class_name].hash + end + + # build the object from hash + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /^Array<(.*)>/i + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + else + #TODO show warning in debug mode + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + else + # data not found in attributes(hash), not an issue as the data can be optional + end + end + + self + end + + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /^(true|t|yes|y|1)$/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + _model = Petstore.const_get(type).new + _model.build_from_hash(value) + end + end + + def to_s + to_hash.to_s + end + + # to_body is an alias to to_body (backward compatibility)) + def to_body + to_hash + end + + # return the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Method to output non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/client/petstore/ruby/lib/petstore/models/cat.rb new file mode 100644 index 0000000000..db40e8eab2 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/cat.rb @@ -0,0 +1,175 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'date' + +module Petstore + class Cat + attr_accessor :class_name + + attr_accessor :declawed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + + :'class_name' => :'className', + + :'declawed' => :'declawed' + + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'class_name' => :'String', + :'declawed' => :'BOOLEAN' + + } + end + + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} + + + if attributes[:'className'] + self.class_name = attributes[:'className'] + end + + if attributes[:'declawed'] + self.declawed = attributes[:'declawed'] + end + + end + + # Check equality by comparing each attribute. + def ==(o) + return true if self.equal?(o) + self.class == o.class && + class_name == o.class_name && + declawed == o.declawed + end + + # @see the `==` method + def eql?(o) + self == o + end + + # Calculate hash code according to all attributes. + def hash + [class_name, declawed].hash + end + + # build the object from hash + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /^Array<(.*)>/i + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + else + #TODO show warning in debug mode + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + else + # data not found in attributes(hash), not an issue as the data can be optional + end + end + + self + end + + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /^(true|t|yes|y|1)$/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + _model = Petstore.const_get(type).new + _model.build_from_hash(value) + end + end + + def to_s + to_hash.to_s + end + + # to_body is an alias to to_body (backward compatibility)) + def to_body + to_hash + end + + # return the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Method to output non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/client/petstore/ruby/lib/petstore/models/dog.rb new file mode 100644 index 0000000000..a7f19f2b91 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/dog.rb @@ -0,0 +1,175 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'date' + +module Petstore + class Dog + attr_accessor :class_name + + attr_accessor :breed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + + :'class_name' => :'className', + + :'breed' => :'breed' + + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'class_name' => :'String', + :'breed' => :'String' + + } + end + + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} + + + if attributes[:'className'] + self.class_name = attributes[:'className'] + end + + if attributes[:'breed'] + self.breed = attributes[:'breed'] + end + + end + + # Check equality by comparing each attribute. + def ==(o) + return true if self.equal?(o) + self.class == o.class && + class_name == o.class_name && + breed == o.breed + end + + # @see the `==` method + def eql?(o) + self == o + end + + # Calculate hash code according to all attributes. + def hash + [class_name, breed].hash + end + + # build the object from hash + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /^Array<(.*)>/i + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + else + #TODO show warning in debug mode + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + else + # data not found in attributes(hash), not an issue as the data can be optional + end + end + + self + end + + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /^(true|t|yes|y|1)$/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + _model = Petstore.const_get(type).new + _model.build_from_hash(value) + end + end + + def to_s + to_hash.to_s + end + + # to_body is an alias to to_body (backward compatibility)) + def to_body + to_hash + end + + # return the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Method to output non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/samples/client/petstore/ruby/spec/models/animal_spec.rb b/samples/client/petstore/ruby/spec/models/animal_spec.rb new file mode 100644 index 0000000000..ddbfeca85f --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/animal_spec.rb @@ -0,0 +1,50 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::Animal +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'Animal' do + before do + # run before each test + @instance = Petstore::Animal.new + end + + after do + # run after each test + end + + describe 'test an instance of Animal' do + it 'should create an instact of Animal' do + @instance.should be_a(Petstore::Animal) + end + end + describe 'test attribute "class_name"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + +end + diff --git a/samples/client/petstore/ruby/spec/models/cat_spec.rb b/samples/client/petstore/ruby/spec/models/cat_spec.rb new file mode 100644 index 0000000000..220a37dfeb --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/cat_spec.rb @@ -0,0 +1,60 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::Cat +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'Cat' do + before do + # run before each test + @instance = Petstore::Cat.new + end + + after do + # run after each test + end + + describe 'test an instance of Cat' do + it 'should create an instact of Cat' do + @instance.should be_a(Petstore::Cat) + end + end + describe 'test attribute "class_name"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "declawed"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + +end + diff --git a/samples/client/petstore/ruby/spec/models/dog_spec.rb b/samples/client/petstore/ruby/spec/models/dog_spec.rb new file mode 100644 index 0000000000..23b1b9a83f --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/dog_spec.rb @@ -0,0 +1,60 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::Dog +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'Dog' do + before do + # run before each test + @instance = Petstore::Dog.new + end + + after do + # run after each test + end + + describe 'test an instance of Dog' do + it 'should create an instact of Dog' do + @instance.should be_a(Petstore::Dog) + end + end + describe 'test attribute "class_name"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "breed"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + +end +