diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 9f13b0fdb01..9949834d24b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -133,6 +133,99 @@ public class DefaultCodegen { return objs; } + /** + * post process enum defined in model's properties + * + * @param objs Map of models + * @return maps of models with better enum support + */ + public Map postProcessModelsEnum(Map objs) { + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + + for (CodegenProperty var : cm.vars) { + Map allowableValues = var.allowableValues; + + // handle ArrayProperty + if (var.items != null) { + allowableValues = var.items.allowableValues; + } + + if (allowableValues == null) { + continue; + } + List values = (List) allowableValues.get("values"); + if (values == null) { + continue; + } + + // put "enumVars" map into `allowableValues", including `name` and `value` + List> enumVars = new ArrayList>(); + String commonPrefix = findCommonPrefixOfVars(values); + int truncateIdx = commonPrefix.length(); + for (String value : values) { + Map enumVar = new HashMap(); + String enumName; + if (truncateIdx == 0) { + enumName = value; + } else { + enumName = value.substring(truncateIdx); + if ("".equals(enumName)) { + enumName = value; + } + } + enumVar.put("name", toEnumVarName(enumName)); + enumVar.put("value", value); + enumVars.add(enumVar); + } + allowableValues.put("enumVars", enumVars); + // handle default value for enum, e.g. available => StatusEnum.AVAILABLE + if (var.defaultValue != null) { + String enumName = null; + for (Map enumVar : enumVars) { + if (var.defaultValue.equals(enumVar.get("value"))) { + enumName = enumVar.get("name"); + break; + } + } + if (enumName != null) { + var.defaultValue = var.datatypeWithEnum + "." + enumName; + } + } + } + } + return objs; + } + + /** + * Returns the common prefix of variables for enum naming + * + * @param vars List of variable names + * @return the common prefix for naming + */ + public String findCommonPrefixOfVars(List vars) { + String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()])); + // exclude trailing characters that should be part of a valid variable + // e.g. ["status-on", "status-off"] => "status-" (not "status-o") + return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); + } + + /** + * Return the sanitized variable name for enum + * + * @param value enum variable name + * @return the sanitized variable name for enum + */ + public String toEnumVarName(String value) { + String var = value.replaceAll("\\W+", "_").toUpperCase(); + if (var.matches("\\d.*")) { + return "_" + var; + } else { + return var; + } + } // override with any special post-processing @SuppressWarnings("static-method") diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index b8f2b187a6a..d5a095c0c76 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -436,14 +436,16 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { return codegenModel; } - private String findCommonPrefixOfVars(List vars) { + @Override + public String findCommonPrefixOfVars(List vars) { String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()])); // exclude trailing characters that should be part of a valid variable // e.g. ["status-on", "status-off"] => "status-" (not "status-o") return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); } - private String toEnumVarName(String value) { + @Override + public String toEnumVarName(String value) { String var = value.replaceAll("_", " "); var = WordUtils.capitalizeFully(var); var = var.replaceAll("\\W+", ""); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 3d9b890d058..bd770a1e509 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -697,63 +697,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public Map postProcessModels(Map objs) { - List models = (List) objs.get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); - - for (CodegenProperty var : cm.vars) { - Map allowableValues = var.allowableValues; - - // handle ArrayProperty - if (var.items != null) { - allowableValues = var.items.allowableValues; - } - - if (allowableValues == null) { - continue; - } - List values = (List) allowableValues.get("values"); - if (values == null) { - continue; - } - - // put "enumVars" map into `allowableValues", including `name` and `value` - List> enumVars = new ArrayList>(); - String commonPrefix = findCommonPrefixOfVars(values); - int truncateIdx = commonPrefix.length(); - for (String value : values) { - Map enumVar = new HashMap(); - String enumName; - if (truncateIdx == 0) { - enumName = value; - } else { - enumName = value.substring(truncateIdx); - if ("".equals(enumName)) { - enumName = value; - } - } - enumVar.put("name", toEnumVarName(enumName)); - enumVar.put("value", value); - enumVars.add(enumVar); - } - allowableValues.put("enumVars", enumVars); - // handle default value for enum, e.g. available => StatusEnum.AVAILABLE - if (var.defaultValue != null) { - String enumName = null; - for (Map enumVar : enumVars) { - if (var.defaultValue.equals(enumVar.get("value"))) { - enumName = enumVar.get("name"); - break; - } - } - if (enumName != null) { - var.defaultValue = var.datatypeWithEnum + "." + enumName; - } - } - } - } - return objs; + return postProcessModelsEnum(objs); } @Override @@ -850,14 +794,16 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { return super.needToImport(type) && type.indexOf(".") < 0; } - private static String findCommonPrefixOfVars(List vars) { + @Override + public String findCommonPrefixOfVars(List vars) { String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()])); // exclude trailing characters that should be part of a valid variable // e.g. ["status-on", "status-off"] => "status-" (not "status-o") return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); } - private static String toEnumVarName(String value) { + @Override + public String toEnumVarName(String value) { String var = value.replaceAll("\\W+", "_").toUpperCase(); if (var.matches("\\d.*")) { return "_" + var; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java index 9ca4589be5d..bc8b162c44b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java @@ -930,14 +930,16 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo && !languageSpecificPrimitives.contains(type); } - private static String findCommonPrefixOfVars(List vars) { + @Override + public String findCommonPrefixOfVars(List vars) { String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()])); // exclude trailing characters that should be part of a valid variable // e.g. ["status-on", "status-off"] => "status-" (not "status-o") return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); } - private static String toEnumVarName(String value) { + @Override + public String toEnumVarName(String value) { String var = value.replaceAll("\\W+", "_").toUpperCase(); if (var.matches("\\d.*")) { return "_" + var; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index 15dfd889cdd..6bf5a2568b0 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -4,6 +4,7 @@ import io.swagger.codegen.CliOption; import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.CodegenConstants; import io.swagger.codegen.CodegenParameter; +import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.CodegenType; import io.swagger.codegen.DefaultCodegen; import io.swagger.codegen.SupportingFile; @@ -12,6 +13,7 @@ import io.swagger.models.properties.*; import java.io.File; import java.util.Arrays; import java.util.HashMap; +import java.util.Map; import java.util.HashSet; import java.util.regex.Matcher; @@ -567,4 +569,14 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { p.example = example; } + @Override + public String toEnumName(CodegenProperty property) { + LOGGER.info("php toEnumName:" + underscore(property.name).toUpperCase()); + return underscore(property.name).toUpperCase(); + } + + @Override + public Map postProcessModels(Map objs) { + return postProcessModelsEnum(objs); + } } diff --git a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache index 7945137c664..5b8b9b21632 100644 --- a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache @@ -69,7 +69,7 @@ class ApiClient * Constructor of the class * @param Configuration $config config for this ApiClient */ - public function __construct(Configuration $config = null) + public function __construct(\{{invokerPackage}}\Configuration $config = null) { if ($config == null) { $config = Configuration::getDefaultConfiguration(); diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index c0401940b48..c8b16b46052 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -60,7 +60,7 @@ use \{{invokerPackage}}\ObjectSerializer; * Constructor * @param \{{invokerPackage}}\ApiClient|null $apiClient The api client to use */ - function __construct($apiClient = null) + function __construct(\{{invokerPackage}}\ApiClient $apiClient = null) { if ($apiClient == null) { $apiClient = new ApiClient(); @@ -84,7 +84,7 @@ use \{{invokerPackage}}\ObjectSerializer; * @param \{{invokerPackage}}\ApiClient $apiClient set the API client * @return {{classname}} */ - public function setApiClient(ApiClient $apiClient) + public function setApiClient(\{{invokerPackage}}\ApiClient $apiClient) { $this->apiClient = $apiClient; return $this; diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 6f292e854af..32fe44e0af5 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -62,20 +62,20 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA {{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function swaggerTypes() { return self::$swaggerTypes{{#parent}} + parent::swaggerTypes(){{/parent}}; } /** * Array of attributes where the key is the local name, and the value is the original name - * @var string[] + * @var string[] */ static $attributeMap = array( {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function attributeMap() { return {{#parent}}parent::attributeMap() + {{/parent}}self::$attributeMap; } @@ -88,7 +88,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function setters() { return {{#parent}}parent::setters() + {{/parent}}self::$setters; } @@ -101,11 +101,27 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA {{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function getters() { return {{#parent}}parent::getters() + {{/parent}}self::$getters; } + {{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = "{{{value}}}"; + {{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}} + + {{#isEnum}} + /** + * Gets allowable values of the enum + * @return string[] + */ + public function {{getter}}AllowableValues() { + return [ + {{#allowableValues}}{{#values}}self::{{datatypeWithEnum}}_{{{this}}},{{^-last}} + {{/-last}}{{/values}}{{/allowableValues}} + ]; + } + {{/isEnum}} + {{#vars}} /** * ${{name}} {{#description}}{{{description}}}{{/description}} @@ -140,7 +156,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA { return $this->{{name}}; } - + /** * Sets {{name}} * @param {{datatype}} ${{name}} {{#description}}{{{description}}}{{/description}} @@ -165,7 +181,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -175,7 +191,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -186,7 +202,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -196,7 +212,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string 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 838b3c8b2da..5f5156bbfee 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -4,9 +4,9 @@ "description": "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", "version": "1.0.0", "title": "Swagger Petstore", - "termsOfService": "http://helloreverb.com/terms/", + "termsOfService": "http://swagger.io/terms/", "contact": { - "email": "apiteam@wordnik.com" + "email": "apiteam@swagger.io" }, "license": { "name": "Apache 2.0", @@ -19,6 +19,49 @@ "http" ], "paths": { + "/pet?testing_byte_array=true": { + "post": { + "tags": [ + "pet" + ], + "summary": "Fake endpoint to test byte array in body parameter for adding a new pet to the store", + "description": "", + "operationId": "addPetUsingByteArray", + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "description": "Pet object in the form of byte array", + "required": false, + "schema": { + "type": "string", + "format": "binary" + } + } + ], + "responses": { + "405": { + "description": "Invalid input" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + } + }, "/pet": { "post": { "tags": [ @@ -113,7 +156,7 @@ "pet" ], "summary": "Finds Pets by status", - "description": "Multiple status values can be provided with comma seperated strings", + "description": "Multiple status values can be provided with comma separated strings", "operationId": "findPetsByStatus", "produces": [ "application/json", @@ -123,14 +166,23 @@ { "name": "status", "in": "query", - "description": "Status values that need to be considered for filter", + "description": "Status values that need to be considered for query", "required": false, "type": "array", "items": { "type": "string", - "enum": ["available", "pending", "sold"] + "enum": [ + "available", + "pending", + "sold" + ] }, "collectionFormat": "multi", + "enum": [ + "available", + "pending", + "sold" + ], "default": "available" } ], @@ -142,15 +194,6 @@ "items": { "$ref": "#/definitions/Pet" } - }, - "examples": { - "application/json": { - "name": "Puma", - "type": "Dog", - "color": "Black", - "gender": "Female", - "breed": "Mixed" - } } }, "400": { @@ -216,6 +259,150 @@ ] } }, + "/pet/{petId}?testing_byte_array=true": { + "get": { + "tags": [ + "pet" + ], + "summary": "Fake endpoint to test byte array return by 'Find pet by ID'", + "description": "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", + "operationId": "", + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet that needs to be fetched", + "required": true, + "type": "integer", + "format": "int64" + } + ], + "responses": { + "404": { + "description": "Pet not found" + }, + "200": { + "description": "successful operation", + "schema": { + "type": "string", + "format": "binary" + } + }, + "400": { + "description": "Invalid ID supplied" + } + }, + "security": [ + { + "api_key": [] + }, + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + } + }, + "/pet/{petId}?response=inline_arbitrary_object": { + "get": { + "tags": [ + "pet" + ], + "summary": "Fake endpoint to test inline arbitrary object return by 'Find pet by ID'", + "description": "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", + "operationId": "getPetByIdInObject", + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet that needs to be fetched", + "required": true, + "type": "integer", + "format": "int64" + } + ], + "responses": { + "404": { + "description": "Pet not found" + }, + "200": { + "description": "successful operation", + "schema": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "category": { + "type": "object" + }, + "name": { + "type": "string", + "example": "doggie" + }, + "photoUrls": { + "type": "array", + "xml": { + "name": "photoUrl", + "wrapped": true + }, + "items": { + "type": "string" + } + }, + "tags": { + "type": "array", + "xml": { + "name": "tag", + "wrapped": true + }, + "items": { + "$ref": "#/definitions/Tag" + } + }, + "status": { + "type": "string", + "description": "pet status in the store", + "enum": [ + "available", + "pending", + "sold" + ] + } + } + } + }, + "400": { + "description": "Invalid ID supplied" + } + }, + "security": [ + { + "api_key": [] + }, + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + } + }, "/pet/{petId}": { "get": { "tags": [ @@ -443,6 +630,33 @@ ] } }, + "/store/inventory?response=arbitrary_object": { + "get": { + "tags": [ + "store" + ], + "summary": "Fake endpoint to test arbitrary object return by 'Get inventory'", + "description": "Returns an arbitrary object which is actually a map of status codes to quantities", + "operationId": "getInventoryInObject", + "produces": [ + "application/json", + "application/xml" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, "/store/order": { "post": { "tags": [ @@ -476,7 +690,62 @@ "400": { "description": "Invalid Order" } - } + }, + "security": [ + { + "test_api_client_id": [], + "test_api_client_secret": [] + } + ] + } + }, + "/store/findByStatus": { + "get": { + "tags": [ + "store" + ], + "summary": "Finds orders by status", + "description": "A single status value can be provided as a string", + "operationId": "findOrdersByStatus", + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "status", + "in": "query", + "description": "Status value that needs to be considered for query", + "required": false, + "type": "string", + "enum": [ + "placed", + "approved", + "delivered" + ], + "default": "placed" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Order" + } + } + }, + "400": { + "description": "Invalid status value" + } + }, + "security": [ + { + "test_api_client_id": [], + "test_api_client_secret": [] + } + ] } }, "/store/order/{orderId}": { @@ -513,7 +782,15 @@ "400": { "description": "Invalid ID supplied" } - } + }, + "security": [ + { + "test_api_key_header": [] + }, + { + "test_api_key_query": [] + } + ] }, "delete": { "tags": [ @@ -730,6 +1007,18 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/User" + }, + "examples": { + "application/json": { + "id": 1, + "username": "johnp", + "firstName": "John", + "lastName": "Public", + "email": "johnp@swagger.io", + "password": "-secret-", + "phone": "0123456789", + "userStatus": 0 + } } }, "400": { @@ -802,7 +1091,12 @@ "400": { "description": "Invalid username supplied" } - } + }, + "security": [ + { + "test_http_basic": [] + } + ] } } }, @@ -820,6 +1114,29 @@ "write:pets": "modify pets in your account", "read:pets": "read your pets" } + }, + "test_api_client_id": { + "type": "apiKey", + "name": "x-test_api_client_id", + "in": "header" + }, + "test_api_client_secret": { + "type": "apiKey", + "name": "x-test_api_client_secret", + "in": "header" + }, + "test_api_key_header": { + "type": "apiKey", + "name": "test_api_key_header", + "in": "header" + }, + "test_api_key_query": { + "type": "apiKey", + "name": "test_api_key_query", + "in": "query" + }, + "test_http_basic": { + "type": "basic" } }, "definitions": { @@ -940,7 +1257,8 @@ "properties": { "id": { "type": "integer", - "format": "int64" + "format": "int64", + "readOnly": true }, "petId": { "type": "integer", @@ -970,6 +1288,110 @@ "xml": { "name": "Order" } + }, + "$special[model.name]": { + "properties": { + "$special[property.name]": { + "type": "integer", + "format": "int64" + } + }, + "xml": { + "name": "$special[model.name]" + } + }, + "Return": { + "descripton": "Model for testing reserved words", + "properties": { + "return": { + "type": "integer", + "format": "int32" + } + }, + "xml": { + "name": "Return" + } + }, + "Name": { + "descripton": "Model for testing model name same as property name", + "properties": { + "name": { + "type": "integer", + "format": "int32" + }, + "snake_case": { + "type": "integer", + "format": "int32" + } + }, + "xml": { + "name": "Name" + } + }, + "200_response": { + "descripton": "Model for testing model name starting with number", + "properties": { + "name": { + "type": "integer", + "format": "int32" + } + }, + "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" + } + } + }, + "Enum_Test" : { + "type" : "object", + "properties" : { + "enum_string" : { + "type" : "string", + "enum" : ["UPPER", "lower"] + }, + "enum_integer" : { + "type" : "integer", + "enum" : [1, -1] + }, + "enum_number" : { + "type" : "number", + "enum" : [1.1, -1.2] + } + } } } } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java index 27395e86ba9..8fede114081 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java index 19b0ebeae4e..5d1cf18a00f 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java index d8d32210b10..05f7d31ae5a 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java index 1383dd0decb..5e872f5bdc3 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java index c4ff05ec24f..1aaaa92d13e 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java @@ -8,15 +8,15 @@ import io.swagger.client.Configuration; import io.swagger.client.Pair; import io.swagger.client.model.Pet; +import io.swagger.client.model.InlineResponse200; import java.io.File; -import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class PetApi { private ApiClient apiClient; @@ -36,20 +36,16 @@ public class PetApi { this.apiClient = apiClient; } + /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (required) + * @param body Pet object that needs to be added to the store (optional) * @throws ApiException if fails to make API call */ public void addPet(Pet body) throws ApiException { Object localVarPostBody = body; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); - } - // create path and map variables String localVarPath = "/pet".replaceAll("\\{format\\}","json"); @@ -58,11 +54,14 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -73,9 +72,51 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; - + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param body Pet object in the form of byte array (optional) + * @throws ApiException if fails to make API call + */ + public void addPetUsingByteArray(byte[] body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + + } + /** * Deletes a pet * @@ -100,13 +141,16 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (apiKey != null) localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -117,24 +161,21 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; - + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter (required) + * @param status Status values that need to be considered for query (optional, default to available) * @return List * @throws ApiException if fails to make API call */ public List findPetsByStatus(List status) throws ApiException { Object localVarPostBody = null; - // verify the required parameter 'status' is set - if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); - } - // create path and map variables String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); @@ -143,12 +184,16 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "status", status)); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -159,24 +204,22 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; + GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + } + /** * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (required) + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (optional) * @return List * @throws ApiException if fails to make API call */ public List findPetsByTags(List tags) throws ApiException { Object localVarPostBody = null; - // verify the required parameter 'tags' is set - if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); - } - // create path and map variables String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); @@ -185,12 +228,16 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -201,13 +248,16 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; + GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + } + /** * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return (required) + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched (required) * @return Pet * @throws ApiException if fails to make API call */ @@ -228,11 +278,14 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -241,25 +294,119 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key" }; + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + } + + /** + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched (required) + * @return InlineResponse200 + * @throws ApiException if fails to make API call + */ + public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + + } + + /** + * Fake endpoint to test byte array return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched (required) + * @return byte[] + * @throws ApiException if fails to make API call + */ + public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + + } + /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (required) + * @param body Pet object that needs to be added to the store (optional) * @throws ApiException if fails to make API call */ public void updatePet(Pet body) throws ApiException { Object localVarPostBody = body; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); - } - // create path and map variables String localVarPath = "/pet".replaceAll("\\{format\\}","json"); @@ -268,11 +415,14 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -283,9 +433,11 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; - + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** * Updates a pet in the store with form data * @@ -294,7 +446,7 @@ public class PetApi { * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ - public void updatePetWithForm(Long petId, String name, String status) throws ApiException { + public void updatePetWithForm(String petId, String name, String status) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -311,15 +463,18 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + if (name != null) localVarFormParams.put("name", name); -if (status != null) + if (status != null) localVarFormParams.put("status", status); + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -330,19 +485,20 @@ if (status != null) String[] localVarAuthNames = new String[] { "petstore_auth" }; - + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** * uploads an image * * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ModelApiResponse * @throws ApiException if fails to make API call */ - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -359,15 +515,18 @@ if (status != null) Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + if (additionalMetadata != null) localVarFormParams.put("additionalMetadata", additionalMetadata); -if (file != null) + if (file != null) localVarFormParams.put("file", file); + final String[] localVarAccepts = { - "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -378,7 +537,9 @@ if (file != null) String[] localVarAuthNames = new String[] { "petstore_auth" }; - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + + } + } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java index 59a1a58266e..e38b4831f5d 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class StoreApi { private ApiClient apiClient; @@ -34,6 +34,7 @@ public class StoreApi { this.apiClient = apiClient; } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -57,11 +58,14 @@ public class StoreApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -72,9 +76,55 @@ public class StoreApi { String[] localVarAuthNames = new String[] { }; - + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + + /** + * Finds orders by status + * A single status value can be provided as a string + * @param status Status value that needs to be considered for query (optional, default to placed) + * @return List + * @throws ApiException if fails to make API call + */ + public List findOrdersByStatus(String status) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/findByStatus".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status)); + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; + + + GenericType> localVarReturnType = new GenericType>() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + + } + /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -92,11 +142,14 @@ public class StoreApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -107,17 +160,61 @@ public class StoreApi { String[] localVarAuthNames = new String[] { "api_key" }; + GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + } + + /** + * Fake endpoint to test arbitrary object return by 'Get inventory' + * Returns an arbitrary object which is actually a map of status codes to quantities + * @return Object + * @throws ApiException if fails to make API call + */ + public Object getInventoryInObject() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + + } + /** * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched (required) * @return Order * @throws ApiException if fails to make API call */ - public Order getOrderById(Long orderId) throws ApiException { + public Order getOrderById(String orderId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'orderId' is set @@ -134,11 +231,14 @@ public class StoreApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -147,26 +247,24 @@ public class StoreApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" }; + GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + } + /** * Place an order for a pet * - * @param body order placed for purchasing the pet (required) + * @param body order placed for purchasing the pet (optional) * @return Order * @throws ApiException if fails to make API call */ public Order placeOrder(Order body) throws ApiException { Object localVarPostBody = body; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); - } - // create path and map variables String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); @@ -175,11 +273,14 @@ public class StoreApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -188,9 +289,12 @@ public class StoreApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; + GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + } + } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/UserApi.java index 7ab75eabd34..b2ecae1e675 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/UserApi.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class UserApi { private ApiClient apiClient; @@ -34,20 +34,16 @@ public class UserApi { this.apiClient = apiClient; } + /** * Create user * This can only be done by the logged in user. - * @param body Created user object (required) + * @param body Created user object (optional) * @throws ApiException if fails to make API call */ public void createUser(User body) throws ApiException { Object localVarPostBody = body; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); - } - // create path and map variables String localVarPath = "/user".replaceAll("\\{format\\}","json"); @@ -56,11 +52,14 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -71,23 +70,20 @@ public class UserApi { String[] localVarAuthNames = new String[] { }; - + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** * Creates list of users with given input array * - * @param body List of user object (required) + * @param body List of user object (optional) * @throws ApiException if fails to make API call */ public void createUsersWithArrayInput(List body) throws ApiException { Object localVarPostBody = body; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); - } - // create path and map variables String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); @@ -96,11 +92,14 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -111,23 +110,20 @@ public class UserApi { String[] localVarAuthNames = new String[] { }; - + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** * Creates list of users with given input array * - * @param body List of user object (required) + * @param body List of user object (optional) * @throws ApiException if fails to make API call */ public void createUsersWithListInput(List body) throws ApiException { Object localVarPostBody = body; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); - } - // create path and map variables String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); @@ -136,11 +132,14 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -151,9 +150,11 @@ public class UserApi { String[] localVarAuthNames = new String[] { }; - + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** * Delete user * This can only be done by the logged in user. @@ -177,11 +178,14 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -190,15 +194,17 @@ public class UserApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - + String[] localVarAuthNames = new String[] { "test_http_basic" }; + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException if fails to make API call */ @@ -219,11 +225,14 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -234,30 +243,23 @@ public class UserApi { String[] localVarAuthNames = new String[] { }; + GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + } + /** * Logs user into the system * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) + * @param username The user name for login (optional) + * @param password The password for login in clear text (optional) * @return String * @throws ApiException if fails to make API call */ public String loginUser(String username, String password) throws ApiException { Object localVarPostBody = null; - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); - } - - // verify the required parameter 'password' is set - if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); - } - // create path and map variables String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); @@ -266,13 +268,18 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -283,9 +290,12 @@ public class UserApi { String[] localVarAuthNames = new String[] { }; + GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } + + } + /** * Logs out current logged in user session * @@ -302,11 +312,14 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -317,14 +330,16 @@ public class UserApi { String[] localVarAuthNames = new String[] { }; - + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + /** * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (required) + * @param body Updated user object (optional) * @throws ApiException if fails to make API call */ public void updateUser(String username, User body) throws ApiException { @@ -335,11 +350,6 @@ public class UserApi { throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); - } - // create path and map variables String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); @@ -349,11 +359,14 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { - "application/xml", "application/json" + "application/json", "application/xml" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -364,7 +377,9 @@ public class UserApi { String[] localVarAuthNames = new String[] { }; - + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } + } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 6882dbc41c0..0fc49a435f1 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 64f2c887377..76af4a37c69 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -9,7 +9,7 @@ import java.util.List; import java.io.UnsupportedEncodingException; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java index 76d2917f24e..6ce226b5dea 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Category.java index 08a0de3e889..5fb583a8eb6 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class Category { private Long id = null; @@ -32,7 +32,7 @@ public class Category { this.id = id; } - + /** **/ public Category name(String name) { @@ -49,6 +49,7 @@ public class Category { this.name = name; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Model200Response.java index 4f44da64072..89b6fc76110 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Model200Response.java @@ -7,12 +7,9 @@ import io.swagger.annotations.ApiModelProperty; -/** - * Model for testing model name starting with number - **/ -@ApiModel(description = "Model for testing model name starting with number") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class Model200Response { private Integer name = null; @@ -34,6 +31,7 @@ public class Model200Response { this.name = name; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelReturn.java index 0f4279af8d3..48aaeeec361 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelReturn.java @@ -7,12 +7,9 @@ import io.swagger.annotations.ApiModelProperty; -/** - * Model for testing reserved words - **/ -@ApiModel(description = "Model for testing reserved words") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class ModelReturn { private Integer _return = null; @@ -34,6 +31,7 @@ public class ModelReturn { this._return = _return; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java index e93e3c3ee72..d851de25cbe 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java @@ -7,17 +7,13 @@ import io.swagger.annotations.ApiModelProperty; -/** - * Model for testing model name same as property name - **/ -@ApiModel(description = "Model for testing model name same as property name") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class Name { private Integer name = null; private Integer snakeCase = null; - private String property = null; /** @@ -27,7 +23,7 @@ public class Name { return this; } - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("name") public Integer getName() { return name; @@ -36,30 +32,24 @@ public class Name { this.name = name; } - + + /** + **/ + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + @ApiModelProperty(example = "null", value = "") @JsonProperty("snake_case") public Integer getSnakeCase() { return snakeCase; } - - - /** - **/ - public Name property(String property) { - this.property = property; - return this; + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; } + - @ApiModelProperty(example = "null", value = "") - @JsonProperty("property") - public String getProperty() { - return property; - } - public void setProperty(String property) { - this.property = property; - } - @Override public boolean equals(java.lang.Object o) { @@ -71,13 +61,12 @@ public class Name { } Name name = (Name) o; return Objects.equals(this.name, name.name) && - Objects.equals(this.snakeCase, name.snakeCase) && - Objects.equals(this.property, name.property); + Objects.equals(this.snakeCase, name.snakeCase); } @Override public int hashCode() { - return Objects.hash(name, snakeCase, property); + return Objects.hash(name, snakeCase); } @Override @@ -87,7 +76,6 @@ public class Name { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); - sb.append(" property: ").append(toIndentedString(property)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java index 94be5295f5d..02adc174d7a 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java @@ -11,7 +11,7 @@ import java.util.Date; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class Order { private Long id = null; @@ -39,26 +39,16 @@ public class Order { } private StatusEnum status = null; - private Boolean complete = false; + private Boolean complete = null; - /** - **/ - public Order id(Long id) { - this.id = id; - return this; - } - @ApiModelProperty(example = "null", value = "") @JsonProperty("id") public Long getId() { return id; } - public void setId(Long id) { - this.id = id; - } - + /** **/ public Order petId(Long petId) { @@ -75,7 +65,7 @@ public class Order { this.petId = petId; } - + /** **/ public Order quantity(Integer quantity) { @@ -92,7 +82,7 @@ public class Order { this.quantity = quantity; } - + /** **/ public Order shipDate(Date shipDate) { @@ -109,7 +99,7 @@ public class Order { this.shipDate = shipDate; } - + /** * Order Status **/ @@ -127,7 +117,7 @@ public class Order { this.status = status; } - + /** **/ public Order complete(Boolean complete) { @@ -144,6 +134,7 @@ public class Order { this.complete = complete; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Pet.java index 7a4eca82fe0..1899cf69d9a 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Pet.java @@ -14,7 +14,7 @@ import java.util.List; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class Pet { private Long id = null; @@ -61,7 +61,7 @@ public class Pet { this.id = id; } - + /** **/ public Pet category(Category category) { @@ -78,7 +78,7 @@ public class Pet { this.category = category; } - + /** **/ public Pet name(String name) { @@ -95,7 +95,7 @@ public class Pet { this.name = name; } - + /** **/ public Pet photoUrls(List photoUrls) { @@ -112,7 +112,7 @@ public class Pet { this.photoUrls = photoUrls; } - + /** **/ public Pet tags(List tags) { @@ -129,7 +129,7 @@ public class Pet { this.tags = tags; } - + /** * pet status in the store **/ @@ -147,6 +147,7 @@ public class Pet { this.status = status; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/SpecialModelName.java index f1a153e79a0..3f44bcc50e8 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class SpecialModelName { private Long specialPropertyName = null; @@ -31,6 +31,7 @@ public class SpecialModelName { this.specialPropertyName = specialPropertyName; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Tag.java index 86cb5f48b09..aa94e125d8b 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class Tag { private Long id = null; @@ -32,7 +32,7 @@ public class Tag { this.id = id; } - + /** **/ public Tag name(String name) { @@ -49,6 +49,7 @@ public class Tag { this.name = name; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/User.java index f960f1461dd..be60c56a233 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class User { private Long id = null; @@ -38,7 +38,7 @@ public class User { this.id = id; } - + /** **/ public User username(String username) { @@ -55,7 +55,7 @@ public class User { this.username = username; } - + /** **/ public User firstName(String firstName) { @@ -72,7 +72,7 @@ public class User { this.firstName = firstName; } - + /** **/ public User lastName(String lastName) { @@ -89,7 +89,7 @@ public class User { this.lastName = lastName; } - + /** **/ public User email(String email) { @@ -106,7 +106,7 @@ public class User { this.email = email; } - + /** **/ public User password(String password) { @@ -123,7 +123,7 @@ public class User { this.password = password; } - + /** **/ public User phone(String phone) { @@ -140,7 +140,7 @@ public class User { this.phone = phone; } - + /** * User Status **/ @@ -158,6 +158,7 @@ public class User { this.userStatus = userStatus; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/InlineResponse200.java index 721faf5189e..4eb4016563a 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -13,7 +13,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T17:10:39.649+08:00") public class InlineResponse200 { private List tags = new ArrayList(); @@ -60,7 +60,7 @@ public class InlineResponse200 { this.tags = tags; } - + /** **/ public InlineResponse200 id(Long id) { @@ -77,7 +77,7 @@ public class InlineResponse200 { this.id = id; } - + /** **/ public InlineResponse200 category(Object category) { @@ -94,7 +94,7 @@ public class InlineResponse200 { this.category = category; } - + /** * pet status in the store **/ @@ -112,7 +112,7 @@ public class InlineResponse200 { this.status = status; } - + /** **/ public InlineResponse200 name(String name) { @@ -129,7 +129,7 @@ public class InlineResponse200 { this.name = name; } - + /** **/ public InlineResponse200 photoUrls(List photoUrls) { @@ -146,6 +146,7 @@ public class InlineResponse200 { this.photoUrls = photoUrls; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index a9c21234369..5851cf5af7c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -1,11 +1,11 @@ # SwaggerClient-php -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +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 PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-02T21:49:03.153+08:00 +- Build date: 2016-04-02T19:03:06.710+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -22,11 +22,11 @@ To install the bindings via [Composer](http://getcomposer.org/), add the followi "repositories": [ { "type": "git", - "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" + "url": "https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git" } ], "require": { - "GIT_USER_ID/GIT_REPO_ID": "*@dev" + "YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID": "*@dev" } } ``` @@ -58,24 +58,16 @@ Please follow the [installation procedure](#installation--usage) and then run th setAccessToken('YOUR_ACCESS_TOKEN'); + +$api_instance = new Swagger\Client\Api\PetApi(); +$body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store try { - $api_instance->testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); + $api_instance->addPet($body); } catch (Exception $e) { - echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), "\n"; + echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), "\n"; } ?> @@ -87,17 +79,21 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters *PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image *StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findordersbystatus) | **GET** /store/findByStatus | Finds orders by status *StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet *UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user @@ -113,11 +109,11 @@ Class | Method | HTTP request | Description ## Documentation For Models - [Animal](docs/Animal.md) - - [ApiResponse](docs/ApiResponse.md) - [Cat](docs/Cat.md) - [Category](docs/Category.md) - [Dog](docs/Dog.md) - - [FormatTest](docs/FormatTest.md) + - [EnumTest](docs/EnumTest.md) + - [InlineResponse200](docs/InlineResponse200.md) - [Model200Response](docs/Model200Response.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) @@ -131,17 +127,45 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## test_api_key_header + +- **Type**: API key +- **API key parameter name**: test_api_key_header +- **Location**: HTTP header + ## api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header +## test_http_basic + +- **Type**: HTTP basic authentication + +## test_api_client_secret + +- **Type**: API key +- **API key parameter name**: x-test_api_client_secret +- **Location**: HTTP header + +## test_api_client_id + +- **Type**: API key +- **API key parameter name**: x-test_api_client_id +- **Location**: HTTP header + +## test_api_key_query + +- **Type**: API key +- **API key parameter name**: test_api_key_query +- **Location**: URL query string + ## petstore_auth - **Type**: OAuth - **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - **write:pets**: modify pets in your account - **read:pets**: read your pets diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 1154b72929c..4ab1529c7c0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -60,7 +60,7 @@ class PetApi * Constructor * @param \Swagger\Client\ApiClient|null $apiClient The api client to use */ - function __construct($apiClient = null) + function __construct(\Swagger\Client\ApiClient $apiClient = null) { if ($apiClient == null) { $apiClient = new ApiClient(); @@ -84,7 +84,7 @@ class PetApi * @param \Swagger\Client\ApiClient $apiClient set the API client * @return PetApi */ - public function setApiClient(ApiClient $apiClient) + public function setApiClient(\Swagger\Client\ApiClient $apiClient) { $this->apiClient = $apiClient; return $this; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 27253a09f4f..a238eb41312 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -60,7 +60,7 @@ class StoreApi * Constructor * @param \Swagger\Client\ApiClient|null $apiClient The api client to use */ - function __construct($apiClient = null) + function __construct(\Swagger\Client\ApiClient $apiClient = null) { if ($apiClient == null) { $apiClient = new ApiClient(); @@ -84,7 +84,7 @@ class StoreApi * @param \Swagger\Client\ApiClient $apiClient set the API client * @return StoreApi */ - public function setApiClient(ApiClient $apiClient) + public function setApiClient(\Swagger\Client\ApiClient $apiClient) { $this->apiClient = $apiClient; return $this; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 96c9fa6fc09..ed9744b8255 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -60,7 +60,7 @@ class UserApi * Constructor * @param \Swagger\Client\ApiClient|null $apiClient The api client to use */ - function __construct($apiClient = null) + function __construct(\Swagger\Client\ApiClient $apiClient = null) { if ($apiClient == null) { $apiClient = new ApiClient(); @@ -84,7 +84,7 @@ class UserApi * @param \Swagger\Client\ApiClient $apiClient set the API client * @return UserApi */ - public function setApiClient(ApiClient $apiClient) + public function setApiClient(\Swagger\Client\ApiClient $apiClient) { $this->apiClient = $apiClient; return $this; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php index 65ee9d27f29..b28f2f26140 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php @@ -69,7 +69,7 @@ class ApiClient * Constructor of the class * @param Configuration $config config for this ApiClient */ - public function __construct(Configuration $config = null) + public function __construct(\Swagger\Client\Configuration $config = null) { if ($config == null) { $config = Configuration::getDefaultConfiguration(); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php index 3f01e789547..a6dbe683be3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class Animal implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Animal'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -59,19 +53,19 @@ class Animal implements ArrayAccess static $swaggerTypes = array( 'class_name' => '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[] + * @var string[] */ static $attributeMap = array( 'class_name' => 'className' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +77,7 @@ class Animal implements ArrayAccess static $setters = array( 'class_name' => 'setClassName' ); - + static function setters() { return self::$setters; } @@ -95,16 +89,22 @@ class Animal implements ArrayAccess static $getters = array( 'class_name' => 'getClassName' ); - + static function getters() { return self::$getters; } + + + + + /** * $class_name * @var string */ protected $class_name; + /** * Constructor @@ -113,14 +113,11 @@ class Animal implements ArrayAccess public function __construct(array $data = null) { - // Initialize discriminator property with the model name. - $discrimintor = array_search('className', self::$attributeMap); - $this->{$discrimintor} = static::$swaggerModelName; - if ($data != null) { $this->class_name = $data["class_name"]; } } + /** * Gets class_name * @return string @@ -129,7 +126,7 @@ class Animal implements ArrayAccess { return $this->class_name; } - + /** * Sets class_name * @param string $class_name @@ -141,6 +138,7 @@ class Animal implements ArrayAccess $this->class_name = $class_name; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -150,7 +148,7 @@ class Animal implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -160,7 +158,7 @@ class Animal implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -171,7 +169,7 @@ class Animal implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -181,17 +179,17 @@ class Animal implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - 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 index e0eaf7a106d..8fefbd62c10 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class Cat extends Animal implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Cat'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -59,19 +53,19 @@ class Cat extends Animal implements ArrayAccess static $swaggerTypes = array( 'declawed' => '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[] + * @var string[] */ static $attributeMap = array( 'declawed' => 'declawed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +77,7 @@ class Cat extends Animal implements ArrayAccess static $setters = array( 'declawed' => 'setDeclawed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -95,16 +89,22 @@ class Cat extends Animal implements ArrayAccess static $getters = array( 'declawed' => 'getDeclawed' ); - + static function getters() { return parent::getters() + self::$getters; } + + + + + /** * $declawed * @var bool */ protected $declawed; + /** * Constructor @@ -113,11 +113,11 @@ class Cat extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - if ($data != null) { $this->declawed = $data["declawed"]; } } + /** * Gets declawed * @return bool @@ -126,7 +126,7 @@ class Cat extends Animal implements ArrayAccess { return $this->declawed; } - + /** * Sets declawed * @param bool $declawed @@ -138,6 +138,7 @@ class Cat extends Animal implements ArrayAccess $this->declawed = $declawed; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -147,7 +148,7 @@ class Cat extends Animal implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -157,7 +158,7 @@ class Cat extends Animal implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -168,7 +169,7 @@ class Cat extends Animal implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -178,17 +179,17 @@ class Cat extends Animal implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - 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 fb6eed3af29..ad1d379a8a3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class Category implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Category'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -60,20 +54,20 @@ class Category implements ArrayAccess 'id' => 'int', 'name' => '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[] + * @var string[] */ static $attributeMap = array( 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +80,7 @@ class Category implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -99,21 +93,28 @@ class Category implements ArrayAccess 'id' => 'getId', 'name' => 'getName' ); - + static function getters() { return self::$getters; } + + + + + /** * $id * @var int */ protected $id; + /** * $name * @var string */ protected $name; + /** * Constructor @@ -122,12 +123,12 @@ class Category implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->id = $data["id"]; $this->name = $data["name"]; } } + /** * Gets id * @return int @@ -136,7 +137,7 @@ class Category implements ArrayAccess { return $this->id; } - + /** * Sets id * @param int $id @@ -148,6 +149,7 @@ class Category implements ArrayAccess $this->id = $id; return $this; } + /** * Gets name * @return string @@ -156,7 +158,7 @@ class Category implements ArrayAccess { return $this->name; } - + /** * Sets name * @param string $name @@ -168,6 +170,7 @@ class Category implements ArrayAccess $this->name = $name; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -177,7 +180,7 @@ class Category implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -187,7 +190,7 @@ class Category implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -198,7 +201,7 @@ class Category implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -208,17 +211,17 @@ class Category implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php index 6fd43d3a944..a4251641749 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class Dog extends Animal implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Dog'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -59,19 +53,19 @@ class Dog extends Animal implements ArrayAccess static $swaggerTypes = array( 'breed' => '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[] + * @var string[] */ static $attributeMap = array( 'breed' => 'breed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +77,7 @@ class Dog extends Animal implements ArrayAccess static $setters = array( 'breed' => 'setBreed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -95,16 +89,22 @@ class Dog extends Animal implements ArrayAccess static $getters = array( 'breed' => 'getBreed' ); - + static function getters() { return parent::getters() + self::$getters; } + + + + + /** * $breed * @var string */ protected $breed; + /** * Constructor @@ -113,11 +113,11 @@ class Dog extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - if ($data != null) { $this->breed = $data["breed"]; } } + /** * Gets breed * @return string @@ -126,7 +126,7 @@ class Dog extends Animal implements ArrayAccess { return $this->breed; } - + /** * Sets breed * @param string $breed @@ -138,6 +138,7 @@ class Dog extends Animal implements ArrayAccess $this->breed = $breed; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -147,7 +148,7 @@ class Dog extends Animal implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -157,7 +158,7 @@ class Dog extends Animal implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -168,7 +169,7 @@ class Dog extends Animal implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -178,17 +179,17 @@ class Dog extends Animal implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - 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 3bd2106ba0e..69bc6d72dcf 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class InlineResponse200 implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'inline_response_200'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -64,14 +58,14 @@ class InlineResponse200 implements ArrayAccess 'name' => 'string', 'photo_urls' => '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[] + * @var string[] */ static $attributeMap = array( 'tags' => 'tags', @@ -81,7 +75,7 @@ class InlineResponse200 implements ArrayAccess 'name' => 'name', 'photo_urls' => 'photoUrls' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +92,7 @@ class InlineResponse200 implements ArrayAccess 'name' => 'setName', 'photo_urls' => 'setPhotoUrls' ); - + static function setters() { return self::$setters; } @@ -115,41 +109,55 @@ class InlineResponse200 implements ArrayAccess 'name' => 'getName', 'photo_urls' => 'getPhotoUrls' ); - + static function getters() { return self::$getters; } + const STATUS_AVAILABLE = "available"; + const STATUS_PENDING = "pending"; + const STATUS_SOLD = "sold"; + + + + + /** * $tags * @var \Swagger\Client\Model\Tag[] */ protected $tags; + /** * $id * @var int */ protected $id; + /** * $category * @var object */ protected $category; + /** * $status pet status in the store * @var string */ protected $status; + /** * $name * @var string */ protected $name; + /** * $photo_urls * @var string[] */ protected $photo_urls; + /** * Constructor @@ -158,7 +166,6 @@ class InlineResponse200 implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->tags = $data["tags"]; $this->id = $data["id"]; @@ -168,6 +175,7 @@ class InlineResponse200 implements ArrayAccess $this->photo_urls = $data["photo_urls"]; } } + /** * Gets tags * @return \Swagger\Client\Model\Tag[] @@ -176,7 +184,7 @@ class InlineResponse200 implements ArrayAccess { return $this->tags; } - + /** * Sets tags * @param \Swagger\Client\Model\Tag[] $tags @@ -188,6 +196,7 @@ class InlineResponse200 implements ArrayAccess $this->tags = $tags; return $this; } + /** * Gets id * @return int @@ -196,7 +205,7 @@ class InlineResponse200 implements ArrayAccess { return $this->id; } - + /** * Sets id * @param int $id @@ -208,6 +217,7 @@ class InlineResponse200 implements ArrayAccess $this->id = $id; return $this; } + /** * Gets category * @return object @@ -216,7 +226,7 @@ class InlineResponse200 implements ArrayAccess { return $this->category; } - + /** * Sets category * @param object $category @@ -228,6 +238,7 @@ class InlineResponse200 implements ArrayAccess $this->category = $category; return $this; } + /** * Gets status * @return string @@ -236,7 +247,7 @@ class InlineResponse200 implements ArrayAccess { return $this->status; } - + /** * Sets status * @param string $status pet status in the store @@ -251,6 +262,7 @@ class InlineResponse200 implements ArrayAccess $this->status = $status; return $this; } + /** * Gets name * @return string @@ -259,7 +271,7 @@ class InlineResponse200 implements ArrayAccess { return $this->name; } - + /** * Sets name * @param string $name @@ -271,6 +283,7 @@ class InlineResponse200 implements ArrayAccess $this->name = $name; return $this; } + /** * Gets photo_urls * @return string[] @@ -279,7 +292,7 @@ class InlineResponse200 implements ArrayAccess { return $this->photo_urls; } - + /** * Sets photo_urls * @param string[] $photo_urls @@ -291,6 +304,7 @@ class InlineResponse200 implements ArrayAccess $this->photo_urls = $photo_urls; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -300,7 +314,7 @@ class InlineResponse200 implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -310,7 +324,7 @@ class InlineResponse200 implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -321,7 +335,7 @@ class InlineResponse200 implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -331,17 +345,17 @@ class InlineResponse200 implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } 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 8d62f9531ec..0a3ec1bc34c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -38,7 +38,7 @@ use \ArrayAccess; * Model200Response Class Doc Comment * * @category Class - * @description Model for testing model name starting with number + * @description * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 @@ -46,12 +46,6 @@ use \ArrayAccess; */ class Model200Response implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = '200_response'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -59,19 +53,19 @@ class Model200Response implements ArrayAccess static $swaggerTypes = array( 'name' => 'int' ); - + 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[] + * @var string[] */ static $attributeMap = array( 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +77,7 @@ class Model200Response implements ArrayAccess static $setters = array( 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -95,16 +89,22 @@ class Model200Response implements ArrayAccess static $getters = array( 'name' => 'getName' ); - + static function getters() { return self::$getters; } + + + + + /** * $name * @var int */ protected $name; + /** * Constructor @@ -113,11 +113,11 @@ class Model200Response implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->name = $data["name"]; } } + /** * Gets name * @return int @@ -126,7 +126,7 @@ class Model200Response implements ArrayAccess { return $this->name; } - + /** * Sets name * @param int $name @@ -138,6 +138,7 @@ class Model200Response implements ArrayAccess $this->name = $name; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -147,7 +148,7 @@ class Model200Response implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -157,7 +158,7 @@ class Model200Response implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -168,7 +169,7 @@ class Model200Response implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -178,17 +179,17 @@ class Model200Response implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } 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 d4660e118fd..f3391fb9c88 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -38,7 +38,7 @@ use \ArrayAccess; * ModelReturn Class Doc Comment * * @category Class - * @description Model for testing reserved words + * @description * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 @@ -46,12 +46,6 @@ use \ArrayAccess; */ class ModelReturn implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Return'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -59,19 +53,19 @@ class ModelReturn implements ArrayAccess static $swaggerTypes = array( 'return' => 'int' ); - + 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[] + * @var string[] */ static $attributeMap = array( 'return' => 'return' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +77,7 @@ class ModelReturn implements ArrayAccess static $setters = array( 'return' => 'setReturn' ); - + static function setters() { return self::$setters; } @@ -95,16 +89,22 @@ class ModelReturn implements ArrayAccess static $getters = array( 'return' => 'getReturn' ); - + static function getters() { return self::$getters; } + + + + + /** * $return * @var int */ protected $return; + /** * Constructor @@ -113,11 +113,11 @@ class ModelReturn implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->return = $data["return"]; } } + /** * Gets return * @return int @@ -126,7 +126,7 @@ class ModelReturn implements ArrayAccess { return $this->return; } - + /** * Sets return * @param int $return @@ -138,6 +138,7 @@ class ModelReturn implements ArrayAccess $this->return = $return; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -147,7 +148,7 @@ class ModelReturn implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -157,7 +158,7 @@ class ModelReturn implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -168,7 +169,7 @@ class ModelReturn implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -178,17 +179,17 @@ class ModelReturn implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } 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 9e1c4b92762..5154866eb62 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -38,7 +38,7 @@ use \ArrayAccess; * Name Class Doc Comment * * @category Class - * @description Model for testing model name same as property name + * @description * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 @@ -46,36 +46,28 @@ use \ArrayAccess; */ class Name implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Name'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] */ static $swaggerTypes = array( 'name' => 'int', - 'snake_case' => 'int', - 'property' => 'string' + 'snake_case' => 'int' ); - + 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[] + * @var string[] */ static $attributeMap = array( 'name' => 'name', - 'snake_case' => 'snake_case', - 'property' => 'property' + 'snake_case' => 'snake_case' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,10 +78,9 @@ class Name implements ArrayAccess */ static $setters = array( 'name' => 'setName', - 'snake_case' => 'setSnakeCase', - 'property' => 'setProperty' + 'snake_case' => 'setSnakeCase' ); - + static function setters() { return self::$setters; } @@ -100,29 +91,30 @@ class Name implements ArrayAccess */ static $getters = array( 'name' => 'getName', - 'snake_case' => 'getSnakeCase', - 'property' => 'getProperty' + 'snake_case' => 'getSnakeCase' ); - + static function getters() { return self::$getters; } + + + + + /** * $name * @var int */ protected $name; + /** * $snake_case * @var int */ protected $snake_case; - /** - * $property - * @var string - */ - protected $property; + /** * Constructor @@ -131,13 +123,12 @@ class Name implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->name = $data["name"]; $this->snake_case = $data["snake_case"]; - $this->property = $data["property"]; } } + /** * Gets name * @return int @@ -146,7 +137,7 @@ class Name implements ArrayAccess { return $this->name; } - + /** * Sets name * @param int $name @@ -158,6 +149,7 @@ class Name implements ArrayAccess $this->name = $name; return $this; } + /** * Gets snake_case * @return int @@ -166,7 +158,7 @@ class Name implements ArrayAccess { return $this->snake_case; } - + /** * Sets snake_case * @param int $snake_case @@ -178,26 +170,7 @@ class Name implements ArrayAccess $this->snake_case = $snake_case; return $this; } - /** - * Gets property - * @return string - */ - public function getProperty() - { - return $this->property; - } - - /** - * Sets property - * @param string $property - * @return $this - */ - public function setProperty($property) - { - - $this->property = $property; - return $this; - } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -207,7 +180,7 @@ class Name implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -217,7 +190,7 @@ class Name implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -228,7 +201,7 @@ class Name implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -238,17 +211,17 @@ class Name implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index 7ee5c124d2c..1335d16c472 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class Order implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Order'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -64,14 +58,14 @@ class Order implements ArrayAccess 'status' => 'string', 'complete' => 'bool' ); - + 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[] + * @var string[] */ static $attributeMap = array( 'id' => 'id', @@ -81,7 +75,7 @@ class Order implements ArrayAccess 'status' => 'status', 'complete' => 'complete' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +92,7 @@ class Order implements ArrayAccess 'status' => 'setStatus', 'complete' => 'setComplete' ); - + static function setters() { return self::$setters; } @@ -115,41 +109,55 @@ class Order implements ArrayAccess 'status' => 'getStatus', 'complete' => 'getComplete' ); - + static function getters() { return self::$getters; } + const STATUS_PLACED = "placed"; + const STATUS_APPROVED = "approved"; + const STATUS_DELIVERED = "delivered"; + + + + + /** * $id * @var int */ protected $id; + /** * $pet_id * @var int */ protected $pet_id; + /** * $quantity * @var int */ protected $quantity; + /** * $ship_date * @var \DateTime */ protected $ship_date; + /** * $status Order Status * @var string */ protected $status; + /** * $complete * @var bool */ - protected $complete = false; + protected $complete; + /** * Constructor @@ -158,7 +166,6 @@ class Order implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->id = $data["id"]; $this->pet_id = $data["pet_id"]; @@ -168,6 +175,7 @@ class Order implements ArrayAccess $this->complete = $data["complete"]; } } + /** * Gets id * @return int @@ -176,7 +184,7 @@ class Order implements ArrayAccess { return $this->id; } - + /** * Sets id * @param int $id @@ -188,6 +196,7 @@ class Order implements ArrayAccess $this->id = $id; return $this; } + /** * Gets pet_id * @return int @@ -196,7 +205,7 @@ class Order implements ArrayAccess { return $this->pet_id; } - + /** * Sets pet_id * @param int $pet_id @@ -208,6 +217,7 @@ class Order implements ArrayAccess $this->pet_id = $pet_id; return $this; } + /** * Gets quantity * @return int @@ -216,7 +226,7 @@ class Order implements ArrayAccess { return $this->quantity; } - + /** * Sets quantity * @param int $quantity @@ -228,6 +238,7 @@ class Order implements ArrayAccess $this->quantity = $quantity; return $this; } + /** * Gets ship_date * @return \DateTime @@ -236,7 +247,7 @@ class Order implements ArrayAccess { return $this->ship_date; } - + /** * Sets ship_date * @param \DateTime $ship_date @@ -248,6 +259,7 @@ class Order implements ArrayAccess $this->ship_date = $ship_date; return $this; } + /** * Gets status * @return string @@ -256,7 +268,7 @@ class Order implements ArrayAccess { return $this->status; } - + /** * Sets status * @param string $status Order Status @@ -271,6 +283,7 @@ class Order implements ArrayAccess $this->status = $status; return $this; } + /** * Gets complete * @return bool @@ -279,7 +292,7 @@ class Order implements ArrayAccess { return $this->complete; } - + /** * Sets complete * @param bool $complete @@ -291,6 +304,7 @@ class Order implements ArrayAccess $this->complete = $complete; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -300,7 +314,7 @@ class Order implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -310,7 +324,7 @@ class Order implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -321,7 +335,7 @@ class Order implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -331,17 +345,17 @@ class Order implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php index 3a9e46cd3fb..52d18a8150b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class Pet implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Pet'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -64,14 +58,14 @@ class Pet implements ArrayAccess 'tags' => '\Swagger\Client\Model\Tag[]', 'status' => '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[] + * @var string[] */ static $attributeMap = array( 'id' => 'id', @@ -81,7 +75,7 @@ class Pet implements ArrayAccess 'tags' => 'tags', 'status' => 'status' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +92,7 @@ class Pet implements ArrayAccess 'tags' => 'setTags', 'status' => 'setStatus' ); - + static function setters() { return self::$setters; } @@ -115,41 +109,55 @@ class Pet implements ArrayAccess 'tags' => 'getTags', 'status' => 'getStatus' ); - + static function getters() { return self::$getters; } + const STATUS_AVAILABLE = "available"; + const STATUS_PENDING = "pending"; + const STATUS_SOLD = "sold"; + + + + + /** * $id * @var int */ protected $id; + /** * $category * @var \Swagger\Client\Model\Category */ protected $category; + /** * $name * @var string */ protected $name; + /** * $photo_urls * @var string[] */ protected $photo_urls; + /** * $tags * @var \Swagger\Client\Model\Tag[] */ protected $tags; + /** * $status pet status in the store * @var string */ protected $status; + /** * Constructor @@ -158,7 +166,6 @@ class Pet implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->id = $data["id"]; $this->category = $data["category"]; @@ -168,6 +175,7 @@ class Pet implements ArrayAccess $this->status = $data["status"]; } } + /** * Gets id * @return int @@ -176,7 +184,7 @@ class Pet implements ArrayAccess { return $this->id; } - + /** * Sets id * @param int $id @@ -188,6 +196,7 @@ class Pet implements ArrayAccess $this->id = $id; return $this; } + /** * Gets category * @return \Swagger\Client\Model\Category @@ -196,7 +205,7 @@ class Pet implements ArrayAccess { return $this->category; } - + /** * Sets category * @param \Swagger\Client\Model\Category $category @@ -208,6 +217,7 @@ class Pet implements ArrayAccess $this->category = $category; return $this; } + /** * Gets name * @return string @@ -216,7 +226,7 @@ class Pet implements ArrayAccess { return $this->name; } - + /** * Sets name * @param string $name @@ -228,6 +238,7 @@ class Pet implements ArrayAccess $this->name = $name; return $this; } + /** * Gets photo_urls * @return string[] @@ -236,7 +247,7 @@ class Pet implements ArrayAccess { return $this->photo_urls; } - + /** * Sets photo_urls * @param string[] $photo_urls @@ -248,6 +259,7 @@ class Pet implements ArrayAccess $this->photo_urls = $photo_urls; return $this; } + /** * Gets tags * @return \Swagger\Client\Model\Tag[] @@ -256,7 +268,7 @@ class Pet implements ArrayAccess { return $this->tags; } - + /** * Sets tags * @param \Swagger\Client\Model\Tag[] $tags @@ -268,6 +280,7 @@ class Pet implements ArrayAccess $this->tags = $tags; return $this; } + /** * Gets status * @return string @@ -276,7 +289,7 @@ class Pet implements ArrayAccess { return $this->status; } - + /** * Sets status * @param string $status pet status in the store @@ -291,6 +304,7 @@ class Pet implements ArrayAccess $this->status = $status; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -300,7 +314,7 @@ class Pet implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -310,7 +324,7 @@ class Pet implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -321,7 +335,7 @@ class Pet implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -331,17 +345,17 @@ class Pet implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } 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 fb748811cf2..e3f0430e6f6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class SpecialModelName implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = '$special[model.name]'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -59,19 +53,19 @@ class SpecialModelName implements ArrayAccess static $swaggerTypes = array( 'special_property_name' => 'int' ); - + 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[] + * @var string[] */ static $attributeMap = array( 'special_property_name' => '$special[property.name]' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +77,7 @@ class SpecialModelName implements ArrayAccess static $setters = array( 'special_property_name' => 'setSpecialPropertyName' ); - + static function setters() { return self::$setters; } @@ -95,16 +89,22 @@ class SpecialModelName implements ArrayAccess static $getters = array( 'special_property_name' => 'getSpecialPropertyName' ); - + static function getters() { return self::$getters; } + + + + + /** * $special_property_name * @var int */ protected $special_property_name; + /** * Constructor @@ -113,11 +113,11 @@ class SpecialModelName implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->special_property_name = $data["special_property_name"]; } } + /** * Gets special_property_name * @return int @@ -126,7 +126,7 @@ class SpecialModelName implements ArrayAccess { return $this->special_property_name; } - + /** * Sets special_property_name * @param int $special_property_name @@ -138,6 +138,7 @@ class SpecialModelName implements ArrayAccess $this->special_property_name = $special_property_name; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -147,7 +148,7 @@ class SpecialModelName implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -157,7 +158,7 @@ class SpecialModelName implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -168,7 +169,7 @@ class SpecialModelName implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -178,17 +179,17 @@ class SpecialModelName implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php index 4bb56401c48..e96ed199fa6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class Tag implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'Tag'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -60,20 +54,20 @@ class Tag implements ArrayAccess 'id' => 'int', 'name' => '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[] + * @var string[] */ static $attributeMap = array( 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +80,7 @@ class Tag implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -99,21 +93,28 @@ class Tag implements ArrayAccess 'id' => 'getId', 'name' => 'getName' ); - + static function getters() { return self::$getters; } + + + + + /** * $id * @var int */ protected $id; + /** * $name * @var string */ protected $name; + /** * Constructor @@ -122,12 +123,12 @@ class Tag implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->id = $data["id"]; $this->name = $data["name"]; } } + /** * Gets id * @return int @@ -136,7 +137,7 @@ class Tag implements ArrayAccess { return $this->id; } - + /** * Sets id * @param int $id @@ -148,6 +149,7 @@ class Tag implements ArrayAccess $this->id = $id; return $this; } + /** * Gets name * @return string @@ -156,7 +158,7 @@ class Tag implements ArrayAccess { return $this->name; } - + /** * Sets name * @param string $name @@ -168,6 +170,7 @@ class Tag implements ArrayAccess $this->name = $name; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -177,7 +180,7 @@ class Tag implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -187,7 +190,7 @@ class Tag implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -198,7 +201,7 @@ class Tag implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -208,17 +211,17 @@ class Tag implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php index da9cc20ff4c..3a56a1e66d9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -46,12 +46,6 @@ use \ArrayAccess; */ class User implements ArrayAccess { - /** - * The original name of the model. - * @var string - */ - static $swaggerModelName = 'User'; - /** * Array of property to type mappings. Used for (de)serialization * @var string[] @@ -66,14 +60,14 @@ class User implements ArrayAccess 'phone' => 'string', 'user_status' => 'int' ); - + 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[] + * @var string[] */ static $attributeMap = array( 'id' => 'id', @@ -85,7 +79,7 @@ class User implements ArrayAccess 'phone' => 'phone', 'user_status' => 'userStatus' ); - + static function attributeMap() { return self::$attributeMap; } @@ -104,7 +98,7 @@ class User implements ArrayAccess 'phone' => 'setPhone', 'user_status' => 'setUserStatus' ); - + static function setters() { return self::$setters; } @@ -123,51 +117,64 @@ class User implements ArrayAccess 'phone' => 'getPhone', 'user_status' => 'getUserStatus' ); - + static function getters() { return self::$getters; } + + + + + /** * $id * @var int */ protected $id; + /** * $username * @var string */ protected $username; + /** * $first_name * @var string */ protected $first_name; + /** * $last_name * @var string */ protected $last_name; + /** * $email * @var string */ protected $email; + /** * $password * @var string */ protected $password; + /** * $phone * @var string */ protected $phone; + /** * $user_status User Status * @var int */ protected $user_status; + /** * Constructor @@ -176,7 +183,6 @@ class User implements ArrayAccess public function __construct(array $data = null) { - if ($data != null) { $this->id = $data["id"]; $this->username = $data["username"]; @@ -188,6 +194,7 @@ class User implements ArrayAccess $this->user_status = $data["user_status"]; } } + /** * Gets id * @return int @@ -196,7 +203,7 @@ class User implements ArrayAccess { return $this->id; } - + /** * Sets id * @param int $id @@ -208,6 +215,7 @@ class User implements ArrayAccess $this->id = $id; return $this; } + /** * Gets username * @return string @@ -216,7 +224,7 @@ class User implements ArrayAccess { return $this->username; } - + /** * Sets username * @param string $username @@ -228,6 +236,7 @@ class User implements ArrayAccess $this->username = $username; return $this; } + /** * Gets first_name * @return string @@ -236,7 +245,7 @@ class User implements ArrayAccess { return $this->first_name; } - + /** * Sets first_name * @param string $first_name @@ -248,6 +257,7 @@ class User implements ArrayAccess $this->first_name = $first_name; return $this; } + /** * Gets last_name * @return string @@ -256,7 +266,7 @@ class User implements ArrayAccess { return $this->last_name; } - + /** * Sets last_name * @param string $last_name @@ -268,6 +278,7 @@ class User implements ArrayAccess $this->last_name = $last_name; return $this; } + /** * Gets email * @return string @@ -276,7 +287,7 @@ class User implements ArrayAccess { return $this->email; } - + /** * Sets email * @param string $email @@ -288,6 +299,7 @@ class User implements ArrayAccess $this->email = $email; return $this; } + /** * Gets password * @return string @@ -296,7 +308,7 @@ class User implements ArrayAccess { return $this->password; } - + /** * Sets password * @param string $password @@ -308,6 +320,7 @@ class User implements ArrayAccess $this->password = $password; return $this; } + /** * Gets phone * @return string @@ -316,7 +329,7 @@ class User implements ArrayAccess { return $this->phone; } - + /** * Sets phone * @param string $phone @@ -328,6 +341,7 @@ class User implements ArrayAccess $this->phone = $phone; return $this; } + /** * Gets user_status * @return int @@ -336,7 +350,7 @@ class User implements ArrayAccess { return $this->user_status; } - + /** * Sets user_status * @param int $user_status User Status @@ -348,6 +362,7 @@ class User implements ArrayAccess $this->user_status = $user_status; return $this; } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -357,7 +372,7 @@ class User implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -367,7 +382,7 @@ class User implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -378,7 +393,7 @@ class User implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -388,17 +403,17 @@ class User implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + 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)); } - - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); } }