From 14ceb4bf84bc228f57fa3c05479d62e7fa9aee98 Mon Sep 17 00:00:00 2001 From: demonfiddler Date: Fri, 25 Mar 2016 16:36:06 +0000 Subject: [PATCH 001/170] Fix, tests for Issue#2240 "Support invokerPackage configuration option" --- .../languages/JavascriptClientCodegen.java | 42 +++++++++++++++---- .../resources/Javascript/ApiClient.mustache | 12 +++--- .../main/resources/Javascript/README.mustache | 2 +- .../main/resources/Javascript/api.mustache | 14 +++---- .../resources/Javascript/api_doc.mustache | 2 +- .../resources/Javascript/git_push.sh.mustache | 2 +- .../main/resources/Javascript/index.mustache | 16 +++---- .../main/resources/Javascript/model.mustache | 14 +++---- .../resources/Javascript/package.mustache | 2 +- .../JavaScriptClientOptionsTest.java | 2 + .../options/JavaScriptOptionsProvider.java | 4 +- .../petstore/javascript-promise/README.md | 4 +- .../javascript-promise/docs/PetApi.md | 22 +++++----- .../javascript-promise/docs/StoreApi.md | 12 +++--- .../javascript-promise/docs/UserApi.md | 16 +++---- .../petstore/javascript-promise/git_push.sh | 2 +- .../javascript-promise/src/api/PetApi.js | 6 +-- .../javascript-promise/src/api/StoreApi.js | 6 +-- .../javascript-promise/src/api/UserApi.js | 6 +-- .../petstore/javascript-promise/src/index.js | 8 ++-- .../javascript-promise/src/model/Category.js | 2 +- .../src/model/InlineResponse200.js | 2 +- .../src/model/Model200Response.js | 2 +- .../src/model/ModelReturn.js | 2 +- .../javascript-promise/src/model/Name.js | 2 +- .../javascript-promise/src/model/Order.js | 2 +- .../javascript-promise/src/model/Pet.js | 2 +- .../src/model/SpecialModelName.js | 2 +- .../javascript-promise/src/model/Tag.js | 2 +- .../javascript-promise/src/model/User.js | 2 +- samples/client/petstore/javascript/README.md | 4 +- .../client/petstore/javascript/docs/PetApi.md | 22 +++++----- .../petstore/javascript/docs/StoreApi.md | 12 +++--- .../petstore/javascript/docs/UserApi.md | 16 +++---- .../client/petstore/javascript/git_push.sh | 2 +- .../petstore/javascript/src/api/PetApi.js | 6 +-- .../petstore/javascript/src/api/StoreApi.js | 6 +-- .../petstore/javascript/src/api/UserApi.js | 6 +-- .../client/petstore/javascript/src/index.js | 8 ++-- .../petstore/javascript/src/model/Category.js | 2 +- .../javascript/src/model/InlineResponse200.js | 2 +- .../javascript/src/model/Model200Response.js | 2 +- .../javascript/src/model/ModelReturn.js | 2 +- .../petstore/javascript/src/model/Name.js | 2 +- .../petstore/javascript/src/model/Order.js | 2 +- .../petstore/javascript/src/model/Pet.js | 2 +- .../javascript/src/model/SpecialModelName.js | 2 +- .../petstore/javascript/src/model/Tag.js | 2 +- .../petstore/javascript/src/model/User.js | 2 +- 49 files changed, 173 insertions(+), 143 deletions(-) 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 d9c93e4f69ea..0541995b926d 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 @@ -63,6 +63,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo protected String projectVersion; protected String projectLicenseName; + protected String invokerPackage; protected String sourceFolder = "src"; protected String localVariablePrefix = ""; protected boolean usePromises; @@ -137,6 +138,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC).defaultValue("src")); cliOptions.add(new CliOption(CodegenConstants.LOCAL_VARIABLE_PREFIX, CodegenConstants.LOCAL_VARIABLE_PREFIX_DESC)); + cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); cliOptions.add(new CliOption(PROJECT_NAME, @@ -203,6 +205,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); } + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + } if (additionalProperties.containsKey(USE_PROMISES)) { setUsePromises(Boolean.parseBoolean((String)additionalProperties.get(USE_PROMISES))); } @@ -265,6 +270,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo additionalProperties.put(PROJECT_DESCRIPTION, escapeText(projectDescription)); additionalProperties.put(PROJECT_VERSION, projectVersion); additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); + additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); additionalProperties.put(CodegenConstants.LOCAL_VARIABLE_PREFIX, localVariablePrefix); additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage); additionalProperties.put(CodegenConstants.SOURCE_FOLDER, sourceFolder); @@ -278,8 +284,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo additionalProperties.put("modelDocPath", modelDocPath); supportingFiles.add(new SupportingFile("package.mustache", "", "package.json")); - supportingFiles.add(new SupportingFile("index.mustache", sourceFolder, "index.js")); - supportingFiles.add(new SupportingFile("ApiClient.mustache", sourceFolder, "ApiClient.js")); + supportingFiles.add(new SupportingFile("index.mustache", createPath(sourceFolder, invokerPackage), "index.js")); + supportingFiles.add(new SupportingFile("ApiClient.mustache", createPath(sourceFolder, invokerPackage), "ApiClient.js")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); } @@ -289,14 +295,35 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo return "_" + name; } + private String createPath(String... segments) { + StringBuilder buf = new StringBuilder(); + for (String segment : segments) { + if (!StringUtils.isEmpty(segment) && !segment.equals(".")) { + if (buf.length() != 0) + buf.append(File.separatorChar); + buf.append(segment); + } + } + for (int i = 0; i < buf.length(); i++) { + char c = buf.charAt(i); + if ((c == '/' || c == '\\') && c != File.separatorChar) + buf.setCharAt(i, File.separatorChar); + } + return buf.toString(); + } + @Override public String apiFileFolder() { - return outputFolder + '/' + sourceFolder + '/' + apiPackage().replace('.', '/'); + return createPath(outputFolder, sourceFolder, invokerPackage, apiPackage()); } @Override public String modelFileFolder() { - return outputFolder + '/' + sourceFolder + '/' + modelPackage().replace('.', '/'); + return createPath(outputFolder, sourceFolder, invokerPackage, modelPackage()); + } + + public void setInvokerPackage(String invokerPackage) { + this.invokerPackage = invokerPackage; } public void setSourceFolder(String sourceFolder) { @@ -345,12 +372,12 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo @Override public String apiDocFileFolder() { - return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + return createPath(outputFolder, apiDocPath); } @Override public String modelDocFileFolder() { - return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + return createPath(outputFolder, modelDocPath); } @Override @@ -694,7 +721,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo } private String getModelledType(String dataType) { - return "module:" + (StringUtils.isEmpty(modelPackage) ? "" : (modelPackage + "/")) + dataType; + return "module:" + (StringUtils.isEmpty(invokerPackage) ? "" : (invokerPackage + "/")) + + (StringUtils.isEmpty(modelPackage) ? "" : (modelPackage + "/")) + dataType; } private String getJSDocTypeWithBraces(CodegenModel cm, CodegenProperty cp) { diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache index 25f5474523f0..c470d86d9cd7 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache @@ -16,7 +16,7 @@ 'use strict'; {{#emitJSDoc}} /** - * @module ApiClient + * @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient * @version {{projectVersion}} */ @@ -24,7 +24,7 @@ * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an * application to use this class directly - the *Api and model classes provide the public API for the service. The * contents of this file should be regarded as internal but are documented for completeness. - * @alias module:ApiClient + * @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient * @class */ {{/emitJSDoc}} var exports = function() { @@ -218,7 +218,7 @@ /** * Builds a string representation of an array-type actual parameter, according to the given collection format. * @param {Array} param An array parameter. - * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy. + * @param {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy. * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns * param as is if collectionFormat is multi. */ @@ -309,7 +309,7 @@ {{#emitJSDoc}}{{^usePromises}} /** * Callback function to receive the result of the operation. - * @callback module:ApiClient~callApiCallback + * @callback module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient~callApiCallback * @param {String} error Error message, if any. * @param data The data returned by the service call. * @param {String} response The complete HTTP response. @@ -329,7 +329,7 @@ * @param {Array.} accepts An array of acceptable response MIME types. * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the * constructor for a complex type.{{^usePromises}} - * @param {module:ApiClient~callApiCallback} callback The callback function. + * @param {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient~callApiCallback} callback The callback function. {{/usePromises}} * @returns {{#usePromises}}{Promise} A Promise object{{/usePromises}}{{^usePromises}}{Object} The SuperAgent request object{{/usePromises}}. */ {{/emitJSDoc}} exports.prototype.callApi = function callApi(path, httpMethod, pathParams, @@ -476,7 +476,7 @@ {{#emitJSDoc}} /** * The default API client implementation. - * @type {module:ApiClient} + * @type {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient} */ {{/emitJSDoc}} exports.instance = new exports(); diff --git a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache index 767e2a849fdf..633f2f0aebb5 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache @@ -6,7 +6,7 @@ {{/appDescription}} This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: {{appVersion}} +- API version: {{appVersion}} - Package version: {{projectVersion}} - Build date: {{generatedDate}} - Build package: {{generatorClass}} diff --git a/modules/swagger-codegen/src/main/resources/Javascript/api.mustache b/modules/swagger-codegen/src/main/resources/Javascript/api.mustache index 8cc6cee18b98..f47085ad6570 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/api.mustache @@ -1,7 +1,7 @@ {{=< >=}}(function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'<#imports>, '../<#modelPackage>/'], factory); + define(['<#invokerPackage>/ApiClient'<#imports>, '<#invokerPackage>/<#modelPackage>/'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')<#imports>, require('../<#modelPackage>/')); @@ -17,17 +17,17 @@ <#emitJSDoc> /** * service. - * @module <#apiPackage>/ + * @module <#invokerPackage>/<#apiPackage>/ * @version */ /** * Constructs a new . <#description> * - * @alias module:<#apiPackage>/ + * @alias module:<#invokerPackage>/<#apiPackage>/ * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} - * if unspecified. + * @param {module:<#invokerPackage>/ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:<#invokerPackage>/ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; @@ -35,7 +35,7 @@ <#operations><#operation><#emitJSDoc><^usePromises> /** * Callback function to receive the result of the operation. - * @callback module:<#apiPackage>/~Callback + * @callback module:<#invokerPackage>/<#apiPackage>/~Callback * @param {String} error Error message, if any. * @param <#vendorExtensions.x-jsdoc-type><&vendorExtensions.x-jsdoc-type> data The data returned by the service call.<^vendorExtensions.x-jsdoc-type>data This operation does not return a value. * @param {String} response The complete HTTP response. @@ -47,7 +47,7 @@ * @param <&vendorExtensions.x-jsdoc-type> <#hasOptionalParams> * @param {Object} opts Optional parameters<#allParams><^required> * @param <&vendorExtensions.x-jsdoc-type> opts. <#defaultValue> (default to <.>)<^usePromises> - * @param {module:<#apiPackage>/~Callback} callback The callback function, accepting three arguments: error, data, response<#returnType> + * @param {module:<#invokerPackage>/<#apiPackage>/~Callback} callback The callback function, accepting three arguments: error, data, response<#returnType> * data is of type: <&vendorExtensions.x-jsdoc-type> */ this. = function() {<#hasOptionalParams> diff --git a/modules/swagger-codegen/src/main/resources/Javascript/api_doc.mustache b/modules/swagger-codegen/src/main/resources/Javascript/api_doc.mustache index 698b42dfe114..714350a2170b 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/api_doc.mustache @@ -80,7 +80,7 @@ Name | Type | Description | Notes {{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} diff --git a/modules/swagger-codegen/src/main/resources/Javascript/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/Javascript/git_push.sh.mustache index e153ce23ecf4..086955d7ca56 100755 --- a/modules/swagger-codegen/src/main/resources/Javascript/git_push.sh.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/git_push.sh.mustache @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the Git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/modules/swagger-codegen/src/main/resources/Javascript/index.mustache b/modules/swagger-codegen/src/main/resources/Javascript/index.mustache index b48956afbb45..1561763af0ea 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/index.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/index.mustache @@ -1,7 +1,7 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient'{{#models}}, './{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}'{{/models}}{{#apiInfo}}{{#apis}}, './{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}'{{/apis}}{{/apiInfo}}], factory); + define(['{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient'{{#models}}, '{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}'{{/models}}{{#apiInfo}}{{#apis}}, '{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}'{{/apis}}{{/apiInfo}}], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('./ApiClient'){{#models}}, require('./{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}'){{/models}}{{#apiInfo}}{{#apis}}, require('./{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}'){{/apis}}{{/apiInfo}}); @@ -15,7 +15,7 @@ *

* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: *

-   * var {{moduleName}} = require('./index'); // See note below*.
+   * var {{moduleName}} = require('{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}index'); // See note below*.
    * var xxxSvc = new {{moduleName}}.XxxApi(); // Allocate the API class we're going to use.
    * var yyyModel = new {{moduleName}}.Yyy(); // Construct a model instance.
    * yyyModel.someProperty = 'someValue';
@@ -23,8 +23,8 @@
    * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
    * ...
    * 
- * *NOTE: For a top-level AMD script, use require(['./index'], function(){...}) and put the application logic within the - * callback function. + * *NOTE: For a top-level AMD script, use require(['{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}index'], function(){...}) + * and put the application logic within the callback function. *

*

* A non-AMD browser application (discouraged) might do something like this: @@ -37,23 +37,23 @@ * ... * *

- * @module index + * @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}index * @version {{projectVersion}} */{{/emitJSDoc}} {{=< >=}} var exports = {<#emitJSDoc> /** * The ApiClient constructor. - * @property {module:ApiClient} + * @property {module:<#invokerPackage>/ApiClient} */ ApiClient: ApiClient<#models>,<#emitJSDoc> /** * The model constructor. - * @property {module:<#modelPackage>/} + * @property {module:<#invokerPackage>/<#modelPackage>/} */ : <#apiInfo><#apis>,<#emitJSDoc> /** * The service constructor. - * @property {module:<#apiPackage>/} + * @property {module:<#invokerPackage>/<#apiPackage>/} */ : }; diff --git a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache index c8849223fc4b..3972fbbda861 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'{{#imports}}, './{{import}}'{{/imports}}], factory); + define(['{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient'{{#imports}}, '{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{import}}'{{/imports}}], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'){{#imports}}, require('./{{import}}'){{/imports}}); @@ -17,17 +17,17 @@ {{#models}}{{#model}}{{#emitJSDoc}} /** * The {{classname}} model module. - * @module {{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} + * @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} * @version {{projectVersion}} */ /** * Constructs a new {{classname}}.{{#description}} * {{description}}{{/description}} - * @alias module:{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} + * @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} * @class{{#useInheritance}}{{#parent}} - * @extends module:{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{parent}}{{/parent}}{{#interfaces}} - * @implements module:{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}} + * @extends module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{parent}}{{/parent}}{{#interfaces}} + * @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}} * @param {{.}}{{/vendorExtensions.x-all-required}} */{{/emitJSDoc}} var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) { @@ -40,8 +40,8 @@ * Constructs a {{classname}} from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from data to obj if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {{=< >=}}{module:<#modelPackage>/}<={{ }}=> obj Optional instance to populate. - * @return {{=< >=}}{module:<#modelPackage>/}<={{ }}=> The populated {{classname}} instance. + * @param {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> obj Optional instance to populate. + * @return {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> The populated {{classname}} instance. */ {{/emitJSDoc}} exports.constructFromObject = function(data, obj) { if (data) { {{!// TODO: support polymorphism: discriminator property on data determines class to instantiate.}} diff --git a/modules/swagger-codegen/src/main/resources/Javascript/package.mustache b/modules/swagger-codegen/src/main/resources/Javascript/package.mustache index 55c33e3f2808..ca84decf9d39 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/package.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/package.mustache @@ -3,7 +3,7 @@ "version": "{{{projectVersion}}}", "description": "{{{projectDescription}}}",{{#projectLicenseName}} "license": "{{{projectLicenseName}}}",{{/projectLicenseName}} - "main": "{{sourceFolder}}/index.js", + "main": "{{sourceFolder}}{{#invokerPackage}}/{{invokerPackage}}{{/invokerPackage}}/index.js", "scripts": { "test": "./node_modules/mocha/bin/mocha --recursive" }, diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/javascript/JavaScriptClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/javascript/JavaScriptClientOptionsTest.java index 927d4d7755b8..eda6602607dc 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/javascript/JavaScriptClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/javascript/JavaScriptClientOptionsTest.java @@ -30,6 +30,8 @@ public class JavaScriptClientOptionsTest extends AbstractOptionsTest { protected void setExpectations() { // Commented generic options not yet supported by JavaScript codegen. new Expectations(clientCodegen) {{ + clientCodegen.setInvokerPackage(JavaScriptOptionsProvider.INVOKER_PACKAGE_VALUE); + times = 1; clientCodegen.setModelPackage(JavaScriptOptionsProvider.MODEL_PACKAGE_VALUE); times = 1; clientCodegen.setApiPackage(JavaScriptOptionsProvider.API_PACKAGE_VALUE); diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaScriptOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaScriptOptionsProvider.java index 9b0f06a10312..b445fc1c528f 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaScriptOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaScriptOptionsProvider.java @@ -10,9 +10,9 @@ import java.util.Map; public class JavaScriptOptionsProvider implements OptionsProvider { public static final String ARTIFACT_ID_VALUE = "swagger-javascript-client-test"; + public static final String INVOKER_PACKAGE_VALUE = "invoker"; public static final String MODEL_PACKAGE_VALUE = "model"; public static final String API_PACKAGE_VALUE = "api"; -// public static final String INVOKER_PACKAGE_VALUE = "js"; public static final String SORT_PARAMS_VALUE = "false"; public static final String GROUP_ID_VALUE = "io.swagger.test"; public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT"; @@ -38,11 +38,11 @@ public class JavaScriptOptionsProvider implements OptionsProvider { public JavaScriptOptionsProvider() { // Commented generic options not yet supported by JavaScript codegen. options = new ImmutableMap.Builder() + .put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE) .put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE) .put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE) .put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) -// .put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE) // .put(CodegenConstants.GROUP_ID, GROUP_ID_VALUE) // .put(CodegenConstants.ARTIFACT_ID, ARTIFACT_ID_VALUE) // .put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE) diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index 478bc4657ca2..10c836d3141a 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -4,9 +4,9 @@ SwaggerPetstore - JavaScript client for swagger-petstore This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: 1.0.0 +- API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-03-24T19:50:42.301+08:00 +- Build date: 2016-03-25T16:32:33.021Z - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation diff --git a/samples/client/petstore/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md index 77d9630f8889..3fa3216fd870 100644 --- a/samples/client/petstore/javascript-promise/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise/docs/PetApi.md @@ -61,7 +61,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -110,7 +110,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -162,7 +162,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -211,7 +211,7 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -260,7 +260,7 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -314,7 +314,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -368,7 +368,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -422,7 +422,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -471,7 +471,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -525,7 +525,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json, application/xml @@ -579,7 +579,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: multipart/form-data - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript-promise/docs/StoreApi.md b/samples/client/petstore/javascript-promise/docs/StoreApi.md index 930586a96f57..e8c3baf3e08d 100644 --- a/samples/client/petstore/javascript-promise/docs/StoreApi.md +++ b/samples/client/petstore/javascript-promise/docs/StoreApi.md @@ -50,7 +50,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -107,7 +107,7 @@ Name | Type | Description | Notes [test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -151,7 +151,7 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -195,7 +195,7 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -251,7 +251,7 @@ Name | Type | Description | Notes [test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -308,7 +308,7 @@ Name | Type | Description | Notes [test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md index 1c14b708231c..8f3d03e50bbe 100644 --- a/samples/client/petstore/javascript-promise/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -53,7 +53,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -97,7 +97,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -141,7 +141,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -190,7 +190,7 @@ null (empty response body) [test_http_basic](../README.md#test_http_basic) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -233,7 +233,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -279,7 +279,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -316,7 +316,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -363,7 +363,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript-promise/git_push.sh b/samples/client/petstore/javascript-promise/git_push.sh index 1a36388db023..40bb5f9da47b 100644 --- a/samples/client/petstore/javascript-promise/git_push.sh +++ b/samples/client/petstore/javascript-promise/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the Git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 520791b3f0a1..74b427a11174 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Pet', '../model/InlineResponse200'], factory); + define(['ApiClient', 'model/Pet', 'model/InlineResponse200'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Pet'), require('../model/InlineResponse200')); @@ -25,8 +25,8 @@ * Constructs a new PetApi. * @alias module:api/PetApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} - * if unspecified. + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index 32a6dce47e96..01ba6d01340c 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Order'], factory); + define(['ApiClient', 'model/Order'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Order')); @@ -25,8 +25,8 @@ * Constructs a new StoreApi. * @alias module:api/StoreApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} - * if unspecified. + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index 8914d9c883d5..0d37d907d298 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/User'], factory); + define(['ApiClient', 'model/User'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/User')); @@ -25,8 +25,8 @@ * Constructs a new UserApi. * @alias module:api/UserApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} - * if unspecified. + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index 4c0cd3040c70..4d0ac2dd47d7 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -1,7 +1,7 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['ApiClient', 'model/Category', 'model/InlineResponse200', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/Order', 'model/Pet', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); @@ -15,7 +15,7 @@ *

* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: *

-   * var SwaggerPetstore = require('./index'); // See note below*.
+   * var SwaggerPetstore = require('index'); // See note below*.
    * var xxxSvc = new SwaggerPetstore.XxxApi(); // Allocate the API class we're going to use.
    * var yyyModel = new SwaggerPetstore.Yyy(); // Construct a model instance.
    * yyyModel.someProperty = 'someValue';
@@ -23,8 +23,8 @@
    * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
    * ...
    * 
- * *NOTE: For a top-level AMD script, use require(['./index'], function(){...}) and put the application logic within the - * callback function. + * *NOTE: For a top-level AMD script, use require(['index'], function(){...}) + * and put the application logic within the callback function. *

*

* A non-AMD browser application (discouraged) might do something like this: diff --git a/samples/client/petstore/javascript-promise/src/model/Category.js b/samples/client/petstore/javascript-promise/src/model/Category.js index 473f4b783d58..8f36ada19137 100644 --- a/samples/client/petstore/javascript-promise/src/model/Category.js +++ b/samples/client/petstore/javascript-promise/src/model/Category.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript-promise/src/model/InlineResponse200.js b/samples/client/petstore/javascript-promise/src/model/InlineResponse200.js index f9ecda79491a..f2abaf1bd1b7 100644 --- a/samples/client/petstore/javascript-promise/src/model/InlineResponse200.js +++ b/samples/client/petstore/javascript-promise/src/model/InlineResponse200.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', './Tag'], factory); + define(['ApiClient', 'model/Tag'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./Tag')); diff --git a/samples/client/petstore/javascript-promise/src/model/Model200Response.js b/samples/client/petstore/javascript-promise/src/model/Model200Response.js index fb559f5ebaa2..2014fd12b2b0 100644 --- a/samples/client/petstore/javascript-promise/src/model/Model200Response.js +++ b/samples/client/petstore/javascript-promise/src/model/Model200Response.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js index d5036e230ead..10ddfe73ba5b 100644 --- a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript-promise/src/model/Name.js b/samples/client/petstore/javascript-promise/src/model/Name.js index a5a070025f71..f7fa187006c5 100644 --- a/samples/client/petstore/javascript-promise/src/model/Name.js +++ b/samples/client/petstore/javascript-promise/src/model/Name.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript-promise/src/model/Order.js b/samples/client/petstore/javascript-promise/src/model/Order.js index 81f1feb78000..65bec4521b91 100644 --- a/samples/client/petstore/javascript-promise/src/model/Order.js +++ b/samples/client/petstore/javascript-promise/src/model/Order.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript-promise/src/model/Pet.js b/samples/client/petstore/javascript-promise/src/model/Pet.js index 39a09b471700..99c049a72cf1 100644 --- a/samples/client/petstore/javascript-promise/src/model/Pet.js +++ b/samples/client/petstore/javascript-promise/src/model/Pet.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', './Category', './Tag'], factory); + define(['ApiClient', 'model/Category', 'model/Tag'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./Category'), require('./Tag')); diff --git a/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js b/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js index fb6b4765d3fc..8694196cdd96 100644 --- a/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript-promise/src/model/Tag.js b/samples/client/petstore/javascript-promise/src/model/Tag.js index 8a0739b2ef5b..bbfb6fe662a6 100644 --- a/samples/client/petstore/javascript-promise/src/model/Tag.js +++ b/samples/client/petstore/javascript-promise/src/model/Tag.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript-promise/src/model/User.js b/samples/client/petstore/javascript-promise/src/model/User.js index 1d960a89914b..aff0c42f3ec8 100644 --- a/samples/client/petstore/javascript-promise/src/model/User.js +++ b/samples/client/petstore/javascript-promise/src/model/User.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 2f3f0edb8976..297547536ea0 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -4,9 +4,9 @@ SwaggerPetstore - JavaScript client for swagger-petstore This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API verion: 1.0.0 +- API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-03-24T19:50:27.240+08:00 +- Build date: 2016-03-25T16:30:21.376Z - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation diff --git a/samples/client/petstore/javascript/docs/PetApi.md b/samples/client/petstore/javascript/docs/PetApi.md index e33bf7c3b127..e0b75c349026 100644 --- a/samples/client/petstore/javascript/docs/PetApi.md +++ b/samples/client/petstore/javascript/docs/PetApi.md @@ -64,7 +64,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -116,7 +116,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -171,7 +171,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -223,7 +223,7 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -275,7 +275,7 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -332,7 +332,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -389,7 +389,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -446,7 +446,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -498,7 +498,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -555,7 +555,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json, application/xml @@ -612,7 +612,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: multipart/form-data - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript/docs/StoreApi.md b/samples/client/petstore/javascript/docs/StoreApi.md index b2ea41e35ee7..63239abf107f 100644 --- a/samples/client/petstore/javascript/docs/StoreApi.md +++ b/samples/client/petstore/javascript/docs/StoreApi.md @@ -53,7 +53,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -113,7 +113,7 @@ Name | Type | Description | Notes [test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -160,7 +160,7 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -207,7 +207,7 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -266,7 +266,7 @@ Name | Type | Description | Notes [test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -326,7 +326,7 @@ Name | Type | Description | Notes [test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript/docs/UserApi.md b/samples/client/petstore/javascript/docs/UserApi.md index f2fcf2c4b525..0c7fdca59dd9 100644 --- a/samples/client/petstore/javascript/docs/UserApi.md +++ b/samples/client/petstore/javascript/docs/UserApi.md @@ -56,7 +56,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -103,7 +103,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -150,7 +150,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -202,7 +202,7 @@ null (empty response body) [test_http_basic](../README.md#test_http_basic) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -248,7 +248,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -297,7 +297,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -337,7 +337,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -387,7 +387,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript/git_push.sh b/samples/client/petstore/javascript/git_push.sh index 1a36388db023..40bb5f9da47b 100644 --- a/samples/client/petstore/javascript/git_push.sh +++ b/samples/client/petstore/javascript/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the Git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index 3bfc6ffd4f08..cd6a0466108b 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Pet', '../model/InlineResponse200'], factory); + define(['ApiClient', 'model/Pet', 'model/InlineResponse200'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Pet'), require('../model/InlineResponse200')); @@ -25,8 +25,8 @@ * Constructs a new PetApi. * @alias module:api/PetApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} - * if unspecified. + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index bcef8b433c1e..78f863314b7c 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Order'], factory); + define(['ApiClient', 'model/Order'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Order')); @@ -25,8 +25,8 @@ * Constructs a new StoreApi. * @alias module:api/StoreApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} - * if unspecified. + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index 3060a13e70c3..2d8e353f5ff4 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/User'], factory); + define(['ApiClient', 'model/User'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/User')); @@ -25,8 +25,8 @@ * Constructs a new UserApi. * @alias module:api/UserApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} - * if unspecified. + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index 4c0cd3040c70..4d0ac2dd47d7 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,7 +1,7 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['ApiClient', 'model/Category', 'model/InlineResponse200', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/Order', 'model/Pet', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); @@ -15,7 +15,7 @@ *

* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: *

-   * var SwaggerPetstore = require('./index'); // See note below*.
+   * var SwaggerPetstore = require('index'); // See note below*.
    * var xxxSvc = new SwaggerPetstore.XxxApi(); // Allocate the API class we're going to use.
    * var yyyModel = new SwaggerPetstore.Yyy(); // Construct a model instance.
    * yyyModel.someProperty = 'someValue';
@@ -23,8 +23,8 @@
    * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
    * ...
    * 
- * *NOTE: For a top-level AMD script, use require(['./index'], function(){...}) and put the application logic within the - * callback function. + * *NOTE: For a top-level AMD script, use require(['index'], function(){...}) + * and put the application logic within the callback function. *

*

* A non-AMD browser application (discouraged) might do something like this: diff --git a/samples/client/petstore/javascript/src/model/Category.js b/samples/client/petstore/javascript/src/model/Category.js index 473f4b783d58..8f36ada19137 100644 --- a/samples/client/petstore/javascript/src/model/Category.js +++ b/samples/client/petstore/javascript/src/model/Category.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript/src/model/InlineResponse200.js b/samples/client/petstore/javascript/src/model/InlineResponse200.js index f9ecda79491a..f2abaf1bd1b7 100644 --- a/samples/client/petstore/javascript/src/model/InlineResponse200.js +++ b/samples/client/petstore/javascript/src/model/InlineResponse200.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', './Tag'], factory); + define(['ApiClient', 'model/Tag'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./Tag')); diff --git a/samples/client/petstore/javascript/src/model/Model200Response.js b/samples/client/petstore/javascript/src/model/Model200Response.js index fb559f5ebaa2..2014fd12b2b0 100644 --- a/samples/client/petstore/javascript/src/model/Model200Response.js +++ b/samples/client/petstore/javascript/src/model/Model200Response.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript/src/model/ModelReturn.js b/samples/client/petstore/javascript/src/model/ModelReturn.js index d5036e230ead..10ddfe73ba5b 100644 --- a/samples/client/petstore/javascript/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript/src/model/ModelReturn.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript/src/model/Name.js b/samples/client/petstore/javascript/src/model/Name.js index a5a070025f71..f7fa187006c5 100644 --- a/samples/client/petstore/javascript/src/model/Name.js +++ b/samples/client/petstore/javascript/src/model/Name.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index 81f1feb78000..65bec4521b91 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index 39a09b471700..99c049a72cf1 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', './Category', './Tag'], factory); + define(['ApiClient', 'model/Category', 'model/Tag'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./Category'), require('./Tag')); diff --git a/samples/client/petstore/javascript/src/model/SpecialModelName.js b/samples/client/petstore/javascript/src/model/SpecialModelName.js index fb6b4765d3fc..8694196cdd96 100644 --- a/samples/client/petstore/javascript/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript/src/model/SpecialModelName.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript/src/model/Tag.js b/samples/client/petstore/javascript/src/model/Tag.js index 8a0739b2ef5b..bbfb6fe662a6 100644 --- a/samples/client/petstore/javascript/src/model/Tag.js +++ b/samples/client/petstore/javascript/src/model/Tag.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); diff --git a/samples/client/petstore/javascript/src/model/User.js b/samples/client/petstore/javascript/src/model/User.js index 1d960a89914b..aff0c42f3ec8 100644 --- a/samples/client/petstore/javascript/src/model/User.js +++ b/samples/client/petstore/javascript/src/model/User.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); From 023a941a15fa6ae2748cd315f8d05ec04fa9e316 Mon Sep 17 00:00:00 2001 From: demonfiddler Date: Thu, 31 Mar 2016 13:50:33 +0100 Subject: [PATCH 002/170] Fix for Issue #2471 "JavaScript client code generator emits invalid code for map and array types" --- .../languages/JavascriptClientCodegen.java | 16 +++++++++++ .../resources/Javascript/ApiClient.mustache | 19 +++++++++++++ .../main/resources/Javascript/model.mustache | 27 +++++++++++-------- 3 files changed, 51 insertions(+), 11 deletions(-) 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 0541995b926d..b01c9d4cd5c4 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 @@ -12,9 +12,12 @@ import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.CodegenType; import io.swagger.codegen.SupportingFile; import io.swagger.codegen.DefaultCodegen; +import io.swagger.models.ArrayModel; +import io.swagger.models.ComposedModel; import io.swagger.models.Info; import io.swagger.models.License; import io.swagger.models.Model; +import io.swagger.models.ModelImpl; import io.swagger.models.Operation; import io.swagger.models.Swagger; import io.swagger.models.properties.ArrayProperty; @@ -705,6 +708,19 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel); codegenModel = JavascriptClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel); } + if (model instanceof ArrayModel) { + ArrayModel am = (ArrayModel) model; + if (am.getItems() != null) { + codegenModel.vendorExtensions.put("x-isArray", true); + codegenModel.vendorExtensions.put("x-itemType", getSwaggerType(am.getItems())); + } + } else if (model instanceof ModelImpl) { + ModelImpl mm = (ModelImpl)model; + if (mm.getAdditionalProperties() != null) { + codegenModel.vendorExtensions.put("x-isMap", true); + codegenModel.vendorExtensions.put("x-itemType", getSwaggerType(mm.getAdditionalProperties())); + } + } return codegenModel; } diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache index c470d86d9cd7..25a0e5155aaf 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache @@ -474,6 +474,25 @@ } }; +{{#emitJSDoc}} /** + * Constructs a new map or array model from REST data. + * @param data {Object|Array} The REST data. + * @param obj {Object|Array} The target object or array. + */ +{{/emitJSDoc}} exports.constructFromObject = function(data, obj, itemType) { + if (Array.isArray(data)) { + for (var i = 0; i < data.length; i++) { + if (data.hasOwnProperty(i)) + obj[i] = exports.convertToType(data[i], itemType); + } + } else { + for (var k in data) { + if (data.hasOwnProperty(k)) + result[k] = exports.convertToType(data[k], itemType); + } + } + }; + {{#emitJSDoc}} /** * The default API client implementation. * @type {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient} diff --git a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache index 3972fbbda861..37a55ca71f1e 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache @@ -26,15 +26,19 @@ * {{description}}{{/description}} * @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} * @class{{#useInheritance}}{{#parent}} - * @extends module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{parent}}{{/parent}}{{#interfaces}} + * @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{parent}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}} * @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}} * @param {{.}}{{/vendorExtensions.x-all-required}} - */{{/emitJSDoc}} - var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) { -{{#useInheritance}}{{#parentModel}} {{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}} -{{#interfaceModels}} {{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}}); -{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} this['{{baseName}}'] = {{name}};{{/required}} -{{/vars}} }; + */ +{{/emitJSDoc}} var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) { + var _this = this; +{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array(); + Object.setPrototypeOf(_this, exports); +{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parent}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}}{{/parent}} +{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}}); +{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}} +{{/vars}}{{#parent}}{{^parentModel}} return _this; +{{/parentModel}}{{/parent}} }; {{#emitJSDoc}} /** * Constructs a {{classname}} from a plain JavaScript object, optionally creating a new instance. @@ -44,9 +48,10 @@ * @return {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> The populated {{classname}} instance. */ {{/emitJSDoc}} exports.constructFromObject = function(data, obj) { - if (data) { {{!// TODO: support polymorphism: discriminator property on data determines class to instantiate.}} + if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} { obj = obj || new exports(); -{{#useInheritance}}{{#parent}} {{.}}.constructFromObject(data, obj);{{/parent}} +{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, {{vendorExtensions.x-itemType}}); +{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}}{{#parent}} {{parent}}.constructFromObject(data, obj);{{/parent}}{{/parentModel}} {{#interfaces}} {{.}}.constructFromObject(data, obj); {{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) { obj['{{baseName}}']{{{defaultValueWithParam}}} @@ -54,10 +59,10 @@ {{/vars}} } return obj; } -{{#useInheritance}}{{#parent}} +{{#useInheritance}}{{#parentModel}}{{#parent}} exports.prototype = Object.create({{parent}}.prototype); exports.prototype.constructor = exports; -{{/parent}}{{/useInheritance}} +{{/parent}}{{/parentModel}}{{/useInheritance}} {{#vars}}{{#emitJSDoc}} /**{{#description}} * {{{description}}}{{/description}} From 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d Mon Sep 17 00:00:00 2001 From: demonfiddler Date: Fri, 1 Apr 2016 10:45:09 +0100 Subject: [PATCH 003/170] Fix for Issue #2146 "NPE in JavascriptClientCodegen if definition name does not start with an upper case character" --- .../main/java/io/swagger/codegen/DefaultCodegen.java | 8 ++++---- .../codegen/languages/JavascriptClientCodegen.java | 10 ++++++++-- .../src/main/resources/Javascript/model.mustache | 12 ++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index ea16e75f1c94..9547e1d5a655 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 @@ -130,10 +130,10 @@ public class DefaultCodegen { @SuppressWarnings({ "static-method", "unchecked" }) public Map postProcessAllModels(Map objs) { if (supportsInheritance) { - // Index all CodegenModels by name. + // Index all CodegenModels by model name. Map allModels = new HashMap(); for (Entry entry : objs.entrySet()) { - String modelName = entry.getKey(); + String modelName = toModelName(entry.getKey()); Map inner = (Map) entry.getValue(); List> models = (List>) inner.get("models"); for (Map mo : models) { @@ -1013,7 +1013,7 @@ public class DefaultCodegen { m.interfaces.add(interfaceRef); addImport(m, interfaceRef); if (allDefinitions != null) { - final Model interfaceModel = allDefinitions.get(interfaceRef); + final Model interfaceModel = allDefinitions.get(_interface.getSimpleRef()); if (supportsInheritance) { addProperties(allProperties, allRequired, interfaceModel, allDefinitions); } else { @@ -1070,7 +1070,7 @@ public class DefaultCodegen { required.addAll(mi.getRequired()); } } else if (model instanceof RefModel) { - String interfaceRef = toModelName(((RefModel) model).getSimpleRef()); + String interfaceRef = ((RefModel) model).getSimpleRef(); Model interfaceModel = allDefinitions.get(interfaceRef); addProperties(properties, required, interfaceModel, allDefinitions); } else if (model instanceof ComposedModel) { 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 b01c9d4cd5c4..1e18aae72b28 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 @@ -298,6 +298,12 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo return "_" + name; } + /** + * Concatenates an array of path segments into a path string. + * @param segments The path segments to concatenate. A segment may contain either of the file separator characters '\' or '/'. + * A segment is ignored if it is null, empty or ".". + * @return A path string using the correct platform-specific file separator character. + */ private String createPath(String... segments) { StringBuilder buf = new StringBuilder(); for (String segment : segments) { @@ -704,8 +710,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo CodegenModel codegenModel = super.fromModel(name, model, allDefinitions); if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums) { - final Model parentModel = allDefinitions.get(toModelName(codegenModel.parent)); - final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel); + final Model parentModel = allDefinitions.get(codegenModel.parentSchema); + final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions); codegenModel = JavascriptClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel); } if (model instanceof ArrayModel) { diff --git a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache index 37a55ca71f1e..11b9ec74e0bb 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache @@ -26,7 +26,7 @@ * {{description}}{{/description}} * @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} * @class{{#useInheritance}}{{#parent}} - * @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{parent}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}} + * @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}} * @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}} * @param {{.}}{{/vendorExtensions.x-all-required}} */ @@ -34,7 +34,7 @@ var _this = this; {{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array(); Object.setPrototypeOf(_this, exports); -{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parent}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}}{{/parent}} +{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}} {{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}}); {{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}} {{/vars}}{{#parent}}{{^parentModel}} return _this; @@ -51,7 +51,7 @@ if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} { obj = obj || new exports(); {{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, {{vendorExtensions.x-itemType}}); -{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}}{{#parent}} {{parent}}.constructFromObject(data, obj);{{/parent}}{{/parentModel}} +{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}} {{#interfaces}} {{.}}.constructFromObject(data, obj); {{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) { obj['{{baseName}}']{{{defaultValueWithParam}}} @@ -59,10 +59,10 @@ {{/vars}} } return obj; } -{{#useInheritance}}{{#parentModel}}{{#parent}} - exports.prototype = Object.create({{parent}}.prototype); +{{#useInheritance}}{{#parentModel}} + exports.prototype = Object.create({{classname}}.prototype); exports.prototype.constructor = exports; -{{/parent}}{{/parentModel}}{{/useInheritance}} +{{/parentModel}}{{/useInheritance}} {{#vars}}{{#emitJSDoc}} /**{{#description}} * {{{description}}}{{/description}} From c503396a4270c9f0c72557165381d57c0eed873d Mon Sep 17 00:00:00 2001 From: diyfr Date: Wed, 27 Apr 2016 11:39:30 +0200 Subject: [PATCH 004/170] Update Dependacies Update to Springfox 2.4 and maven war plugin to 2.6 --- .../src/main/resources/JavaSpringMVC/pom.mustache | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache index 8cb969102e18..387aa0729aa3 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache @@ -11,7 +11,7 @@ org.apache.maven.plugins maven-war-plugin - 2.1.1 + 2.6 maven-failsafe-plugin @@ -121,10 +121,10 @@ 1.5.8 9.2.9.v20150224 1.13 - 1.6.3 - 4.8.1 - 2.5 - 2.3.1 - 4.1.8.RELEASE + 1.7.21 + 4.12 + 3.0 + 2.4.0 + 4.2.5.RELEASE - \ No newline at end of file + From adf0833527b08150475501591e178be201b6d129 Mon Sep 17 00:00:00 2001 From: diyfr Date: Wed, 27 Apr 2016 11:41:34 +0200 Subject: [PATCH 005/170] Update swaggerConfig.mustache with springfox-code-2.4.0 ApiInfo have a Builder in springfox version 2.4.0 see springfox.documentation.builders.ApiInfoBuilder nota String contact is deprecated use springfox.documentation.service (String name, String url, String email) --- .../JavaSpringMVC/swaggerConfig.mustache | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache index 4a6e6879df32..6dde7ebce034 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache @@ -7,6 +7,7 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @@ -22,15 +23,15 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; public class SwaggerConfig { @Bean ApiInfo apiInfo() { - ApiInfo apiInfo = new ApiInfo( - "{{appName}}", - "{{{appDescription}}}", - "{{appVersion}}", - "{{infoUrl}}", - "{{infoEmail}}", - "{{licenseInfo}}", - "{{licenseUrl}}" ); - return apiInfo; + return new ApiInfoBuilder() + .title("{{appName}}") + .description("{{{appDescription}}}") + .license("{{licenseInfo}}") + .licenseUrl("{{licenseUrl}}") + .termsOfServiceUrl("{{infoUrl}}") + .version("{{appVersion}}") + .contact(new Contact("","", "{{infoEmail}}")) + .build(); } @Bean @@ -38,4 +39,4 @@ public class SwaggerConfig { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()); } -} \ No newline at end of file +} From 7f99469efd19564af2c5b5ced526b64d26fb890a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sun, 24 Apr 2016 23:13:40 +0200 Subject: [PATCH 006/170] [PHP] Add test case testing ArrayAccess interface Test if we implement the ArrayAccess interface correct on out model objects. --- ...ith-fake-endpoints-models-for-testing.yaml | 4 +++ .../SwaggerClient-php/tests/PetApiTest.php | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 4160e59cc48a..fb14faa262d6 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -842,6 +842,10 @@ definitions: properties: className: type: string + AnimalFarm: + type: array + items: + $ref: '#/definitions/Animal' format_test: type: object required: diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index 4c4585632aeb..0695eb9d981a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -423,6 +423,33 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame('Dog', $new_dog->getClassName()); } + // test if ArrayAccess interface works + public function testArrayStuff() + { + // create an AnimalFarm which is an object implementing the + // ArrayAccess interface + $farm = new Swagger\Client\Model\AnimalFarm(); + + // add some animals to the farm to make sure the ArrayAccess + // interface works + $farm[] = new Swagger\Client\Model\Dog(); + $farm[] = new Swagger\Client\Model\Cat(); + $farm[] = new Swagger\Client\Model\Animal(); + + // assert we can look up the animals in the farm by array + // indices (let's try a random order) + $this->assertInstanceOf('Swagger\Client\Model\Cat', $farm[1]); + $this->assertInstanceOf('Swagger\Client\Model\Dog', $farm[0]); + $this->assertInstanceOf('Swagger\Client\Model\Animal', $farm[2]); + + // let's try to `foreach` the animals in the farm and let's + // try to use the objects we loop through + foreach ($farm as $animal) { + $this->assertContains($animal->getClassName(), array('Dog', 'Cat', 'Animal')); + $this->assertInstanceOf('Swagger\Client\Model\Animal', $animal); + } + } + } ?> From bbe12c1658ee88c7df811bbbfb5f9850fdbe04d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sun, 24 Apr 2016 23:02:33 +0200 Subject: [PATCH 007/170] [PHP] Use parentSchema instead parent to detect inheritance `parent` in a model is set not only when the model inherits from another model but also when a parent container exists. So We will now use `parentSchema` to check whether a parent class exists. If si we still use `parent` to output the class name because that has been converted to a proper model name and `parentSchema` hasn't. --- .../src/main/resources/php/model.mustache | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 6f292e854afe..0a826f542724 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -46,7 +46,7 @@ use \ArrayAccess; * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 * @link https://github.com/swagger-api/swagger-codegen */ -class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayAccess +class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}implements ArrayAccess { /** * The original name of the model. @@ -64,7 +64,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA ); static function swaggerTypes() { - return self::$swaggerTypes{{#parent}} + parent::swaggerTypes(){{/parent}}; + return self::$swaggerTypes{{#parentSchema}} + parent::swaggerTypes(){{/parentSchema}}; } /** @@ -77,7 +77,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA ); static function attributeMap() { - return {{#parent}}parent::attributeMap() + {{/parent}}self::$attributeMap; + return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap; } /** @@ -90,7 +90,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA ); static function setters() { - return {{#parent}}parent::setters() + {{/parent}}self::$setters; + return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters; } /** @@ -103,7 +103,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA ); static function getters() { - return {{#parent}}parent::getters() + {{/parent}}self::$getters; + return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters; } {{#vars}} @@ -120,7 +120,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA */ public function __construct(array $data = null) { - {{#parent}}parent::__construct($data);{{/parent}} + {{#parentSchema}}parent::__construct($data);{{/parentSchema}} {{#discriminator}}// Initialize discriminator property with the model name. $discrimintor = array_search('{{discriminator}}', self::$attributeMap); $this->{$discrimintor} = static::$swaggerModelName; From 9f40a82310b36764e5d8ee055983c888ac4d88a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sun, 24 Apr 2016 23:20:39 +0200 Subject: [PATCH 008/170] [PHP] Fix ArrayAccess interface implmentation in models The models didn't implement a generally working ArrayAccess interface. This would fail on list container types (array). This commit refactors some internals of the model object. The model properties are no longer stored as separate properties on the PHP object but as entries in a `$container` property. This is needed to make the model work also for list containers. Besides it avoids potential problems where the model would specify property names that could collide with names used by the Swagger model implementation itself (i.e. `$attributeMap`). --- .../src/main/resources/php/model.mustache | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 0a826f542724..47ff89a57eeb 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -106,13 +106,17 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters; } - {{#vars}} /** - * ${{name}} {{#description}}{{{description}}}{{/description}} - * @var {{datatype}} - */ - protected ${{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}; - {{/vars}} + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array({{#vars}} + /** + * $container['{{{name}}}']{{#description}} {{{description}}}{{/description}} + * @var {{datatype}} + */ + '{{{name}}}' => {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}, + {{/vars}}); /** * Constructor @@ -123,11 +127,11 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#parentSchema}}parent::__construct($data);{{/parentSchema}} {{#discriminator}}// Initialize discriminator property with the model name. $discrimintor = array_search('{{discriminator}}', self::$attributeMap); - $this->{$discrimintor} = static::$swaggerModelName; + $this->container[$discrimintor] = static::$swaggerModelName; {{/discriminator}} if ($data != null) { - {{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}} + {{#vars}}$this->container['{{name}}'] = $data['{{name}}'];{{#hasMore}} {{/hasMore}}{{/vars}} } } @@ -138,7 +142,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function {{getter}}() { - return $this->{{name}}; + return $this->container['{{name}}']; } /** @@ -148,11 +152,11 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function {{setter}}(${{name}}) { - {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); if (!in_array(${{{name}}}, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}"); }{{/isEnum}} - $this->{{name}} = ${{name}}; + $this->container['{{name}}'] = ${{name}}; return $this; } {{/vars}} @@ -163,7 +167,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -173,7 +177,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -184,7 +188,11 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -194,7 +202,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** From 5d57bb1e627fd14c34a86abfa874a9ab8a797ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Wed, 27 Apr 2016 21:04:06 +0200 Subject: [PATCH 009/170] [PHP] Regenerate petstore sample --- .../petstore/php/SwaggerClient-php/README.md | 38 ++- .../php/SwaggerClient-php/docs/AnimalFarm.md | 9 + .../php/SwaggerClient-php/docs/FakeApi.md | 75 ++++++ .../php/SwaggerClient-php/docs/FormatTest.md | 1 + .../php/SwaggerClient-php/lib/Api/FakeApi.php | 239 +++++++++++++++++ .../SwaggerClient-php/lib/Model/Animal.php | 34 ++- .../lib/Model/AnimalFarm.php | 178 +++++++++++++ .../lib/Model/ApiResponse.php | 66 +++-- .../php/SwaggerClient-php/lib/Model/Cat.php | 32 ++- .../SwaggerClient-php/lib/Model/Category.php | 49 ++-- .../php/SwaggerClient-php/lib/Model/Dog.php | 32 ++- .../lib/Model/FormatTest.php | 250 +++++++++++------- .../lib/Model/Model200Response.php | 32 ++- .../lib/Model/ModelReturn.php | 32 ++- .../php/SwaggerClient-php/lib/Model/Name.php | 66 +++-- .../php/SwaggerClient-php/lib/Model/Order.php | 119 +++++---- .../php/SwaggerClient-php/lib/Model/Pet.php | 119 +++++---- .../lib/Model/SpecialModelName.php | 32 ++- .../php/SwaggerClient-php/lib/Model/Tag.php | 49 ++-- .../php/SwaggerClient-php/lib/Model/User.php | 151 ++++++----- .../lib/ObjectSerializer.php | 2 +- .../lib/Tests/AnimalFarmTest.php | 70 +++++ .../lib/Tests/FakeApiTest.php | 76 ++++++ .../lib/Tests/FormatTestTest.php | 70 +++++ 24 files changed, 1377 insertions(+), 444 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/AnimalFarm.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalFarmTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/FormatTestTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 80e8d1bae7a9..0eb04769d788 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-23T22:48:00.795+08:00 +- Build date: 2016-04-27T21:03:06.377+02:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -58,16 +58,24 @@ 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 +$api_instance = new Swagger\Client\Api\FakeApi(); +$number = 3.4; // float | None +$double = 1.2; // double | None +$string = "string_example"; // string | None +$byte = "B"; // string | None +$integer = 56; // int | None +$int32 = 56; // int | None +$int64 = 789; // int | None +$float = 3.4; // float | None +$binary = "B"; // string | None +$date = new \DateTime(); // \DateTime | None +$date_time = new \DateTime(); // \DateTime | None +$password = "password_example"; // string | None try { - $api_instance->addPet($body); + $api_instance->testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); } catch (Exception $e) { - echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), "\n"; + echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), "\n"; } ?> @@ -79,6 +87,7 @@ 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* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -104,6 +113,7 @@ Class | Method | HTTP request | Description ## Documentation For Models - [Animal](docs/Animal.md) + - [AnimalFarm](docs/AnimalFarm.md) - [ApiResponse](docs/ApiResponse.md) - [Cat](docs/Cat.md) - [Category](docs/Category.md) @@ -122,12 +132,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -137,6 +141,12 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Author diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/AnimalFarm.md b/samples/client/petstore/php/SwaggerClient-php/docs/AnimalFarm.md new file mode 100644 index 000000000000..df6bab21dae8 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/AnimalFarm.md @@ -0,0 +1,9 @@ +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md new file mode 100644 index 000000000000..93c24ef7eebc --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md @@ -0,0 +1,75 @@ +# Swagger\Client\FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters + + +# **testEndpointParameters** +> testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```php +testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), "\n"; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float**| None | + **double** | **double**| None | + **string** | **string**| None | + **byte** | **string**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **binary** | **string**| None | [optional] + **date** | **\DateTime**| None | [optional] + **date_time** | **\DateTime**| None | [optional] + **password** | **string**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md index e043ee8d2b8e..90531d28c401 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md @@ -14,6 +14,7 @@ Name | Type | Description | Notes **binary** | **string** | | [optional] **date** | [**\DateTime**](Date.md) | | **date_time** | [**\DateTime**](\DateTime.md) | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] **password** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php new file mode 100644 index 000000000000..5d9e5ea7c860 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -0,0 +1,239 @@ +getConfig()->setHost('http://petstore.swagger.io/v2'); + } + + $this->apiClient = $apiClient; + } + + /** + * Get API client + * @return \Swagger\Client\ApiClient get the API client + */ + public function getApiClient() + { + return $this->apiClient; + } + + /** + * Set the API client + * @param \Swagger\Client\ApiClient $apiClient set the API client + * @return FakeApi + */ + public function setApiClient(ApiClient $apiClient) + { + $this->apiClient = $apiClient; + return $this; + } + + /** + * testEndpointParameters + * + * Fake endpoint for testing various parameters + * + * @param float $number None (required) + * @param double $double None (required) + * @param string $string None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function testEndpointParameters($number, $double, $string, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $binary = null, $date = null, $date_time = null, $password = null) + { + list($response) = $this->testEndpointParametersWithHttpInfo ($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); + return $response; + } + + + /** + * testEndpointParametersWithHttpInfo + * + * Fake endpoint for testing various parameters + * + * @param float $number None (required) + * @param double $double None (required) + * @param string $string None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @return Array of null, HTTP status code, HTTP response headers (array of strings) + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function testEndpointParametersWithHttpInfo($number, $double, $string, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $binary = null, $date = null, $date_time = null, $password = null) + { + + // verify the required parameter 'number' is set + if ($number === null) { + throw new \InvalidArgumentException('Missing the required parameter $number when calling testEndpointParameters'); + } + // verify the required parameter 'double' is set + if ($double === null) { + throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters'); + } + // verify the required parameter 'string' is set + if ($string === null) { + throw new \InvalidArgumentException('Missing the required parameter $string when calling testEndpointParameters'); + } + // verify the required parameter 'byte' is set + if ($byte === null) { + throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters'); + } + + // parse inputs + $resourcePath = "/fake"; + $httpBody = ''; + $queryParams = array(); + $headerParams = array(); + $formParams = array(); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + + + + + // default format to json + $resourcePath = str_replace("{format}", "json", $resourcePath); + + // form params + if ($integer !== null) { + $formParams['integer'] = $this->apiClient->getSerializer()->toFormValue($integer); + }// form params + if ($int32 !== null) { + $formParams['int32'] = $this->apiClient->getSerializer()->toFormValue($int32); + }// form params + if ($int64 !== null) { + $formParams['int64'] = $this->apiClient->getSerializer()->toFormValue($int64); + }// form params + if ($number !== null) { + $formParams['number'] = $this->apiClient->getSerializer()->toFormValue($number); + }// form params + if ($float !== null) { + $formParams['float'] = $this->apiClient->getSerializer()->toFormValue($float); + }// form params + if ($double !== null) { + $formParams['double'] = $this->apiClient->getSerializer()->toFormValue($double); + }// form params + if ($string !== null) { + $formParams['string'] = $this->apiClient->getSerializer()->toFormValue($string); + }// form params + if ($byte !== null) { + $formParams['byte'] = $this->apiClient->getSerializer()->toFormValue($byte); + }// form params + if ($binary !== null) { + $formParams['binary'] = $this->apiClient->getSerializer()->toFormValue($binary); + }// form params + if ($date !== null) { + $formParams['date'] = $this->apiClient->getSerializer()->toFormValue($date); + }// form params + if ($date_time !== null) { + $formParams['dateTime'] = $this->apiClient->getSerializer()->toFormValue($date_time); + }// form params + if ($password !== null) { + $formParams['password'] = $this->apiClient->getSerializer()->toFormValue($password); + } + + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, 'POST', + $queryParams, $httpBody, + $headerParams + ); + + return array(null, $statusCode, $httpHeader); + } catch (ApiException $e) { + switch ($e->getCode()) { + } + + throw $e; + } + } +} 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 3f01e789547e..8ea6b41d472b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -101,10 +101,16 @@ class Animal implements ArrayAccess } /** - * $class_name - * @var string - */ - protected $class_name; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['class_name'] + * @var string + */ + 'class_name' => null, + ); /** * Constructor @@ -115,10 +121,10 @@ class Animal implements ArrayAccess // Initialize discriminator property with the model name. $discrimintor = array_search('className', self::$attributeMap); - $this->{$discrimintor} = static::$swaggerModelName; + $this->container[$discrimintor] = static::$swaggerModelName; if ($data != null) { - $this->class_name = $data["class_name"]; + $this->container['class_name'] = $data['class_name']; } } /** @@ -127,7 +133,7 @@ class Animal implements ArrayAccess */ public function getClassName() { - return $this->class_name; + return $this->container['class_name']; } /** @@ -138,7 +144,7 @@ class Animal implements ArrayAccess public function setClassName($class_name) { - $this->class_name = $class_name; + $this->container['class_name'] = $class_name; return $this; } /** @@ -148,7 +154,7 @@ class Animal implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -158,7 +164,7 @@ class Animal implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -169,7 +175,11 @@ class Animal implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -179,7 +189,7 @@ class Animal implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php new file mode 100644 index 000000000000..568aa5b98c75 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -0,0 +1,178 @@ +container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 4f467a5aab55..4247dc5f1a7b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -109,20 +109,28 @@ class ApiResponse implements ArrayAccess } /** - * $code - * @var int - */ - protected $code; - /** - * $type - * @var string - */ - protected $type; - /** - * $message - * @var string - */ - protected $message; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['code'] + * @var int + */ + 'code' => null, + + /** + * $container['type'] + * @var string + */ + 'type' => null, + + /** + * $container['message'] + * @var string + */ + 'message' => null, + ); /** * Constructor @@ -133,9 +141,9 @@ class ApiResponse implements ArrayAccess if ($data != null) { - $this->code = $data["code"]; - $this->type = $data["type"]; - $this->message = $data["message"]; + $this->container['code'] = $data['code']; + $this->container['type'] = $data['type']; + $this->container['message'] = $data['message']; } } /** @@ -144,7 +152,7 @@ class ApiResponse implements ArrayAccess */ public function getCode() { - return $this->code; + return $this->container['code']; } /** @@ -155,7 +163,7 @@ class ApiResponse implements ArrayAccess public function setCode($code) { - $this->code = $code; + $this->container['code'] = $code; return $this; } /** @@ -164,7 +172,7 @@ class ApiResponse implements ArrayAccess */ public function getType() { - return $this->type; + return $this->container['type']; } /** @@ -175,7 +183,7 @@ class ApiResponse implements ArrayAccess public function setType($type) { - $this->type = $type; + $this->container['type'] = $type; return $this; } /** @@ -184,7 +192,7 @@ class ApiResponse implements ArrayAccess */ public function getMessage() { - return $this->message; + return $this->container['message']; } /** @@ -195,7 +203,7 @@ class ApiResponse implements ArrayAccess public function setMessage($message) { - $this->message = $message; + $this->container['message'] = $message; return $this; } /** @@ -205,7 +213,7 @@ class ApiResponse implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -215,7 +223,7 @@ class ApiResponse implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -226,7 +234,11 @@ class ApiResponse implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -236,7 +248,7 @@ class ApiResponse implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 e0eaf7a106d6..e8b4db070d9d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -101,10 +101,16 @@ class Cat extends Animal implements ArrayAccess } /** - * $declawed - * @var bool - */ - protected $declawed; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['declawed'] + * @var bool + */ + 'declawed' => null, + ); /** * Constructor @@ -115,7 +121,7 @@ class Cat extends Animal implements ArrayAccess parent::__construct($data); if ($data != null) { - $this->declawed = $data["declawed"]; + $this->container['declawed'] = $data['declawed']; } } /** @@ -124,7 +130,7 @@ class Cat extends Animal implements ArrayAccess */ public function getDeclawed() { - return $this->declawed; + return $this->container['declawed']; } /** @@ -135,7 +141,7 @@ class Cat extends Animal implements ArrayAccess public function setDeclawed($declawed) { - $this->declawed = $declawed; + $this->container['declawed'] = $declawed; return $this; } /** @@ -145,7 +151,7 @@ class Cat extends Animal implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -155,7 +161,7 @@ class Cat extends Animal implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -166,7 +172,11 @@ class Cat extends Animal implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -176,7 +186,7 @@ class Cat extends Animal implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 fb6eed3af292..eb4fdfd413c6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -105,15 +105,22 @@ class Category implements ArrayAccess } /** - * $id - * @var int - */ - protected $id; - /** - * $name - * @var string - */ - protected $name; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['id'] + * @var int + */ + 'id' => null, + + /** + * $container['name'] + * @var string + */ + 'name' => null, + ); /** * Constructor @@ -124,8 +131,8 @@ class Category implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->name = $data["name"]; + $this->container['id'] = $data['id']; + $this->container['name'] = $data['name']; } } /** @@ -134,7 +141,7 @@ class Category implements ArrayAccess */ public function getId() { - return $this->id; + return $this->container['id']; } /** @@ -145,7 +152,7 @@ class Category implements ArrayAccess public function setId($id) { - $this->id = $id; + $this->container['id'] = $id; return $this; } /** @@ -154,7 +161,7 @@ class Category implements ArrayAccess */ public function getName() { - return $this->name; + return $this->container['name']; } /** @@ -165,7 +172,7 @@ class Category implements ArrayAccess public function setName($name) { - $this->name = $name; + $this->container['name'] = $name; return $this; } /** @@ -175,7 +182,7 @@ class Category implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -185,7 +192,7 @@ class Category implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -196,7 +203,11 @@ class Category implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -206,7 +217,7 @@ class Category implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 6fd43d3a9447..665ad7d67bac 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -101,10 +101,16 @@ class Dog extends Animal implements ArrayAccess } /** - * $breed - * @var string - */ - protected $breed; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['breed'] + * @var string + */ + 'breed' => null, + ); /** * Constructor @@ -115,7 +121,7 @@ class Dog extends Animal implements ArrayAccess parent::__construct($data); if ($data != null) { - $this->breed = $data["breed"]; + $this->container['breed'] = $data['breed']; } } /** @@ -124,7 +130,7 @@ class Dog extends Animal implements ArrayAccess */ public function getBreed() { - return $this->breed; + return $this->container['breed']; } /** @@ -135,7 +141,7 @@ class Dog extends Animal implements ArrayAccess public function setBreed($breed) { - $this->breed = $breed; + $this->container['breed'] = $breed; return $this; } /** @@ -145,7 +151,7 @@ class Dog extends Animal implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -155,7 +161,7 @@ class Dog extends Animal implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -166,7 +172,11 @@ class Dog extends Animal implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -176,7 +186,7 @@ class Dog extends Animal implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 7bfe30c0ef76..0314dacf61ad 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -68,6 +68,7 @@ class FormatTest implements ArrayAccess 'binary' => 'string', 'date' => '\DateTime', 'date_time' => '\DateTime', + 'uuid' => 'UUID', 'password' => 'string' ); @@ -91,6 +92,7 @@ class FormatTest implements ArrayAccess 'binary' => 'binary', 'date' => 'date', 'date_time' => 'dateTime', + 'uuid' => 'uuid', 'password' => 'password' ); @@ -114,6 +116,7 @@ class FormatTest implements ArrayAccess 'binary' => 'setBinary', 'date' => 'setDate', 'date_time' => 'setDateTime', + 'uuid' => 'setUuid', 'password' => 'setPassword' ); @@ -137,6 +140,7 @@ class FormatTest implements ArrayAccess 'binary' => 'getBinary', 'date' => 'getDate', 'date_time' => 'getDateTime', + 'uuid' => 'getUuid', 'password' => 'getPassword' ); @@ -145,65 +149,88 @@ class FormatTest implements ArrayAccess } /** - * $integer - * @var int - */ - protected $integer; - /** - * $int32 - * @var int - */ - protected $int32; - /** - * $int64 - * @var int - */ - protected $int64; - /** - * $number - * @var float - */ - protected $number; - /** - * $float - * @var float - */ - protected $float; - /** - * $double - * @var double - */ - protected $double; - /** - * $string - * @var string - */ - protected $string; - /** - * $byte - * @var string - */ - protected $byte; - /** - * $binary - * @var string - */ - protected $binary; - /** - * $date - * @var \DateTime - */ - protected $date; - /** - * $date_time - * @var \DateTime - */ - protected $date_time; - /** - * $password - * @var string - */ - protected $password; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['integer'] + * @var int + */ + 'integer' => null, + + /** + * $container['int32'] + * @var int + */ + 'int32' => null, + + /** + * $container['int64'] + * @var int + */ + 'int64' => null, + + /** + * $container['number'] + * @var float + */ + 'number' => null, + + /** + * $container['float'] + * @var float + */ + 'float' => null, + + /** + * $container['double'] + * @var double + */ + 'double' => null, + + /** + * $container['string'] + * @var string + */ + 'string' => null, + + /** + * $container['byte'] + * @var string + */ + 'byte' => null, + + /** + * $container['binary'] + * @var string + */ + 'binary' => null, + + /** + * $container['date'] + * @var \DateTime + */ + 'date' => null, + + /** + * $container['date_time'] + * @var \DateTime + */ + 'date_time' => null, + + /** + * $container['uuid'] + * @var UUID + */ + 'uuid' => null, + + /** + * $container['password'] + * @var string + */ + 'password' => null, + ); /** * Constructor @@ -214,18 +241,19 @@ class FormatTest implements ArrayAccess if ($data != null) { - $this->integer = $data["integer"]; - $this->int32 = $data["int32"]; - $this->int64 = $data["int64"]; - $this->number = $data["number"]; - $this->float = $data["float"]; - $this->double = $data["double"]; - $this->string = $data["string"]; - $this->byte = $data["byte"]; - $this->binary = $data["binary"]; - $this->date = $data["date"]; - $this->date_time = $data["date_time"]; - $this->password = $data["password"]; + $this->container['integer'] = $data['integer']; + $this->container['int32'] = $data['int32']; + $this->container['int64'] = $data['int64']; + $this->container['number'] = $data['number']; + $this->container['float'] = $data['float']; + $this->container['double'] = $data['double']; + $this->container['string'] = $data['string']; + $this->container['byte'] = $data['byte']; + $this->container['binary'] = $data['binary']; + $this->container['date'] = $data['date']; + $this->container['date_time'] = $data['date_time']; + $this->container['uuid'] = $data['uuid']; + $this->container['password'] = $data['password']; } } /** @@ -234,7 +262,7 @@ class FormatTest implements ArrayAccess */ public function getInteger() { - return $this->integer; + return $this->container['integer']; } /** @@ -245,7 +273,7 @@ class FormatTest implements ArrayAccess public function setInteger($integer) { - $this->integer = $integer; + $this->container['integer'] = $integer; return $this; } /** @@ -254,7 +282,7 @@ class FormatTest implements ArrayAccess */ public function getInt32() { - return $this->int32; + return $this->container['int32']; } /** @@ -265,7 +293,7 @@ class FormatTest implements ArrayAccess public function setInt32($int32) { - $this->int32 = $int32; + $this->container['int32'] = $int32; return $this; } /** @@ -274,7 +302,7 @@ class FormatTest implements ArrayAccess */ public function getInt64() { - return $this->int64; + return $this->container['int64']; } /** @@ -285,7 +313,7 @@ class FormatTest implements ArrayAccess public function setInt64($int64) { - $this->int64 = $int64; + $this->container['int64'] = $int64; return $this; } /** @@ -294,7 +322,7 @@ class FormatTest implements ArrayAccess */ public function getNumber() { - return $this->number; + return $this->container['number']; } /** @@ -305,7 +333,7 @@ class FormatTest implements ArrayAccess public function setNumber($number) { - $this->number = $number; + $this->container['number'] = $number; return $this; } /** @@ -314,7 +342,7 @@ class FormatTest implements ArrayAccess */ public function getFloat() { - return $this->float; + return $this->container['float']; } /** @@ -325,7 +353,7 @@ class FormatTest implements ArrayAccess public function setFloat($float) { - $this->float = $float; + $this->container['float'] = $float; return $this; } /** @@ -334,7 +362,7 @@ class FormatTest implements ArrayAccess */ public function getDouble() { - return $this->double; + return $this->container['double']; } /** @@ -345,7 +373,7 @@ class FormatTest implements ArrayAccess public function setDouble($double) { - $this->double = $double; + $this->container['double'] = $double; return $this; } /** @@ -354,7 +382,7 @@ class FormatTest implements ArrayAccess */ public function getString() { - return $this->string; + return $this->container['string']; } /** @@ -365,7 +393,7 @@ class FormatTest implements ArrayAccess public function setString($string) { - $this->string = $string; + $this->container['string'] = $string; return $this; } /** @@ -374,7 +402,7 @@ class FormatTest implements ArrayAccess */ public function getByte() { - return $this->byte; + return $this->container['byte']; } /** @@ -385,7 +413,7 @@ class FormatTest implements ArrayAccess public function setByte($byte) { - $this->byte = $byte; + $this->container['byte'] = $byte; return $this; } /** @@ -394,7 +422,7 @@ class FormatTest implements ArrayAccess */ public function getBinary() { - return $this->binary; + return $this->container['binary']; } /** @@ -405,7 +433,7 @@ class FormatTest implements ArrayAccess public function setBinary($binary) { - $this->binary = $binary; + $this->container['binary'] = $binary; return $this; } /** @@ -414,7 +442,7 @@ class FormatTest implements ArrayAccess */ public function getDate() { - return $this->date; + return $this->container['date']; } /** @@ -425,7 +453,7 @@ class FormatTest implements ArrayAccess public function setDate($date) { - $this->date = $date; + $this->container['date'] = $date; return $this; } /** @@ -434,7 +462,7 @@ class FormatTest implements ArrayAccess */ public function getDateTime() { - return $this->date_time; + return $this->container['date_time']; } /** @@ -445,7 +473,27 @@ class FormatTest implements ArrayAccess public function setDateTime($date_time) { - $this->date_time = $date_time; + $this->container['date_time'] = $date_time; + return $this; + } + /** + * Gets uuid + * @return UUID + */ + public function getUuid() + { + return $this->container['uuid']; + } + + /** + * Sets uuid + * @param UUID $uuid + * @return $this + */ + public function setUuid($uuid) + { + + $this->container['uuid'] = $uuid; return $this; } /** @@ -454,7 +502,7 @@ class FormatTest implements ArrayAccess */ public function getPassword() { - return $this->password; + return $this->container['password']; } /** @@ -465,7 +513,7 @@ class FormatTest implements ArrayAccess public function setPassword($password) { - $this->password = $password; + $this->container['password'] = $password; return $this; } /** @@ -475,7 +523,7 @@ class FormatTest implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -485,7 +533,7 @@ class FormatTest implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -496,7 +544,11 @@ class FormatTest implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -506,7 +558,7 @@ class FormatTest implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 8d62f9531ec6..29bf83b4081a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -101,10 +101,16 @@ class Model200Response implements ArrayAccess } /** - * $name - * @var int - */ - protected $name; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['name'] + * @var int + */ + 'name' => null, + ); /** * Constructor @@ -115,7 +121,7 @@ class Model200Response implements ArrayAccess if ($data != null) { - $this->name = $data["name"]; + $this->container['name'] = $data['name']; } } /** @@ -124,7 +130,7 @@ class Model200Response implements ArrayAccess */ public function getName() { - return $this->name; + return $this->container['name']; } /** @@ -135,7 +141,7 @@ class Model200Response implements ArrayAccess public function setName($name) { - $this->name = $name; + $this->container['name'] = $name; return $this; } /** @@ -145,7 +151,7 @@ class Model200Response implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -155,7 +161,7 @@ class Model200Response implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -166,7 +172,11 @@ class Model200Response implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -176,7 +186,7 @@ class Model200Response implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 d4660e118fde..7953b4b56ded 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -101,10 +101,16 @@ class ModelReturn implements ArrayAccess } /** - * $return - * @var int - */ - protected $return; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['return'] + * @var int + */ + 'return' => null, + ); /** * Constructor @@ -115,7 +121,7 @@ class ModelReturn implements ArrayAccess if ($data != null) { - $this->return = $data["return"]; + $this->container['return'] = $data['return']; } } /** @@ -124,7 +130,7 @@ class ModelReturn implements ArrayAccess */ public function getReturn() { - return $this->return; + return $this->container['return']; } /** @@ -135,7 +141,7 @@ class ModelReturn implements ArrayAccess public function setReturn($return) { - $this->return = $return; + $this->container['return'] = $return; return $this; } /** @@ -145,7 +151,7 @@ class ModelReturn implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -155,7 +161,7 @@ class ModelReturn implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -166,7 +172,11 @@ class ModelReturn implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -176,7 +186,7 @@ class ModelReturn implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 9e1c4b927620..e60962bd73df 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -109,20 +109,28 @@ class Name implements ArrayAccess } /** - * $name - * @var int - */ - protected $name; - /** - * $snake_case - * @var int - */ - protected $snake_case; - /** - * $property - * @var string - */ - protected $property; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['name'] + * @var int + */ + 'name' => null, + + /** + * $container['snake_case'] + * @var int + */ + 'snake_case' => null, + + /** + * $container['property'] + * @var string + */ + 'property' => null, + ); /** * Constructor @@ -133,9 +141,9 @@ class Name implements ArrayAccess if ($data != null) { - $this->name = $data["name"]; - $this->snake_case = $data["snake_case"]; - $this->property = $data["property"]; + $this->container['name'] = $data['name']; + $this->container['snake_case'] = $data['snake_case']; + $this->container['property'] = $data['property']; } } /** @@ -144,7 +152,7 @@ class Name implements ArrayAccess */ public function getName() { - return $this->name; + return $this->container['name']; } /** @@ -155,7 +163,7 @@ class Name implements ArrayAccess public function setName($name) { - $this->name = $name; + $this->container['name'] = $name; return $this; } /** @@ -164,7 +172,7 @@ class Name implements ArrayAccess */ public function getSnakeCase() { - return $this->snake_case; + return $this->container['snake_case']; } /** @@ -175,7 +183,7 @@ class Name implements ArrayAccess public function setSnakeCase($snake_case) { - $this->snake_case = $snake_case; + $this->container['snake_case'] = $snake_case; return $this; } /** @@ -184,7 +192,7 @@ class Name implements ArrayAccess */ public function getProperty() { - return $this->property; + return $this->container['property']; } /** @@ -195,7 +203,7 @@ class Name implements ArrayAccess public function setProperty($property) { - $this->property = $property; + $this->container['property'] = $property; return $this; } /** @@ -205,7 +213,7 @@ class Name implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -215,7 +223,7 @@ class Name implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -226,7 +234,11 @@ class Name implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -236,7 +248,7 @@ class Name implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 7ee5c124d2cd..22afa8036854 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -121,35 +121,46 @@ class Order implements ArrayAccess } /** - * $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; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['id'] + * @var int + */ + 'id' => null, + + /** + * $container['pet_id'] + * @var int + */ + 'pet_id' => null, + + /** + * $container['quantity'] + * @var int + */ + 'quantity' => null, + + /** + * $container['ship_date'] + * @var \DateTime + */ + 'ship_date' => null, + + /** + * $container['status'] Order Status + * @var string + */ + 'status' => null, + + /** + * $container['complete'] + * @var bool + */ + 'complete' => false, + ); /** * Constructor @@ -160,12 +171,12 @@ class Order implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->pet_id = $data["pet_id"]; - $this->quantity = $data["quantity"]; - $this->ship_date = $data["ship_date"]; - $this->status = $data["status"]; - $this->complete = $data["complete"]; + $this->container['id'] = $data['id']; + $this->container['pet_id'] = $data['pet_id']; + $this->container['quantity'] = $data['quantity']; + $this->container['ship_date'] = $data['ship_date']; + $this->container['status'] = $data['status']; + $this->container['complete'] = $data['complete']; } } /** @@ -174,7 +185,7 @@ class Order implements ArrayAccess */ public function getId() { - return $this->id; + return $this->container['id']; } /** @@ -185,7 +196,7 @@ class Order implements ArrayAccess public function setId($id) { - $this->id = $id; + $this->container['id'] = $id; return $this; } /** @@ -194,7 +205,7 @@ class Order implements ArrayAccess */ public function getPetId() { - return $this->pet_id; + return $this->container['pet_id']; } /** @@ -205,7 +216,7 @@ class Order implements ArrayAccess public function setPetId($pet_id) { - $this->pet_id = $pet_id; + $this->container['pet_id'] = $pet_id; return $this; } /** @@ -214,7 +225,7 @@ class Order implements ArrayAccess */ public function getQuantity() { - return $this->quantity; + return $this->container['quantity']; } /** @@ -225,7 +236,7 @@ class Order implements ArrayAccess public function setQuantity($quantity) { - $this->quantity = $quantity; + $this->container['quantity'] = $quantity; return $this; } /** @@ -234,7 +245,7 @@ class Order implements ArrayAccess */ public function getShipDate() { - return $this->ship_date; + return $this->container['ship_date']; } /** @@ -245,7 +256,7 @@ class Order implements ArrayAccess public function setShipDate($ship_date) { - $this->ship_date = $ship_date; + $this->container['ship_date'] = $ship_date; return $this; } /** @@ -254,7 +265,7 @@ class Order implements ArrayAccess */ public function getStatus() { - return $this->status; + return $this->container['status']; } /** @@ -264,11 +275,11 @@ class Order implements ArrayAccess */ public function setStatus($status) { - $allowed_values = array("placed", "approved", "delivered"); + $allowed_values = array('placed', 'approved', 'delivered'); if (!in_array($status, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'placed', 'approved', 'delivered'"); } - $this->status = $status; + $this->container['status'] = $status; return $this; } /** @@ -277,7 +288,7 @@ class Order implements ArrayAccess */ public function getComplete() { - return $this->complete; + return $this->container['complete']; } /** @@ -288,7 +299,7 @@ class Order implements ArrayAccess public function setComplete($complete) { - $this->complete = $complete; + $this->container['complete'] = $complete; return $this; } /** @@ -298,7 +309,7 @@ class Order implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -308,7 +319,7 @@ class Order implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -319,7 +330,11 @@ class Order implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -329,7 +344,7 @@ class Order implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 3a9e46cd3fb4..ce790bf5ca70 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -121,35 +121,46 @@ class Pet implements ArrayAccess } /** - * $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; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['id'] + * @var int + */ + 'id' => null, + + /** + * $container['category'] + * @var \Swagger\Client\Model\Category + */ + 'category' => null, + + /** + * $container['name'] + * @var string + */ + 'name' => null, + + /** + * $container['photo_urls'] + * @var string[] + */ + 'photo_urls' => null, + + /** + * $container['tags'] + * @var \Swagger\Client\Model\Tag[] + */ + 'tags' => null, + + /** + * $container['status'] pet status in the store + * @var string + */ + 'status' => null, + ); /** * Constructor @@ -160,12 +171,12 @@ class Pet implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->category = $data["category"]; - $this->name = $data["name"]; - $this->photo_urls = $data["photo_urls"]; - $this->tags = $data["tags"]; - $this->status = $data["status"]; + $this->container['id'] = $data['id']; + $this->container['category'] = $data['category']; + $this->container['name'] = $data['name']; + $this->container['photo_urls'] = $data['photo_urls']; + $this->container['tags'] = $data['tags']; + $this->container['status'] = $data['status']; } } /** @@ -174,7 +185,7 @@ class Pet implements ArrayAccess */ public function getId() { - return $this->id; + return $this->container['id']; } /** @@ -185,7 +196,7 @@ class Pet implements ArrayAccess public function setId($id) { - $this->id = $id; + $this->container['id'] = $id; return $this; } /** @@ -194,7 +205,7 @@ class Pet implements ArrayAccess */ public function getCategory() { - return $this->category; + return $this->container['category']; } /** @@ -205,7 +216,7 @@ class Pet implements ArrayAccess public function setCategory($category) { - $this->category = $category; + $this->container['category'] = $category; return $this; } /** @@ -214,7 +225,7 @@ class Pet implements ArrayAccess */ public function getName() { - return $this->name; + return $this->container['name']; } /** @@ -225,7 +236,7 @@ class Pet implements ArrayAccess public function setName($name) { - $this->name = $name; + $this->container['name'] = $name; return $this; } /** @@ -234,7 +245,7 @@ class Pet implements ArrayAccess */ public function getPhotoUrls() { - return $this->photo_urls; + return $this->container['photo_urls']; } /** @@ -245,7 +256,7 @@ class Pet implements ArrayAccess public function setPhotoUrls($photo_urls) { - $this->photo_urls = $photo_urls; + $this->container['photo_urls'] = $photo_urls; return $this; } /** @@ -254,7 +265,7 @@ class Pet implements ArrayAccess */ public function getTags() { - return $this->tags; + return $this->container['tags']; } /** @@ -265,7 +276,7 @@ class Pet implements ArrayAccess public function setTags($tags) { - $this->tags = $tags; + $this->container['tags'] = $tags; return $this; } /** @@ -274,7 +285,7 @@ class Pet implements ArrayAccess */ public function getStatus() { - return $this->status; + return $this->container['status']; } /** @@ -284,11 +295,11 @@ class Pet implements ArrayAccess */ public function setStatus($status) { - $allowed_values = array("available", "pending", "sold"); + $allowed_values = array('available', 'pending', 'sold'); if (!in_array($status, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'"); } - $this->status = $status; + $this->container['status'] = $status; return $this; } /** @@ -298,7 +309,7 @@ class Pet implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -308,7 +319,7 @@ class Pet implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -319,7 +330,11 @@ class Pet implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -329,7 +344,7 @@ class Pet implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 fb748811cf27..18eee0cf7e47 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -101,10 +101,16 @@ class SpecialModelName implements ArrayAccess } /** - * $special_property_name - * @var int - */ - protected $special_property_name; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['special_property_name'] + * @var int + */ + 'special_property_name' => null, + ); /** * Constructor @@ -115,7 +121,7 @@ class SpecialModelName implements ArrayAccess if ($data != null) { - $this->special_property_name = $data["special_property_name"]; + $this->container['special_property_name'] = $data['special_property_name']; } } /** @@ -124,7 +130,7 @@ class SpecialModelName implements ArrayAccess */ public function getSpecialPropertyName() { - return $this->special_property_name; + return $this->container['special_property_name']; } /** @@ -135,7 +141,7 @@ class SpecialModelName implements ArrayAccess public function setSpecialPropertyName($special_property_name) { - $this->special_property_name = $special_property_name; + $this->container['special_property_name'] = $special_property_name; return $this; } /** @@ -145,7 +151,7 @@ class SpecialModelName implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -155,7 +161,7 @@ class SpecialModelName implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -166,7 +172,11 @@ class SpecialModelName implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -176,7 +186,7 @@ class SpecialModelName implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 4bb56401c48b..7e1ab0159d6e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -105,15 +105,22 @@ class Tag implements ArrayAccess } /** - * $id - * @var int - */ - protected $id; - /** - * $name - * @var string - */ - protected $name; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['id'] + * @var int + */ + 'id' => null, + + /** + * $container['name'] + * @var string + */ + 'name' => null, + ); /** * Constructor @@ -124,8 +131,8 @@ class Tag implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->name = $data["name"]; + $this->container['id'] = $data['id']; + $this->container['name'] = $data['name']; } } /** @@ -134,7 +141,7 @@ class Tag implements ArrayAccess */ public function getId() { - return $this->id; + return $this->container['id']; } /** @@ -145,7 +152,7 @@ class Tag implements ArrayAccess public function setId($id) { - $this->id = $id; + $this->container['id'] = $id; return $this; } /** @@ -154,7 +161,7 @@ class Tag implements ArrayAccess */ public function getName() { - return $this->name; + return $this->container['name']; } /** @@ -165,7 +172,7 @@ class Tag implements ArrayAccess public function setName($name) { - $this->name = $name; + $this->container['name'] = $name; return $this; } /** @@ -175,7 +182,7 @@ class Tag implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -185,7 +192,7 @@ class Tag implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -196,7 +203,11 @@ class Tag implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -206,7 +217,7 @@ class Tag implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** 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 da9cc20ff4cc..34a18044a06a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -129,45 +129,58 @@ class User implements ArrayAccess } /** - * $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; + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['id'] + * @var int + */ + 'id' => null, + + /** + * $container['username'] + * @var string + */ + 'username' => null, + + /** + * $container['first_name'] + * @var string + */ + 'first_name' => null, + + /** + * $container['last_name'] + * @var string + */ + 'last_name' => null, + + /** + * $container['email'] + * @var string + */ + 'email' => null, + + /** + * $container['password'] + * @var string + */ + 'password' => null, + + /** + * $container['phone'] + * @var string + */ + 'phone' => null, + + /** + * $container['user_status'] User Status + * @var int + */ + 'user_status' => null, + ); /** * Constructor @@ -178,14 +191,14 @@ class User implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->username = $data["username"]; - $this->first_name = $data["first_name"]; - $this->last_name = $data["last_name"]; - $this->email = $data["email"]; - $this->password = $data["password"]; - $this->phone = $data["phone"]; - $this->user_status = $data["user_status"]; + $this->container['id'] = $data['id']; + $this->container['username'] = $data['username']; + $this->container['first_name'] = $data['first_name']; + $this->container['last_name'] = $data['last_name']; + $this->container['email'] = $data['email']; + $this->container['password'] = $data['password']; + $this->container['phone'] = $data['phone']; + $this->container['user_status'] = $data['user_status']; } } /** @@ -194,7 +207,7 @@ class User implements ArrayAccess */ public function getId() { - return $this->id; + return $this->container['id']; } /** @@ -205,7 +218,7 @@ class User implements ArrayAccess public function setId($id) { - $this->id = $id; + $this->container['id'] = $id; return $this; } /** @@ -214,7 +227,7 @@ class User implements ArrayAccess */ public function getUsername() { - return $this->username; + return $this->container['username']; } /** @@ -225,7 +238,7 @@ class User implements ArrayAccess public function setUsername($username) { - $this->username = $username; + $this->container['username'] = $username; return $this; } /** @@ -234,7 +247,7 @@ class User implements ArrayAccess */ public function getFirstName() { - return $this->first_name; + return $this->container['first_name']; } /** @@ -245,7 +258,7 @@ class User implements ArrayAccess public function setFirstName($first_name) { - $this->first_name = $first_name; + $this->container['first_name'] = $first_name; return $this; } /** @@ -254,7 +267,7 @@ class User implements ArrayAccess */ public function getLastName() { - return $this->last_name; + return $this->container['last_name']; } /** @@ -265,7 +278,7 @@ class User implements ArrayAccess public function setLastName($last_name) { - $this->last_name = $last_name; + $this->container['last_name'] = $last_name; return $this; } /** @@ -274,7 +287,7 @@ class User implements ArrayAccess */ public function getEmail() { - return $this->email; + return $this->container['email']; } /** @@ -285,7 +298,7 @@ class User implements ArrayAccess public function setEmail($email) { - $this->email = $email; + $this->container['email'] = $email; return $this; } /** @@ -294,7 +307,7 @@ class User implements ArrayAccess */ public function getPassword() { - return $this->password; + return $this->container['password']; } /** @@ -305,7 +318,7 @@ class User implements ArrayAccess public function setPassword($password) { - $this->password = $password; + $this->container['password'] = $password; return $this; } /** @@ -314,7 +327,7 @@ class User implements ArrayAccess */ public function getPhone() { - return $this->phone; + return $this->container['phone']; } /** @@ -325,7 +338,7 @@ class User implements ArrayAccess public function setPhone($phone) { - $this->phone = $phone; + $this->container['phone'] = $phone; return $this; } /** @@ -334,7 +347,7 @@ class User implements ArrayAccess */ public function getUserStatus() { - return $this->user_status; + return $this->container['user_status']; } /** @@ -345,7 +358,7 @@ class User implements ArrayAccess public function setUserStatus($user_status) { - $this->user_status = $user_status; + $this->container['user_status'] = $user_status; return $this; } /** @@ -355,7 +368,7 @@ class User implements ArrayAccess */ public function offsetExists($offset) { - return isset($this->$offset); + return isset($this->container[$offset]); } /** @@ -365,7 +378,7 @@ class User implements ArrayAccess */ public function offsetGet($offset) { - return $this->$offset; + return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** @@ -376,7 +389,11 @@ class User implements ArrayAccess */ public function offsetSet($offset, $value) { - $this->$offset = $value; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** @@ -386,7 +403,7 @@ class User implements ArrayAccess */ public function offsetUnset($offset) { - unset($this->$offset); + unset($this->container[$offset]); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index 3adaa899f5f8..ac63c18fbd5d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -256,7 +256,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { + } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalFarmTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalFarmTest.php new file mode 100644 index 000000000000..f154716c064f --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalFarmTest.php @@ -0,0 +1,70 @@ + Date: Wed, 27 Apr 2016 20:53:48 +0100 Subject: [PATCH 010/170] Issue #2276 Auto generated test stubs --- .../languages/PythonClientCodegen.java | 30 +++ .../resources/python/__init__test.mustache | 0 .../main/resources/python/api_test.mustache | 43 ++++ .../main/resources/python/model_test.mustache | 48 +++++ samples/client/petstore/python/README.md | 2 +- .../client/petstore/python/docs/FakeApi.md | 77 +++++++ .../python/swagger_client/apis/fake_api.py | 165 +++++++++++++++ .../petstore/python/tests/test_animal.py | 44 ++++ .../python/tests/test_api_response.py | 44 ++++ .../client/petstore/python/tests/test_cat.py | 44 ++++ .../petstore/python/tests/test_category.py | 44 ++++ .../client/petstore/python/tests/test_dog.py | 44 ++++ .../petstore/python/tests/test_fake_api.py | 40 ++++ .../petstore/python/tests/test_format_test.py | 44 ++++ .../python/tests/test_model_200_response.py | 44 ++++ .../python/tests/test_model_return.py | 44 ++++ .../client/petstore/python/tests/test_name.py | 44 ++++ .../petstore/python/tests/test_order.py | 44 ++++ .../client/petstore/python/tests/test_pet.py | 44 ++++ .../petstore/python/tests/test_pet_api.py | 191 ++++-------------- .../python/tests/test_special_model_name.py | 44 ++++ .../petstore/python/tests/test_store_api.py | 47 +++-- .../client/petstore/python/tests/test_tag.py | 44 ++++ .../client/petstore/python/tests/test_user.py | 44 ++++ .../petstore/python/tests/test_user_api.py | 61 ++++++ 25 files changed, 1156 insertions(+), 164 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/python/__init__test.mustache create mode 100644 modules/swagger-codegen/src/main/resources/python/api_test.mustache create mode 100644 modules/swagger-codegen/src/main/resources/python/model_test.mustache create mode 100644 samples/client/petstore/python/docs/FakeApi.md create mode 100644 samples/client/petstore/python/swagger_client/apis/fake_api.py create mode 100644 samples/client/petstore/python/tests/test_animal.py create mode 100644 samples/client/petstore/python/tests/test_api_response.py create mode 100644 samples/client/petstore/python/tests/test_cat.py create mode 100644 samples/client/petstore/python/tests/test_category.py create mode 100644 samples/client/petstore/python/tests/test_dog.py create mode 100644 samples/client/petstore/python/tests/test_fake_api.py create mode 100644 samples/client/petstore/python/tests/test_format_test.py create mode 100644 samples/client/petstore/python/tests/test_model_200_response.py create mode 100644 samples/client/petstore/python/tests/test_model_return.py create mode 100644 samples/client/petstore/python/tests/test_name.py create mode 100644 samples/client/petstore/python/tests/test_order.py create mode 100644 samples/client/petstore/python/tests/test_pet.py create mode 100644 samples/client/petstore/python/tests/test_special_model_name.py create mode 100644 samples/client/petstore/python/tests/test_tag.py create mode 100644 samples/client/petstore/python/tests/test_user.py create mode 100644 samples/client/petstore/python/tests/test_user_api.py diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index 7cb4dc703db2..08d63c426765 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -20,6 +20,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig protected String packageVersion; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; + + private String testFolder; public PythonClientCodegen() { super(); @@ -27,12 +29,19 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig modelPackage = "models"; apiPackage = "api"; outputFolder = "generated-code" + File.separatorChar + "python"; + modelTemplateFiles.put("model.mustache", ".py"); apiTemplateFiles.put("api.mustache", ".py"); + + modelTestTemplateFiles.put("model_test.mustache", ".py"); + apiTestTemplateFiles.put("api_test.mustache", ".py"); + embeddedTemplateDir = templateDir = "python"; modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); + + testFolder = "tests"; languageSpecificPrimitives.clear(); languageSpecificPrimitives.add("int"); @@ -126,6 +135,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig supportingFiles.add(new SupportingFile("__init__package.mustache", swaggerFolder, "__init__.py")); supportingFiles.add(new SupportingFile("__init__model.mustache", modelPackage, "__init__.py")); supportingFiles.add(new SupportingFile("__init__api.mustache", apiPackage, "__init__.py")); + supportingFiles.add(new SupportingFile("__init__test.mustache", testFolder, "__init__.py")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); } @@ -184,6 +194,16 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig public String modelFileFolder() { return outputFolder + File.separatorChar + modelPackage().replace('.', File.separatorChar); } + + @Override + public String apiTestFileFolder() { + return outputFolder + File.separatorChar + testFolder; + } + + @Override + public String modelTestFileFolder() { + return outputFolder + File.separatorChar + testFolder; + } @Override public String getTypeDeclaration(Property p) { @@ -310,6 +330,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // PhoneNumber => phone_number return underscore(dropDots(name)); } + + @Override + public String toModelTestFilename(String name) { + return "test_" + toModelFilename(name); + }; @Override public String toApiFilename(String name) { @@ -319,6 +344,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // e.g. PhoneNumberApi.rb => phone_number_api.rb return underscore(name) + "_api"; } + + @Override + public String toApiTestFilename(String name) { + return "test_" + toApiFilename(name); + } @Override public String toApiName(String name) { diff --git a/modules/swagger-codegen/src/main/resources/python/__init__test.mustache b/modules/swagger-codegen/src/main/resources/python/__init__test.mustache new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/modules/swagger-codegen/src/main/resources/python/api_test.mustache b/modules/swagger-codegen/src/main/resources/python/api_test.mustache new file mode 100644 index 000000000000..78bd20624431 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/python/api_test.mustache @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.apis.{{classVarName}} import {{classname}} + +class {{#operations}}{{classname}}Test(unittest.TestCase): + + def setUp(self): + self.api = swagger_client.apis.{{classVarName}}.{{classname}}() + + def tearDown(self): + pass + + {{#operation}} + def test_{{operationId}}(self): + pass + + {{/operation}} +{{/operations}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/python/model_test.mustache b/modules/swagger-codegen/src/main/resources/python/model_test.mustache new file mode 100644 index 000000000000..af4601de6964 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/python/model_test.mustache @@ -0,0 +1,48 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +{{#models}} +{{#model}} +import swagger_client +from swagger_client.models.{{classFilename}} import {{classname}} + + +class {{classname}}Test(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test {{classname}} + """ + def test{{classname}}(self): + self.model = swagger_client.models.{{classFilename}}.{{classname}}() + +{{/model}} +{{/models}} diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 851c5458cb16..d29b88be8d5e 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-27T17:36:32.266+08:00 +- Build date: 2016-04-27T20:52:27.297+01:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md new file mode 100644 index 000000000000..66d9a04434a5 --- /dev/null +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -0,0 +1,77 @@ +# swagger_client.FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters + + +# **test_endpoint_parameters** +> test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```python +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = swagger_client.FakeApi() +number = 3.4 # float | None +double = 1.2 # float | None +string = 'string_example' # str | None +byte = 'B' # str | None +integer = 56 # int | None (optional) +int32 = 56 # int | None (optional) +int64 = 789 # int | None (optional) +float = 3.4 # float | None (optional) +binary = 'B' # str | None (optional) +date = '2013-10-20' # date | None (optional) +date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional) +password = 'password_example' # str | None (optional) + +try: + # Fake endpoint for testing various parameters + api_instance.test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password) +except ApiException as e: + print "Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float**| None | + **double** | **float**| None | + **string** | **str**| None | + **byte** | **str**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **binary** | **str**| None | [optional] + **date** | **date**| None | [optional] + **date_time** | **datetime**| None | [optional] + **password** | **str**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python/swagger_client/apis/fake_api.py b/samples/client/petstore/python/swagger_client/apis/fake_api.py new file mode 100644 index 000000000000..2b183794ef16 --- /dev/null +++ b/samples/client/petstore/python/swagger_client/apis/fake_api.py @@ -0,0 +1,165 @@ +# coding: utf-8 + +""" +FakeApi.py +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" + +from __future__ import absolute_import + +import sys +import os + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..configuration import Configuration +from ..api_client import ApiClient + + +class FakeApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + config = Configuration() + if api_client: + self.api_client = api_client + else: + if not config.api_client: + config.api_client = ApiClient() + self.api_client = config.api_client + + def test_endpoint_parameters(self, number, double, string, byte, **kwargs): + """ + Fake endpoint for testing various parameters + Fake endpoint for testing various parameters + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.test_endpoint_parameters(number, double, string, byte, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param float number: None (required) + :param float double: None (required) + :param str string: None (required) + :param str byte: None (required) + :param int integer: None + :param int int32: None + :param int int64: None + :param float float: None + :param str binary: None + :param date date: None + :param datetime date_time: None + :param str password: None + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['number', 'double', 'string', 'byte', 'integer', 'int32', 'int64', 'float', 'binary', 'date', 'date_time', 'password'] + all_params.append('callback') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_endpoint_parameters" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'number' is set + if ('number' not in params) or (params['number'] is None): + raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") + # verify the required parameter 'double' is set + if ('double' not in params) or (params['double'] is None): + raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") + # verify the required parameter 'string' is set + if ('string' not in params) or (params['string'] is None): + raise ValueError("Missing the required parameter `string` when calling `test_endpoint_parameters`") + # verify the required parameter 'byte' is set + if ('byte' not in params) or (params['byte'] is None): + raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") + + resource_path = '/fake'.replace('{format}', 'json') + path_params = {} + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + if 'integer' in params: + form_params.append(('integer', params['integer'])) + if 'int32' in params: + form_params.append(('int32', params['int32'])) + if 'int64' in params: + form_params.append(('int64', params['int64'])) + if 'number' in params: + form_params.append(('number', params['number'])) + if 'float' in params: + form_params.append(('float', params['float'])) + if 'double' in params: + form_params.append(('double', params['double'])) + if 'string' in params: + form_params.append(('string', params['string'])) + if 'byte' in params: + form_params.append(('byte', params['byte'])) + if 'binary' in params: + form_params.append(('binary', params['binary'])) + if 'date' in params: + form_params.append(('date', params['date'])) + if 'date_time' in params: + form_params.append(('dateTime', params['date_time'])) + if 'password' in params: + form_params.append(('password', params['password'])) + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml', 'application/json']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = [] + + response = self.api_client.call_api(resource_path, 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + return response diff --git a/samples/client/petstore/python/tests/test_animal.py b/samples/client/petstore/python/tests/test_animal.py new file mode 100644 index 000000000000..337bbec0f1b0 --- /dev/null +++ b/samples/client/petstore/python/tests/test_animal.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.animal import Animal + + +class AnimalTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Animal + """ + def testAnimal(self): + self.model = swagger_client.models.animal.Animal() + diff --git a/samples/client/petstore/python/tests/test_api_response.py b/samples/client/petstore/python/tests/test_api_response.py new file mode 100644 index 000000000000..d81daae1e9a2 --- /dev/null +++ b/samples/client/petstore/python/tests/test_api_response.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.api_response import ApiResponse + + +class ApiResponseTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test ApiResponse + """ + def testApiResponse(self): + self.model = swagger_client.models.api_response.ApiResponse() + diff --git a/samples/client/petstore/python/tests/test_cat.py b/samples/client/petstore/python/tests/test_cat.py new file mode 100644 index 000000000000..f72e4fd3209b --- /dev/null +++ b/samples/client/petstore/python/tests/test_cat.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.cat import Cat + + +class CatTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Cat + """ + def testCat(self): + self.model = swagger_client.models.cat.Cat() + diff --git a/samples/client/petstore/python/tests/test_category.py b/samples/client/petstore/python/tests/test_category.py new file mode 100644 index 000000000000..1f7b1bda4d6c --- /dev/null +++ b/samples/client/petstore/python/tests/test_category.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.category import Category + + +class CategoryTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Category + """ + def testCategory(self): + self.model = swagger_client.models.category.Category() + diff --git a/samples/client/petstore/python/tests/test_dog.py b/samples/client/petstore/python/tests/test_dog.py new file mode 100644 index 000000000000..d2b5b38048bf --- /dev/null +++ b/samples/client/petstore/python/tests/test_dog.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.dog import Dog + + +class DogTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Dog + """ + def testDog(self): + self.model = swagger_client.models.dog.Dog() + diff --git a/samples/client/petstore/python/tests/test_fake_api.py b/samples/client/petstore/python/tests/test_fake_api.py new file mode 100644 index 000000000000..a529e2c9b976 --- /dev/null +++ b/samples/client/petstore/python/tests/test_fake_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.apis.fake_api import FakeApi + +class FakeApiTest(unittest.TestCase): + + def setUp(self): + self.api = swagger_client.apis.fake_api.FakeApi() + + def tearDown(self): + pass + + def test_test_endpoint_parameters(self): + pass + diff --git a/samples/client/petstore/python/tests/test_format_test.py b/samples/client/petstore/python/tests/test_format_test.py new file mode 100644 index 000000000000..07aeac49b9a7 --- /dev/null +++ b/samples/client/petstore/python/tests/test_format_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.format_test import FormatTest + + +class FormatTestTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test FormatTest + """ + def testFormatTest(self): + self.model = swagger_client.models.format_test.FormatTest() + diff --git a/samples/client/petstore/python/tests/test_model_200_response.py b/samples/client/petstore/python/tests/test_model_200_response.py new file mode 100644 index 000000000000..cdae133c22bf --- /dev/null +++ b/samples/client/petstore/python/tests/test_model_200_response.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.model_200_response import Model200Response + + +class Model200ResponseTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Model200Response + """ + def testModel200Response(self): + self.model = swagger_client.models.model_200_response.Model200Response() + diff --git a/samples/client/petstore/python/tests/test_model_return.py b/samples/client/petstore/python/tests/test_model_return.py new file mode 100644 index 000000000000..60bda8fd99ed --- /dev/null +++ b/samples/client/petstore/python/tests/test_model_return.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.model_return import ModelReturn + + +class ModelReturnTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test ModelReturn + """ + def testModelReturn(self): + self.model = swagger_client.models.model_return.ModelReturn() + diff --git a/samples/client/petstore/python/tests/test_name.py b/samples/client/petstore/python/tests/test_name.py new file mode 100644 index 000000000000..2e409620e484 --- /dev/null +++ b/samples/client/petstore/python/tests/test_name.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.name import Name + + +class NameTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Name + """ + def testName(self): + self.model = swagger_client.models.name.Name() + diff --git a/samples/client/petstore/python/tests/test_order.py b/samples/client/petstore/python/tests/test_order.py new file mode 100644 index 000000000000..4a956567d1c5 --- /dev/null +++ b/samples/client/petstore/python/tests/test_order.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.order import Order + + +class OrderTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Order + """ + def testOrder(self): + self.model = swagger_client.models.order.Order() + diff --git a/samples/client/petstore/python/tests/test_pet.py b/samples/client/petstore/python/tests/test_pet.py new file mode 100644 index 000000000000..e44ce644c884 --- /dev/null +++ b/samples/client/petstore/python/tests/test_pet.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.pet import Pet + + +class PetTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Pet + """ + def testPet(self): + self.model = swagger_client.models.pet.Pet() + diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 300a7bee7833..e56fa6461ad1 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -1,168 +1,61 @@ # coding: utf-8 """ -Run the tests. -$ pip install nose (optional) -$ cd swagger_client-python -$ nosetests -v +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen """ +from __future__ import absolute_import + import os -import time +import sys import unittest import swagger_client -from swagger_client.rest import ApiException +from swagger_client.apis.pet_api import PetApi -HOST = 'http://petstore.swagger.io/v2' - - -class PetApiTests(unittest.TestCase): +class PetApiTest(unittest.TestCase): def setUp(self): - self.api_client = swagger_client.ApiClient(HOST) - self.pet_api = swagger_client.PetApi(self.api_client) - self.setUpModels() - self.setUpFiles() + self.api = swagger_client.apis.pet_api.PetApi() def tearDown(self): - # sleep 1 sec between two every 2 tests - time.sleep(1) + pass - def setUpModels(self): - self.category = swagger_client.Category() - self.category.id = int(time.time()) - self.category.name = "dog" - self.tag = swagger_client.Tag() - self.tag.id = int(time.time()) - self.tag.name = "swagger-codegen-python-pet-tag" - self.pet = swagger_client.Pet() - self.pet.id = int(time.time()) - self.pet.name = "hello kity" - self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"] - self.pet.status = "sold" - self.pet.category = self.category - self.pet.tags = [self.tag] - - def setUpFiles(self): - self.test_file_dir = os.path.join(os.path.dirname(__file__), "..", "testfiles") - self.test_file_dir = os.path.realpath(self.test_file_dir) - self.foo = os.path.join(self.test_file_dir, "foo.png") - - def test_create_api_instance(self): - pet_api = swagger_client.PetApi() - pet_api2 = swagger_client.PetApi() - api_client3 = swagger_client.ApiClient() - api_client3.user_agent = 'api client 3' - api_client4 = swagger_client.ApiClient() - api_client4.user_agent = 'api client 4' - pet_api3 = swagger_client.PetApi(api_client3) - - # same default api client - self.assertEqual(pet_api.api_client, pet_api2.api_client) - # confirm using the default api client in the config module - self.assertEqual(pet_api.api_client, swagger_client.configuration.api_client) - # 2 different api clients are not the same - self.assertNotEqual(api_client3, api_client4) - # customized pet api not using the default api client - self.assertNotEqual(pet_api3.api_client, swagger_client.configuration.api_client) - # customized pet api not using the old pet api's api client - self.assertNotEqual(pet_api3.api_client, pet_api2.api_client) - - def test_async_request(self): - self.pet_api.add_pet(body=self.pet) - - def callback_function(data): - self.assertIsNotNone(data) - self.assertEqual(data.id, self.pet.id) - self.assertEqual(data.name, self.pet.name) - self.assertIsNotNone(data.category) - self.assertEqual(data.category.id, self.pet.category.id) - self.assertEqual(data.category.name, self.pet.category.name) - self.assertTrue(isinstance(data.tags, list)) - self.assertEqual(data.tags[0].id, self.pet.tags[0].id) - self.assertEqual(data.tags[0].name, self.pet.tags[0].name) - - thread = self.pet_api.get_pet_by_id(pet_id=self.pet.id, callback=callback_function) - thread.join(10) - if thread.isAlive(): - self.fail("Request timeout") - - def test_add_pet_and_get_pet_by_id(self): - self.pet_api.add_pet(body=self.pet) - - fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) - self.assertIsNotNone(fetched) - self.assertEqual(self.pet.id, fetched.id) - self.assertIsNotNone(fetched.category) - self.assertEqual(self.pet.category.name, fetched.category.name) - - def test_update_pet(self): - self.pet.name = "hello kity with updated" - self.pet_api.update_pet(body=self.pet) - - fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) - self.assertIsNotNone(fetched) - self.assertEqual(self.pet.id, fetched.id) - self.assertEqual(self.pet.name, fetched.name) - self.assertIsNotNone(fetched.category) - self.assertEqual(fetched.category.name, self.pet.category.name) - - def test_find_pets_by_status(self): - self.pet_api.add_pet(body=self.pet) - - self.assertIn( - self.pet.id, - list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_status(status=[self.pet.status]))) - ) - - def test_find_pets_by_tags(self): - self.pet_api.add_pet(body=self.pet) - - self.assertIn( - self.pet.id, - list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_tags(tags=[self.tag.name]))) - ) - - def test_update_pet_with_form(self): - self.pet_api.add_pet(body=self.pet) - - name = "hello kity with form updated" - status = "pending" - self.pet_api.update_pet_with_form(pet_id=self.pet.id, name=name, status=status) - - fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) - self.assertEqual(self.pet.id, fetched.id) - self.assertEqual(name, fetched.name) - self.assertEqual(status, fetched.status) - - def test_upload_file(self): - # upload file with form parameter - try: - additional_metadata = "special" - self.pet_api.upload_file( - pet_id=self.pet.id, - additional_metadata=additional_metadata, - file=self.foo - ) - except ApiException as e: - self.fail("upload_file() raised {0} unexpectedly".format(type(e))) - - # upload only file - try: - self.pet_api.upload_file(pet_id=self.pet.id, file=self.foo) - except ApiException as e: - self.fail("upload_file() raised {0} unexpectedly".format(type(e))) + def test_add_pet(self): + pass def test_delete_pet(self): - self.pet_api.add_pet(body=self.pet) - self.pet_api.delete_pet(pet_id=self.pet.id, api_key="special-key") + pass - try: - self.pet_api.get_pet_by_id(pet_id=self.pet.id) - raise "expected an error" - except ApiException as e: - self.assertEqual(404, e.status) + def test_find_pets_by_status(self): + pass + + def test_find_pets_by_tags(self): + pass + + def test_get_pet_by_id(self): + pass + + def test_update_pet(self): + pass + + def test_update_pet_with_form(self): + pass + + def test_upload_file(self): + pass -if __name__ == '__main__': - unittest.main() diff --git a/samples/client/petstore/python/tests/test_special_model_name.py b/samples/client/petstore/python/tests/test_special_model_name.py new file mode 100644 index 000000000000..1dd49228eada --- /dev/null +++ b/samples/client/petstore/python/tests/test_special_model_name.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.special_model_name import SpecialModelName + + +class SpecialModelNameTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test SpecialModelName + """ + def testSpecialModelName(self): + self.model = swagger_client.models.special_model_name.SpecialModelName() + diff --git a/samples/client/petstore/python/tests/test_store_api.py b/samples/client/petstore/python/tests/test_store_api.py index 42b92d0879c0..c22a3dc71345 100644 --- a/samples/client/petstore/python/tests/test_store_api.py +++ b/samples/client/petstore/python/tests/test_store_api.py @@ -1,30 +1,49 @@ # coding: utf-8 """ -Run the tests. -$ pip install nose (optional) -$ cd SwaggerPetstore-python -$ nosetests -v +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen """ +from __future__ import absolute_import + import os -import time +import sys import unittest import swagger_client -from swagger_client.rest import ApiException +from swagger_client.apis.store_api import StoreApi - -class StoreApiTests(unittest.TestCase): +class StoreApiTest(unittest.TestCase): def setUp(self): - self.store_api = swagger_client.StoreApi() + self.api = swagger_client.apis.store_api.StoreApi() def tearDown(self): - # sleep 1 sec between two every 2 tests - time.sleep(1) + pass + + def test_delete_order(self): + pass def test_get_inventory(self): - data = self.store_api.get_inventory() - self.assertIsNotNone(data) - self.assertTrue(isinstance(data, dict)) + pass + + def test_get_order_by_id(self): + pass + + def test_place_order(self): + pass + diff --git a/samples/client/petstore/python/tests/test_tag.py b/samples/client/petstore/python/tests/test_tag.py new file mode 100644 index 000000000000..e3b74cf0962e --- /dev/null +++ b/samples/client/petstore/python/tests/test_tag.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.tag import Tag + + +class TagTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test Tag + """ + def testTag(self): + self.model = swagger_client.models.tag.Tag() + diff --git a/samples/client/petstore/python/tests/test_user.py b/samples/client/petstore/python/tests/test_user.py new file mode 100644 index 000000000000..9fe3a9cb5ec0 --- /dev/null +++ b/samples/client/petstore/python/tests/test_user.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.models.user import User + + +class UserTest(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + """ + Test User + """ + def testUser(self): + self.model = swagger_client.models.user.User() + diff --git a/samples/client/petstore/python/tests/test_user_api.py b/samples/client/petstore/python/tests/test_user_api.py new file mode 100644 index 000000000000..1d8b2f1fbd25 --- /dev/null +++ b/samples/client/petstore/python/tests/test_user_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.apis.user_api import UserApi + +class UserApiTest(unittest.TestCase): + + def setUp(self): + self.api = swagger_client.apis.user_api.UserApi() + + def tearDown(self): + pass + + def test_create_user(self): + pass + + def test_create_users_with_array_input(self): + pass + + def test_create_users_with_list_input(self): + pass + + def test_delete_user(self): + pass + + def test_get_user_by_name(self): + pass + + def test_login_user(self): + pass + + def test_logout_user(self): + pass + + def test_update_user(self): + pass + From 066baf3c1675ff000a0ee2efc5433ec5276d52f7 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Wed, 27 Apr 2016 22:02:48 +0100 Subject: [PATCH 011/170] Update comments in generated unit test stubs --- .../main/resources/python/api_test.mustache | 15 +++++- .../main/resources/python/model_test.mustache | 15 ++++-- samples/client/petstore/python/README.md | 2 +- .../petstore/python/tests/test_animal.py | 15 ++++-- .../python/tests/test_api_response.py | 15 ++++-- .../client/petstore/python/tests/test_cat.py | 15 ++++-- .../petstore/python/tests/test_category.py | 15 ++++-- .../client/petstore/python/tests/test_dog.py | 15 ++++-- .../petstore/python/tests/test_fake_api.py | 13 ++++- .../petstore/python/tests/test_format_test.py | 15 ++++-- .../python/tests/test_model_200_response.py | 15 ++++-- .../python/tests/test_model_return.py | 15 ++++-- .../client/petstore/python/tests/test_name.py | 15 ++++-- .../petstore/python/tests/test_order.py | 15 ++++-- .../client/petstore/python/tests/test_pet.py | 15 ++++-- .../petstore/python/tests/test_pet_api.py | 48 ++++++++++++++++++- .../python/tests/test_special_model_name.py | 15 ++++-- .../petstore/python/tests/test_store_api.py | 28 ++++++++++- .../client/petstore/python/tests/test_tag.py | 15 ++++-- .../client/petstore/python/tests/test_user.py | 15 ++++-- .../petstore/python/tests/test_user_api.py | 48 ++++++++++++++++++- 21 files changed, 297 insertions(+), 82 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/api_test.mustache b/modules/swagger-codegen/src/main/resources/python/api_test.mustache index 78bd20624431..5f0b0ab6ecb1 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_test.mustache @@ -25,9 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.apis.{{classVarName}} import {{classname}} -class {{#operations}}{{classname}}Test(unittest.TestCase): + +class {{#operations}}Test{{classname}}(unittest.TestCase): + """ {{classname}} unit test stubs """ def setUp(self): self.api = swagger_client.apis.{{classVarName}}.{{classname}}() @@ -37,7 +40,15 @@ class {{#operations}}{{classname}}Test(unittest.TestCase): {{#operation}} def test_{{operationId}}(self): + """ + Test case for {{{operationId}}} + + {{{summary}}} + """ pass {{/operation}} -{{/operations}} \ No newline at end of file +{{/operations}} + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/python/model_test.mustache b/modules/swagger-codegen/src/main/resources/python/model_test.mustache index af4601de6964..c00a10a9b510 100644 --- a/modules/swagger-codegen/src/main/resources/python/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model_test.mustache @@ -27,10 +27,12 @@ import unittest {{#models}} {{#model}} import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.{{classFilename}} import {{classname}} -class {{classname}}Test(unittest.TestCase): +class Test{{classname}}(unittest.TestCase): + """ {{classname}} unit test stubs """ def setUp(self): pass @@ -38,11 +40,14 @@ class {{classname}}Test(unittest.TestCase): def tearDown(self): pass - """ - Test {{classname}} - """ def test{{classname}}(self): - self.model = swagger_client.models.{{classFilename}}.{{classname}}() + """ + Test {{classname}} + """ + model = swagger_client.models.{{classFilename}}.{{classname}}() {{/model}} {{/models}} + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index d29b88be8d5e..df5514aac39b 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-27T20:52:27.297+01:00 +- Build date: 2016-04-27T22:01:43.565+01:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/tests/test_animal.py b/samples/client/petstore/python/tests/test_animal.py index 337bbec0f1b0..279ed1850dd7 100644 --- a/samples/client/petstore/python/tests/test_animal.py +++ b/samples/client/petstore/python/tests/test_animal.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.animal import Animal -class AnimalTest(unittest.TestCase): +class TestAnimal(unittest.TestCase): + """ Animal unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class AnimalTest(unittest.TestCase): def tearDown(self): pass - """ - Test Animal - """ def testAnimal(self): - self.model = swagger_client.models.animal.Animal() + """ + Test Animal + """ + model = swagger_client.models.animal.Animal() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_api_response.py b/samples/client/petstore/python/tests/test_api_response.py index d81daae1e9a2..be73dbf373d2 100644 --- a/samples/client/petstore/python/tests/test_api_response.py +++ b/samples/client/petstore/python/tests/test_api_response.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.api_response import ApiResponse -class ApiResponseTest(unittest.TestCase): +class TestApiResponse(unittest.TestCase): + """ ApiResponse unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class ApiResponseTest(unittest.TestCase): def tearDown(self): pass - """ - Test ApiResponse - """ def testApiResponse(self): - self.model = swagger_client.models.api_response.ApiResponse() + """ + Test ApiResponse + """ + model = swagger_client.models.api_response.ApiResponse() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_cat.py b/samples/client/petstore/python/tests/test_cat.py index f72e4fd3209b..728a824fa5b1 100644 --- a/samples/client/petstore/python/tests/test_cat.py +++ b/samples/client/petstore/python/tests/test_cat.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.cat import Cat -class CatTest(unittest.TestCase): +class TestCat(unittest.TestCase): + """ Cat unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class CatTest(unittest.TestCase): def tearDown(self): pass - """ - Test Cat - """ def testCat(self): - self.model = swagger_client.models.cat.Cat() + """ + Test Cat + """ + model = swagger_client.models.cat.Cat() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_category.py b/samples/client/petstore/python/tests/test_category.py index 1f7b1bda4d6c..793fbdf41b05 100644 --- a/samples/client/petstore/python/tests/test_category.py +++ b/samples/client/petstore/python/tests/test_category.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.category import Category -class CategoryTest(unittest.TestCase): +class TestCategory(unittest.TestCase): + """ Category unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class CategoryTest(unittest.TestCase): def tearDown(self): pass - """ - Test Category - """ def testCategory(self): - self.model = swagger_client.models.category.Category() + """ + Test Category + """ + model = swagger_client.models.category.Category() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_dog.py b/samples/client/petstore/python/tests/test_dog.py index d2b5b38048bf..044dc5be51fc 100644 --- a/samples/client/petstore/python/tests/test_dog.py +++ b/samples/client/petstore/python/tests/test_dog.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.dog import Dog -class DogTest(unittest.TestCase): +class TestDog(unittest.TestCase): + """ Dog unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class DogTest(unittest.TestCase): def tearDown(self): pass - """ - Test Dog - """ def testDog(self): - self.model = swagger_client.models.dog.Dog() + """ + Test Dog + """ + model = swagger_client.models.dog.Dog() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_fake_api.py b/samples/client/petstore/python/tests/test_fake_api.py index a529e2c9b976..29b71bdf81a2 100644 --- a/samples/client/petstore/python/tests/test_fake_api.py +++ b/samples/client/petstore/python/tests/test_fake_api.py @@ -25,9 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.apis.fake_api import FakeApi -class FakeApiTest(unittest.TestCase): + +class TestFakeApi(unittest.TestCase): + """ FakeApi unit test stubs """ def setUp(self): self.api = swagger_client.apis.fake_api.FakeApi() @@ -36,5 +39,13 @@ class FakeApiTest(unittest.TestCase): pass def test_test_endpoint_parameters(self): + """ + Test case for test_endpoint_parameters + + Fake endpoint for testing various parameters + """ pass + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_format_test.py b/samples/client/petstore/python/tests/test_format_test.py index 07aeac49b9a7..11101ad52da3 100644 --- a/samples/client/petstore/python/tests/test_format_test.py +++ b/samples/client/petstore/python/tests/test_format_test.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.format_test import FormatTest -class FormatTestTest(unittest.TestCase): +class TestFormatTest(unittest.TestCase): + """ FormatTest unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class FormatTestTest(unittest.TestCase): def tearDown(self): pass - """ - Test FormatTest - """ def testFormatTest(self): - self.model = swagger_client.models.format_test.FormatTest() + """ + Test FormatTest + """ + model = swagger_client.models.format_test.FormatTest() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_model_200_response.py b/samples/client/petstore/python/tests/test_model_200_response.py index cdae133c22bf..8328d2b97578 100644 --- a/samples/client/petstore/python/tests/test_model_200_response.py +++ b/samples/client/petstore/python/tests/test_model_200_response.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.model_200_response import Model200Response -class Model200ResponseTest(unittest.TestCase): +class TestModel200Response(unittest.TestCase): + """ Model200Response unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class Model200ResponseTest(unittest.TestCase): def tearDown(self): pass - """ - Test Model200Response - """ def testModel200Response(self): - self.model = swagger_client.models.model_200_response.Model200Response() + """ + Test Model200Response + """ + model = swagger_client.models.model_200_response.Model200Response() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_model_return.py b/samples/client/petstore/python/tests/test_model_return.py index 60bda8fd99ed..4ff3f38b2eb5 100644 --- a/samples/client/petstore/python/tests/test_model_return.py +++ b/samples/client/petstore/python/tests/test_model_return.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.model_return import ModelReturn -class ModelReturnTest(unittest.TestCase): +class TestModelReturn(unittest.TestCase): + """ ModelReturn unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class ModelReturnTest(unittest.TestCase): def tearDown(self): pass - """ - Test ModelReturn - """ def testModelReturn(self): - self.model = swagger_client.models.model_return.ModelReturn() + """ + Test ModelReturn + """ + model = swagger_client.models.model_return.ModelReturn() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_name.py b/samples/client/petstore/python/tests/test_name.py index 2e409620e484..c3b27897eb1e 100644 --- a/samples/client/petstore/python/tests/test_name.py +++ b/samples/client/petstore/python/tests/test_name.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.name import Name -class NameTest(unittest.TestCase): +class TestName(unittest.TestCase): + """ Name unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class NameTest(unittest.TestCase): def tearDown(self): pass - """ - Test Name - """ def testName(self): - self.model = swagger_client.models.name.Name() + """ + Test Name + """ + model = swagger_client.models.name.Name() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_order.py b/samples/client/petstore/python/tests/test_order.py index 4a956567d1c5..23beefe346c6 100644 --- a/samples/client/petstore/python/tests/test_order.py +++ b/samples/client/petstore/python/tests/test_order.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.order import Order -class OrderTest(unittest.TestCase): +class TestOrder(unittest.TestCase): + """ Order unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class OrderTest(unittest.TestCase): def tearDown(self): pass - """ - Test Order - """ def testOrder(self): - self.model = swagger_client.models.order.Order() + """ + Test Order + """ + model = swagger_client.models.order.Order() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_pet.py b/samples/client/petstore/python/tests/test_pet.py index e44ce644c884..471b7b4f67c8 100644 --- a/samples/client/petstore/python/tests/test_pet.py +++ b/samples/client/petstore/python/tests/test_pet.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.pet import Pet -class PetTest(unittest.TestCase): +class TestPet(unittest.TestCase): + """ Pet unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class PetTest(unittest.TestCase): def tearDown(self): pass - """ - Test Pet - """ def testPet(self): - self.model = swagger_client.models.pet.Pet() + """ + Test Pet + """ + model = swagger_client.models.pet.Pet() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index e56fa6461ad1..81ee6c76e9c7 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -25,9 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.apis.pet_api import PetApi -class PetApiTest(unittest.TestCase): + +class TestPetApi(unittest.TestCase): + """ PetApi unit test stubs """ def setUp(self): self.api = swagger_client.apis.pet_api.PetApi() @@ -36,26 +39,69 @@ class PetApiTest(unittest.TestCase): pass def test_add_pet(self): + """ + Test case for add_pet + + Add a new pet to the store + """ pass def test_delete_pet(self): + """ + Test case for delete_pet + + Deletes a pet + """ pass def test_find_pets_by_status(self): + """ + Test case for find_pets_by_status + + Finds Pets by status + """ pass def test_find_pets_by_tags(self): + """ + Test case for find_pets_by_tags + + Finds Pets by tags + """ pass def test_get_pet_by_id(self): + """ + Test case for get_pet_by_id + + Find pet by ID + """ pass def test_update_pet(self): + """ + Test case for update_pet + + Update an existing pet + """ pass def test_update_pet_with_form(self): + """ + Test case for update_pet_with_form + + Updates a pet in the store with form data + """ pass def test_upload_file(self): + """ + Test case for upload_file + + uploads an image + """ pass + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_special_model_name.py b/samples/client/petstore/python/tests/test_special_model_name.py index 1dd49228eada..17c12655031e 100644 --- a/samples/client/petstore/python/tests/test_special_model_name.py +++ b/samples/client/petstore/python/tests/test_special_model_name.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.special_model_name import SpecialModelName -class SpecialModelNameTest(unittest.TestCase): +class TestSpecialModelName(unittest.TestCase): + """ SpecialModelName unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class SpecialModelNameTest(unittest.TestCase): def tearDown(self): pass - """ - Test SpecialModelName - """ def testSpecialModelName(self): - self.model = swagger_client.models.special_model_name.SpecialModelName() + """ + Test SpecialModelName + """ + model = swagger_client.models.special_model_name.SpecialModelName() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_store_api.py b/samples/client/petstore/python/tests/test_store_api.py index c22a3dc71345..e8dc0a64b1ca 100644 --- a/samples/client/petstore/python/tests/test_store_api.py +++ b/samples/client/petstore/python/tests/test_store_api.py @@ -25,9 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.apis.store_api import StoreApi -class StoreApiTest(unittest.TestCase): + +class TestStoreApi(unittest.TestCase): + """ StoreApi unit test stubs """ def setUp(self): self.api = swagger_client.apis.store_api.StoreApi() @@ -36,14 +39,37 @@ class StoreApiTest(unittest.TestCase): pass def test_delete_order(self): + """ + Test case for delete_order + + Delete purchase order by ID + """ pass def test_get_inventory(self): + """ + Test case for get_inventory + + Returns pet inventories by status + """ pass def test_get_order_by_id(self): + """ + Test case for get_order_by_id + + Find purchase order by ID + """ pass def test_place_order(self): + """ + Test case for place_order + + Place an order for a pet + """ pass + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_tag.py b/samples/client/petstore/python/tests/test_tag.py index e3b74cf0962e..35b51e4d7d2e 100644 --- a/samples/client/petstore/python/tests/test_tag.py +++ b/samples/client/petstore/python/tests/test_tag.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.tag import Tag -class TagTest(unittest.TestCase): +class TestTag(unittest.TestCase): + """ Tag unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class TagTest(unittest.TestCase): def tearDown(self): pass - """ - Test Tag - """ def testTag(self): - self.model = swagger_client.models.tag.Tag() + """ + Test Tag + """ + model = swagger_client.models.tag.Tag() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_user.py b/samples/client/petstore/python/tests/test_user.py index 9fe3a9cb5ec0..1aad154cbf8c 100644 --- a/samples/client/petstore/python/tests/test_user.py +++ b/samples/client/petstore/python/tests/test_user.py @@ -25,10 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.models.user import User -class UserTest(unittest.TestCase): +class TestUser(unittest.TestCase): + """ User unit test stubs """ def setUp(self): pass @@ -36,9 +38,12 @@ class UserTest(unittest.TestCase): def tearDown(self): pass - """ - Test User - """ def testUser(self): - self.model = swagger_client.models.user.User() + """ + Test User + """ + model = swagger_client.models.user.User() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_user_api.py b/samples/client/petstore/python/tests/test_user_api.py index 1d8b2f1fbd25..0205fe7383ab 100644 --- a/samples/client/petstore/python/tests/test_user_api.py +++ b/samples/client/petstore/python/tests/test_user_api.py @@ -25,9 +25,12 @@ import sys import unittest import swagger_client +from swagger_client.rest import ApiException from swagger_client.apis.user_api import UserApi -class UserApiTest(unittest.TestCase): + +class TestUserApi(unittest.TestCase): + """ UserApi unit test stubs """ def setUp(self): self.api = swagger_client.apis.user_api.UserApi() @@ -36,26 +39,69 @@ class UserApiTest(unittest.TestCase): pass def test_create_user(self): + """ + Test case for create_user + + Create user + """ pass def test_create_users_with_array_input(self): + """ + Test case for create_users_with_array_input + + Creates list of users with given input array + """ pass def test_create_users_with_list_input(self): + """ + Test case for create_users_with_list_input + + Creates list of users with given input array + """ pass def test_delete_user(self): + """ + Test case for delete_user + + Delete user + """ pass def test_get_user_by_name(self): + """ + Test case for get_user_by_name + + Get user by user name + """ pass def test_login_user(self): + """ + Test case for login_user + + Logs user into the system + """ pass def test_logout_user(self): + """ + Test case for logout_user + + Logs out current logged in user session + """ pass def test_update_user(self): + """ + Test case for update_user + + Updated user + """ pass + +if __name__ == '__main__': + unittest.main() \ No newline at end of file From 2f8a8c05e076b2fd63d34b2dcaaf3d9e146cebb0 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 27 Apr 2016 14:29:05 -0700 Subject: [PATCH 012/170] Issue #2725: added condition to import json based on return type --- .../io/swagger/codegen/languages/GoClientCodegen.java | 9 +++++++++ .../swagger-codegen/src/main/resources/go/api.mustache | 1 - samples/client/petstore/go/go-petstore/pet_api.go | 2 +- samples/client/petstore/go/go-petstore/store_api.go | 2 +- samples/client/petstore/go/go-petstore/user_api.go | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java index ef0ea2e51426..dc78508c89eb 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java @@ -375,6 +375,15 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { if (_import.startsWith(apiPackage())) iterator.remove(); } + // if the return type is not primitive, import encoding/json + for (CodegenOperation operation : operations) { + if(operation.returnBaseType != null && needToImport(operation.returnBaseType)) { + Map newImportMap2 = new HashMap(); + newImportMap2.put("import", "encoding/json"); + imports.add(newImportMap2); + break; //just need to import once + } + } // recursivly add import for mapping one type to multipe imports List> recursiveImports = (List>) objs.get("imports"); diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 6e540d3f8767..9b8998cf6146 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -4,7 +4,6 @@ package {{packageName}} import ( "strings" "fmt" - "encoding/json" "errors" {{#imports}} "{{import}}" {{/imports}} diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index 423e8a795a72..8bdc25596fea 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -3,10 +3,10 @@ package swagger import ( "strings" "fmt" - "encoding/json" "errors" "os" "io/ioutil" + "encoding/json" ) type PetApi struct { diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index a8b48f63b397..4a9bd1785220 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -3,8 +3,8 @@ package swagger import ( "strings" "fmt" - "encoding/json" "errors" + "encoding/json" ) type StoreApi struct { diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index 228c8d3f9bdc..405c7af99ae4 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -3,8 +3,8 @@ package swagger import ( "strings" "fmt" - "encoding/json" "errors" + "encoding/json" ) type UserApi struct { From 3540c44e715024f684ec5fb674a1882915ebdf01 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 27 Apr 2016 14:33:04 -0700 Subject: [PATCH 013/170] renamed variable --- .../java/io/swagger/codegen/languages/GoClientCodegen.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java index dc78508c89eb..fe25436c9019 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java @@ -378,9 +378,9 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { // if the return type is not primitive, import encoding/json for (CodegenOperation operation : operations) { if(operation.returnBaseType != null && needToImport(operation.returnBaseType)) { - Map newImportMap2 = new HashMap(); - newImportMap2.put("import", "encoding/json"); - imports.add(newImportMap2); + Map customImport = new HashMap(); + customImport.put("import", "encoding/json"); + imports.add(customImport); break; //just need to import once } } From 1674ec3799a9478231f5f7d5948e4f324e38b800 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Wed, 27 Apr 2016 22:53:22 +0100 Subject: [PATCH 014/170] Fix generated test directory name conflicting with sample test directory name --- .../languages/PythonClientCodegen.java | 2 +- samples/client/petstore/python/README.md | 2 +- .../swagger_client.egg-info/top_level.txt | 1 + .../client/petstore/python/test/__init__.py | 0 .../python/{tests => test}/test_animal.py | 0 .../{tests => test}/test_api_response.py | 0 .../python/{tests => test}/test_cat.py | 0 .../python/{tests => test}/test_category.py | 0 .../python/{tests => test}/test_dog.py | 0 .../python/{tests => test}/test_fake_api.py | 0 .../{tests => test}/test_format_test.py | 0 .../test_model_200_response.py | 0 .../{tests => test}/test_model_return.py | 0 .../python/{tests => test}/test_name.py | 0 .../python/{tests => test}/test_order.py | 0 .../python/{tests => test}/test_pet.py | 0 .../petstore/python/test/test_pet_api.py | 107 ++++++++++ .../test_special_model_name.py | 0 .../petstore/python/test/test_store_api.py | 75 +++++++ .../python/{tests => test}/test_tag.py | 0 .../python/{tests => test}/test_user.py | 0 .../python/{tests => test}/test_user_api.py | 0 .../petstore/python/tests/test_pet_api.py | 201 ++++++++++++------ .../petstore/python/tests/test_store_api.py | 69 ++---- 24 files changed, 328 insertions(+), 129 deletions(-) create mode 100644 samples/client/petstore/python/test/__init__.py rename samples/client/petstore/python/{tests => test}/test_animal.py (100%) rename samples/client/petstore/python/{tests => test}/test_api_response.py (100%) rename samples/client/petstore/python/{tests => test}/test_cat.py (100%) rename samples/client/petstore/python/{tests => test}/test_category.py (100%) rename samples/client/petstore/python/{tests => test}/test_dog.py (100%) rename samples/client/petstore/python/{tests => test}/test_fake_api.py (100%) rename samples/client/petstore/python/{tests => test}/test_format_test.py (100%) rename samples/client/petstore/python/{tests => test}/test_model_200_response.py (100%) rename samples/client/petstore/python/{tests => test}/test_model_return.py (100%) rename samples/client/petstore/python/{tests => test}/test_name.py (100%) rename samples/client/petstore/python/{tests => test}/test_order.py (100%) rename samples/client/petstore/python/{tests => test}/test_pet.py (100%) create mode 100644 samples/client/petstore/python/test/test_pet_api.py rename samples/client/petstore/python/{tests => test}/test_special_model_name.py (100%) create mode 100644 samples/client/petstore/python/test/test_store_api.py rename samples/client/petstore/python/{tests => test}/test_tag.py (100%) rename samples/client/petstore/python/{tests => test}/test_user.py (100%) rename samples/client/petstore/python/{tests => test}/test_user_api.py (100%) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index 08d63c426765..1bc95cfdd677 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -41,7 +41,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); - testFolder = "tests"; + testFolder = "test"; languageSpecificPrimitives.clear(); languageSpecificPrimitives.add("int"); diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index df5514aac39b..6640785fae99 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-27T22:01:43.565+01:00 +- Build date: 2016-04-27T22:50:21.115+01:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/swagger_client.egg-info/top_level.txt b/samples/client/petstore/python/swagger_client.egg-info/top_level.txt index 9a02a75c0585..01f6691e7caf 100644 --- a/samples/client/petstore/python/swagger_client.egg-info/top_level.txt +++ b/samples/client/petstore/python/swagger_client.egg-info/top_level.txt @@ -1,2 +1,3 @@ swagger_client +test tests diff --git a/samples/client/petstore/python/test/__init__.py b/samples/client/petstore/python/test/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/python/tests/test_animal.py b/samples/client/petstore/python/test/test_animal.py similarity index 100% rename from samples/client/petstore/python/tests/test_animal.py rename to samples/client/petstore/python/test/test_animal.py diff --git a/samples/client/petstore/python/tests/test_api_response.py b/samples/client/petstore/python/test/test_api_response.py similarity index 100% rename from samples/client/petstore/python/tests/test_api_response.py rename to samples/client/petstore/python/test/test_api_response.py diff --git a/samples/client/petstore/python/tests/test_cat.py b/samples/client/petstore/python/test/test_cat.py similarity index 100% rename from samples/client/petstore/python/tests/test_cat.py rename to samples/client/petstore/python/test/test_cat.py diff --git a/samples/client/petstore/python/tests/test_category.py b/samples/client/petstore/python/test/test_category.py similarity index 100% rename from samples/client/petstore/python/tests/test_category.py rename to samples/client/petstore/python/test/test_category.py diff --git a/samples/client/petstore/python/tests/test_dog.py b/samples/client/petstore/python/test/test_dog.py similarity index 100% rename from samples/client/petstore/python/tests/test_dog.py rename to samples/client/petstore/python/test/test_dog.py diff --git a/samples/client/petstore/python/tests/test_fake_api.py b/samples/client/petstore/python/test/test_fake_api.py similarity index 100% rename from samples/client/petstore/python/tests/test_fake_api.py rename to samples/client/petstore/python/test/test_fake_api.py diff --git a/samples/client/petstore/python/tests/test_format_test.py b/samples/client/petstore/python/test/test_format_test.py similarity index 100% rename from samples/client/petstore/python/tests/test_format_test.py rename to samples/client/petstore/python/test/test_format_test.py diff --git a/samples/client/petstore/python/tests/test_model_200_response.py b/samples/client/petstore/python/test/test_model_200_response.py similarity index 100% rename from samples/client/petstore/python/tests/test_model_200_response.py rename to samples/client/petstore/python/test/test_model_200_response.py diff --git a/samples/client/petstore/python/tests/test_model_return.py b/samples/client/petstore/python/test/test_model_return.py similarity index 100% rename from samples/client/petstore/python/tests/test_model_return.py rename to samples/client/petstore/python/test/test_model_return.py diff --git a/samples/client/petstore/python/tests/test_name.py b/samples/client/petstore/python/test/test_name.py similarity index 100% rename from samples/client/petstore/python/tests/test_name.py rename to samples/client/petstore/python/test/test_name.py diff --git a/samples/client/petstore/python/tests/test_order.py b/samples/client/petstore/python/test/test_order.py similarity index 100% rename from samples/client/petstore/python/tests/test_order.py rename to samples/client/petstore/python/test/test_order.py diff --git a/samples/client/petstore/python/tests/test_pet.py b/samples/client/petstore/python/test/test_pet.py similarity index 100% rename from samples/client/petstore/python/tests/test_pet.py rename to samples/client/petstore/python/test/test_pet.py diff --git a/samples/client/petstore/python/test/test_pet_api.py b/samples/client/petstore/python/test/test_pet_api.py new file mode 100644 index 000000000000..81ee6c76e9c7 --- /dev/null +++ b/samples/client/petstore/python/test/test_pet_api.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.pet_api import PetApi + + +class TestPetApi(unittest.TestCase): + """ PetApi unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.pet_api.PetApi() + + def tearDown(self): + pass + + def test_add_pet(self): + """ + Test case for add_pet + + Add a new pet to the store + """ + pass + + def test_delete_pet(self): + """ + Test case for delete_pet + + Deletes a pet + """ + pass + + def test_find_pets_by_status(self): + """ + Test case for find_pets_by_status + + Finds Pets by status + """ + pass + + def test_find_pets_by_tags(self): + """ + Test case for find_pets_by_tags + + Finds Pets by tags + """ + pass + + def test_get_pet_by_id(self): + """ + Test case for get_pet_by_id + + Find pet by ID + """ + pass + + def test_update_pet(self): + """ + Test case for update_pet + + Update an existing pet + """ + pass + + def test_update_pet_with_form(self): + """ + Test case for update_pet_with_form + + Updates a pet in the store with form data + """ + pass + + def test_upload_file(self): + """ + Test case for upload_file + + uploads an image + """ + pass + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_special_model_name.py b/samples/client/petstore/python/test/test_special_model_name.py similarity index 100% rename from samples/client/petstore/python/tests/test_special_model_name.py rename to samples/client/petstore/python/test/test_special_model_name.py diff --git a/samples/client/petstore/python/test/test_store_api.py b/samples/client/petstore/python/test/test_store_api.py new file mode 100644 index 000000000000..e8dc0a64b1ca --- /dev/null +++ b/samples/client/petstore/python/test/test_store_api.py @@ -0,0 +1,75 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.store_api import StoreApi + + +class TestStoreApi(unittest.TestCase): + """ StoreApi unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.store_api.StoreApi() + + def tearDown(self): + pass + + def test_delete_order(self): + """ + Test case for delete_order + + Delete purchase order by ID + """ + pass + + def test_get_inventory(self): + """ + Test case for get_inventory + + Returns pet inventories by status + """ + pass + + def test_get_order_by_id(self): + """ + Test case for get_order_by_id + + Find purchase order by ID + """ + pass + + def test_place_order(self): + """ + Test case for place_order + + Place an order for a pet + """ + pass + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_tag.py b/samples/client/petstore/python/test/test_tag.py similarity index 100% rename from samples/client/petstore/python/tests/test_tag.py rename to samples/client/petstore/python/test/test_tag.py diff --git a/samples/client/petstore/python/tests/test_user.py b/samples/client/petstore/python/test/test_user.py similarity index 100% rename from samples/client/petstore/python/tests/test_user.py rename to samples/client/petstore/python/test/test_user.py diff --git a/samples/client/petstore/python/tests/test_user_api.py b/samples/client/petstore/python/test/test_user_api.py similarity index 100% rename from samples/client/petstore/python/tests/test_user_api.py rename to samples/client/petstore/python/test/test_user_api.py diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 81ee6c76e9c7..300a7bee7833 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -1,107 +1,168 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ref: https://github.com/swagger-api/swagger-codegen +Run the tests. +$ pip install nose (optional) +$ cd swagger_client-python +$ nosetests -v """ -from __future__ import absolute_import - import os -import sys +import time import unittest import swagger_client from swagger_client.rest import ApiException -from swagger_client.apis.pet_api import PetApi + +HOST = 'http://petstore.swagger.io/v2' -class TestPetApi(unittest.TestCase): - """ PetApi unit test stubs """ +class PetApiTests(unittest.TestCase): def setUp(self): - self.api = swagger_client.apis.pet_api.PetApi() + self.api_client = swagger_client.ApiClient(HOST) + self.pet_api = swagger_client.PetApi(self.api_client) + self.setUpModels() + self.setUpFiles() def tearDown(self): - pass + # sleep 1 sec between two every 2 tests + time.sleep(1) - def test_add_pet(self): - """ - Test case for add_pet + def setUpModels(self): + self.category = swagger_client.Category() + self.category.id = int(time.time()) + self.category.name = "dog" + self.tag = swagger_client.Tag() + self.tag.id = int(time.time()) + self.tag.name = "swagger-codegen-python-pet-tag" + self.pet = swagger_client.Pet() + self.pet.id = int(time.time()) + self.pet.name = "hello kity" + self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"] + self.pet.status = "sold" + self.pet.category = self.category + self.pet.tags = [self.tag] - Add a new pet to the store - """ - pass + def setUpFiles(self): + self.test_file_dir = os.path.join(os.path.dirname(__file__), "..", "testfiles") + self.test_file_dir = os.path.realpath(self.test_file_dir) + self.foo = os.path.join(self.test_file_dir, "foo.png") - def test_delete_pet(self): - """ - Test case for delete_pet + def test_create_api_instance(self): + pet_api = swagger_client.PetApi() + pet_api2 = swagger_client.PetApi() + api_client3 = swagger_client.ApiClient() + api_client3.user_agent = 'api client 3' + api_client4 = swagger_client.ApiClient() + api_client4.user_agent = 'api client 4' + pet_api3 = swagger_client.PetApi(api_client3) - Deletes a pet - """ - pass + # same default api client + self.assertEqual(pet_api.api_client, pet_api2.api_client) + # confirm using the default api client in the config module + self.assertEqual(pet_api.api_client, swagger_client.configuration.api_client) + # 2 different api clients are not the same + self.assertNotEqual(api_client3, api_client4) + # customized pet api not using the default api client + self.assertNotEqual(pet_api3.api_client, swagger_client.configuration.api_client) + # customized pet api not using the old pet api's api client + self.assertNotEqual(pet_api3.api_client, pet_api2.api_client) - def test_find_pets_by_status(self): - """ - Test case for find_pets_by_status + def test_async_request(self): + self.pet_api.add_pet(body=self.pet) - Finds Pets by status - """ - pass + def callback_function(data): + self.assertIsNotNone(data) + self.assertEqual(data.id, self.pet.id) + self.assertEqual(data.name, self.pet.name) + self.assertIsNotNone(data.category) + self.assertEqual(data.category.id, self.pet.category.id) + self.assertEqual(data.category.name, self.pet.category.name) + self.assertTrue(isinstance(data.tags, list)) + self.assertEqual(data.tags[0].id, self.pet.tags[0].id) + self.assertEqual(data.tags[0].name, self.pet.tags[0].name) - def test_find_pets_by_tags(self): - """ - Test case for find_pets_by_tags + thread = self.pet_api.get_pet_by_id(pet_id=self.pet.id, callback=callback_function) + thread.join(10) + if thread.isAlive(): + self.fail("Request timeout") - Finds Pets by tags - """ - pass + def test_add_pet_and_get_pet_by_id(self): + self.pet_api.add_pet(body=self.pet) - def test_get_pet_by_id(self): - """ - Test case for get_pet_by_id - - Find pet by ID - """ - pass + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertIsNotNone(fetched) + self.assertEqual(self.pet.id, fetched.id) + self.assertIsNotNone(fetched.category) + self.assertEqual(self.pet.category.name, fetched.category.name) def test_update_pet(self): - """ - Test case for update_pet + self.pet.name = "hello kity with updated" + self.pet_api.update_pet(body=self.pet) - Update an existing pet - """ - pass + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertIsNotNone(fetched) + self.assertEqual(self.pet.id, fetched.id) + self.assertEqual(self.pet.name, fetched.name) + self.assertIsNotNone(fetched.category) + self.assertEqual(fetched.category.name, self.pet.category.name) + + def test_find_pets_by_status(self): + self.pet_api.add_pet(body=self.pet) + + self.assertIn( + self.pet.id, + list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_status(status=[self.pet.status]))) + ) + + def test_find_pets_by_tags(self): + self.pet_api.add_pet(body=self.pet) + + self.assertIn( + self.pet.id, + list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_tags(tags=[self.tag.name]))) + ) def test_update_pet_with_form(self): - """ - Test case for update_pet_with_form + self.pet_api.add_pet(body=self.pet) - Updates a pet in the store with form data - """ - pass + name = "hello kity with form updated" + status = "pending" + self.pet_api.update_pet_with_form(pet_id=self.pet.id, name=name, status=status) + + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertEqual(self.pet.id, fetched.id) + self.assertEqual(name, fetched.name) + self.assertEqual(status, fetched.status) def test_upload_file(self): - """ - Test case for upload_file + # upload file with form parameter + try: + additional_metadata = "special" + self.pet_api.upload_file( + pet_id=self.pet.id, + additional_metadata=additional_metadata, + file=self.foo + ) + except ApiException as e: + self.fail("upload_file() raised {0} unexpectedly".format(type(e))) - uploads an image - """ - pass + # upload only file + try: + self.pet_api.upload_file(pet_id=self.pet.id, file=self.foo) + except ApiException as e: + self.fail("upload_file() raised {0} unexpectedly".format(type(e))) + def test_delete_pet(self): + self.pet_api.add_pet(body=self.pet) + self.pet_api.delete_pet(pet_id=self.pet.id, api_key="special-key") + + try: + self.pet_api.get_pet_by_id(pet_id=self.pet.id) + raise "expected an error" + except ApiException as e: + self.assertEqual(404, e.status) if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/tests/test_store_api.py b/samples/client/petstore/python/tests/test_store_api.py index e8dc0a64b1ca..42b92d0879c0 100644 --- a/samples/client/petstore/python/tests/test_store_api.py +++ b/samples/client/petstore/python/tests/test_store_api.py @@ -1,75 +1,30 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ref: https://github.com/swagger-api/swagger-codegen +Run the tests. +$ pip install nose (optional) +$ cd SwaggerPetstore-python +$ nosetests -v """ -from __future__ import absolute_import - import os -import sys +import time import unittest import swagger_client from swagger_client.rest import ApiException -from swagger_client.apis.store_api import StoreApi -class TestStoreApi(unittest.TestCase): - """ StoreApi unit test stubs """ +class StoreApiTests(unittest.TestCase): def setUp(self): - self.api = swagger_client.apis.store_api.StoreApi() + self.store_api = swagger_client.StoreApi() def tearDown(self): - pass - - def test_delete_order(self): - """ - Test case for delete_order - - Delete purchase order by ID - """ - pass + # sleep 1 sec between two every 2 tests + time.sleep(1) def test_get_inventory(self): - """ - Test case for get_inventory - - Returns pet inventories by status - """ - pass - - def test_get_order_by_id(self): - """ - Test case for get_order_by_id - - Find purchase order by ID - """ - pass - - def test_place_order(self): - """ - Test case for place_order - - Place an order for a pet - """ - pass - - -if __name__ == '__main__': - unittest.main() \ No newline at end of file + data = self.store_api.get_inventory() + self.assertIsNotNone(data) + self.assertTrue(isinstance(data, dict)) From fbde7f88eea846f4fdc69df9fb7394f5e88bd1e2 Mon Sep 17 00:00:00 2001 From: abcsun Date: Thu, 28 Apr 2016 10:39:54 +0800 Subject: [PATCH 015/170] add parameter validation in methord call --- .../src/main/resources/php/api.mustache | 61 +++- .../petstore/php/SwaggerClient-php/README.md | 25 +- .../php/SwaggerClient-php/docs/FakeApi.md | 75 +++++ .../php/SwaggerClient-php/lib/Api/FakeApi.php | 308 ++++++++++++++++++ .../php/SwaggerClient-php/lib/Api/PetApi.php | 32 +- .../SwaggerClient-php/lib/Api/StoreApi.php | 26 +- .../php/SwaggerClient-php/lib/Api/UserApi.php | 33 +- .../lib/Tests/FakeApiTest.php | 76 +++++ .../lib/Tests/FormatTestTest.php | 70 ++++ 9 files changed, 658 insertions(+), 48 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/FormatTestTest.php diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 2692ba66f94f..c31eff8bc4a8 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -122,7 +122,36 @@ use \{{invokerPackage}}\ObjectSerializer; // verify the required parameter '{{paramName}}' is set if (${{paramName}} === null) { throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{operationId}}'); - }{{/required}}{{/allParams}} + } + {{#hasValidation}} + {{#maxLength}} + if (strlen(${{paramName}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if (strlen(${{paramName}}) > {{minLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if (${{paramName}} > {{maximum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if (${{paramName}} < {{minimum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", ${{paramName}})) { + throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); + } + {{/pattern}} + + {{/hasValidation}} + {{/required}}{{/allParams}} // parse inputs $resourcePath = "{{path}}"; @@ -172,6 +201,33 @@ use \{{invokerPackage}}\ObjectSerializer; {{#formParams}}// form params if (${{paramName}} !== null) { + {{#hasValidation}} + {{#maxLength}} + if (strlen(${{paramName}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if (strlen(${{paramName}}) > {{minLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if (${{paramName}} > {{maximum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if (${{paramName}} < {{minimum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", ${{paramName}})) { + throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); + } + {{/pattern}} + {{/hasValidation}} {{#isFile}} // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax // See: https://wiki.php.net/rfc/curl-file-upload @@ -184,7 +240,8 @@ use \{{invokerPackage}}\ObjectSerializer; {{^isFile}} $formParams['{{baseName}}'] = $this->apiClient->getSerializer()->toFormValue(${{paramName}}); {{/isFile}} - }{{/formParams}} + } + {{/formParams}} {{#bodyParams}}// body params $_tempBody = null; if (isset(${{paramName}})) { diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 80e8d1bae7a9..aa6ce69b760a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-23T22:48:00.795+08:00 +- Build date: 2016-04-28T02:26:28.980Z - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -58,16 +58,24 @@ 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 +$api_instance = new Swagger\Client\Api\FakeApi(); +$number = "number_example"; // string | None +$double = 1.2; // double | None +$string = "string_example"; // string | None +$byte = "B"; // string | None +$integer = 56; // int | None +$int32 = 56; // int | None +$int64 = 789; // int | None +$float = 3.4; // float | None +$binary = "B"; // string | None +$date = new \DateTime(); // \DateTime | None +$date_time = new \DateTime(); // \DateTime | None +$password = "password_example"; // string | None try { - $api_instance->addPet($body); + $api_instance->testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); } catch (Exception $e) { - echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), "\n"; + echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), "\n"; } ?> @@ -79,6 +87,7 @@ 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* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md new file mode 100644 index 000000000000..bc47365c9e0d --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md @@ -0,0 +1,75 @@ +# Swagger\Client\FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters + + +# **testEndpointParameters** +> testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```php +testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), "\n"; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **string**| None | + **double** | **double**| None | + **string** | **string**| None | + **byte** | **string**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **binary** | **string**| None | [optional] + **date** | **\DateTime**| None | [optional] + **date_time** | **\DateTime**| None | [optional] + **password** | **string**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php new file mode 100644 index 000000000000..f6f2e73950a2 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -0,0 +1,308 @@ +getConfig()->setHost('http://petstore.swagger.io/v2'); + } + + $this->apiClient = $apiClient; + } + + /** + * Get API client + * @return \Swagger\Client\ApiClient get the API client + */ + public function getApiClient() + { + return $this->apiClient; + } + + /** + * Set the API client + * @param \Swagger\Client\ApiClient $apiClient set the API client + * @return FakeApi + */ + public function setApiClient(ApiClient $apiClient) + { + $this->apiClient = $apiClient; + return $this; + } + + /** + * testEndpointParameters + * + * Fake endpoint for testing various parameters + * + * @param string $number None (required) + * @param double $double None (required) + * @param string $string None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function testEndpointParameters($number, $double, $string, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $binary = null, $date = null, $date_time = null, $password = null) + { + list($response) = $this->testEndpointParametersWithHttpInfo ($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); + return $response; + } + + + /** + * testEndpointParametersWithHttpInfo + * + * Fake endpoint for testing various parameters + * + * @param string $number None (required) + * @param double $double None (required) + * @param string $string None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @return Array of null, HTTP status code, HTTP response headers (array of strings) + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function testEndpointParametersWithHttpInfo($number, $double, $string, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $binary = null, $date = null, $date_time = null, $password = null) + { + + // verify the required parameter 'number' is set + if ($number === null) { + throw new \InvalidArgumentException('Missing the required parameter $number when calling testEndpointParameters'); + } + if ($number > 543.2) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.'); + } + if ($number < 32.1) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); + } + + + // verify the required parameter 'double' is set + if ($double === null) { + throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters'); + } + if ($double > 123.4) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.'); + } + if ($double < 67.8) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); + } + + + // verify the required parameter 'string' is set + if ($string === null) { + throw new \InvalidArgumentException('Missing the required parameter $string when calling testEndpointParameters'); + } + if (!preg_match("/[a-z]/i", $string)) { + throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.'); + } + + + // verify the required parameter 'byte' is set + if ($byte === null) { + throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters'); + } + + + // parse inputs + $resourcePath = "/fake"; + $httpBody = ''; + $queryParams = array(); + $headerParams = array(); + $formParams = array(); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + + + + + // default format to json + $resourcePath = str_replace("{format}", "json", $resourcePath); + + // form params + if ($integer !== null) { + if ($integer > 100.0) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.'); + } + if ($integer < 10.0) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.'); + } + $formParams['integer'] = $this->apiClient->getSerializer()->toFormValue($integer); + } +// form params + if ($int32 !== null) { + if ($int32 > 200.0) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.'); + } + if ($int32 < 20.0) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.'); + } + $formParams['int32'] = $this->apiClient->getSerializer()->toFormValue($int32); + } +// form params + if ($int64 !== null) { + $formParams['int64'] = $this->apiClient->getSerializer()->toFormValue($int64); + } +// form params + if ($number !== null) { + if ($number > 543.2) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.'); + } + if ($number < 32.1) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); + } + $formParams['number'] = $this->apiClient->getSerializer()->toFormValue($number); + } +// form params + if ($float !== null) { + if ($float > 987.6) { + throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); + } + $formParams['float'] = $this->apiClient->getSerializer()->toFormValue($float); + } +// form params + if ($double !== null) { + if ($double > 123.4) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.'); + } + if ($double < 67.8) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); + } + $formParams['double'] = $this->apiClient->getSerializer()->toFormValue($double); + } +// form params + if ($string !== null) { + if (!preg_match("/[a-z]/i", $string)) { + throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.'); + } + $formParams['string'] = $this->apiClient->getSerializer()->toFormValue($string); + } +// form params + if ($byte !== null) { + $formParams['byte'] = $this->apiClient->getSerializer()->toFormValue($byte); + } +// form params + if ($binary !== null) { + $formParams['binary'] = $this->apiClient->getSerializer()->toFormValue($binary); + } +// form params + if ($date !== null) { + $formParams['date'] = $this->apiClient->getSerializer()->toFormValue($date); + } +// form params + if ($date_time !== null) { + $formParams['dateTime'] = $this->apiClient->getSerializer()->toFormValue($date_time); + } +// form params + if ($password !== null) { + if (strlen($password) > 64) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); + } + if (strlen($password) > 10) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); + } + $formParams['password'] = $this->apiClient->getSerializer()->toFormValue($password); + } + + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, 'POST', + $queryParams, $httpBody, + $headerParams + ); + + return array(null, $statusCode, $httpHeader); + } catch (ApiException $e) { + switch ($e->getCode()) { + } + + throw $e; + } + } +} 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 1154b72929c7..fff4e6be41a7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -122,6 +122,7 @@ class PetApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling addPet'); } + // parse inputs $resourcePath = "/pet"; @@ -141,8 +142,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -209,6 +209,7 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling deletePet'); } + // parse inputs $resourcePath = "/pet/{petId}"; @@ -238,8 +239,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -300,6 +300,7 @@ class PetApi if ($status === null) { throw new \InvalidArgumentException('Missing the required parameter $status when calling findPetsByStatus'); } + // parse inputs $resourcePath = "/pet/findByStatus"; @@ -325,8 +326,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -394,6 +394,7 @@ class PetApi if ($tags === null) { throw new \InvalidArgumentException('Missing the required parameter $tags when calling findPetsByTags'); } + // parse inputs $resourcePath = "/pet/findByTags"; @@ -419,8 +420,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -488,6 +488,7 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetById'); } + // parse inputs $resourcePath = "/pet/{petId}"; @@ -514,8 +515,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -585,6 +585,7 @@ class PetApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling updatePet'); } + // parse inputs $resourcePath = "/pet"; @@ -604,8 +605,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -674,6 +674,7 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling updatePetWithForm'); } + // parse inputs $resourcePath = "/pet/{petId}"; @@ -703,7 +704,8 @@ class PetApi // form params if ($name !== null) { $formParams['name'] = $this->apiClient->getSerializer()->toFormValue($name); - }// form params + } +// form params if ($status !== null) { $formParams['status'] = $this->apiClient->getSerializer()->toFormValue($status); } @@ -772,6 +774,7 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling uploadFile'); } + // parse inputs $resourcePath = "/pet/{petId}/uploadImage"; @@ -801,7 +804,8 @@ class PetApi // form params if ($additional_metadata !== null) { $formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata); - }// form params + } +// form params if ($file !== null) { // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax // See: https://wiki.php.net/rfc/curl-file-upload 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 e5bf83b4463d..77d5b9ecba13 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -122,6 +122,11 @@ class StoreApi if ($order_id === null) { throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deleteOrder'); } + if ($order_id < 1.0) { + throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.deleteOrder, must be bigger than or equal to 1.0.'); + } + + // parse inputs $resourcePath = "/store/order/{orderId}"; @@ -148,8 +153,7 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -218,8 +222,7 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -289,6 +292,14 @@ class StoreApi if ($order_id === null) { throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderById'); } + if ($order_id > 5.0) { + throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be smaller than or equal to 5.0.'); + } + if ($order_id < 1.0) { + throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.0.'); + } + + // parse inputs $resourcePath = "/store/order/{orderId}"; @@ -315,8 +326,7 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -379,6 +389,7 @@ class StoreApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling placeOrder'); } + // parse inputs $resourcePath = "/store/order"; @@ -398,8 +409,7 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; 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 4882ccd97640..7376d58e8fea 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -122,6 +122,7 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUser'); } + // parse inputs $resourcePath = "/user"; @@ -141,8 +142,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -202,6 +202,7 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithArrayInput'); } + // parse inputs $resourcePath = "/user/createWithArray"; @@ -221,8 +222,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -282,6 +282,7 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithListInput'); } + // parse inputs $resourcePath = "/user/createWithList"; @@ -301,8 +302,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -362,6 +362,7 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling deleteUser'); } + // parse inputs $resourcePath = "/user/{username}"; @@ -388,8 +389,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -445,6 +445,7 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling getUserByName'); } + // parse inputs $resourcePath = "/user/{username}"; @@ -471,8 +472,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -537,10 +537,12 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling loginUser'); } + // verify the required parameter 'password' is set if ($password === null) { throw new \InvalidArgumentException('Missing the required parameter $password when calling loginUser'); } + // parse inputs $resourcePath = "/user/login"; @@ -566,8 +568,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -643,8 +644,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -702,10 +702,12 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling updateUser'); } + // verify the required parameter 'body' is set if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling updateUser'); } + // parse inputs $resourcePath = "/user/{username}"; @@ -732,8 +734,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php new file mode 100644 index 000000000000..47b8fa21b68b --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php @@ -0,0 +1,76 @@ + Date: Wed, 27 Apr 2016 22:43:08 -0700 Subject: [PATCH 016/170] added packageName in the codegen option --- bin/go-petstore.sh | 2 +- samples/client/petstore/go/go-petstore/README.md | 6 +++--- samples/client/petstore/go/go-petstore/api_client.go | 2 +- samples/client/petstore/go/go-petstore/api_response.go | 2 +- samples/client/petstore/go/go-petstore/category.go | 2 +- samples/client/petstore/go/go-petstore/configuration.go | 2 +- .../client/petstore/go/go-petstore/model_api_response.go | 2 +- samples/client/petstore/go/go-petstore/order.go | 2 +- samples/client/petstore/go/go-petstore/pet.go | 2 +- samples/client/petstore/go/go-petstore/pet_api.go | 2 +- samples/client/petstore/go/go-petstore/pom.xml | 4 ++-- samples/client/petstore/go/go-petstore/store_api.go | 2 +- samples/client/petstore/go/go-petstore/tag.go | 2 +- samples/client/petstore/go/go-petstore/user.go | 2 +- samples/client/petstore/go/go-petstore/user_api.go | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bin/go-petstore.sh b/bin/go-petstore.sh index 35c5c0e60642..eea1aaaf6f3d 100755 --- a/bin/go-petstore.sh +++ b/bin/go-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/go -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go -o samples/client/petstore/go/go-petstore" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/go -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go -o samples/client/petstore/go/go-petstore -DpackageName=petstore " java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index 910888030a11..92a8f1b86852 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -1,4 +1,4 @@ -# Go API client for swagger +# Go API client for petstore This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. @@ -7,13 +7,13 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-23T17:00:49.475-07:00 +- Build date: 2016-04-27T21:14:49.805-07:00 - Build package: class io.swagger.codegen.languages.GoClientCodegen ## Installation Put the package under your project folder and add the following in import: ``` - "./swagger" + "./petstore" ``` ## Documentation for API Endpoints diff --git a/samples/client/petstore/go/go-petstore/api_client.go b/samples/client/petstore/go/go-petstore/api_client.go index d4b53512c68c..743b45a139da 100644 --- a/samples/client/petstore/go/go-petstore/api_client.go +++ b/samples/client/petstore/go/go-petstore/api_client.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( "strings" diff --git a/samples/client/petstore/go/go-petstore/api_response.go b/samples/client/petstore/go/go-petstore/api_response.go index 2a34a8cf35ac..b670ad101a8b 100644 --- a/samples/client/petstore/go/go-petstore/api_response.go +++ b/samples/client/petstore/go/go-petstore/api_response.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( "net/http" diff --git a/samples/client/petstore/go/go-petstore/category.go b/samples/client/petstore/go/go-petstore/category.go index 1853dfe7239f..eb7157219783 100644 --- a/samples/client/petstore/go/go-petstore/category.go +++ b/samples/client/petstore/go/go-petstore/category.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( ) diff --git a/samples/client/petstore/go/go-petstore/configuration.go b/samples/client/petstore/go/go-petstore/configuration.go index 2a1b4096399b..51aad379b42a 100644 --- a/samples/client/petstore/go/go-petstore/configuration.go +++ b/samples/client/petstore/go/go-petstore/configuration.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( "encoding/base64" diff --git a/samples/client/petstore/go/go-petstore/model_api_response.go b/samples/client/petstore/go/go-petstore/model_api_response.go index 0905f55cf011..8183399abd9f 100644 --- a/samples/client/petstore/go/go-petstore/model_api_response.go +++ b/samples/client/petstore/go/go-petstore/model_api_response.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( ) diff --git a/samples/client/petstore/go/go-petstore/order.go b/samples/client/petstore/go/go-petstore/order.go index a199bcc857df..29b6cffeba06 100644 --- a/samples/client/petstore/go/go-petstore/order.go +++ b/samples/client/petstore/go/go-petstore/order.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( "time" diff --git a/samples/client/petstore/go/go-petstore/pet.go b/samples/client/petstore/go/go-petstore/pet.go index 32b9e6d97fc0..99016d2d5401 100644 --- a/samples/client/petstore/go/go-petstore/pet.go +++ b/samples/client/petstore/go/go-petstore/pet.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( ) diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index 423e8a795a72..e71d41bddb16 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( "strings" diff --git a/samples/client/petstore/go/go-petstore/pom.xml b/samples/client/petstore/go/go-petstore/pom.xml index 50bfe7f14f87..7680ed95cff4 100644 --- a/samples/client/petstore/go/go-petstore/pom.xml +++ b/samples/client/petstore/go/go-petstore/pom.xml @@ -1,10 +1,10 @@ 4.0.0 com.wordnik - Goswagger + Gopetstore pom 1.0.0 - Goswagger + Gopetstore diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index a8b48f63b397..5dcce0bdd0ad 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( "strings" diff --git a/samples/client/petstore/go/go-petstore/tag.go b/samples/client/petstore/go/go-petstore/tag.go index 7347106078a6..71bb9d198a40 100644 --- a/samples/client/petstore/go/go-petstore/tag.go +++ b/samples/client/petstore/go/go-petstore/tag.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( ) diff --git a/samples/client/petstore/go/go-petstore/user.go b/samples/client/petstore/go/go-petstore/user.go index 8f459db46748..91a42e57a0ed 100644 --- a/samples/client/petstore/go/go-petstore/user.go +++ b/samples/client/petstore/go/go-petstore/user.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( ) diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index 228c8d3f9bdc..6ebff7748063 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -1,4 +1,4 @@ -package swagger +package petstore import ( "strings" From 0de7b490462eecfd5118bb062ec6c5fb2247891f Mon Sep 17 00:00:00 2001 From: diyfr Date: Thu, 28 Apr 2016 08:12:21 +0200 Subject: [PATCH 017/170] Update jetty-version --- .../src/main/resources/JavaSpringMVC/pom.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache index 387aa0729aa3..e5ccab21783f 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache @@ -119,7 +119,7 @@ 1.5.8 - 9.2.9.v20150224 + 9.2.15.v20160210 1.13 1.7.21 4.12 From 2d0a5210db0985383c62ad9384f035645fb4124a Mon Sep 17 00:00:00 2001 From: diyfr Date: Thu, 28 Apr 2016 10:17:44 +0200 Subject: [PATCH 018/170] Create Windows Script for Pet Sample with springMVC --- bin/windows/spring-mvc-petstore-server.bat | 10 ++++ samples/server/petstore/spring-mvc/pom.xml | 16 +++--- .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 49 ++++++++++--------- .../main/java/io/swagger/api/StoreApi.java | 14 +++--- .../src/main/java/io/swagger/api/UserApi.java | 30 ++++++------ .../swagger/configuration/SwaggerConfig.java | 23 ++++----- .../configuration/SwaggerUiConfiguration.java | 2 +- .../swagger/configuration/WebApplication.java | 2 +- .../configuration/WebMvcConfiguration.java | 2 +- .../main/java/io/swagger/model/Category.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 4 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 18 files changed, 91 insertions(+), 77 deletions(-) create mode 100644 bin/windows/spring-mvc-petstore-server.bat diff --git a/bin/windows/spring-mvc-petstore-server.bat b/bin/windows/spring-mvc-petstore-server.bat new file mode 100644 index 000000000000..f4ab64d5bd89 --- /dev/null +++ b/bin/windows/spring-mvc-petstore-server.bat @@ -0,0 +1,10 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate -t modules\swagger-codegen\src\main\resources\JavaSpringMVC -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l spring-mvc -o samples\server\petstore\spring-mvc + +java %JAVA_OPTS% -jar %executable% %ags% \ No newline at end of file diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index 861cd47a031b..225d4bb62779 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -11,7 +11,7 @@ org.apache.maven.plugins maven-war-plugin - 2.1.1 + 2.6 maven-failsafe-plugin @@ -119,12 +119,12 @@ 1.5.8 - 9.2.9.v20150224 + 9.2.15.v20160210 1.13 - 1.6.3 - 4.8.1 - 2.5 - 2.3.1 - 4.1.8.RELEASE + 1.7.21 + 4.12 + 3.0 + 2.4.0 + 4.2.5.RELEASE - \ No newline at end of file + diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java index cdd9e9040987..00a3b4f9f753 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java index 1b6e847cc103..c14a1105e632 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java index 52c47326b306..7d86418ffe3e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java index a5bb52fc58b8..66d118d065dc 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index 3e79c0042371..07c6e4e79532 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -4,7 +4,6 @@ import io.swagger.model.*; import io.swagger.model.Pet; import java.io.File; -import io.swagger.model.ModelApiResponse; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -32,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @@ -44,12 +43,12 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) public ResponseEntity addPet( -@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body ) throws NotFoundException { // do some magic! @@ -66,7 +65,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) public ResponseEntity deletePet( @@ -83,7 +82,7 @@ public class PetApi { } - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -93,10 +92,10 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) @RequestMapping(value = "/findByStatus", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status + public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status ) @@ -106,7 +105,7 @@ public class PetApi { } - @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -116,10 +115,10 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) @RequestMapping(value = "/findByTags", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags + public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags ) @@ -129,7 +128,11 @@ public class PetApi { } - @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }), @Authorization(value = "api_key") }) @io.swagger.annotations.ApiResponses(value = { @@ -137,11 +140,11 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) public ResponseEntity getPetById( -@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId ) throws NotFoundException { @@ -161,12 +164,12 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) public ResponseEntity updatePet( -@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body ) throws NotFoundException { // do some magic! @@ -183,11 +186,11 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) public ResponseEntity updatePetWithForm( -@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId +@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId , @@ -206,19 +209,19 @@ public class PetApi { } - @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { + @ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/{petId}/uploadImage", - produces = { "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - public ResponseEntity uploadFile( + public ResponseEntity uploadFile( @ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId , @@ -233,7 +236,7 @@ public class PetApi { ) throws NotFoundException { // do some magic! - return new ResponseEntity(HttpStatus.OK); + return new ResponseEntity(HttpStatus.OK); } } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index b9b4dc22e47f..57f956274b95 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @@ -39,7 +39,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) public ResponseEntity deleteOrder( @@ -58,7 +58,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) @RequestMapping(value = "/inventory", - produces = { "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) public ResponseEntity> getInventory() @@ -74,11 +74,11 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) public ResponseEntity getOrderById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId ) throws NotFoundException { @@ -92,12 +92,12 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) @RequestMapping(value = "/order", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) public ResponseEntity placeOrder( -@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body +@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index 777724026c7d..407896123c1c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -31,19 +31,19 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) public ResponseEntity createUser( -@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body +@ApiParam(value = "Created user object" ) @RequestBody User body ) throws NotFoundException { // do some magic! @@ -55,12 +55,12 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/createWithArray", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) public ResponseEntity createUsersWithArrayInput( -@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body +@ApiParam(value = "List of user object" ) @RequestBody List body ) throws NotFoundException { // do some magic! @@ -72,12 +72,12 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/createWithList", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) public ResponseEntity createUsersWithListInput( -@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body +@ApiParam(value = "List of user object" ) @RequestBody List body ) throws NotFoundException { // do some magic! @@ -90,7 +90,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) public ResponseEntity deleteUser( @@ -109,7 +109,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) public ResponseEntity getUserByName( @@ -127,14 +127,14 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) @RequestMapping(value = "/login", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username + public ResponseEntity loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username , - @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password + @ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password ) @@ -148,7 +148,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/logout", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) public ResponseEntity logoutUser() @@ -163,7 +163,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.PUT) public ResponseEntity updateUser( @@ -172,7 +172,7 @@ public class UserApi { , -@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body +@ApiParam(value = "Updated user object" ) @RequestBody User body ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java index 0f81ad7d00f7..a95b58dd8e62 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -7,6 +7,7 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @@ -18,19 +19,19 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { - ApiInfo apiInfo = new ApiInfo( - "Swagger Petstore", - "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", - "1.0.0", - "", - "apiteam@swagger.io", - "Apache 2.0", - "http://www.apache.org/licenses/LICENSE-2.0.html" ); - return apiInfo; + return new ApiInfoBuilder() + .title("Swagger Petstore") + .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") + .license("Apache 2.0") + .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") + .termsOfServiceUrl("") + .version("1.0.0") + .contact(new Contact("","", "apiteam@wordnik.com")) + .build(); } @Bean @@ -38,4 +39,4 @@ public class SwaggerConfig { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()); } -} \ No newline at end of file +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index b228de3b07c9..163662404043 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java index a505241d556d..d0ec9a2b41cf 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index e1ba8c520a80..eb9046d4d986 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index f3e03a8c88f7..d0ecc814abb2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index ed04a25a4a97..433d9801732d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class Order { private Long id = null; @@ -25,7 +25,7 @@ public class Order { }; private StatusEnum status = null; - private Boolean complete = false; + private Boolean complete = null; /** **/ diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index b725b22c44dd..e997fd6a266d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index 97e11f1f5ab1..94b69d061666 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 88615e98517b..79a6628e5ddb 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-22T17:54:58.453+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") public class User { private Long id = null; From 31f5675e72d02c07aaee91fd5cdb594670f074c7 Mon Sep 17 00:00:00 2001 From: diyfr Date: Thu, 28 Apr 2016 10:37:55 +0200 Subject: [PATCH 019/170] Create windows script for spring-mvc-petstore-j8-async-server sample --- .../spring-mvc-petstore-j8-async-server.bat | 10 ++++ .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 47 ++++++++++--------- .../main/java/io/swagger/api/StoreApi.java | 14 +++--- .../src/main/java/io/swagger/api/UserApi.java | 30 ++++++------ .../swagger/configuration/SwaggerConfig.java | 23 ++++----- .../configuration/SwaggerUiConfiguration.java | 2 +- .../swagger/configuration/WebApplication.java | 2 +- .../configuration/WebMvcConfiguration.java | 2 +- .../main/java/io/swagger/model/Category.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 4 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 17 files changed, 82 insertions(+), 68 deletions(-) create mode 100644 bin/windows/spring-mvc-petstore-j8-async-server.bat diff --git a/bin/windows/spring-mvc-petstore-j8-async-server.bat b/bin/windows/spring-mvc-petstore-j8-async-server.bat new file mode 100644 index 000000000000..601de1ff6f82 --- /dev/null +++ b/bin/windows/spring-mvc-petstore-j8-async-server.bat @@ -0,0 +1,10 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate -t modules\swagger-codegen\src\main\resources\JavaSpringMVC -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json + +java %JAVA_OPTS% -jar %executable% %ags% \ No newline at end of file diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java index 20930979750d..eed42860459b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java index c8a46b8ac99d..99e1b55b6a59 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java index 91b3d9d6d363..1ce56229af2c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java index 40471f4716f4..25a24d69b49b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index df8a67686b6d..20370877b4df 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -3,7 +3,6 @@ package io.swagger.api; import io.swagger.model.*; import io.swagger.model.Pet; -import io.swagger.model.ApiResponse; import java.io.File; import java.util.concurrent.Callable; @@ -35,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @@ -47,12 +46,12 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) default Callable> addPet( -@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body ) throws NotFoundException { // do some magic! @@ -69,7 +68,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value") }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) default Callable> deletePet( @@ -86,7 +85,7 @@ public interface PetApi { } - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -96,10 +95,10 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation"), @ApiResponse(code = 400, message = "Invalid status value") }) @RequestMapping(value = "/findByStatus", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - default Callable>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status + default Callable>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status ) @@ -109,7 +108,7 @@ public interface PetApi { } - @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -119,10 +118,10 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation"), @ApiResponse(code = 400, message = "Invalid tag value") }) @RequestMapping(value = "/findByTags", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - default Callable>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags + default Callable>> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags ) @@ -132,7 +131,11 @@ public interface PetApi { } - @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }), @Authorization(value = "api_key") }) @ApiResponses(value = { @@ -140,11 +143,11 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Pet not found") }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) default Callable> getPetById( -@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId ) throws NotFoundException { @@ -164,12 +167,12 @@ public interface PetApi { @ApiResponse(code = 404, message = "Pet not found"), @ApiResponse(code = 405, message = "Validation exception") }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) default Callable> updatePet( -@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body ) throws NotFoundException { // do some magic! @@ -186,11 +189,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) default Callable> updatePetWithForm( -@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId +@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId , @@ -209,7 +212,7 @@ public interface PetApi { } - @ApiOperation(value = "uploads an image", notes = "", response = ApiResponse.class, authorizations = { + @ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -218,10 +221,10 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/{petId}/uploadImage", - produces = { "application/json" }, + produces = { "application/json", "application/xml" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default Callable> uploadFile( + default Callable> uploadFile( @ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId , @@ -236,7 +239,7 @@ public interface PetApi { ) throws NotFoundException { // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); + return () -> new ResponseEntity(HttpStatus.OK); } } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java index 5063976abb93..bcb1fa75fdf1 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @@ -42,7 +42,7 @@ public interface StoreApi { @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Order not found") }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) default Callable> deleteOrder( @@ -61,7 +61,7 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/inventory", - produces = { "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) default Callable>> getInventory() @@ -77,11 +77,11 @@ public interface StoreApi { @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Order not found") }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) default Callable> getOrderById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId ) throws NotFoundException { @@ -95,12 +95,12 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation"), @ApiResponse(code = 400, message = "Invalid Order") }) @RequestMapping(value = "/order", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) default Callable> placeOrder( -@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body +@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index 73c8893c5cfc..299d87787f79 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -34,19 +34,19 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) default Callable> createUser( -@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body +@ApiParam(value = "Created user object" ) @RequestBody User body ) throws NotFoundException { // do some magic! @@ -58,12 +58,12 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/createWithArray", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) default Callable> createUsersWithArrayInput( -@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body +@ApiParam(value = "List of user object" ) @RequestBody List body ) throws NotFoundException { // do some magic! @@ -75,12 +75,12 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/createWithList", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.POST) default Callable> createUsersWithListInput( -@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body +@ApiParam(value = "List of user object" ) @RequestBody List body ) throws NotFoundException { // do some magic! @@ -93,7 +93,7 @@ public interface UserApi { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) default Callable> deleteUser( @@ -112,7 +112,7 @@ public interface UserApi { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) default Callable> getUserByName( @@ -130,14 +130,14 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation"), @ApiResponse(code = 400, message = "Invalid username/password supplied") }) @RequestMapping(value = "/login", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - default Callable> loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username + default Callable> loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username , - @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password + @ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password ) @@ -151,7 +151,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/logout", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.GET) default Callable> logoutUser() @@ -166,7 +166,7 @@ public interface UserApi { @ApiResponse(code = 400, message = "Invalid user supplied"), @ApiResponse(code = 404, message = "User not found") }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, + produces = { "application/json", "application/xml" }, method = RequestMethod.PUT) default Callable> updateUser( @@ -175,7 +175,7 @@ public interface UserApi { , -@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body +@ApiParam(value = "Updated user object" ) @RequestBody User body ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java index 9573f7880f8d..0fdecba76ae9 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -7,6 +7,7 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @@ -18,19 +19,19 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { - ApiInfo apiInfo = new ApiInfo( - "Swagger Petstore", - "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", - "1.0.0", - "", - "apiteam@swagger.io", - "Apache 2.0", - "http://www.apache.org/licenses/LICENSE-2.0.html" ); - return apiInfo; + return new ApiInfoBuilder() + .title("Swagger Petstore") + .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") + .license("Apache 2.0") + .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") + .termsOfServiceUrl("") + .version("1.0.0") + .contact(new Contact("","", "apiteam@wordnik.com")) + .build(); } @Bean @@ -38,4 +39,4 @@ public class SwaggerConfig { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()); } -} \ No newline at end of file +} diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index 7673f5afbcbd..3aced576dd6c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java index f8658aaaa29f..20493a360b78 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index aab4bf2e7d13..18b4303d9836 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index f4690dd79001..beb9b8c217ce 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index 8b5355db47fa..6ae758200d87 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class Order { private Long id = null; @@ -23,7 +23,7 @@ public class Order { }; private StatusEnum status = null; - private Boolean complete = false; + private Boolean complete = null; /** **/ diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index e767e6f079c3..6154d4e5b8f3 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -14,7 +14,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index 9b7bd88ad3c5..f927f607be23 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index f05fe4b60997..55661ec8c7d4 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") public class User { private Long id = null; From 91a023569bb8be24602e25cda0cafafa226b1ea3 Mon Sep 17 00:00:00 2001 From: diyfr Date: Thu, 28 Apr 2016 10:50:25 +0200 Subject: [PATCH 020/170] Update missing dependencies ApiInfoBuilder --- .../src/main/resources/JavaSpringMVC/swaggerConfig.mustache | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache index 6dde7ebce034..024fe6735ef6 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache @@ -6,6 +6,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; From 1836f4e8c6e49e94d3dbce9bd99dd32ee44ffb2a Mon Sep 17 00:00:00 2001 From: diyfr Date: Thu, 28 Apr 2016 10:55:48 +0200 Subject: [PATCH 021/170] Generate springmvc sample petstore --- .../src/main/java/io/swagger/api/ApiException.java | 2 +- .../src/main/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../src/main/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../src/main/java/io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 2 +- .../src/main/java/io/swagger/api/StoreApi.java | 2 +- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../src/main/java/io/swagger/configuration/SwaggerConfig.java | 3 ++- .../java/io/swagger/configuration/SwaggerUiConfiguration.java | 2 +- .../src/main/java/io/swagger/configuration/WebApplication.java | 2 +- .../java/io/swagger/configuration/WebMvcConfiguration.java | 2 +- .../src/main/java/io/swagger/model/Category.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/ApiException.java | 2 +- .../src/main/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../src/main/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../src/main/java/io/swagger/api/NotFoundException.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/PetApi.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/StoreApi.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/UserApi.java | 2 +- .../src/main/java/io/swagger/configuration/SwaggerConfig.java | 3 ++- .../java/io/swagger/configuration/SwaggerUiConfiguration.java | 2 +- .../src/main/java/io/swagger/configuration/WebApplication.java | 2 +- .../java/io/swagger/configuration/WebMvcConfiguration.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/Category.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/Order.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/Pet.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/Tag.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/User.java | 2 +- 32 files changed, 34 insertions(+), 32 deletions(-) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java index eed42860459b..f74d7cdbf0a1 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java index 99e1b55b6a59..46a9786a7c47 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java index 1ce56229af2c..6f7fd34a4be5 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java index 25a24d69b49b..98f3a8ac2775 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index 20370877b4df..0c16978979f8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java index bcb1fa75fdf1..40394c34220e 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index 299d87787f79..c0ccb9c77161 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java index 0fdecba76ae9..0c492ee68118 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -6,6 +6,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; @@ -19,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index 3aced576dd6c..5db2ffb104b2 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java index 20493a360b78..ba65c1f5de86 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index 18b4303d9836..980bce332058 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index beb9b8c217ce..e688825fe933 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index 6ae758200d87..81b169d88133 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index 6154d4e5b8f3..71a4d76957d8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -14,7 +14,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index f927f607be23..0fa8185e7a9e 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index 55661ec8c7d4..e0cded1bac99 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:36:54.900+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") public class User { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java index 00a3b4f9f753..a8f744cc0588 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java index c14a1105e632..2c7a4b1f1191 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java index 7d86418ffe3e..461e8200dae5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java index 66d118d065dc..003446a4bc3e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index 07c6e4e79532..7089162319e5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index 57f956274b95..ce2d893034be 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index 407896123c1c..20426eaff854 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java index a95b58dd8e62..034dea3b5502 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -6,6 +6,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; @@ -19,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index 163662404043..d6fc62c12d47 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java index d0ec9a2b41cf..b9484e486d5b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index eb9046d4d986..8d37ed29ca3e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index d0ecc814abb2..5004b1cbe1c2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index 433d9801732d..99ffb9a760bf 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index e997fd6a266d..6083adaaf56c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index 94b69d061666..9d0f927b1ca2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 79a6628e5ddb..1229c621cc25 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:14:29.515+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") public class User { private Long id = null; From 4921ee8c4cb4aee5b508099520108b324773319c Mon Sep 17 00:00:00 2001 From: diyfr Date: Thu, 28 Apr 2016 13:57:18 +0200 Subject: [PATCH 022/170] Update javax-servlet-api 3.0(missing in repo maven) to 3.0.1 --- .../src/main/resources/JavaSpringMVC/pom.mustache | 2 +- .../src/main/java/io/swagger/api/ApiException.java | 2 +- .../src/main/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../src/main/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../src/main/java/io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 2 +- .../src/main/java/io/swagger/api/StoreApi.java | 2 +- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../src/main/java/io/swagger/configuration/SwaggerConfig.java | 2 +- .../java/io/swagger/configuration/SwaggerUiConfiguration.java | 2 +- .../src/main/java/io/swagger/configuration/WebApplication.java | 2 +- .../main/java/io/swagger/configuration/WebMvcConfiguration.java | 2 +- .../src/main/java/io/swagger/model/Category.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java | 2 +- .../spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- samples/server/petstore/spring-mvc/pom.xml | 2 +- .../spring-mvc/src/main/java/io/swagger/api/ApiException.java | 2 +- .../src/main/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../src/main/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../src/main/java/io/swagger/api/NotFoundException.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/PetApi.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/StoreApi.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/UserApi.java | 2 +- .../src/main/java/io/swagger/configuration/SwaggerConfig.java | 2 +- .../java/io/swagger/configuration/SwaggerUiConfiguration.java | 2 +- .../src/main/java/io/swagger/configuration/WebApplication.java | 2 +- .../main/java/io/swagger/configuration/WebMvcConfiguration.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/Category.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/Order.java | 2 +- .../petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java | 2 +- .../petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/User.java | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache index e5ccab21783f..10e84165ff9f 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache @@ -123,7 +123,7 @@ 1.13 1.7.21 4.12 - 3.0 + 3.0.1 2.4.0 4.2.5.RELEASE diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java index f74d7cdbf0a1..151d180e920e 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java index 46a9786a7c47..2ba2c5fca8c5 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java index 6f7fd34a4be5..0e2936a69805 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java index 98f3a8ac2775..948f28ecc62f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index 0c16978979f8..5409909a936f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java index 40394c34220e..509bb1c45b42 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index c0ccb9c77161..b807a60e53b5 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java index 0c492ee68118..54c96c5dcee0 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index 5db2ffb104b2..947171610ebd 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java index ba65c1f5de86..69251cc36958 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index 980bce332058..9be9c03f914c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index e688825fe933..19b50189d24b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index 81b169d88133..0e13b811356f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index 71a4d76957d8..c6bfa0018a78 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -14,7 +14,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index 0fa8185e7a9e..1225500b418a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index e0cded1bac99..b3d416aa72d8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:54:46.059+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") public class User { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index 225d4bb62779..9d052fa426e1 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -123,7 +123,7 @@ 1.13 1.7.21 4.12 - 3.0 + 3.0.1 2.4.0 4.2.5.RELEASE diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java index a8f744cc0588..a1c2e80fdf5b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java index 2c7a4b1f1191..e0d02318552f 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java index 461e8200dae5..a999917b7f85 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java index 003446a4bc3e..bce9620c9500 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index 7089162319e5..92a56f62c840 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index ce2d893034be..9448fcd0aab3 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index 20426eaff854..2978839c51df 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java index 034dea3b5502..bb0cdba5e3cd 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index d6fc62c12d47..59b40d444cc7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java index b9484e486d5b..f6c0330cfb96 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index 8d37ed29ca3e..e6304b22910e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index 5004b1cbe1c2..e4895d859646 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index 99ffb9a760bf..b3af14d1f1a3 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index 6083adaaf56c..7043bf6b9685 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index 9d0f927b1ca2..91752161bf34 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 1229c621cc25..1c2756b72f4e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T10:53:15.241+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") public class User { private Long id = null; From bb3dbb1d1bb498b9d23ff1a5368219d0bf0db420 Mon Sep 17 00:00:00 2001 From: diyfr Date: Thu, 28 Apr 2016 15:10:39 +0200 Subject: [PATCH 023/170] Confuse with maven version package (javax:javax.servlet-api && javax:servlet-api ) --- .../src/main/resources/JavaSpringMVC/pom.mustache | 2 +- .../src/main/java/io/swagger/api/ApiException.java | 2 +- .../src/main/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../src/main/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../src/main/java/io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 2 +- .../src/main/java/io/swagger/api/StoreApi.java | 2 +- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../src/main/java/io/swagger/configuration/SwaggerConfig.java | 2 +- .../java/io/swagger/configuration/SwaggerUiConfiguration.java | 2 +- .../src/main/java/io/swagger/configuration/WebApplication.java | 2 +- .../main/java/io/swagger/configuration/WebMvcConfiguration.java | 2 +- .../src/main/java/io/swagger/model/Category.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java | 2 +- .../spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- samples/server/petstore/spring-mvc/pom.xml | 2 +- .../spring-mvc/src/main/java/io/swagger/api/ApiException.java | 2 +- .../src/main/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../src/main/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../src/main/java/io/swagger/api/NotFoundException.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/PetApi.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/StoreApi.java | 2 +- .../spring-mvc/src/main/java/io/swagger/api/UserApi.java | 2 +- .../src/main/java/io/swagger/configuration/SwaggerConfig.java | 2 +- .../java/io/swagger/configuration/SwaggerUiConfiguration.java | 2 +- .../src/main/java/io/swagger/configuration/WebApplication.java | 2 +- .../main/java/io/swagger/configuration/WebMvcConfiguration.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/Category.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/Order.java | 2 +- .../petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java | 2 +- .../petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java | 2 +- .../spring-mvc/src/main/java/io/swagger/model/User.java | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache index 10e84165ff9f..9b352e551c5b 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache @@ -123,7 +123,7 @@ 1.13 1.7.21 4.12 - 3.0.1 + 2.5 2.4.0 4.2.5.RELEASE diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java index 151d180e920e..7fa9d6b24cca 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java index 2ba2c5fca8c5..12e868926e9b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java index 0e2936a69805..a9baf798c662 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java index 948f28ecc62f..af4fba572837 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index 5409909a936f..bc264595a443 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java index 509bb1c45b42..5b4e2ae6aefd 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index b807a60e53b5..5ef98712f286 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java index 54c96c5dcee0..87096d412607 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index 947171610ebd..f2cb3004e64c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java index 69251cc36958..48bad4bb263b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index 9be9c03f914c..64f96fe37f32 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index 19b50189d24b..850c801606e4 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index 0e13b811356f..72ed79b768bb 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index c6bfa0018a78..aca7ff86695e 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -14,7 +14,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index 1225500b418a..d688eb2ee021 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index b3d416aa72d8..9a4778315690 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:55:54.953+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") public class User { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index 9d052fa426e1..f52c6e759fd3 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -123,7 +123,7 @@ 1.13 1.7.21 4.12 - 3.0.1 + 2.5 2.4.0 4.2.5.RELEASE diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java index a1c2e80fdf5b..25f2efe14cd6 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java index e0d02318552f..ccc0cbbb7aae 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java index a999917b7f85..2b007cb749a2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java index bce9620c9500..9ec36e8ab356 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index 92a56f62c840..f50ce573df59 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index 9448fcd0aab3..254d8822b5c8 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index 2978839c51df..a87eed542e2f 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java index bb0cdba5e3cd..e55006ed86e3 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index 59b40d444cc7..bd977dde85d5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java index f6c0330cfb96..dd1da23da947 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index e6304b22910e..e4f224f59473 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index e4895d859646..bae60f19a802 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index b3af14d1f1a3..9787055aa3a6 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index 7043bf6b9685..3948dba37dac 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index 91752161bf34..5547993d18a4 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 1c2756b72f4e..448ba1dceecd 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T13:56:01.922+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") public class User { private Long id = null; From 619e9f17a026f22a720df9ceec53426393e0bf9d Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Thu, 28 Apr 2016 10:09:04 -0700 Subject: [PATCH 024/170] updated reference to use go-resty --- samples/client/petstore/go/pom.xml | 4 ++-- samples/client/petstore/go/test.go | 30 ------------------------------ 2 files changed, 2 insertions(+), 32 deletions(-) delete mode 100644 samples/client/petstore/go/test.go diff --git a/samples/client/petstore/go/pom.xml b/samples/client/petstore/go/pom.xml index 50bfe7f14f87..724ac791dcd9 100644 --- a/samples/client/petstore/go/pom.xml +++ b/samples/client/petstore/go/pom.xml @@ -41,7 +41,7 @@ - go-get-sling + go-get-resty pre-integration-test exec @@ -50,7 +50,7 @@ go get - github.com/dghubble/sling + github.com/go-resty/resty diff --git a/samples/client/petstore/go/test.go b/samples/client/petstore/go/test.go deleted file mode 100644 index 6a50c9bbc8e1..000000000000 --- a/samples/client/petstore/go/test.go +++ /dev/null @@ -1,30 +0,0 @@ -package main - -import ( - sw "./go-petstore" - "encoding/json" - "fmt" -) - -func main() { - - s := sw.NewPetApi() - - // test POST(body) - newPet := (sw.Pet{Id: 12830, Name: "gopher", - PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"}) - - jsonNewPet, _ := json.Marshal(newPet) - fmt.Println("newPet:", string(jsonNewPet)) - s.AddPet(newPet) - - // test POST(form) - s.UpdatePetWithForm(12830, "golang", "available") - - // test GET - resp, err, apiResponse := s.GetPetById(12830) - fmt.Println("GetPetById: ", resp, err, apiResponse) - - err2, apiResponse2 := s.DeletePet(12830, "") - fmt.Println("DeletePet: ", err2, apiResponse2) -} From 19d22d834c20f367fc84573fc42d77b515acd195 Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Thu, 21 Apr 2016 12:47:07 -0400 Subject: [PATCH 025/170] TypeScript Fetch: implementation --- .../TypeScriptFetchClientCodegen.java | 38 ++++ .../services/io.swagger.codegen.CodegenConfig | 1 + .../resources/TypeScript-Fetch/api.mustache | 133 +++++++++++++ .../main/resources/TypeScript-Fetch/assign.ts | 18 ++ .../TypeScript-Fetch/git_push.sh.mustache | 52 +++++ .../resources/TypeScript-Fetch/package.json | 5 + .../resources/TypeScript-Fetch/tsconfig.json | 12 ++ .../resources/TypeScript-Fetch/typings.json | 9 + .../TypeScriptFetchClientOptionsProvider.java | 31 +++ .../TypeScriptFetchClientOptionsTest.java | 34 ++++ .../TypeScriptFetchModelTest.java | 177 ++++++++++++++++++ 11 files changed, 510 insertions(+) create mode 100644 modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java create mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache create mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/assign.ts create mode 100755 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/git_push.sh.mustache create mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json create mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json create mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json create mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java create mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchClientOptionsTest.java create mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchModelTest.java diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java new file mode 100644 index 000000000000..6d34adfad8d7 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java @@ -0,0 +1,38 @@ +package io.swagger.codegen.languages; + +import io.swagger.codegen.SupportingFile; + +import java.io.File; + +public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodegen { + + @Override + public String getName() { + return "typescript-fetch"; + } + + @Override + public String getHelp() { + return "Generates a TypeScript client library using Fetch API."; + } + + @Override + public void processOpts() { + super.processOpts(); + final String defaultFolder = apiPackage().replace('.', File.separatorChar); + + supportingFiles.add(new SupportingFile("api.mustache", null, "api.ts")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("assign.ts", defaultFolder, "assign.ts")); + supportingFiles.add(new SupportingFile("package.json", "", "package.json")); + supportingFiles.add(new SupportingFile("typings.json", "", "typings.json")); + supportingFiles.add(new SupportingFile("tsconfig.json", "", "tsconfig.json")); + } + + public TypeScriptFetchClientCodegen() { + super(); + outputFolder = "generated-code/typescript-fetch"; + embeddedTemplateDir = templateDir = "TypeScript-Fetch"; + } + +} diff --git a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig index 22823c956262..39eca08ccdb5 100644 --- a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig @@ -38,6 +38,7 @@ io.swagger.codegen.languages.TizenClientCodegen io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen io.swagger.codegen.languages.TypeScriptAngularClientCodegen io.swagger.codegen.languages.TypeScriptNodeClientCodegen +io.swagger.codegen.languages.TypeScriptFetchClientCodegen io.swagger.codegen.languages.AkkaScalaClientCodegen io.swagger.codegen.languages.CsharpDotNet2ClientCodegen io.swagger.codegen.languages.ClojureClientCodegen diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache new file mode 100644 index 000000000000..02e6816ff262 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache @@ -0,0 +1,133 @@ +import * as querystring from 'querystring'; +import * as fetch from 'isomorphic-fetch'; +import {assign} from './assign'; + + +{{#models}} +{{#model}} +{{#description}} +/** + * {{{description}}} + */ +{{/description}} +export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#vars}} +{{#description}} + + /** + * {{{description}}} + */ +{{/description}} + "{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; +{{/vars}} +} + +{{#hasEnums}} +{{#vars}} +{{#isEnum}} + +export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} + {{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} +} +{{/isEnum}} +{{/vars}} +{{/hasEnums}} +{{/model}} +{{/models}} + +{{#apiInfo}} +{{#apis}} +{{#operations}} +//export namespace {{package}} { + 'use strict'; + +{{#description}} + /** + * {{&description}} + */ +{{/description}} + export class {{classname}} { + protected basePath = '{{basePath}}'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + +{{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}}* @param {{paramName}} {{description}} + {{/allParams}}*/ + public {{nickname}} (params: { {{#allParams}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}};{{/allParams}} }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> { + const localVarPath = this.basePath + '{{path}}'{{#pathParams}} + .replace('{' + '{{baseName}}' + '}', String(params.{{paramName}})){{/pathParams}}; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); +{{#hasFormParams}} + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + +{{/hasFormParams}} +{{#hasBodyParam}} + headerParams['Content-Type'] = 'application/json'; + +{{/hasBodyParam}} +{{#allParams}} +{{#required}} + // verify required parameter '{{paramName}}' is set + if (params.{{paramName}} == null) { + throw new Error('Missing required parameter {{paramName}} when calling {{nickname}}'); + } +{{/required}} +{{/allParams}} +{{#queryParams}} + if (params.{{paramName}} !== undefined) { + queryParameters['{{baseName}}'] = params.{{paramName}}; + } + +{{/queryParams}} +{{#headerParams}} + headerParams['{{baseName}}'] = params.{{paramName}}; + +{{/headerParams}} +{{#formParams}} + formParams['{{baseName}}'] = params.{{paramName}}; + +{{/formParams}} + let fetchParams = { + method: '{{httpMethod}}', + headers: headerParams, + {{#bodyParam}}body: JSON.stringify(params.{{paramName}}), + {{/bodyParam}} + {{#hasFormParams}}body: querystring.stringify(formParams), + {{/hasFormParams}} + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } +{{/operation}} + } +//} +{{/operations}} +{{/apis}} +{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/assign.ts b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/assign.ts new file mode 100644 index 000000000000..040f87d7d98b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/assign.ts @@ -0,0 +1,18 @@ +export function assign (target, ...args) { + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + for (let source of args) { + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; +}; \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/git_push.sh.mustache new file mode 100755 index 000000000000..e153ce23ecf4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/git_push.sh.mustache @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json new file mode 100644 index 000000000000..94206a9f3a14 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "isomorphic-fetch": "^2.2.1" + } +} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json new file mode 100644 index 000000000000..ea2d7b83410c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es5", + "sourceMap": true + }, + "exclude": [ + "node_modules", + "typings/browser", + "typings/main", + "typings/main.d.ts" + ] +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json new file mode 100644 index 000000000000..c22f086f7f05 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json @@ -0,0 +1,9 @@ +{ + "version": false, + "dependencies": {}, + "ambientDependencies": { + "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", + "node": "registry:dt/node#4.0.0+20160423143914", + "isomorphic-fetch": "github:leonyu/DefinitelyTyped/isomorphic-fetch/isomorphic-fetch.d.ts#isomorphic-fetch-fix-module" + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java new file mode 100644 index 000000000000..6981dd3702c6 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java @@ -0,0 +1,31 @@ +package io.swagger.codegen.options; + +import com.google.common.collect.ImmutableMap; +import io.swagger.codegen.CodegenConstants; + +import java.util.Map; + +public class TypeScriptFetchClientOptionsProvider implements OptionsProvider { + public static final String SORT_PARAMS_VALUE = "false"; + public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; + public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; + + @Override + public String getLanguage() { + return "typescript-fetch"; + } + + @Override + public Map createOptions() { + ImmutableMap.Builder builder = new ImmutableMap.Builder(); + return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) + .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) + .build(); + } + + @Override + public boolean isServer() { + return false; + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchClientOptionsTest.java new file mode 100644 index 000000000000..d6d0849de296 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchClientOptionsTest.java @@ -0,0 +1,34 @@ +package io.swagger.codegen.typescriptfetch; + +import io.swagger.codegen.AbstractOptionsTest; +import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.languages.TypeScriptFetchClientCodegen; +import io.swagger.codegen.options.TypeScriptFetchClientOptionsProvider; +import mockit.Expectations; +import mockit.Tested; + +public class TypeScriptFetchClientOptionsTest extends AbstractOptionsTest { + + @Tested + private TypeScriptFetchClientCodegen clientCodegen; + + public TypeScriptFetchClientOptionsTest() { + super(new TypeScriptFetchClientOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void setExpectations() { + new Expectations(clientCodegen) {{ + clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.SORT_PARAMS_VALUE)); + times = 1; + clientCodegen.setModelPropertyNaming(TypeScriptFetchClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); + times = 1; + }}; + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchModelTest.java new file mode 100644 index 000000000000..d2173fdb7103 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchModelTest.java @@ -0,0 +1,177 @@ +package io.swagger.codegen.typescriptfetch; + +import com.google.common.collect.Sets; +import io.swagger.codegen.CodegenModel; +import io.swagger.codegen.CodegenProperty; +import io.swagger.codegen.DefaultCodegen; +import io.swagger.codegen.languages.TypeScriptFetchClientCodegen; +import io.swagger.models.ArrayModel; +import io.swagger.models.Model; +import io.swagger.models.ModelImpl; +import io.swagger.models.properties.*; +import org.testng.Assert; +import org.testng.annotations.Test; + +@SuppressWarnings("static-method") +public class TypeScriptFetchModelTest { + + @Test(description = "convert a simple TypeScript Angular model") + public void simpleModelTest() { + final Model model = new ModelImpl() + .description("a sample model") + .property("id", new LongProperty()) + .property("name", new StringProperty()) + .property("createdAt", new DateTimeProperty()) + .required("id") + .required("name"); + final DefaultCodegen codegen = new TypeScriptFetchClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 3); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.datatype, "number"); + Assert.assertEquals(property1.name, "id"); + Assert.assertEquals(property1.defaultValue, "null"); + Assert.assertEquals(property1.baseType, "number"); + Assert.assertTrue(property1.hasMore); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isNotContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "name"); + Assert.assertEquals(property2.datatype, "string"); + Assert.assertEquals(property2.name, "name"); + Assert.assertEquals(property2.defaultValue, "null"); + Assert.assertEquals(property2.baseType, "string"); + Assert.assertTrue(property2.hasMore); + Assert.assertTrue(property2.required); + Assert.assertTrue(property2.isNotContainer); + + final CodegenProperty property3 = cm.vars.get(2); + Assert.assertEquals(property3.baseName, "createdAt"); + Assert.assertEquals(property3.complexType, null); + Assert.assertEquals(property3.datatype, "Date"); + Assert.assertEquals(property3.name, "createdAt"); + Assert.assertEquals(property3.defaultValue, "null"); + Assert.assertNull(property3.hasMore); + Assert.assertNull(property3.required); + Assert.assertTrue(property3.isNotContainer); + } + + @Test(description = "convert a model with list property") + public void listPropertyTest() { + final Model model = new ModelImpl() + .description("a sample model") + .property("id", new LongProperty()) + .property("urls", new ArrayProperty().items(new StringProperty())) + .required("id"); + final DefaultCodegen codegen = new TypeScriptFetchClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 2); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.datatype, "number"); + Assert.assertEquals(property1.name, "id"); + Assert.assertEquals(property1.defaultValue, "null"); + Assert.assertEquals(property1.baseType, "number"); + Assert.assertTrue(property1.hasMore); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isNotContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "urls"); + Assert.assertEquals(property2.datatype, "Array"); + Assert.assertEquals(property2.name, "urls"); + Assert.assertEquals(property2.baseType, "Array"); + Assert.assertNull(property2.hasMore); + Assert.assertNull(property2.required); + Assert.assertTrue(property2.isContainer); + } + + @Test(description = "convert a model with complex property") + public void complexPropertyTest() { + final Model model = new ModelImpl() + .description("a sample model") + .property("children", new RefProperty("#/definitions/Children")); + final DefaultCodegen codegen = new TypeScriptFetchClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.datatype, "Children"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.defaultValue, "null"); + Assert.assertEquals(property1.baseType, "Children"); + Assert.assertNull(property1.required); + Assert.assertTrue(property1.isNotContainer); + } + + @Test(description = "convert a model with complex list property") + public void complexListPropertyTest() { + final Model model = new ModelImpl() + .description("a sample model") + .property("children", new ArrayProperty() + .items(new RefProperty("#/definitions/Children"))); + final DefaultCodegen codegen = new TypeScriptFetchClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.complexType, "Children"); + Assert.assertEquals(property1.datatype, "Array"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "Array"); + Assert.assertNull(property1.required); + Assert.assertTrue(property1.isContainer); + } + + @Test(description = "convert an array model") + public void arrayModelTest() { + final Model model = new ArrayModel() + .description("an array model") + .items(new RefProperty("#/definitions/Children")); + final DefaultCodegen codegen = new TypeScriptFetchClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "an array model"); + Assert.assertEquals(cm.vars.size(), 0); + } + + @Test(description = "convert a map model") + public void mapModelTest() { + final Model model = new ModelImpl() + .description("a map model") + .additionalProperties(new RefProperty("#/definitions/Children")); + final DefaultCodegen codegen = new TypeScriptFetchClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a map model"); + Assert.assertEquals(cm.vars.size(), 0); + Assert.assertEquals(cm.imports.size(), 1); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + } +} From 72120099b43f6453f7e890993720080bac791d43 Mon Sep 17 00:00:00 2001 From: abcsun Date: Fri, 29 Apr 2016 11:04:27 +0800 Subject: [PATCH 026/170] change the validation to allParams --- .../src/main/resources/php/api.mustache | 33 +----- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 101 +++++++----------- .../php/SwaggerClient-php/lib/Api/PetApi.php | 32 +++--- .../SwaggerClient-php/lib/Api/StoreApi.php | 18 ++-- .../php/SwaggerClient-php/lib/Api/UserApi.php | 38 +++---- 6 files changed, 85 insertions(+), 139 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index c31eff8bc4a8..c0401940b484 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -123,6 +123,7 @@ use \{{invokerPackage}}\ObjectSerializer; if (${{paramName}} === null) { throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{operationId}}'); } + {{/required}} {{#hasValidation}} {{#maxLength}} if (strlen(${{paramName}}) > {{maxLength}}) { @@ -151,7 +152,7 @@ use \{{invokerPackage}}\ObjectSerializer; {{/pattern}} {{/hasValidation}} - {{/required}}{{/allParams}} + {{/allParams}} // parse inputs $resourcePath = "{{path}}"; @@ -201,33 +202,6 @@ use \{{invokerPackage}}\ObjectSerializer; {{#formParams}}// form params if (${{paramName}} !== null) { - {{#hasValidation}} - {{#maxLength}} - if (strlen(${{paramName}}) > {{maxLength}}) { - throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); - } - {{/maxLength}} - {{#minLength}} - if (strlen(${{paramName}}) > {{minLength}}) { - throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); - } - {{/minLength}} - {{#maximum}} - if (${{paramName}} > {{maximum}}) { - throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); - } - {{/maximum}} - {{#minimum}} - if (${{paramName}} < {{minimum}}) { - throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); - } - {{/minimum}} - {{#pattern}} - if (!preg_match("{{pattern}}", ${{paramName}})) { - throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); - } - {{/pattern}} - {{/hasValidation}} {{#isFile}} // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax // See: https://wiki.php.net/rfc/curl-file-upload @@ -240,8 +214,7 @@ use \{{invokerPackage}}\ObjectSerializer; {{^isFile}} $formParams['{{baseName}}'] = $this->apiClient->getSerializer()->toFormValue(${{paramName}}); {{/isFile}} - } - {{/formParams}} + }{{/formParams}} {{#bodyParams}}// body params $_tempBody = null; if (isset(${{paramName}})) { diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index aa6ce69b760a..e7d9b552b043 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-28T02:26:28.980Z +- Build date: 2016-04-29T03:01:58.276Z - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index f6f2e73950a2..ee15a10d025a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -151,7 +151,7 @@ class FakeApi throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); } - + // verify the required parameter 'double' is set if ($double === null) { throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters'); @@ -163,7 +163,7 @@ class FakeApi throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); } - + // verify the required parameter 'string' is set if ($string === null) { throw new \InvalidArgumentException('Missing the required parameter $string when calling testEndpointParameters'); @@ -172,12 +172,36 @@ class FakeApi throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.'); } - + // verify the required parameter 'byte' is set if ($byte === null) { throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters'); } - + if ($integer > 100.0) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.'); + } + if ($integer < 10.0) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.'); + } + + if ($int32 > 200.0) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.'); + } + if ($int32 < 20.0) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.'); + } + + if ($float > 987.6) { + throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); + } + + if (strlen($password) > 64) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); + } + if (strlen($password) > 10) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); + } + // parse inputs $resourcePath = "/fake"; @@ -199,86 +223,39 @@ class FakeApi // form params if ($integer !== null) { - if ($integer > 100.0) { - throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.'); - } - if ($integer < 10.0) { - throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.'); - } $formParams['integer'] = $this->apiClient->getSerializer()->toFormValue($integer); - } -// form params + }// form params if ($int32 !== null) { - if ($int32 > 200.0) { - throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.'); - } - if ($int32 < 20.0) { - throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.'); - } $formParams['int32'] = $this->apiClient->getSerializer()->toFormValue($int32); - } -// form params + }// form params if ($int64 !== null) { $formParams['int64'] = $this->apiClient->getSerializer()->toFormValue($int64); - } -// form params + }// form params if ($number !== null) { - if ($number > 543.2) { - throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.'); - } - if ($number < 32.1) { - throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); - } $formParams['number'] = $this->apiClient->getSerializer()->toFormValue($number); - } -// form params + }// form params if ($float !== null) { - if ($float > 987.6) { - throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); - } $formParams['float'] = $this->apiClient->getSerializer()->toFormValue($float); - } -// form params + }// form params if ($double !== null) { - if ($double > 123.4) { - throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.'); - } - if ($double < 67.8) { - throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); - } $formParams['double'] = $this->apiClient->getSerializer()->toFormValue($double); - } -// form params + }// form params if ($string !== null) { - if (!preg_match("/[a-z]/i", $string)) { - throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.'); - } $formParams['string'] = $this->apiClient->getSerializer()->toFormValue($string); - } -// form params + }// form params if ($byte !== null) { $formParams['byte'] = $this->apiClient->getSerializer()->toFormValue($byte); - } -// form params + }// form params if ($binary !== null) { $formParams['binary'] = $this->apiClient->getSerializer()->toFormValue($binary); - } -// form params + }// form params if ($date !== null) { $formParams['date'] = $this->apiClient->getSerializer()->toFormValue($date); - } -// form params + }// form params if ($date_time !== null) { $formParams['dateTime'] = $this->apiClient->getSerializer()->toFormValue($date_time); - } -// form params + }// form params if ($password !== null) { - if (strlen($password) > 64) { - throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); - } - if (strlen($password) > 10) { - throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); - } $formParams['password'] = $this->apiClient->getSerializer()->toFormValue($password); } 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 fff4e6be41a7..1154b72929c7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -122,7 +122,6 @@ class PetApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling addPet'); } - // parse inputs $resourcePath = "/pet"; @@ -142,7 +141,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -209,7 +209,6 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling deletePet'); } - // parse inputs $resourcePath = "/pet/{petId}"; @@ -239,7 +238,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -300,7 +300,6 @@ class PetApi if ($status === null) { throw new \InvalidArgumentException('Missing the required parameter $status when calling findPetsByStatus'); } - // parse inputs $resourcePath = "/pet/findByStatus"; @@ -326,7 +325,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -394,7 +394,6 @@ class PetApi if ($tags === null) { throw new \InvalidArgumentException('Missing the required parameter $tags when calling findPetsByTags'); } - // parse inputs $resourcePath = "/pet/findByTags"; @@ -420,7 +419,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -488,7 +488,6 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetById'); } - // parse inputs $resourcePath = "/pet/{petId}"; @@ -515,7 +514,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -585,7 +585,6 @@ class PetApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling updatePet'); } - // parse inputs $resourcePath = "/pet"; @@ -605,7 +604,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -674,7 +674,6 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling updatePetWithForm'); } - // parse inputs $resourcePath = "/pet/{petId}"; @@ -704,8 +703,7 @@ class PetApi // form params if ($name !== null) { $formParams['name'] = $this->apiClient->getSerializer()->toFormValue($name); - } -// form params + }// form params if ($status !== null) { $formParams['status'] = $this->apiClient->getSerializer()->toFormValue($status); } @@ -774,7 +772,6 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling uploadFile'); } - // parse inputs $resourcePath = "/pet/{petId}/uploadImage"; @@ -804,8 +801,7 @@ class PetApi // form params if ($additional_metadata !== null) { $formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata); - } -// form params + }// form params if ($file !== null) { // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax // See: https://wiki.php.net/rfc/curl-file-upload 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 77d5b9ecba13..27253a09f4fc 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -126,7 +126,6 @@ class StoreApi throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.deleteOrder, must be bigger than or equal to 1.0.'); } - // parse inputs $resourcePath = "/store/order/{orderId}"; @@ -153,7 +152,8 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -202,8 +202,7 @@ class StoreApi */ public function getInventoryWithHttpInfo() { - - + // parse inputs $resourcePath = "/store/inventory"; $httpBody = ''; @@ -222,7 +221,8 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -299,7 +299,6 @@ class StoreApi throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.0.'); } - // parse inputs $resourcePath = "/store/order/{orderId}"; @@ -326,7 +325,8 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -389,7 +389,6 @@ class StoreApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling placeOrder'); } - // parse inputs $resourcePath = "/store/order"; @@ -409,7 +408,8 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; 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 7376d58e8fea..96c9fa6fc09a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -122,7 +122,6 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUser'); } - // parse inputs $resourcePath = "/user"; @@ -142,7 +141,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -202,7 +202,6 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithArrayInput'); } - // parse inputs $resourcePath = "/user/createWithArray"; @@ -222,7 +221,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -282,7 +282,6 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithListInput'); } - // parse inputs $resourcePath = "/user/createWithList"; @@ -302,7 +301,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -362,7 +362,6 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling deleteUser'); } - // parse inputs $resourcePath = "/user/{username}"; @@ -389,7 +388,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -445,7 +445,6 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling getUserByName'); } - // parse inputs $resourcePath = "/user/{username}"; @@ -472,7 +471,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -537,12 +537,11 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling loginUser'); } - + // verify the required parameter 'password' is set if ($password === null) { throw new \InvalidArgumentException('Missing the required parameter $password when calling loginUser'); } - // parse inputs $resourcePath = "/user/login"; @@ -568,7 +567,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -624,8 +624,7 @@ class UserApi */ public function logoutUserWithHttpInfo() { - - + // parse inputs $resourcePath = "/user/logout"; $httpBody = ''; @@ -644,7 +643,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -702,12 +702,11 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling updateUser'); } - + // verify the required parameter 'body' is set if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling updateUser'); } - // parse inputs $resourcePath = "/user/{username}"; @@ -734,7 +733,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; From 90442db86d9d53f1d52ca5fe8e2bf4022ada697c Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 29 Apr 2016 11:10:52 +0800 Subject: [PATCH 027/170] skip overwriting ruby spec files --- .../java/io/swagger/codegen/DefaultGenerator.java | 7 +++++++ .../swagger/codegen/languages/RubyClientCodegen.java | 7 +++++++ samples/client/petstore/ruby/README.md | 4 ++-- samples/client/petstore/ruby/docs/FakeApi.md | 4 ++-- samples/client/petstore/ruby/docs/FormatTest.md | 1 + .../petstore/ruby/lib/petstore/models/format_test.rb | 11 ++++++++++- 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index aebf7e50de5e..b5a920004c83 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -264,6 +264,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { String suffix = config.modelTemplateFiles().get(templateName); String filename = config.modelFileFolder() + File.separator + config.toModelFilename(name) + suffix; if (!config.shouldOverwrite(filename)) { + LOGGER.info("Skipped overwriting " + filename); continue; } String templateFile = getFullTemplateFile(config, templateName); @@ -286,6 +287,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { String suffix = config.modelTestTemplateFiles().get(templateName); String filename = config.modelTestFileFolder() + File.separator + config.toModelTestFilename(name) + suffix; if (!config.shouldOverwrite(filename)) { + LOGGER.info("Skipped overwriting " + filename); continue; } String templateFile = getFullTemplateFile(config, templateName); @@ -308,6 +310,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { String suffix = config.modelDocTemplateFiles().get(templateName); String filename = config.modelDocFileFolder() + File.separator + config.toModelDocFilename(name) + suffix; if (!config.shouldOverwrite(filename)) { + LOGGER.info("Skipped overwriting " + filename); continue; } String templateFile = getFullTemplateFile(config, templateName); @@ -393,6 +396,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { for (String templateName : config.apiTemplateFiles().keySet()) { String filename = config.apiFilename(templateName, tag); if (!config.shouldOverwrite(filename) && new File(filename).exists()) { + LOGGER.info("Skipped overwriting " + filename); continue; } @@ -416,6 +420,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { for (String templateName : config.apiTestTemplateFiles().keySet()) { String filename = config.apiTestFilename(templateName, tag); if (!config.shouldOverwrite(filename) && new File(filename).exists()) { + LOGGER.info("Skipped overwriting " + filename); continue; } @@ -439,6 +444,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { for (String templateName : config.apiDocTemplateFiles().keySet()) { String filename = config.apiDocFilename(templateName, tag); if (!config.shouldOverwrite(filename) && new File(filename).exists()) { + LOGGER.info("Skipped overwriting " + filename); continue; } @@ -521,6 +527,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } String outputFilename = outputFolder + File.separator + support.destinationFilename; if (!config.shouldOverwrite(outputFilename)) { + LOGGER.info("Skipped overwriting " + outputFilename); continue; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java index 828cd0eb7190..e81aa717262e 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java @@ -642,4 +642,11 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { public void setGemAuthorEmail(String gemAuthorEmail) { this.gemAuthorEmail = gemAuthorEmail; } + + + @Override + public boolean shouldOverwrite(String filename) { + // skip spec file as the file might have been updated with new test cases + return super.shouldOverwrite(filename) && !filename.endsWith("_spec.rb"); + } } diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index cab06a92ce16..da8816ec7113 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-26T10:05:22.048-07:00 +- Build date: 2016-04-29T11:03:36.514+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -57,7 +57,7 @@ require 'petstore' api_instance = Petstore::FakeApi.new -number = "number_example" # String | None +number = 3.4 # Float | None double = 1.2 # Float | None diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md index a7c0b42a4759..32f2902d930a 100644 --- a/samples/client/petstore/ruby/docs/FakeApi.md +++ b/samples/client/petstore/ruby/docs/FakeApi.md @@ -21,7 +21,7 @@ require 'petstore' api_instance = Petstore::FakeApi.new -number = "number_example" # String | None +number = 3.4 # Float | None double = 1.2 # Float | None @@ -52,7 +52,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **String**| None | + **number** | **Float**| None | **double** | **Float**| None | **string** | **String**| None | **byte** | **String**| None | diff --git a/samples/client/petstore/ruby/docs/FormatTest.md b/samples/client/petstore/ruby/docs/FormatTest.md index 7197a7a6584f..014f2431f122 100644 --- a/samples/client/petstore/ruby/docs/FormatTest.md +++ b/samples/client/petstore/ruby/docs/FormatTest.md @@ -14,6 +14,7 @@ Name | Type | Description | Notes **binary** | **String** | | [optional] **date** | **Date** | | **date_time** | **DateTime** | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index a7ebd095f9d4..807a8f4d605b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -40,6 +40,8 @@ module Petstore attr_accessor :date_time + attr_accessor :uuid + attr_accessor :password # Attribute mapping from ruby-style variable name to JSON key. @@ -56,6 +58,7 @@ module Petstore :'binary' => :'binary', :'date' => :'date', :'date_time' => :'dateTime', + :'uuid' => :'uuid', :'password' => :'password' } end @@ -74,6 +77,7 @@ module Petstore :'binary' => :'String', :'date' => :'Date', :'date_time' => :'DateTime', + :'uuid' => :'UUID', :'password' => :'String' } end @@ -130,6 +134,10 @@ module Petstore self.date_time = attributes[:'dateTime'] end + if attributes.has_key?(:'uuid') + self.uuid = attributes[:'uuid'] + end + if attributes.has_key?(:'password') self.password = attributes[:'password'] end @@ -354,6 +362,7 @@ module Petstore binary == o.binary && date == o.date && date_time == o.date_time && + uuid == o.uuid && password == o.password end @@ -366,7 +375,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [integer, int32, int64, number, float, double, string, byte, binary, date, date_time, password].hash + [integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password].hash end # Builds the object from hash From 0d0ff13e837c4ed88ea4d4d8fe6bf2a3a207871b Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Thu, 28 Apr 2016 21:39:56 -0700 Subject: [PATCH 028/170] added test.go backup file --- samples/client/petstore/go/test.go.bak.go | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 samples/client/petstore/go/test.go.bak.go diff --git a/samples/client/petstore/go/test.go.bak.go b/samples/client/petstore/go/test.go.bak.go new file mode 100644 index 000000000000..54e14b9c7a04 --- /dev/null +++ b/samples/client/petstore/go/test.go.bak.go @@ -0,0 +1,30 @@ +package main + +import ( + sw "./go-petstore" + "encoding/json" + "fmt" +) + +func main() { + + s := sw.NewPetApi() + + // test POST(body) + newPet := (sw.Pet{Id: 12830, Name: "gopher", + PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"}) + + jsonNewPet, _ := json.Marshal(newPet) + fmt.Println("newPet:", string(jsonNewPet)) + s.AddPet(newPet) + + // test POST(form) + s.UpdatePetWithForm(12830, "golang", "available") + + // test GET + resp, apiResponse, err := s.GetPetById(12830) + fmt.Println("GetPetById: ", resp, err, apiResponse) + + err2, apiResponse2 := s.DeletePet(12830, "") + fmt.Println("DeletePet: ", err2, apiResponse2) +} From 2cb498d9fbb334c27d798eb4c1d2a73b99e2c191 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Thu, 28 Apr 2016 21:42:04 -0700 Subject: [PATCH 029/170] renamed file --- samples/client/petstore/go/test.go.bak.go | 30 ----------------------- 1 file changed, 30 deletions(-) delete mode 100644 samples/client/petstore/go/test.go.bak.go diff --git a/samples/client/petstore/go/test.go.bak.go b/samples/client/petstore/go/test.go.bak.go deleted file mode 100644 index 54e14b9c7a04..000000000000 --- a/samples/client/petstore/go/test.go.bak.go +++ /dev/null @@ -1,30 +0,0 @@ -package main - -import ( - sw "./go-petstore" - "encoding/json" - "fmt" -) - -func main() { - - s := sw.NewPetApi() - - // test POST(body) - newPet := (sw.Pet{Id: 12830, Name: "gopher", - PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"}) - - jsonNewPet, _ := json.Marshal(newPet) - fmt.Println("newPet:", string(jsonNewPet)) - s.AddPet(newPet) - - // test POST(form) - s.UpdatePetWithForm(12830, "golang", "available") - - // test GET - resp, apiResponse, err := s.GetPetById(12830) - fmt.Println("GetPetById: ", resp, err, apiResponse) - - err2, apiResponse2 := s.DeletePet(12830, "") - fmt.Println("DeletePet: ", err2, apiResponse2) -} From 20bb1aa869d9caeb5d3bbcad621479c2be40b3ab Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Thu, 28 Apr 2016 21:43:14 -0700 Subject: [PATCH 030/170] added test.go.bak --- samples/client/petstore/go/test.go.bak | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 samples/client/petstore/go/test.go.bak diff --git a/samples/client/petstore/go/test.go.bak b/samples/client/petstore/go/test.go.bak new file mode 100644 index 000000000000..54e14b9c7a04 --- /dev/null +++ b/samples/client/petstore/go/test.go.bak @@ -0,0 +1,30 @@ +package main + +import ( + sw "./go-petstore" + "encoding/json" + "fmt" +) + +func main() { + + s := sw.NewPetApi() + + // test POST(body) + newPet := (sw.Pet{Id: 12830, Name: "gopher", + PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"}) + + jsonNewPet, _ := json.Marshal(newPet) + fmt.Println("newPet:", string(jsonNewPet)) + s.AddPet(newPet) + + // test POST(form) + s.UpdatePetWithForm(12830, "golang", "available") + + // test GET + resp, apiResponse, err := s.GetPetById(12830) + fmt.Println("GetPetById: ", resp, err, apiResponse) + + err2, apiResponse2 := s.DeletePet(12830, "") + fmt.Println("DeletePet: ", err2, apiResponse2) +} From a6e45bf97dfc25852dbabe0d24d9b6260dd9ebb0 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Fri, 29 Apr 2016 15:59:21 -0700 Subject: [PATCH 031/170] added user api test --- samples/client/petstore/go/user_api_test.go | 161 ++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 samples/client/petstore/go/user_api_test.go diff --git a/samples/client/petstore/go/user_api_test.go b/samples/client/petstore/go/user_api_test.go new file mode 100644 index 000000000000..38245f23e3da --- /dev/null +++ b/samples/client/petstore/go/user_api_test.go @@ -0,0 +1,161 @@ +package main + +import ( + sw "./go-petstore" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestCreateUser(t *testing.T) { + s := sw.NewUserApi() + newUser := sw.User{ + Id: 1000, + FirstName: "gopher", + LastName : "lang", + Username : "gopher", + Password : "lang", + Email : "lang@test.com", + Phone : "5101112222", + UserStatus: 1} + + apiResponse, err := s.CreateUser(newUser) + + if err != nil { + t.Errorf("Error while adding user") + t.Log(err) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } +} + +// func TestCreateUsersWithArrayInput(t *testing.T) { +// s := sw.NewUserApi() +// newUsers := []sw.User{ +// sw.User { +// Id: int64(1001), +// FirstName: "gopher1", +// LastName : "lang1", +// Username : "gopher1", +// Password : "lang1", +// Email : "lang1@test.com", +// Phone : "5101112222", +// UserStatus: int32(1), +// }, +// sw.User { +// Id: int64(1002), +// FirstName: "gopher2", +// LastName : "lang2", +// Username : "gopher2", +// Password : "lang2", +// Email : "lang2@test.com", +// Phone : "5101112222", +// UserStatus: int32(1), +// }, +// } + +// apiResponse, err := s.CreateUsersWithArrayInput(newUsers) + +// if err != nil { +// t.Errorf("Error while adding users") +// t.Log(err) +// } +// if apiResponse.Response.StatusCode != 200 { +// t.Log(apiResponse.Response) +// } + +// //tear down +// _, err1 := s.DeleteUser("gopher1") +// if(err1 != nil){ +// t.Errorf("Error while deleting user") +// t.Log(err1) +// } + +// _, err2 := s.DeleteUser("gopher2") +// if(err2 != nil){ +// t.Errorf("Error while deleting user") +// t.Log(err2) +// } +// } + +func TestGetUserByName(t *testing.T) { + assert := assert.New(t) + + s := sw.NewUserApi() + resp, apiResponse, err := s.GetUserByName("gopher") + if err != nil { + t.Errorf("Error while getting pet by id") + t.Log(err) + } else { + assert.Equal(resp.Id, int64(1000), "User id should be equal") + assert.Equal(resp.Username, "gopher", "User name should be gopher") + assert.Equal(resp.LastName, "lang", "Last name should be lang") + //t.Log(resp) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } +} + +func TestGetUserByNameWithInvalidID(t *testing.T) { + s := sw.NewUserApi() + resp, apiResponse, err := s.GetUserByName("999999999") + if err != nil { + t.Errorf("Error while getting pet by invalid id") + t.Log(err) + t.Log(apiResponse) + } else { + t.Log(resp) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } +} + +func TestUpdateUser(t *testing.T) { + assert := assert.New(t) + s := sw.NewUserApi() + newUser := sw.User{ + Id: 1000, + FirstName: "gopher20", + LastName : "lang20", + Username : "gopher", + Password : "lang", + Email : "lang@test.com", + Phone : "5101112222", + UserStatus: 1} + + apiResponse, err := s.UpdateUser("gopher", newUser) + + if err != nil { + t.Errorf("Error while deleting pet by id") + t.Log(err) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } + + //verify changings are correct + resp, apiResponse, err := s.GetUserByName("gopher") + if err != nil { + t.Errorf("Error while getting pet by id") + t.Log(err) + } else { + assert.Equal(resp.Id, int64(1000), "User id should be equal") + assert.Equal(resp.FirstName, "gopher20", "User name should be gopher") + assert.Equal(resp.Password, "lang", "User name should be the same") + } +} + +func TestDeleteUser(t *testing.T) { + s := sw.NewUserApi() + apiResponse, err := s.DeleteUser("gopher") + + if err != nil { + t.Errorf("Error while deleting user") + t.Log(err) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } +} \ No newline at end of file From ad28879fce642243c9e557bacf69d2ea5d8c0e7f Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Fri, 29 Apr 2016 16:02:41 -0700 Subject: [PATCH 032/170] changed tabs to spaces --- samples/client/petstore/go/user_api_test.go | 258 ++++++++++---------- 1 file changed, 129 insertions(+), 129 deletions(-) diff --git a/samples/client/petstore/go/user_api_test.go b/samples/client/petstore/go/user_api_test.go index 38245f23e3da..ecc59c6f06e2 100644 --- a/samples/client/petstore/go/user_api_test.go +++ b/samples/client/petstore/go/user_api_test.go @@ -1,161 +1,161 @@ package main import ( - sw "./go-petstore" - "github.com/stretchr/testify/assert" - "testing" + sw "./go-petstore" + "github.com/stretchr/testify/assert" + "testing" ) func TestCreateUser(t *testing.T) { - s := sw.NewUserApi() - newUser := sw.User{ - Id: 1000, - FirstName: "gopher", - LastName : "lang", - Username : "gopher", - Password : "lang", - Email : "lang@test.com", - Phone : "5101112222", - UserStatus: 1} + s := sw.NewUserApi() + newUser := sw.User{ + Id: 1000, + FirstName: "gopher", + LastName : "lang", + Username : "gopher", + Password : "lang", + Email : "lang@test.com", + Phone : "5101112222", + UserStatus: 1} - apiResponse, err := s.CreateUser(newUser) + apiResponse, err := s.CreateUser(newUser) - if err != nil { - t.Errorf("Error while adding user") - t.Log(err) - } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) - } + if err != nil { + t.Errorf("Error while adding user") + t.Log(err) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } } // func TestCreateUsersWithArrayInput(t *testing.T) { -// s := sw.NewUserApi() -// newUsers := []sw.User{ -// sw.User { -// Id: int64(1001), -// FirstName: "gopher1", -// LastName : "lang1", -// Username : "gopher1", -// Password : "lang1", -// Email : "lang1@test.com", -// Phone : "5101112222", -// UserStatus: int32(1), -// }, -// sw.User { -// Id: int64(1002), -// FirstName: "gopher2", -// LastName : "lang2", -// Username : "gopher2", -// Password : "lang2", -// Email : "lang2@test.com", -// Phone : "5101112222", -// UserStatus: int32(1), -// }, -// } - -// apiResponse, err := s.CreateUsersWithArrayInput(newUsers) +// s := sw.NewUserApi() +// newUsers := []sw.User{ +// sw.User { +// Id: int64(1001), +// FirstName: "gopher1", +// LastName : "lang1", +// Username : "gopher1", +// Password : "lang1", +// Email : "lang1@test.com", +// Phone : "5101112222", +// UserStatus: int32(1), +// }, +// sw.User { +// Id: int64(1002), +// FirstName: "gopher2", +// LastName : "lang2", +// Username : "gopher2", +// Password : "lang2", +// Email : "lang2@test.com", +// Phone : "5101112222", +// UserStatus: int32(1), +// }, +// } + +// apiResponse, err := s.CreateUsersWithArrayInput(newUsers) -// if err != nil { -// t.Errorf("Error while adding users") -// t.Log(err) -// } -// if apiResponse.Response.StatusCode != 200 { -// t.Log(apiResponse.Response) -// } +// if err != nil { +// t.Errorf("Error while adding users") +// t.Log(err) +// } +// if apiResponse.Response.StatusCode != 200 { +// t.Log(apiResponse.Response) +// } -// //tear down -// _, err1 := s.DeleteUser("gopher1") -// if(err1 != nil){ -// t.Errorf("Error while deleting user") -// t.Log(err1) -// } +// //tear down +// _, err1 := s.DeleteUser("gopher1") +// if(err1 != nil){ +// t.Errorf("Error while deleting user") +// t.Log(err1) +// } -// _, err2 := s.DeleteUser("gopher2") -// if(err2 != nil){ -// t.Errorf("Error while deleting user") -// t.Log(err2) -// } +// _, err2 := s.DeleteUser("gopher2") +// if(err2 != nil){ +// t.Errorf("Error while deleting user") +// t.Log(err2) +// } // } func TestGetUserByName(t *testing.T) { - assert := assert.New(t) + assert := assert.New(t) - s := sw.NewUserApi() - resp, apiResponse, err := s.GetUserByName("gopher") - if err != nil { - t.Errorf("Error while getting pet by id") - t.Log(err) - } else { - assert.Equal(resp.Id, int64(1000), "User id should be equal") - assert.Equal(resp.Username, "gopher", "User name should be gopher") - assert.Equal(resp.LastName, "lang", "Last name should be lang") - //t.Log(resp) - } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) - } + s := sw.NewUserApi() + resp, apiResponse, err := s.GetUserByName("gopher") + if err != nil { + t.Errorf("Error while getting pet by id") + t.Log(err) + } else { + assert.Equal(resp.Id, int64(1000), "User id should be equal") + assert.Equal(resp.Username, "gopher", "User name should be gopher") + assert.Equal(resp.LastName, "lang", "Last name should be lang") + //t.Log(resp) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } } func TestGetUserByNameWithInvalidID(t *testing.T) { - s := sw.NewUserApi() - resp, apiResponse, err := s.GetUserByName("999999999") - if err != nil { - t.Errorf("Error while getting pet by invalid id") - t.Log(err) - t.Log(apiResponse) - } else { - t.Log(resp) - } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) - } + s := sw.NewUserApi() + resp, apiResponse, err := s.GetUserByName("999999999") + if err != nil { + t.Errorf("Error while getting pet by invalid id") + t.Log(err) + t.Log(apiResponse) + } else { + t.Log(resp) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } } func TestUpdateUser(t *testing.T) { - assert := assert.New(t) - s := sw.NewUserApi() - newUser := sw.User{ - Id: 1000, - FirstName: "gopher20", - LastName : "lang20", - Username : "gopher", - Password : "lang", - Email : "lang@test.com", - Phone : "5101112222", - UserStatus: 1} + assert := assert.New(t) + s := sw.NewUserApi() + newUser := sw.User{ + Id: 1000, + FirstName: "gopher20", + LastName : "lang20", + Username : "gopher", + Password : "lang", + Email : "lang@test.com", + Phone : "5101112222", + UserStatus: 1} - apiResponse, err := s.UpdateUser("gopher", newUser) + apiResponse, err := s.UpdateUser("gopher", newUser) - if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) - } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) - } + if err != nil { + t.Errorf("Error while deleting pet by id") + t.Log(err) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } - //verify changings are correct - resp, apiResponse, err := s.GetUserByName("gopher") - if err != nil { - t.Errorf("Error while getting pet by id") - t.Log(err) - } else { - assert.Equal(resp.Id, int64(1000), "User id should be equal") - assert.Equal(resp.FirstName, "gopher20", "User name should be gopher") - assert.Equal(resp.Password, "lang", "User name should be the same") - } + //verify changings are correct + resp, apiResponse, err := s.GetUserByName("gopher") + if err != nil { + t.Errorf("Error while getting pet by id") + t.Log(err) + } else { + assert.Equal(resp.Id, int64(1000), "User id should be equal") + assert.Equal(resp.FirstName, "gopher20", "User name should be gopher") + assert.Equal(resp.Password, "lang", "User name should be the same") + } } func TestDeleteUser(t *testing.T) { - s := sw.NewUserApi() - apiResponse, err := s.DeleteUser("gopher") + s := sw.NewUserApi() + apiResponse, err := s.DeleteUser("gopher") - if err != nil { - t.Errorf("Error while deleting user") - t.Log(err) - } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) - } + if err != nil { + t.Errorf("Error while deleting user") + t.Log(err) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } } \ No newline at end of file From ed219f8a9a31be9bf3fd65ddcc43f2e6ebcf5cbd Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Fri, 29 Apr 2016 16:10:10 -0700 Subject: [PATCH 033/170] fix typo --- samples/client/petstore/go/user_api_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/client/petstore/go/user_api_test.go b/samples/client/petstore/go/user_api_test.go index ecc59c6f06e2..cf7a4f596152 100644 --- a/samples/client/petstore/go/user_api_test.go +++ b/samples/client/petstore/go/user_api_test.go @@ -84,7 +84,7 @@ func TestGetUserByName(t *testing.T) { s := sw.NewUserApi() resp, apiResponse, err := s.GetUserByName("gopher") if err != nil { - t.Errorf("Error while getting pet by id") + t.Errorf("Error while getting user by id") t.Log(err) } else { assert.Equal(resp.Id, int64(1000), "User id should be equal") @@ -101,7 +101,7 @@ func TestGetUserByNameWithInvalidID(t *testing.T) { s := sw.NewUserApi() resp, apiResponse, err := s.GetUserByName("999999999") if err != nil { - t.Errorf("Error while getting pet by invalid id") + t.Errorf("Error while getting user by invalid id") t.Log(err) t.Log(apiResponse) } else { @@ -128,7 +128,7 @@ func TestUpdateUser(t *testing.T) { apiResponse, err := s.UpdateUser("gopher", newUser) if err != nil { - t.Errorf("Error while deleting pet by id") + t.Errorf("Error while deleting user by id") t.Log(err) } if apiResponse.Response.StatusCode != 200 { @@ -138,7 +138,7 @@ func TestUpdateUser(t *testing.T) { //verify changings are correct resp, apiResponse, err := s.GetUserByName("gopher") if err != nil { - t.Errorf("Error while getting pet by id") + t.Errorf("Error while getting user by id") t.Log(err) } else { assert.Equal(resp.Id, int64(1000), "User id should be equal") From 09248bcd25ec27728eaec95439357fe03d693c1c Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Fri, 29 Apr 2016 16:17:18 -0700 Subject: [PATCH 034/170] added comments for skip test --- samples/client/petstore/go/user_api_test.go | 89 +++++++++++---------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/samples/client/petstore/go/user_api_test.go b/samples/client/petstore/go/user_api_test.go index cf7a4f596152..747bde0be7ec 100644 --- a/samples/client/petstore/go/user_api_test.go +++ b/samples/client/petstore/go/user_api_test.go @@ -29,54 +29,55 @@ func TestCreateUser(t *testing.T) { } } -// func TestCreateUsersWithArrayInput(t *testing.T) { -// s := sw.NewUserApi() -// newUsers := []sw.User{ -// sw.User { -// Id: int64(1001), -// FirstName: "gopher1", -// LastName : "lang1", -// Username : "gopher1", -// Password : "lang1", -// Email : "lang1@test.com", -// Phone : "5101112222", -// UserStatus: int32(1), -// }, -// sw.User { -// Id: int64(1002), -// FirstName: "gopher2", -// LastName : "lang2", -// Username : "gopher2", -// Password : "lang2", -// Email : "lang2@test.com", -// Phone : "5101112222", -// UserStatus: int32(1), -// }, -// } +//adding x to skip the test, currently it is failing +func xTestCreateUsersWithArrayInput(t *testing.T) { + s := sw.NewUserApi() + newUsers := []sw.User{ + sw.User { + Id: int64(1001), + FirstName: "gopher1", + LastName : "lang1", + Username : "gopher1", + Password : "lang1", + Email : "lang1@test.com", + Phone : "5101112222", + UserStatus: int32(1), + }, + sw.User { + Id: int64(1002), + FirstName: "gopher2", + LastName : "lang2", + Username : "gopher2", + Password : "lang2", + Email : "lang2@test.com", + Phone : "5101112222", + UserStatus: int32(1), + }, + } -// apiResponse, err := s.CreateUsersWithArrayInput(newUsers) + apiResponse, err := s.CreateUsersWithArrayInput(newUsers) -// if err != nil { -// t.Errorf("Error while adding users") -// t.Log(err) -// } -// if apiResponse.Response.StatusCode != 200 { -// t.Log(apiResponse.Response) -// } + if err != nil { + t.Errorf("Error while adding users") + t.Log(err) + } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } -// //tear down -// _, err1 := s.DeleteUser("gopher1") -// if(err1 != nil){ -// t.Errorf("Error while deleting user") -// t.Log(err1) -// } + //tear down + _, err1 := s.DeleteUser("gopher1") + if(err1 != nil){ + t.Errorf("Error while deleting user") + t.Log(err1) + } -// _, err2 := s.DeleteUser("gopher2") -// if(err2 != nil){ -// t.Errorf("Error while deleting user") -// t.Log(err2) -// } -// } + _, err2 := s.DeleteUser("gopher2") + if(err2 != nil){ + t.Errorf("Error while deleting user") + t.Log(err2) + } +} func TestGetUserByName(t *testing.T) { assert := assert.New(t) From 83567861e0987f731db3ecde4eee20b3f975d036 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 30 Apr 2016 20:15:45 +0800 Subject: [PATCH 035/170] update JS readme to use gitUserId instead --- .../main/resources/Javascript/README.mustache | 4 +- samples/client/petstore/javascript/README.md | 48 +--- .../client/petstore/javascript/docs/PetApi.md | 251 +++--------------- .../petstore/javascript/docs/StoreApi.md | 167 ++---------- .../petstore/javascript/docs/UserApi.md | 60 ++--- .../petstore/javascript/src/ApiClient.js | 5 - .../petstore/javascript/src/api/PetApi.js | 145 +--------- .../petstore/javascript/src/api/StoreApi.js | 86 +----- .../petstore/javascript/src/api/UserApi.js | 2 +- .../client/petstore/javascript/src/index.js | 51 +--- 10 files changed, 101 insertions(+), 718 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache index 37282d5a24c2..7136e9f326a9 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache @@ -32,11 +32,11 @@ npm install {{{projectName}}} --save #### git # If the library is hosted at a git repository, e.g. -https://github.com/{{#gitUserName}}{{.}}{{/gitUserName}}{{^gitUserName}}YOUR_USERNAME{{/gitUserName}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} +https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} then install it via: ```shell -npm install {{#gitUserName}}{{.}}{{/gitUserName}}{{^gitUserName}}YOUR_USERNAME{{/gitUserName}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} --save + npm install {{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} --save ``` ### For browser diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index c57237d7cebd..3c23ae243f11 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T22:17:15.122+08:00 +- Build date: 2016-04-30T20:15:39.280+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -27,11 +27,11 @@ npm install swagger-petstore --save #### git # If the library is hosted at a git repository, e.g. -https://github.com/YOUR_USERNAME/YOUR_GIT_REPO_ID +https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID then install it via: ```shell -npm install YOUR_USERNAME/YOUR_GIT_REPO_ID --save + npm install YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID --save ``` ### For browser @@ -83,20 +83,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -*SwaggerPetstore.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 *SwaggerPetstore.PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet *SwaggerPetstore.PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *SwaggerPetstore.PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *SwaggerPetstore.PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -*SwaggerPetstore.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' -*SwaggerPetstore.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' *SwaggerPetstore.PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet *SwaggerPetstore.PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data *SwaggerPetstore.PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image *SwaggerPetstore.StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*SwaggerPetstore.StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status *SwaggerPetstore.StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -*SwaggerPetstore.StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *SwaggerPetstore.StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID *SwaggerPetstore.StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet *SwaggerPetstore.UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user @@ -111,18 +106,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [SwaggerPetstore.Animal](docs/Animal.md) - - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) - - [SwaggerPetstore.Dog](docs/Dog.md) - - [SwaggerPetstore.FormatTest](docs/FormatTest.md) - - [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md) - - [SwaggerPetstore.Model200Response](docs/Model200Response.md) - - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) - - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.Order](docs/Order.md) - [SwaggerPetstore.Pet](docs/Pet.md) - - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) - [SwaggerPetstore.Tag](docs/Tag.md) - [SwaggerPetstore.User](docs/User.md) @@ -130,40 +116,12 @@ 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 diff --git a/samples/client/petstore/javascript/docs/PetApi.md b/samples/client/petstore/javascript/docs/PetApi.md index 35a760e218be..39b8726b0b63 100644 --- a/samples/client/petstore/javascript/docs/PetApi.md +++ b/samples/client/petstore/javascript/docs/PetApi.md @@ -5,13 +5,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**addPetUsingByteArray**](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 [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**getPetByIdInObject**](PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -[**petPetIdtestingByteArraytrueGet**](PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -32,12 +29,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store }; var callback = function(error, data, response) { @@ -47,7 +44,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.addPet(opts, callback); +apiInstance.addPet(opts, callback); ``` ### Parameters @@ -64,58 +61,6 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - - -# **addPetUsingByteArray** -> addPetUsingByteArray(opts) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var opts = { - 'body': "B" // {String} Pet object in the form of byte array -}; - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully.'); - } -}; -api.addPetUsingByteArray(opts, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **String**| Pet object in the form of byte array | [optional] - -### Return type - -null (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - ### HTTP request headers - **Content-Type**: application/json, application/xml @@ -136,14 +81,14 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} Pet id to delete +var petId = 789; // Integer | Pet id to delete var opts = { - 'apiKey': "apiKey_example" // {String} + 'apiKey': "apiKey_example" // String | }; var callback = function(error, data, response) { @@ -153,7 +98,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.deletePet(petId, opts, callback); +apiInstance.deletePet(petId, opts, callback); ``` ### Parameters @@ -182,7 +127,7 @@ null (empty response body) Finds Pets by status -Multiple status values can be provided with comma separated strings +Multiple status values can be provided with comma seperated strings ### Example ```javascript @@ -191,12 +136,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'status': ["available"] // {[String]} Status values that need to be considered for query + 'status': ["available"] // [String] | Status values that need to be considered for filter }; var callback = function(error, data, response) { @@ -206,14 +151,14 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.findPetsByStatus(opts, callback); +apiInstance.findPetsByStatus(opts, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**[String]**](String.md)| Status values that need to be considered for query | [optional] [default to available] + **status** | [**[String]**](String.md)| Status values that need to be considered for filter | [optional] [default to available] ### Return type @@ -243,12 +188,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'tags': ["tags_example"] // {[String]} Tags to filter by + 'tags': ["tags_example"] // [String] | Tags to filter by }; var callback = function(error, data, response) { @@ -258,7 +203,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.findPetsByTags(opts, callback); +apiInstance.findPetsByTags(opts, callback); ``` ### Parameters @@ -295,17 +240,17 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" +api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" +//api_key.apiKeyPrefix = 'Token'; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} ID of pet that needs to be fetched +var petId = 789; // Integer | ID of pet that needs to be fetched var callback = function(error, data, response) { @@ -315,7 +260,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.getPetById(petId, callback); +apiInstance.getPetById(petId, callback); ``` ### Parameters @@ -332,120 +277,6 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **getPetByIdInObject** -> InlineResponse200 getPetByIdInObject(petId) - -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 - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.getPetByIdInObject(petId, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | - -### Return type - -[**InlineResponse200**](InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **petPetIdtestingByteArraytrueGet** -> 'String' petPetIdtestingByteArraytrueGet(petId) - -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 - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.petPetIdtestingByteArraytrueGet(petId, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | - -### Return type - -**'String'** - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - ### HTTP request headers - **Content-Type**: Not defined @@ -466,12 +297,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store }; var callback = function(error, data, response) { @@ -481,7 +312,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.updatePet(opts, callback); +apiInstance.updatePet(opts, callback); ``` ### Parameters @@ -518,15 +349,15 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = "petId_example"; // {String} ID of pet that needs to be updated +var petId = "petId_example"; // String | ID of pet that needs to be updated var opts = { - 'name': "name_example", // {String} Updated name of the pet - 'status': "status_example" // {String} Updated status of the pet + 'name': "name_example", // String | Updated name of the pet + 'status': "status_example" // String | Updated status of the pet }; var callback = function(error, data, response) { @@ -536,7 +367,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.updatePetWithForm(petId, opts, callback); +apiInstance.updatePetWithForm(petId, opts, callback); ``` ### Parameters @@ -575,15 +406,15 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} ID of pet to update +var petId = 789; // Integer | ID of pet to update var opts = { - 'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server - 'file': "/path/to/file.txt" // {File} file to upload + 'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server + 'file': "/path/to/file.txt" // File | file to upload }; var callback = function(error, data, response) { @@ -593,7 +424,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.uploadFile(petId, opts, callback); +apiInstance.uploadFile(petId, opts, callback); ``` ### Parameters diff --git a/samples/client/petstore/javascript/docs/StoreApi.md b/samples/client/petstore/javascript/docs/StoreApi.md index 6ad8406dfc9b..563157be5b0d 100644 --- a/samples/client/petstore/javascript/docs/StoreApi.md +++ b/samples/client/petstore/javascript/docs/StoreApi.md @@ -5,9 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**findOrdersByStatus**](StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getInventoryInObject**](StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet @@ -24,9 +22,9 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted +var orderId = "orderId_example"; // String | ID of the order that needs to be deleted var callback = function(error, data, response) { @@ -36,7 +34,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.deleteOrder(orderId, callback); +apiInstance.deleteOrder(orderId, callback); ``` ### Parameters @@ -53,66 +51,6 @@ null (empty response body) No authorization required -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **findOrdersByStatus** -> [Order] findOrdersByStatus(opts) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var opts = { - 'status': "placed" // {String} Status value that needs to be considered for query -}; - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.findOrdersByStatus(opts, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **String**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**[Order]**](Order.md) - -### Authorization - -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) - ### HTTP request headers - **Content-Type**: Not defined @@ -120,7 +58,7 @@ Name | Type | Description | Notes # **getInventory** -> {'String': 'Integer'} getInventory +> {'String': 'Integer'} getInventory() Returns pet inventories by status @@ -133,11 +71,11 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" +api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" +//api_key.apiKeyPrefix = 'Token'; -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); var callback = function(error, data, response) { if (error) { @@ -146,7 +84,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.getInventory(callback); +apiInstance.getInventory(callback); ``` ### Parameters @@ -160,53 +98,6 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **getInventoryInObject** -> Object getInventoryInObject - -Fake endpoint to test arbitrary object return by 'Get inventory' - -Returns an arbitrary object which is actually a map of status codes to quantities - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.getInventoryInObject(callback); -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Object** - -### Authorization - -[api_key](../README.md#api_key) - ### HTTP request headers - **Content-Type**: Not defined @@ -223,23 +114,10 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure API key authorization: test_api_key_header -var test_api_key_header = defaultClient.authentications['test_api_key_header']; -test_api_key_header.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_key_header.apiKeyPrefix['test_api_key_header'] = "Token" +var apiInstance = new SwaggerPetstore.StoreApi(); -// Configure API key authorization: test_api_key_query -var test_api_key_query = defaultClient.authentications['test_api_key_query']; -test_api_key_query.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched +var orderId = "orderId_example"; // String | ID of pet that needs to be fetched var callback = function(error, data, response) { @@ -249,7 +127,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.getOrderById(orderId, callback); +apiInstance.getOrderById(orderId, callback); ``` ### Parameters @@ -264,7 +142,7 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) +No authorization required ### HTTP request headers @@ -282,24 +160,11 @@ Place an order for a pet ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); var opts = { - 'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet + 'body': new SwaggerPetstore.Order() // Order | order placed for purchasing the pet }; var callback = function(error, data, response) { @@ -309,7 +174,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.placeOrder(opts, callback); +apiInstance.placeOrder(opts, callback); ``` ### Parameters @@ -324,7 +189,7 @@ Name | Type | Description | Notes ### Authorization -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) +No authorization required ### HTTP request headers diff --git a/samples/client/petstore/javascript/docs/UserApi.md b/samples/client/petstore/javascript/docs/UserApi.md index 4e990c894263..5f9faae29b57 100644 --- a/samples/client/petstore/javascript/docs/UserApi.md +++ b/samples/client/petstore/javascript/docs/UserApi.md @@ -26,10 +26,10 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': new SwaggerPetstore.User() // {User} Created user object + 'body': new SwaggerPetstore.User() // User | Created user object }; var callback = function(error, data, response) { @@ -39,7 +39,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.createUser(opts, callback); +apiInstance.createUser(opts, callback); ``` ### Parameters @@ -73,10 +73,10 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': [new SwaggerPetstore.User()] // {[User]} List of user object + 'body': [new SwaggerPetstore.User()] // [User] | List of user object }; var callback = function(error, data, response) { @@ -86,7 +86,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.createUsersWithArrayInput(opts, callback); +apiInstance.createUsersWithArrayInput(opts, callback); ``` ### Parameters @@ -120,10 +120,10 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': [new SwaggerPetstore.User()] // {[User]} List of user object + 'body': [new SwaggerPetstore.User()] // [User] | List of user object }; var callback = function(error, data, response) { @@ -133,7 +133,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.createUsersWithListInput(opts, callback); +apiInstance.createUsersWithListInput(opts, callback); ``` ### Parameters @@ -166,16 +166,10 @@ This can only be done by the logged in user. ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure HTTP basic authorization: test_http_basic -var test_http_basic = defaultClient.authentications['test_http_basic']; -test_http_basic.username = 'YOUR USERNAME' -test_http_basic.password = 'YOUR PASSWORD' +var apiInstance = new SwaggerPetstore.UserApi(); -var apiInstance = new SwaggerPetstore.UserApi() - -var username = "username_example"; // {String} The name that needs to be deleted +var username = "username_example"; // String | The name that needs to be deleted var callback = function(error, data, response) { @@ -185,7 +179,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.deleteUser(username, callback); +apiInstance.deleteUser(username, callback); ``` ### Parameters @@ -200,7 +194,7 @@ null (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers @@ -219,9 +213,9 @@ Get user by user name ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing. +var username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. var callback = function(error, data, response) { @@ -231,7 +225,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.getUserByName(username, callback); +apiInstance.getUserByName(username, callback); ``` ### Parameters @@ -265,11 +259,11 @@ Logs user into the system ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'username': "username_example", // {String} The user name for login - 'password': "password_example" // {String} The password for login in clear text + 'username': "username_example", // String | The user name for login + 'password': "password_example" // String | The password for login in clear text }; var callback = function(error, data, response) { @@ -279,7 +273,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.loginUser(opts, callback); +apiInstance.loginUser(opts, callback); ``` ### Parameters @@ -304,7 +298,7 @@ No authorization required # **logoutUser** -> logoutUser +> logoutUser() Logs out current logged in user session @@ -314,7 +308,7 @@ Logs out current logged in user session ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var callback = function(error, data, response) { if (error) { @@ -323,7 +317,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.logoutUser(callback); +apiInstance.logoutUser(callback); ``` ### Parameters @@ -354,12 +348,12 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // {String} name that need to be deleted +var username = "username_example"; // String | name that need to be deleted var opts = { - 'body': new SwaggerPetstore.User() // {User} Updated user object + 'body': new SwaggerPetstore.User() // User | Updated user object }; var callback = function(error, data, response) { @@ -369,7 +363,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.updateUser(username, opts, callback); +apiInstance.updateUser(username, opts, callback); ``` ### Parameters diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index 2b6c0c5b1922..f8c45a6680f8 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -40,12 +40,7 @@ * @type {Array.} */ this.authentications = { - 'test_api_key_header': {type: 'apiKey', 'in': 'header', name: 'test_api_key_header'}, 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'test_http_basic': {type: 'basic'}, - 'test_api_client_secret': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_secret'}, - 'test_api_client_id': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_id'}, - 'test_api_key_query': {type: 'apiKey', 'in': 'query', name: 'test_api_key_query'}, 'petstore_auth': {type: 'oauth2'} }; /** diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index 3bfc6ffd4f08..3e55e3264ba5 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -1,18 +1,18 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Pet', '../model/InlineResponse200'], factory); + define(['../ApiClient', '../model/Pet'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/Pet'), require('../model/InlineResponse200')); + module.exports = factory(require('../ApiClient'), require('../model/Pet')); } else { // Browser globals (root is window) if (!root.SwaggerPetstore) { root.SwaggerPetstore = {}; } - root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet, root.SwaggerPetstore.InlineResponse200); + root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet); } -}(this, function(ApiClient, Pet, InlineResponse200) { +}(this, function(ApiClient, Pet) { 'use strict'; /** @@ -73,47 +73,6 @@ ); } - /** - * Callback function to receive the result of the addPetUsingByteArray operation. - * @callback module:api/PetApi~addPetUsingByteArrayCallback - * @param {String} error Error message, if any. - * @param data This operation does not return a value. - * @param {String} response The complete HTTP response. - */ - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param {Object} opts Optional parameters - * @param {String} opts.body Pet object in the form of byte array - * @param {module:api/PetApi~addPetUsingByteArrayCallback} callback The callback function, accepting three arguments: error, data, response - */ - this.addPetUsingByteArray = function(opts, callback) { - opts = opts || {}; - var postBody = opts['body']; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/pet?testing_byte_array=true', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - /** * Callback function to receive the result of the deletePet operation. * @callback module:api/PetApi~deletePetCallback @@ -173,9 +132,9 @@ /** * Finds Pets by status - * Multiple status values can be provided with comma separated strings + * Multiple status values can be provided with comma seperated strings * @param {Object} opts Optional parameters - * @param {Array.} opts.status Status values that need to be considered for query (default to available) + * @param {Array.} opts.status Status values that need to be considered for filter (default to available) * @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {Array.} */ @@ -295,98 +254,6 @@ ); } - /** - * Callback function to receive the result of the getPetByIdInObject operation. - * @callback module:api/PetApi~getPetByIdInObjectCallback - * @param {String} error Error message, if any. - * @param {module:model/InlineResponse200} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * 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 {Integer} petId ID of pet that needs to be fetched - * @param {module:api/PetApi~getPetByIdInObjectCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {module:model/InlineResponse200} - */ - this.getPetByIdInObject = function(petId, callback) { - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling getPetByIdInObject"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key', 'petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = InlineResponse200; - - return this.apiClient.callApi( - '/pet/{petId}?response=inline_arbitrary_object', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - - /** - * Callback function to receive the result of the petPetIdtestingByteArraytrueGet operation. - * @callback module:api/PetApi~petPetIdtestingByteArraytrueGetCallback - * @param {String} error Error message, if any. - * @param {'String'} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param {Integer} petId ID of pet that needs to be fetched - * @param {module:api/PetApi~petPetIdtestingByteArraytrueGetCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {'String'} - */ - this.petPetIdtestingByteArraytrueGet = function(petId, callback) { - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key', 'petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = 'String'; - - return this.apiClient.callApi( - '/pet/{petId}?testing_byte_array=true', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - /** * Callback function to receive the result of the updatePet operation. * @callback module:api/PetApi~updatePetCallback diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index cdda27abba41..7b9658346698 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -77,49 +77,6 @@ ); } - /** - * Callback function to receive the result of the findOrdersByStatus operation. - * @callback module:api/StoreApi~findOrdersByStatusCallback - * @param {String} error Error message, if any. - * @param {Array.} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * Finds orders by status - * A single status value can be provided as a string - * @param {Object} opts Optional parameters - * @param {module:model/String} opts.status Status value that needs to be considered for query (default to placed) - * @param {module:api/StoreApi~findOrdersByStatusCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {Array.} - */ - this.findOrdersByStatus = function(opts, callback) { - opts = opts || {}; - var postBody = null; - - - var pathParams = { - }; - var queryParams = { - 'status': opts['status'] - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['test_api_client_id', 'test_api_client_secret']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = [Order]; - - return this.apiClient.callApi( - '/store/findByStatus', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - /** * Callback function to receive the result of the getInventory operation. * @callback module:api/StoreApi~getInventoryCallback @@ -159,45 +116,6 @@ ); } - /** - * Callback function to receive the result of the getInventoryInObject operation. - * @callback module:api/StoreApi~getInventoryInObjectCallback - * @param {String} error Error message, if any. - * @param {Object} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @param {module:api/StoreApi~getInventoryInObjectCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {Object} - */ - this.getInventoryInObject = function(callback) { - var postBody = null; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = Object; - - return this.apiClient.callApi( - '/store/inventory?response=arbitrary_object', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - /** * Callback function to receive the result of the getOrderById operation. * @callback module:api/StoreApi~getOrderByIdCallback @@ -232,7 +150,7 @@ var formParams = { }; - var authNames = ['test_api_key_header', 'test_api_key_query']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = Order; @@ -274,7 +192,7 @@ var formParams = { }; - var authNames = ['test_api_client_id', 'test_api_client_secret']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = Order; diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index 30f18bbb7557..d865a3e9af15 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -188,7 +188,7 @@ var formParams = { }; - var authNames = ['test_http_basic']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = null; diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index c29f14094f9e..54f3dd199613 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,12 +1,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Animal', './model/Cat', './model/Category', './model/Dog', './model/FormatTest', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['./ApiClient', './model/Category', './model/Order', './model/Pet', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/FormatTest'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Animal, Cat, Category, Dog, FormatTest, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Category, Order, Pet, Tag, User, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -46,51 +46,11 @@ * @property {module:ApiClient} */ ApiClient: ApiClient, - /** - * The Animal model constructor. - * @property {module:model/Animal} - */ - Animal: Animal, - /** - * The Cat model constructor. - * @property {module:model/Cat} - */ - Cat: Cat, /** * The Category model constructor. * @property {module:model/Category} */ Category: Category, - /** - * The Dog model constructor. - * @property {module:model/Dog} - */ - Dog: Dog, - /** - * The FormatTest model constructor. - * @property {module:model/FormatTest} - */ - FormatTest: FormatTest, - /** - * The InlineResponse200 model constructor. - * @property {module:model/InlineResponse200} - */ - InlineResponse200: InlineResponse200, - /** - * The Model200Response model constructor. - * @property {module:model/Model200Response} - */ - Model200Response: Model200Response, - /** - * The ModelReturn model constructor. - * @property {module:model/ModelReturn} - */ - ModelReturn: ModelReturn, - /** - * The Name model constructor. - * @property {module:model/Name} - */ - Name: Name, /** * The Order model constructor. * @property {module:model/Order} @@ -101,11 +61,6 @@ * @property {module:model/Pet} */ Pet: Pet, - /** - * The SpecialModelName model constructor. - * @property {module:model/SpecialModelName} - */ - SpecialModelName: SpecialModelName, /** * The Tag model constructor. * @property {module:model/Tag} From 7f09a86a1e00717c02a8544c9dd5424507e9afa9 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 30 Apr 2016 20:23:35 +0800 Subject: [PATCH 036/170] update wording related to git --- .../codegen/config/CodegenConfigurator.java | 4 +- .../petstore/javascript-promise/README.md | 48 +--- .../javascript-promise/docs/PetApi.md | 226 +++--------------- .../javascript-promise/docs/StoreApi.md | 153 +----------- .../javascript-promise/docs/UserApi.md | 44 ++-- .../petstore/javascript-promise/git_push.sh | 4 +- .../javascript-promise/src/ApiClient.js | 5 - .../javascript-promise/src/api/PetApi.js | 121 +--------- .../javascript-promise/src/api/StoreApi.js | 70 +----- .../javascript-promise/src/api/UserApi.js | 2 +- .../petstore/javascript-promise/src/index.js | 51 +--- samples/client/petstore/javascript/README.md | 6 +- .../client/petstore/javascript/git_push.sh | 4 +- 13 files changed, 88 insertions(+), 650 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java index faa2d581533e..4ac39d5296f1 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java @@ -60,8 +60,8 @@ public class CodegenConfigurator { private Map additionalProperties = new HashMap(); private Map importMappings = new HashMap(); private Set languageSpecificPrimitives = new HashSet(); - private String gitUserId="YOUR_GIT_USR_ID"; - private String gitRepoId="YOUR_GIT_REPO_ID"; + private String gitUserId="GIT_USER_ID"; + private String gitRepoId="GIT_REPO_ID"; private String releaseNote="Minor update"; private String httpUserAgent; diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index 2b49c2d1519d..9c652f5ed62b 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T22:19:40.915+08:00 +- Build date: 2016-04-30T20:22:59.696+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -27,11 +27,11 @@ npm install swagger-petstore --save #### git # If the library is hosted at a git repository, e.g. -https://github.com/YOUR_USERNAME/YOUR_GIT_REPO_ID +https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via: ```shell -npm install YOUR_USERNAME/YOUR_GIT_REPO_ID --save + npm install GIT_USER_ID/GIT_REPO_ID --save ``` ### For browser @@ -80,20 +80,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -*SwaggerPetstore.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 *SwaggerPetstore.PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet *SwaggerPetstore.PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *SwaggerPetstore.PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *SwaggerPetstore.PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -*SwaggerPetstore.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' -*SwaggerPetstore.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' *SwaggerPetstore.PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet *SwaggerPetstore.PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data *SwaggerPetstore.PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image *SwaggerPetstore.StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*SwaggerPetstore.StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status *SwaggerPetstore.StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -*SwaggerPetstore.StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *SwaggerPetstore.StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID *SwaggerPetstore.StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet *SwaggerPetstore.UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user @@ -108,18 +103,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [SwaggerPetstore.Animal](docs/Animal.md) - - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) - - [SwaggerPetstore.Dog](docs/Dog.md) - - [SwaggerPetstore.FormatTest](docs/FormatTest.md) - - [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md) - - [SwaggerPetstore.Model200Response](docs/Model200Response.md) - - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) - - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.Order](docs/Order.md) - [SwaggerPetstore.Pet](docs/Pet.md) - - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) - [SwaggerPetstore.Tag](docs/Tag.md) - [SwaggerPetstore.User](docs/User.md) @@ -127,40 +113,12 @@ 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 diff --git a/samples/client/petstore/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md index 5aecb88ee7ce..0a0513875eb8 100644 --- a/samples/client/petstore/javascript-promise/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise/docs/PetApi.md @@ -5,13 +5,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**addPetUsingByteArray**](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 [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**getPetByIdInObject**](PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -[**petPetIdtestingByteArraytrueGet**](PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -32,12 +29,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store }; apiInstance.addPet(opts).then(function() { console.log('API called successfully.'); @@ -61,55 +58,6 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - - -# **addPetUsingByteArray** -> addPetUsingByteArray(opts) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var opts = { - 'body': "B" // {String} Pet object in the form of byte array -}; -apiInstance.addPetUsingByteArray(opts).then(function() { - console.log('API called successfully.'); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **String**| Pet object in the form of byte array | [optional] - -### Return type - -null (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - ### HTTP request headers - **Content-Type**: application/json, application/xml @@ -130,14 +78,14 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} Pet id to delete +var petId = 789; // Integer | Pet id to delete var opts = { - 'apiKey': "apiKey_example" // {String} + 'apiKey': "apiKey_example" // String | }; apiInstance.deletePet(petId, opts).then(function() { console.log('API called successfully.'); @@ -173,7 +121,7 @@ null (empty response body) Finds Pets by status -Multiple status values can be provided with comma separated strings +Multiple status values can be provided with comma seperated strings ### Example ```javascript @@ -182,12 +130,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'status': ["available"] // {[String]} Status values that need to be considered for query + 'status': ["available"] // [String] | Status values that need to be considered for filter }; apiInstance.findPetsByStatus(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -201,7 +149,7 @@ apiInstance.findPetsByStatus(opts).then(function(data) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**[String]**](String.md)| Status values that need to be considered for query | [optional] [default to available] + **status** | [**[String]**](String.md)| Status values that need to be considered for filter | [optional] [default to available] ### Return type @@ -231,12 +179,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'tags': ["tags_example"] // {[String]} Tags to filter by + 'tags': ["tags_example"] // [String] | Tags to filter by }; apiInstance.findPetsByTags(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -280,17 +228,17 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" +api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" +//api_key.apiKeyPrefix = 'Token'; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} ID of pet that needs to be fetched +var petId = 789; // Integer | ID of pet that needs to be fetched apiInstance.getPetById(petId).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -314,114 +262,6 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **getPetByIdInObject** -> InlineResponse200 getPetByIdInObject(petId) - -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 - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - -apiInstance.getPetByIdInObject(petId).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | - -### Return type - -[**InlineResponse200**](InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **petPetIdtestingByteArraytrueGet** -> 'String' petPetIdtestingByteArraytrueGet(petId) - -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 - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - -apiInstance.petPetIdtestingByteArraytrueGet(petId).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | - -### Return type - -**'String'** - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - ### HTTP request headers - **Content-Type**: Not defined @@ -442,12 +282,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store }; apiInstance.updatePet(opts).then(function() { console.log('API called successfully.'); @@ -491,15 +331,15 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = "petId_example"; // {String} ID of pet that needs to be updated +var petId = "petId_example"; // String | ID of pet that needs to be updated var opts = { - 'name': "name_example", // {String} Updated name of the pet - 'status': "status_example" // {String} Updated status of the pet + 'name': "name_example", // String | Updated name of the pet + 'status': "status_example" // String | Updated status of the pet }; apiInstance.updatePetWithForm(petId, opts).then(function() { console.log('API called successfully.'); @@ -545,15 +385,15 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} ID of pet to update +var petId = 789; // Integer | ID of pet to update var opts = { - 'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server - 'file': "/path/to/file.txt" // {File} file to upload + 'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server + 'file': "/path/to/file.txt" // File | file to upload }; apiInstance.uploadFile(petId, opts).then(function() { console.log('API called successfully.'); diff --git a/samples/client/petstore/javascript-promise/docs/StoreApi.md b/samples/client/petstore/javascript-promise/docs/StoreApi.md index d083e46c0db5..ce57b57bc4f0 100644 --- a/samples/client/petstore/javascript-promise/docs/StoreApi.md +++ b/samples/client/petstore/javascript-promise/docs/StoreApi.md @@ -5,9 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**findOrdersByStatus**](StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getInventoryInObject**](StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet @@ -24,9 +22,9 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted +var orderId = "orderId_example"; // String | ID of the order that needs to be deleted apiInstance.deleteOrder(orderId).then(function() { console.log('API called successfully.'); @@ -50,63 +48,6 @@ null (empty response body) No authorization required -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **findOrdersByStatus** -> [Order] findOrdersByStatus(opts) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var opts = { - 'status': "placed" // {String} Status value that needs to be considered for query -}; -apiInstance.findOrdersByStatus(opts).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **String**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**[Order]**](Order.md) - -### Authorization - -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) - ### HTTP request headers - **Content-Type**: Not defined @@ -114,7 +55,7 @@ Name | Type | Description | Notes # **getInventory** -> {'String': 'Integer'} getInventory +> {'String': 'Integer'} getInventory() Returns pet inventories by status @@ -127,11 +68,11 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" +api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" +//api_key.apiKeyPrefix = 'Token'; -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); apiInstance.getInventory().then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { @@ -151,50 +92,6 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **getInventoryInObject** -> Object getInventoryInObject - -Fake endpoint to test arbitrary object return by 'Get inventory' - -Returns an arbitrary object which is actually a map of status codes to quantities - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() -apiInstance.getInventoryInObject().then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Object** - -### Authorization - -[api_key](../README.md#api_key) - ### HTTP request headers - **Content-Type**: Not defined @@ -211,23 +108,10 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure API key authorization: test_api_key_header -var test_api_key_header = defaultClient.authentications['test_api_key_header']; -test_api_key_header.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_key_header.apiKeyPrefix['test_api_key_header'] = "Token" +var apiInstance = new SwaggerPetstore.StoreApi(); -// Configure API key authorization: test_api_key_query -var test_api_key_query = defaultClient.authentications['test_api_key_query']; -test_api_key_query.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched +var orderId = "orderId_example"; // String | ID of pet that needs to be fetched apiInstance.getOrderById(orderId).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -249,7 +133,7 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) +No authorization required ### HTTP request headers @@ -267,24 +151,11 @@ Place an order for a pet ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); var opts = { - 'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet + 'body': new SwaggerPetstore.Order() // Order | order placed for purchasing the pet }; apiInstance.placeOrder(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -306,7 +177,7 @@ Name | Type | Description | Notes ### Authorization -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) +No authorization required ### HTTP request headers diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md index b68f2e8bffc2..99b56e9cf3d4 100644 --- a/samples/client/petstore/javascript-promise/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -26,10 +26,10 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': new SwaggerPetstore.User() // {User} Created user object + 'body': new SwaggerPetstore.User() // User | Created user object }; apiInstance.createUser(opts).then(function() { console.log('API called successfully.'); @@ -70,10 +70,10 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': [new SwaggerPetstore.User()] // {[User]} List of user object + 'body': [new SwaggerPetstore.User()] // [User] | List of user object }; apiInstance.createUsersWithArrayInput(opts).then(function() { console.log('API called successfully.'); @@ -114,10 +114,10 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': [new SwaggerPetstore.User()] // {[User]} List of user object + 'body': [new SwaggerPetstore.User()] // [User] | List of user object }; apiInstance.createUsersWithListInput(opts).then(function() { console.log('API called successfully.'); @@ -157,16 +157,10 @@ This can only be done by the logged in user. ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure HTTP basic authorization: test_http_basic -var test_http_basic = defaultClient.authentications['test_http_basic']; -test_http_basic.username = 'YOUR USERNAME' -test_http_basic.password = 'YOUR PASSWORD' +var apiInstance = new SwaggerPetstore.UserApi(); -var apiInstance = new SwaggerPetstore.UserApi() - -var username = "username_example"; // {String} The name that needs to be deleted +var username = "username_example"; // String | The name that needs to be deleted apiInstance.deleteUser(username).then(function() { console.log('API called successfully.'); @@ -188,7 +182,7 @@ null (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers @@ -207,9 +201,9 @@ Get user by user name ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing. +var username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. apiInstance.getUserByName(username).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -250,11 +244,11 @@ Logs user into the system ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'username': "username_example", // {String} The user name for login - 'password': "password_example" // {String} The password for login in clear text + 'username': "username_example", // String | The user name for login + 'password': "password_example" // String | The password for login in clear text }; apiInstance.loginUser(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -286,7 +280,7 @@ No authorization required # **logoutUser** -> logoutUser +> logoutUser() Logs out current logged in user session @@ -296,7 +290,7 @@ Logs out current logged in user session ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); apiInstance.logoutUser().then(function() { console.log('API called successfully.'); }, function(error) { @@ -333,12 +327,12 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // {String} name that need to be deleted +var username = "username_example"; // String | name that need to be deleted var opts = { - 'body': new SwaggerPetstore.User() // {User} Updated user object + 'body': new SwaggerPetstore.User() // User | Updated user object }; apiInstance.updateUser(username, opts).then(function() { console.log('API called successfully.'); diff --git a/samples/client/petstore/javascript-promise/git_push.sh b/samples/client/petstore/javascript-promise/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/javascript-promise/git_push.sh +++ b/samples/client/petstore/javascript-promise/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index da6c506ba649..5ee2b04a14f2 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -40,12 +40,7 @@ * @type {Array.} */ this.authentications = { - 'test_api_key_header': {type: 'apiKey', 'in': 'header', name: 'test_api_key_header'}, 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'test_http_basic': {type: 'basic'}, - 'test_api_client_secret': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_secret'}, - 'test_api_client_id': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_id'}, - 'test_api_key_query': {type: 'apiKey', 'in': 'query', name: 'test_api_key_query'}, 'petstore_auth': {type: 'oauth2'} }; /** diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 520791b3f0a1..1a021ccfcaa3 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -1,18 +1,18 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Pet', '../model/InlineResponse200'], factory); + define(['../ApiClient', '../model/Pet'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/Pet'), require('../model/InlineResponse200')); + module.exports = factory(require('../ApiClient'), require('../model/Pet')); } else { // Browser globals (root is window) if (!root.SwaggerPetstore) { root.SwaggerPetstore = {}; } - root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet, root.SwaggerPetstore.InlineResponse200); + root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet); } -}(this, function(ApiClient, Pet, InlineResponse200) { +}(this, function(ApiClient, Pet) { 'use strict'; /** @@ -66,39 +66,6 @@ } - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param {Object} opts Optional parameters - * @param {String} opts.body Pet object in the form of byte array - */ - this.addPetUsingByteArray = function(opts) { - opts = opts || {}; - var postBody = opts['body']; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/pet?testing_byte_array=true', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** * Deletes a pet * @@ -142,9 +109,9 @@ /** * Finds Pets by status - * Multiple status values can be provided with comma separated strings + * Multiple status values can be provided with comma seperated strings * @param {Object} opts Optional parameters - * @param {Array.} opts.status Status values that need to be considered for query (default to available) + * @param {Array.} opts.status Status values that need to be considered for filter (default to available) * data is of type: {Array.} */ this.findPetsByStatus = function(opts) { @@ -248,82 +215,6 @@ } - /** - * 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 {Integer} petId ID of pet that needs to be fetched - * data is of type: {module:model/InlineResponse200} - */ - this.getPetByIdInObject = function(petId) { - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling getPetByIdInObject"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key', 'petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = InlineResponse200; - - return this.apiClient.callApi( - '/pet/{petId}?response=inline_arbitrary_object', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param {Integer} petId ID of pet that needs to be fetched - * data is of type: {'String'} - */ - this.petPetIdtestingByteArraytrueGet = function(petId) { - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key', 'petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = 'String'; - - return this.apiClient.callApi( - '/pet/{petId}?testing_byte_array=true', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** * Update an existing pet * diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index 77d0276ead02..e5d35fee0edd 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -70,41 +70,6 @@ } - /** - * Finds orders by status - * A single status value can be provided as a string - * @param {Object} opts Optional parameters - * @param {module:model/String} opts.status Status value that needs to be considered for query (default to placed) - * data is of type: {Array.} - */ - this.findOrdersByStatus = function(opts) { - opts = opts || {}; - var postBody = null; - - - var pathParams = { - }; - var queryParams = { - 'status': opts['status'] - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['test_api_client_id', 'test_api_client_secret']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = [Order]; - - return this.apiClient.callApi( - '/store/findByStatus', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -136,37 +101,6 @@ } - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * data is of type: {Object} - */ - this.getInventoryInObject = function() { - var postBody = null; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = Object; - - return this.apiClient.callApi( - '/store/inventory?response=arbitrary_object', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -192,7 +126,7 @@ var formParams = { }; - var authNames = ['test_api_key_header', 'test_api_key_query']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = Order; @@ -226,7 +160,7 @@ var formParams = { }; - var authNames = ['test_api_client_id', 'test_api_client_secret']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = Order; diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index b2f3e8c16c9d..9dfad35ded42 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -156,7 +156,7 @@ var formParams = { }; - var authNames = ['test_http_basic']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = null; diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index c29f14094f9e..54f3dd199613 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -1,12 +1,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Animal', './model/Cat', './model/Category', './model/Dog', './model/FormatTest', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['./ApiClient', './model/Category', './model/Order', './model/Pet', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/FormatTest'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Animal, Cat, Category, Dog, FormatTest, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Category, Order, Pet, Tag, User, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -46,51 +46,11 @@ * @property {module:ApiClient} */ ApiClient: ApiClient, - /** - * The Animal model constructor. - * @property {module:model/Animal} - */ - Animal: Animal, - /** - * The Cat model constructor. - * @property {module:model/Cat} - */ - Cat: Cat, /** * The Category model constructor. * @property {module:model/Category} */ Category: Category, - /** - * The Dog model constructor. - * @property {module:model/Dog} - */ - Dog: Dog, - /** - * The FormatTest model constructor. - * @property {module:model/FormatTest} - */ - FormatTest: FormatTest, - /** - * The InlineResponse200 model constructor. - * @property {module:model/InlineResponse200} - */ - InlineResponse200: InlineResponse200, - /** - * The Model200Response model constructor. - * @property {module:model/Model200Response} - */ - Model200Response: Model200Response, - /** - * The ModelReturn model constructor. - * @property {module:model/ModelReturn} - */ - ModelReturn: ModelReturn, - /** - * The Name model constructor. - * @property {module:model/Name} - */ - Name: Name, /** * The Order model constructor. * @property {module:model/Order} @@ -101,11 +61,6 @@ * @property {module:model/Pet} */ Pet: Pet, - /** - * The SpecialModelName model constructor. - * @property {module:model/SpecialModelName} - */ - SpecialModelName: SpecialModelName, /** * The Tag model constructor. * @property {module:model/Tag} diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 3c23ae243f11..e52ef5daae63 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-30T20:15:39.280+08:00 +- Build date: 2016-04-30T20:20:04.619+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -27,11 +27,11 @@ npm install swagger-petstore --save #### git # If the library is hosted at a git repository, e.g. -https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID +https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via: ```shell - npm install YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID --save + npm install GIT_USER_ID/GIT_REPO_ID --save ``` ### For browser diff --git a/samples/client/petstore/javascript/git_push.sh b/samples/client/petstore/javascript/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/javascript/git_push.sh +++ b/samples/client/petstore/javascript/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi From 8d9a09efb10650b5998a4f8c99dcf6f6789fc888 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 30 Apr 2016 21:36:25 +0800 Subject: [PATCH 037/170] update JS test case --- .../petstore/javascript-promise/test/ApiClientTest.js | 8 ++++++-- samples/client/petstore/javascript/test/ApiClientTest.js | 8 ++++++-- samples/client/petstore/javascript/test/api/PetApiTest.js | 3 +++ .../client/petstore/javascript/test/api/StoreApiTest.js | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/samples/client/petstore/javascript-promise/test/ApiClientTest.js b/samples/client/petstore/javascript-promise/test/ApiClientTest.js index c91fbb037830..085983688bbb 100644 --- a/samples/client/petstore/javascript-promise/test/ApiClientTest.js +++ b/samples/client/petstore/javascript-promise/test/ApiClientTest.js @@ -13,7 +13,11 @@ describe('ApiClient', function() { expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2'); expect(apiClient.authentications).to.eql({ petstore_auth: {type: 'oauth2'}, - api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'}, + api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'} + /* comment out the following as these fake security def (testing purpose) + * are removed from the spec, we'll add these back after updating the + * petstore server + * test_http_basic: {type: 'basic'}, test_api_client_id: { type: 'apiKey', @@ -34,7 +38,7 @@ describe('ApiClient', function() { type: 'apiKey', 'in': 'header', name: 'test_api_key_header' - } + }*/ }); }); diff --git a/samples/client/petstore/javascript/test/ApiClientTest.js b/samples/client/petstore/javascript/test/ApiClientTest.js index d259ad54c147..3a8eb843d74d 100644 --- a/samples/client/petstore/javascript/test/ApiClientTest.js +++ b/samples/client/petstore/javascript/test/ApiClientTest.js @@ -13,7 +13,11 @@ describe('ApiClient', function() { expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2'); expect(apiClient.authentications).to.eql({ petstore_auth: {type: 'oauth2'}, - api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'}, + api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'} + /* commented out the following as these fake security def (testing purpose) + * has been removed from the spec, we'll add it back after updating the + * petstore server + * test_http_basic: {type: 'basic'}, test_api_client_id: { type: 'apiKey', @@ -34,7 +38,7 @@ describe('ApiClient', function() { type: 'apiKey', 'in': 'header', name: 'test_api_key_header' - } + }*/ }); }); diff --git a/samples/client/petstore/javascript/test/api/PetApiTest.js b/samples/client/petstore/javascript/test/api/PetApiTest.js index d5f7ba3424c7..700b30ac5059 100644 --- a/samples/client/petstore/javascript/test/api/PetApiTest.js +++ b/samples/client/petstore/javascript/test/api/PetApiTest.js @@ -79,6 +79,8 @@ }); }); + /* commented out the following as the fake endpoint has been removed from the spec + * we'll add it back after updating the Petstore server it('getPetByIdInObject', function(done) { var pet = createRandomPet(); api.addPet({body: pet}, function(error) { @@ -104,6 +106,7 @@ }); }); }); + */ }); })); diff --git a/samples/client/petstore/javascript/test/api/StoreApiTest.js b/samples/client/petstore/javascript/test/api/StoreApiTest.js index 6347148221a8..65fb06b3fd08 100644 --- a/samples/client/petstore/javascript/test/api/StoreApiTest.js +++ b/samples/client/petstore/javascript/test/api/StoreApiTest.js @@ -19,6 +19,9 @@ }); describe('StoreApi', function() { + /* commented out the following as the fake endpoint has been removed from the spec + * we'll add it back after updating the petstore server + * it('getInventoryInObject', function(done) { api.getInventoryInObject(function(error, obj) { if (error) throw error; @@ -36,6 +39,7 @@ done(); }); }); + */ }); })); From ab7b73ca21fb76c21eb354561048acfda6597075 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 1 May 2016 12:09:23 +0800 Subject: [PATCH 038/170] update js samples --- .../petstore/javascript-promise/README.md | 6 +- .../javascript-promise/docs/PetApi.md | 163 ------------------ .../javascript-promise/docs/StoreApi.md | 107 ------------ .../javascript-promise/src/ApiClient.js | 19 ++ .../javascript-promise/src/api/PetApi.js | 6 +- .../petstore/javascript-promise/src/index.js | 6 +- .../javascript-promise/src/model/Category.js | 3 +- .../javascript-promise/src/model/Order.js | 3 +- .../javascript-promise/src/model/Pet.js | 7 +- .../javascript-promise/src/model/Tag.js | 3 +- .../javascript-promise/src/model/User.js | 3 +- samples/client/petstore/javascript/README.md | 2 +- .../petstore/javascript/src/ApiClient.js | 19 ++ .../petstore/javascript/src/api/PetApi.js | 6 +- .../client/petstore/javascript/src/index.js | 8 +- .../petstore/javascript/src/model/Category.js | 3 +- .../petstore/javascript/src/model/Order.js | 3 +- .../petstore/javascript/src/model/Pet.js | 7 +- .../petstore/javascript/src/model/Tag.js | 3 +- .../petstore/javascript/src/model/User.js | 3 +- 20 files changed, 73 insertions(+), 307 deletions(-) diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index b39e28b3654d..f1d10a435b65 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -6,11 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -<<<<<<< HEAD -- Build date: 2016-04-30T20:22:59.696+08:00 -======= -- Build date: 2016-03-25T16:32:33.021Z ->>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d +- Build date: 2016-05-01T12:08:53.092+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation diff --git a/samples/client/petstore/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md index aa8728b96ba9..0a0513875eb8 100644 --- a/samples/client/petstore/javascript-promise/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise/docs/PetApi.md @@ -59,58 +59,6 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) ### HTTP request headers -<<<<<<< HEAD -======= - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - - -# **addPetUsingByteArray** -> addPetUsingByteArray(opts) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var opts = { - 'body': "B" // {String} Pet object in the form of byte array -}; -apiInstance.addPetUsingByteArray(opts).then(function() { - console.log('API called successfully.'); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **String**| Pet object in the form of byte array | [optional] - -### Return type - -null (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers ->>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -315,117 +263,6 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers -<<<<<<< HEAD -======= - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **getPetByIdInObject** -> InlineResponse200 getPetByIdInObject(petId) - -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 - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - -apiInstance.getPetByIdInObject(petId).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | - -### Return type - -[**InlineResponse200**](InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **petPetIdtestingByteArraytrueGet** -> 'String' petPetIdtestingByteArraytrueGet(petId) - -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 - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - -apiInstance.petPetIdtestingByteArraytrueGet(petId).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | - -### Return type - -**'String'** - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP request headers ->>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript-promise/docs/StoreApi.md b/samples/client/petstore/javascript-promise/docs/StoreApi.md index 65b6d7ec3744..ce57b57bc4f0 100644 --- a/samples/client/petstore/javascript-promise/docs/StoreApi.md +++ b/samples/client/petstore/javascript-promise/docs/StoreApi.md @@ -49,66 +49,6 @@ null (empty response body) No authorization required ### HTTP request headers -<<<<<<< HEAD -======= - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **findOrdersByStatus** -> [Order] findOrdersByStatus(opts) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var opts = { - 'status': "placed" // {String} Status value that needs to be considered for query -}; -apiInstance.findOrdersByStatus(opts).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **String**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**[Order]**](Order.md) - -### Authorization - -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) - -### HTTP request headers ->>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -153,53 +93,6 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) ### HTTP request headers -<<<<<<< HEAD -======= - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **getInventoryInObject** -> Object getInventoryInObject - -Fake endpoint to test arbitrary object return by 'Get inventory' - -Returns an arbitrary object which is actually a map of status codes to quantities - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() -apiInstance.getInventoryInObject().then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Object** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers ->>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index 5ee2b04a14f2..ac0b172ff220 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -451,6 +451,25 @@ } }; + /** + * Constructs a new map or array model from REST data. + * @param data {Object|Array} The REST data. + * @param obj {Object|Array} The target object or array. + */ + exports.constructFromObject = function(data, obj, itemType) { + if (Array.isArray(data)) { + for (var i = 0; i < data.length; i++) { + if (data.hasOwnProperty(i)) + obj[i] = exports.convertToType(data[i], itemType); + } + } else { + for (var k in data) { + if (data.hasOwnProperty(k)) + result[k] = exports.convertToType(data[k], itemType); + } + } + }; + /** * The default API client implementation. * @type {module:ApiClient} diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 52ce89b95e01..1b0855e52871 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -1,11 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. -<<<<<<< HEAD - define(['../ApiClient', '../model/Pet'], factory); -======= - define(['ApiClient', 'model/Pet', 'model/InlineResponse200'], factory); ->>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d + define(['ApiClient', 'model/Pet'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Pet')); diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index a7b2e0af3d16..b0d17b3ef3a7 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -1,11 +1,7 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. -<<<<<<< HEAD - define(['./ApiClient', './model/Category', './model/Order', './model/Pet', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); -======= - define(['ApiClient', 'model/Category', 'model/InlineResponse200', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/Order', 'model/Pet', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); ->>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d + define(['ApiClient', 'model/Category', 'model/Order', 'model/Pet', 'model/Tag', 'model/User', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); diff --git a/samples/client/petstore/javascript-promise/src/model/Category.js b/samples/client/petstore/javascript-promise/src/model/Category.js index 8f36ada19137..9956525e037c 100644 --- a/samples/client/petstore/javascript-promise/src/model/Category.js +++ b/samples/client/petstore/javascript-promise/src/model/Category.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; @@ -40,7 +41,7 @@ * @return {module:model/Category} The populated Category instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript-promise/src/model/Order.js b/samples/client/petstore/javascript-promise/src/model/Order.js index 65bec4521b91..664908b77a9a 100644 --- a/samples/client/petstore/javascript-promise/src/model/Order.js +++ b/samples/client/petstore/javascript-promise/src/model/Order.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; @@ -44,7 +45,7 @@ * @return {module:model/Order} The populated Order instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript-promise/src/model/Pet.js b/samples/client/petstore/javascript-promise/src/model/Pet.js index 99c049a72cf1..ae907d35ca2f 100644 --- a/samples/client/petstore/javascript-promise/src/model/Pet.js +++ b/samples/client/petstore/javascript-promise/src/model/Pet.js @@ -29,11 +29,12 @@ * @param photoUrls */ var exports = function(name, photoUrls) { + var _this = this; - this['name'] = name; - this['photoUrls'] = photoUrls; + _this['name'] = name; + _this['photoUrls'] = photoUrls; }; @@ -46,7 +47,7 @@ * @return {module:model/Pet} The populated Pet instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript-promise/src/model/Tag.js b/samples/client/petstore/javascript-promise/src/model/Tag.js index bbfb6fe662a6..d9ab35fb8b53 100644 --- a/samples/client/petstore/javascript-promise/src/model/Tag.js +++ b/samples/client/petstore/javascript-promise/src/model/Tag.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; @@ -40,7 +41,7 @@ * @return {module:model/Tag} The populated Tag instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript-promise/src/model/User.js b/samples/client/petstore/javascript-promise/src/model/User.js index aff0c42f3ec8..3bc6aaab630e 100644 --- a/samples/client/petstore/javascript-promise/src/model/User.js +++ b/samples/client/petstore/javascript-promise/src/model/User.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; @@ -46,7 +47,7 @@ * @return {module:model/User} The populated User instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index e52ef5daae63..2d707697bf27 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-30T20:20:04.619+08:00 +- Build date: 2016-05-01T12:06:44.623+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index f8c45a6680f8..d45704dcdac9 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -463,6 +463,25 @@ } }; + /** + * Constructs a new map or array model from REST data. + * @param data {Object|Array} The REST data. + * @param obj {Object|Array} The target object or array. + */ + exports.constructFromObject = function(data, obj, itemType) { + if (Array.isArray(data)) { + for (var i = 0; i < data.length; i++) { + if (data.hasOwnProperty(i)) + obj[i] = exports.convertToType(data[i], itemType); + } + } else { + for (var k in data) { + if (data.hasOwnProperty(k)) + result[k] = exports.convertToType(data[k], itemType); + } + } + }; + /** * The default API client implementation. * @type {module:ApiClient} diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index 3e55e3264ba5..da88c3f34f9e 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Pet'], factory); + define(['ApiClient', 'model/Pet'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Pet')); @@ -25,8 +25,8 @@ * Constructs a new PetApi. * @alias module:api/PetApi * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} - * if unspecified. + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index 54f3dd199613..b0d17b3ef3a7 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,7 +1,7 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Category', './model/Order', './model/Pet', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['ApiClient', 'model/Category', 'model/Order', 'model/Pet', 'model/Tag', 'model/User', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); @@ -15,7 +15,7 @@ *

* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: *

-   * var SwaggerPetstore = require('./index'); // See note below*.
+   * var SwaggerPetstore = require('index'); // See note below*.
    * var xxxSvc = new SwaggerPetstore.XxxApi(); // Allocate the API class we're going to use.
    * var yyyModel = new SwaggerPetstore.Yyy(); // Construct a model instance.
    * yyyModel.someProperty = 'someValue';
@@ -23,8 +23,8 @@
    * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
    * ...
    * 
- * *NOTE: For a top-level AMD script, use require(['./index'], function(){...}) and put the application logic within the - * callback function. + * *NOTE: For a top-level AMD script, use require(['index'], function(){...}) + * and put the application logic within the callback function. *

*

* A non-AMD browser application (discouraged) might do something like this: diff --git a/samples/client/petstore/javascript/src/model/Category.js b/samples/client/petstore/javascript/src/model/Category.js index 8f36ada19137..9956525e037c 100644 --- a/samples/client/petstore/javascript/src/model/Category.js +++ b/samples/client/petstore/javascript/src/model/Category.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; @@ -40,7 +41,7 @@ * @return {module:model/Category} The populated Category instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index 65bec4521b91..664908b77a9a 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; @@ -44,7 +45,7 @@ * @return {module:model/Order} The populated Order instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index 99c049a72cf1..ae907d35ca2f 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -29,11 +29,12 @@ * @param photoUrls */ var exports = function(name, photoUrls) { + var _this = this; - this['name'] = name; - this['photoUrls'] = photoUrls; + _this['name'] = name; + _this['photoUrls'] = photoUrls; }; @@ -46,7 +47,7 @@ * @return {module:model/Pet} The populated Pet instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript/src/model/Tag.js b/samples/client/petstore/javascript/src/model/Tag.js index bbfb6fe662a6..d9ab35fb8b53 100644 --- a/samples/client/petstore/javascript/src/model/Tag.js +++ b/samples/client/petstore/javascript/src/model/Tag.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; @@ -40,7 +41,7 @@ * @return {module:model/Tag} The populated Tag instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { diff --git a/samples/client/petstore/javascript/src/model/User.js b/samples/client/petstore/javascript/src/model/User.js index aff0c42f3ec8..3bc6aaab630e 100644 --- a/samples/client/petstore/javascript/src/model/User.js +++ b/samples/client/petstore/javascript/src/model/User.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; @@ -46,7 +47,7 @@ * @return {module:model/User} The populated User instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { From e6fb2507a47138d9169be1ccf83d0b8a907d9a0c Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Sat, 30 Apr 2016 23:18:59 -0700 Subject: [PATCH 039/170] changed go client to return object pointer --- .../src/main/resources/go/api.mustache | 8 +-- .../client/petstore/go/go-petstore/pet_api.go | 64 +++++++++--------- .../petstore/go/go-petstore/store_api.go | 30 ++++----- .../petstore/go/go-petstore/user_api.go | 66 +++++++++---------- samples/client/petstore/go/pet_api_test.go | 2 +- 5 files changed, 85 insertions(+), 85 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 9b8998cf6146..ef3585a10692 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -36,7 +36,7 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}}{ {{#allParams}} * @param {{paramName}} {{description}} {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ -func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}APIResponse, error) { +func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}*{{{returnType}}}, {{/returnType}}*APIResponse, error) { var httpMethod = "{{httpMethod}}" // create path and map variables @@ -48,7 +48,7 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ {{#required}} // verify the required parameter '{{paramName}}' is set if &{{paramName}} == nil { - return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + return {{#returnType}}new({{{returnType}}}), {{/returnType}}nil, errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") } {{/required}} {{/allParams}} @@ -137,14 +137,14 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ if err != nil { - return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err + return {{#returnType}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err } {{#returnType}} err = json.Unmarshal(httpResponse.Body(), &successPayload) {{/returnType}} - return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err + return {{#returnType}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err } {{/operation}} {{/operations}} diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index ac4e23656be7..6cc79073c4f7 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -35,7 +35,7 @@ func NewPetApiWithBasePath(basePath string) *PetApi{ * @param body Pet object that needs to be added to the store * @return void */ -func (a PetApi) AddPet (body Pet) (APIResponse, error) { +func (a PetApi) AddPet (body Pet) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -43,7 +43,7 @@ func (a PetApi) AddPet (body Pet) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->AddPet") + return nil, errors.New("Missing required parameter 'body' when calling PetApi->AddPet") } headerParams := make(map[string]string) @@ -95,10 +95,10 @@ func (a PetApi) AddPet (body Pet) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Deletes a pet @@ -107,7 +107,7 @@ func (a PetApi) AddPet (body Pet) (APIResponse, error) { * @param apiKey * @return void */ -func (a PetApi) DeletePet (petId int64, apiKey string) (APIResponse, error) { +func (a PetApi) DeletePet (petId int64, apiKey string) (*APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -116,7 +116,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (APIResponse, error) { // verify the required parameter 'petId' is set if &petId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") + return nil, errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") } headerParams := make(map[string]string) @@ -166,10 +166,10 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Finds Pets by status @@ -177,7 +177,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (APIResponse, error) { * @param status Status values that need to be considered for filter * @return []Pet */ -func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) { +func (a PetApi) FindPetsByStatus (status []string) (*[]Pet, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -185,7 +185,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) { // verify the required parameter 'status' is set if &status == nil { - return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") + return new([]Pet), nil, errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") } headerParams := make(map[string]string) @@ -234,12 +234,12 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) { if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** * Finds Pets by tags @@ -247,7 +247,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) { * @param tags Tags to filter by * @return []Pet */ -func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) { +func (a PetApi) FindPetsByTags (tags []string) (*[]Pet, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -255,7 +255,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) { // verify the required parameter 'tags' is set if &tags == nil { - return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") + return new([]Pet), nil, errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") } headerParams := make(map[string]string) @@ -304,12 +304,12 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) { if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** * Find pet by ID @@ -317,7 +317,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) { * @param petId ID of pet to return * @return Pet */ -func (a PetApi) GetPetById (petId int64) (Pet, APIResponse, error) { +func (a PetApi) GetPetById (petId int64) (*Pet, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -326,7 +326,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, APIResponse, error) { // verify the required parameter 'petId' is set if &petId == nil { - return *new(Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") + return new(Pet), nil, errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") } headerParams := make(map[string]string) @@ -373,12 +373,12 @@ func (a PetApi) GetPetById (petId int64) (Pet, APIResponse, error) { if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** * Update an existing pet @@ -386,7 +386,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, APIResponse, error) { * @param body Pet object that needs to be added to the store * @return void */ -func (a PetApi) UpdatePet (body Pet) (APIResponse, error) { +func (a PetApi) UpdatePet (body Pet) (*APIResponse, error) { var httpMethod = "Put" // create path and map variables @@ -394,7 +394,7 @@ func (a PetApi) UpdatePet (body Pet) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") + return nil, errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") } headerParams := make(map[string]string) @@ -446,10 +446,10 @@ func (a PetApi) UpdatePet (body Pet) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Updates a pet in the store with form data @@ -459,7 +459,7 @@ func (a PetApi) UpdatePet (body Pet) (APIResponse, error) { * @param status Updated status of the pet * @return void */ -func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (APIResponse, error) { +func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -468,7 +468,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (API // verify the required parameter 'petId' is set if &petId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") + return nil, errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") } headerParams := make(map[string]string) @@ -519,10 +519,10 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (API if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * uploads an image @@ -532,7 +532,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (API * @param file file to upload * @return ModelApiResponse */ -func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (ModelApiResponse, APIResponse, error) { +func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (*ModelApiResponse, *APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -541,7 +541,7 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil // verify the required parameter 'petId' is set if &petId == nil { - return *new(ModelApiResponse), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") + return new(ModelApiResponse), nil, errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") } headerParams := make(map[string]string) @@ -593,10 +593,10 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index ae0111773544..66f95d04f398 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -33,7 +33,7 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi{ * @param orderId ID of the order that needs to be deleted * @return void */ -func (a StoreApi) DeleteOrder (orderId string) (APIResponse, error) { +func (a StoreApi) DeleteOrder (orderId string) (*APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -42,7 +42,7 @@ func (a StoreApi) DeleteOrder (orderId string) (APIResponse, error) { // verify the required parameter 'orderId' is set if &orderId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") + return nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") } headerParams := make(map[string]string) @@ -84,17 +84,17 @@ func (a StoreApi) DeleteOrder (orderId string) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Returns pet inventories by status * Returns a map of status codes to quantities * @return map[string]int32 */ -func (a StoreApi) GetInventory () (map[string]int32, APIResponse, error) { +func (a StoreApi) GetInventory () (*map[string]int32, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -144,12 +144,12 @@ func (a StoreApi) GetInventory () (map[string]int32, APIResponse, error) { if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** * Find purchase order by ID @@ -157,7 +157,7 @@ func (a StoreApi) GetInventory () (map[string]int32, APIResponse, error) { * @param orderId ID of pet that needs to be fetched * @return Order */ -func (a StoreApi) GetOrderById (orderId int64) (Order, APIResponse, error) { +func (a StoreApi) GetOrderById (orderId int64) (*Order, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -166,7 +166,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, APIResponse, error) { // verify the required parameter 'orderId' is set if &orderId == nil { - return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") + return new(Order), nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") } headerParams := make(map[string]string) @@ -208,12 +208,12 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, APIResponse, error) { if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** * Place an order for a pet @@ -221,7 +221,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, APIResponse, error) { * @param body order placed for purchasing the pet * @return Order */ -func (a StoreApi) PlaceOrder (body Order) (Order, APIResponse, error) { +func (a StoreApi) PlaceOrder (body Order) (*Order, *APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -229,7 +229,7 @@ func (a StoreApi) PlaceOrder (body Order) (Order, APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") + return new(Order), nil, errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") } headerParams := make(map[string]string) @@ -273,10 +273,10 @@ func (a StoreApi) PlaceOrder (body Order) (Order, APIResponse, error) { if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index 8ac944e79fa1..3c4c530c1919 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -33,7 +33,7 @@ func NewUserApiWithBasePath(basePath string) *UserApi{ * @param body Created user object * @return void */ -func (a UserApi) CreateUser (body User) (APIResponse, error) { +func (a UserApi) CreateUser (body User) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -41,7 +41,7 @@ func (a UserApi) CreateUser (body User) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") + return nil, errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") } headerParams := make(map[string]string) @@ -85,10 +85,10 @@ func (a UserApi) CreateUser (body User) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Creates list of users with given input array @@ -96,7 +96,7 @@ func (a UserApi) CreateUser (body User) (APIResponse, error) { * @param body List of user object * @return void */ -func (a UserApi) CreateUsersWithArrayInput (body []User) (APIResponse, error) { +func (a UserApi) CreateUsersWithArrayInput (body []User) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -104,7 +104,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") + return nil, errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") } headerParams := make(map[string]string) @@ -148,10 +148,10 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Creates list of users with given input array @@ -159,7 +159,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (APIResponse, error) { * @param body List of user object * @return void */ -func (a UserApi) CreateUsersWithListInput (body []User) (APIResponse, error) { +func (a UserApi) CreateUsersWithListInput (body []User) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -167,7 +167,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") + return nil, errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") } headerParams := make(map[string]string) @@ -211,10 +211,10 @@ func (a UserApi) CreateUsersWithListInput (body []User) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Delete user @@ -222,7 +222,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (APIResponse, error) { * @param username The name that needs to be deleted * @return void */ -func (a UserApi) DeleteUser (username string) (APIResponse, error) { +func (a UserApi) DeleteUser (username string) (*APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -231,7 +231,7 @@ func (a UserApi) DeleteUser (username string) (APIResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") + return nil, errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") } headerParams := make(map[string]string) @@ -273,10 +273,10 @@ func (a UserApi) DeleteUser (username string) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Get user by user name @@ -284,7 +284,7 @@ func (a UserApi) DeleteUser (username string) (APIResponse, error) { * @param username The name that needs to be fetched. Use user1 for testing. * @return User */ -func (a UserApi) GetUserByName (username string) (User, APIResponse, error) { +func (a UserApi) GetUserByName (username string) (*User, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -293,7 +293,7 @@ func (a UserApi) GetUserByName (username string) (User, APIResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *new(User), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") + return new(User), nil, errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") } headerParams := make(map[string]string) @@ -335,12 +335,12 @@ func (a UserApi) GetUserByName (username string) (User, APIResponse, error) { if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** * Logs user into the system @@ -349,7 +349,7 @@ func (a UserApi) GetUserByName (username string) (User, APIResponse, error) { * @param password The password for login in clear text * @return string */ -func (a UserApi) LoginUser (username string, password string) (string, APIResponse, error) { +func (a UserApi) LoginUser (username string, password string) (*string, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -357,11 +357,11 @@ func (a UserApi) LoginUser (username string, password string) (string, APIRespon // verify the required parameter 'username' is set if &username == nil { - return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") + return new(string), nil, errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") } // verify the required parameter 'password' is set if &password == nil { - return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") + return new(string), nil, errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") } headerParams := make(map[string]string) @@ -405,19 +405,19 @@ func (a UserApi) LoginUser (username string, password string) (string, APIRespon if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** * Logs out current logged in user session * * @return void */ -func (a UserApi) LogoutUser () (APIResponse, error) { +func (a UserApi) LogoutUser () (*APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -463,10 +463,10 @@ func (a UserApi) LogoutUser () (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** * Updated user @@ -475,7 +475,7 @@ func (a UserApi) LogoutUser () (APIResponse, error) { * @param body Updated user object * @return void */ -func (a UserApi) UpdateUser (username string, body User) (APIResponse, error) { +func (a UserApi) UpdateUser (username string, body User) (*APIResponse, error) { var httpMethod = "Put" // create path and map variables @@ -484,11 +484,11 @@ func (a UserApi) UpdateUser (username string, body User) (APIResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") + return nil, errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") } // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") + return nil, errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") } headerParams := make(map[string]string) @@ -532,8 +532,8 @@ func (a UserApi) UpdateUser (username string, body User) (APIResponse, error) { if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/pet_api_test.go b/samples/client/petstore/go/pet_api_test.go index 5b18e3a76754..8b996dea85fc 100644 --- a/samples/client/petstore/go/pet_api_test.go +++ b/samples/client/petstore/go/pet_api_test.go @@ -95,7 +95,7 @@ func TestFindPetsByStatus(t *testing.T) { t.Log(apiResponse) } else { t.Log(apiResponse) - if len(resp) == 0 { + if len(*resp) == 0 { t.Errorf("Error no pets returned") } From 56d1b896b79f27d614ca94737d56a5a357bf19e6 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Sat, 30 Apr 2016 23:35:04 -0700 Subject: [PATCH 040/170] enable testing array after resty fixed their issue --- samples/client/petstore/go/user_api_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/client/petstore/go/user_api_test.go b/samples/client/petstore/go/user_api_test.go index 747bde0be7ec..8ea2c29042a2 100644 --- a/samples/client/petstore/go/user_api_test.go +++ b/samples/client/petstore/go/user_api_test.go @@ -30,7 +30,7 @@ func TestCreateUser(t *testing.T) { } //adding x to skip the test, currently it is failing -func xTestCreateUsersWithArrayInput(t *testing.T) { +func TestCreateUsersWithArrayInput(t *testing.T) { s := sw.NewUserApi() newUsers := []sw.User{ sw.User { From 5fdf615de7c94764915e3471e5dbe4ab14768605 Mon Sep 17 00:00:00 2001 From: Neil O'Toole Date: Sun, 1 May 2016 14:41:40 +0100 Subject: [PATCH 041/170] Issue #2478 - generated code now conforms more closely to conventions --- .../src/main/resources/go/api.mustache | 217 ++--- .../src/main/resources/go/api_client.mustache | 173 ++-- .../main/resources/go/api_response.mustache | 18 +- .../main/resources/go/configuration.mustache | 72 +- .../src/main/resources/go/model.mustache | 24 +- .../client/petstore/go/go-petstore/README.md | 2 +- .../petstore/go/go-petstore/api_client.go | 173 ++-- .../petstore/go/go-petstore/api_response.go | 18 +- .../petstore/go/go-petstore/category.go | 12 +- .../petstore/go/go-petstore/configuration.go | 72 +- .../petstore/go/go-petstore/git_push.sh | 4 +- .../go/go-petstore/model_api_response.go | 16 +- .../client/petstore/go/go-petstore/order.go | 28 +- samples/client/petstore/go/go-petstore/pet.go | 29 +- .../client/petstore/go/go-petstore/pet_api.go | 878 +++++++++--------- .../petstore/go/go-petstore/store_api.go | 404 ++++---- samples/client/petstore/go/go-petstore/tag.go | 12 +- .../client/petstore/go/go-petstore/user.go | 37 +- .../petstore/go/go-petstore/user_api.go | 780 ++++++++-------- 19 files changed, 1417 insertions(+), 1552 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 9b8998cf6146..6e3b5481f8cf 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -2,149 +2,120 @@ package {{packageName}} {{#operations}} import ( - "strings" - "fmt" - "errors" -{{#imports}} "{{import}}" + "strings" + "fmt" + "errors" + {{#imports}}"{{import}}" {{/imports}} ) type {{classname}} struct { - Configuration Configuration + Configuration Configuration } -func New{{classname}}() *{{classname}}{ - configuration := NewConfiguration() - return &{{classname}} { - Configuration: *configuration, - } +func New{{classname}}() *{{classname}} { + configuration := NewConfiguration() + return &{{classname}}{ + Configuration: *configuration, + } } -func New{{classname}}WithBasePath(basePath string) *{{classname}}{ - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &{{classname}} { - Configuration: *configuration, - } -} +func New{{classname}}WithBasePath(basePath string) *{{classname}} { + configuration := NewConfiguration() + configuration.BasePath = basePath + return &{{classname}}{ + Configuration: *configuration, + } +} {{#operation}} + /** - * {{summary}} - * {{notes}} + * {{summary}}{{#notes}} + * {{notes}}{{/notes}} + * {{#allParams}} * @param {{paramName}} {{description}} {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ -func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}APIResponse, error) { +func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}APIResponse, error) { - var httpMethod = "{{httpMethod}}" - // create path and map variables - path := a.Configuration.BasePath + "{{path}}" -{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1) -{{/pathParams}} + var httpMethod = "{{httpMethod}}" + // create path and map variables + path := a.Configuration.BasePath + "{{path}}"{{#pathParams}} + path = strings.Replace(path, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}} +{{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if &{{paramName}} == nil { + return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + }{{/required}}{{/allParams}} - {{#allParams}} - {{#required}} - // verify the required parameter '{{paramName}}' is set - if &{{paramName}} == nil { - return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") - } - {{/required}} - {{/allParams}} + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte +{{#authMethods}} + // authentication ({{name}}) required +{{#isApiKey}}{{#isKeyInHeader}} + // set key with prefix in header + headerParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}") +{{/isKeyInHeader}}{{#isKeyInQuery}} + // set key with prefix in querystring{{#hasKeyParamName}} + queryParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}") +{{/hasKeyParamName}}{{/isKeyInQuery}}{{/isApiKey}}{{#isBasic}} + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + headerParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + }{{/isBasic}}{{#isOAuth}} + // oauth required + if a.Configuration.AccessToken != ""{ + headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + }{{/isOAuth}}{{/authMethods}} + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + }{{#hasQueryParams}}{{#queryParams}} - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}}) + {{/queryParams}}{{/hasQueryParams}} - {{#authMethods}}// authentication ({{name}}) required - {{#isApiKey}}{{#isKeyInHeader}} - // set key with prefix in header - headerParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}") - {{/isKeyInHeader}}{{#isKeyInQuery}} - // set key with prefix in querystring - {{#hasKeyParamName}} - queryParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}") - {{/hasKeyParamName}} - {{/isKeyInQuery}}{{/isApiKey}} - {{#isBasic}} - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - headerParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - {{/isBasic}} - {{#isOAuth}} - // oauth required - if a.Configuration.AccessToken != ""{ - headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - {{/isOAuth}} - {{/authMethods}} + // to determine the Content-Type header + localVarHttpContentTypes := []string{ {{#consumes}}"{{mediaType}}", {{/consumes}} } - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - - {{#hasQueryParams}} - {{#queryParams}} - queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}}) - {{/queryParams}} - {{/hasQueryParams}} + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + {{#produces}}"{{mediaType}}", +{{/produces}} } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - {{#consumes}} - "{{mediaType}}", - {{/consumes}} - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - {{#produces}} - "{{mediaType}}", - {{/produces}} - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } -{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}" - headerParams["{{baseName}}"] = {{paramName}} -{{/headerParams}}{{/hasHeaderParams}} -{{#hasFormParams}} -{{#formParams}} - {{#isFile}}fbs, _ := ioutil.ReadAll(file) - fileBytes = fbs - fileName = file.Name() - {{/isFile}} -{{^isFile}}formParams["{{paramName}}"] = {{paramName}} - {{/isFile}} -{{/formParams}} -{{/hasFormParams}}{{#hasBodyParam}}{{#bodyParams}} // body params - postBody = &{{paramName}} + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + }{{#hasHeaderParams}} + +{{#headerParams}} // header params "{{baseName}}" + headerParams["{{baseName}}"] = {{paramName}} +{{/headerParams}}{{/hasHeaderParams}}{{#hasFormParams}} +{{#formParams}}{{#isFile}} fbs, _ := ioutil.ReadAll(file) + fileBytes = fbs + fileName = file.Name(){{/isFile}} +{{^isFile}} formParams["{{paramName}}"] = {{paramName}}{{/isFile}}{{/formParams}}{{/hasFormParams}}{{#hasBodyParam}} +{{#bodyParams}} // body params + postBody = &{{paramName}} {{/bodyParams}}{{/hasBodyParam}} -{{#returnType}} var successPayload = new({{returnType}}){{/returnType}} - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - - if err != nil { - return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err - } +{{#returnType}} var successPayload = new({{returnType}}){{/returnType}} + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err + } {{#returnType}} - - err = json.Unmarshal(httpResponse.Body(), &successPayload) -{{/returnType}} - - return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err + err = json.Unmarshal(httpResponse.Body(), &successPayload){{/returnType}} + return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err } -{{/operation}} -{{/operations}} +{{/operation}}{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/go/api_client.mustache b/modules/swagger-codegen/src/main/resources/go/api_client.mustache index a88445656d77..88c5ce07e4e0 100644 --- a/modules/swagger-codegen/src/main/resources/go/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api_client.mustache @@ -1,123 +1,120 @@ package {{packageName}} import ( - "strings" - "github.com/go-resty/resty" - "fmt" - "reflect" - "bytes" - "path/filepath" + "bytes" + "fmt" + "path/filepath" + "reflect" + "strings" + + "github.com/go-resty/resty" ) type APIClient struct { - } func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { - if (len(contentTypes) == 0){ - return "" - } - if contains(contentTypes,"application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' } func (c *APIClient) SelectHeaderAccept(accepts []string) string { - if (len(accepts) == 0){ - return "" - } - if contains(accepts,"application/json"){ - return "application/json" - } - - return strings.Join(accepts,",") + if len(accepts) == 0 { + return "" + } + if contains(accepts, "application/json") { + return "application/json" + } + return strings.Join(accepts, ",") } func contains(source []string, containvalue string) bool { - for _, a := range source { - if strings.ToLower(a) == strings.ToLower(containvalue) { - return true - } - } - return false + for _, a := range source { + if strings.ToLower(a) == strings.ToLower(containvalue) { + return true + } + } + return false } - func (c *APIClient) CallAPI(path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams map[string]string, - formParams map[string]string, - fileName string, - fileBytes []byte) (*resty.Response, error) { + postBody interface{}, + headerParams map[string]string, + queryParams map[string]string, + formParams map[string]string, + fileName string, + fileBytes []byte) (*resty.Response, error) { - //set debug flag - configuration := NewConfiguration() - resty.SetDebug(configuration.GetDebug()) + //set debug flag + configuration := NewConfiguration() + resty.SetDebug(configuration.GetDebug()) - request := prepareRequest(postBody, headerParams, queryParams, formParams,fileName,fileBytes) + request := prepareRequest(postBody, headerParams, queryParams, formParams, fileName, fileBytes) - switch strings.ToUpper(method) { - case "GET": - response, err := request.Get(path) - return response, err - case "POST": - response, err := request.Post(path) - return response, err - case "PUT": - response, err := request.Put(path) - return response, err - case "PATCH": - response, err := request.Patch(path) - return response, err - case "DELETE": - response, err := request.Delete(path) - return response, err - } + switch strings.ToUpper(method) { + case "GET": + response, err := request.Get(path) + return response, err + case "POST": + response, err := request.Post(path) + return response, err + case "PUT": + response, err := request.Put(path) + return response, err + case "PATCH": + response, err := request.Patch(path) + return response, err + case "DELETE": + response, err := request.Delete(path) + return response, err + } - return nil, fmt.Errorf("invalid method %v", method) + return nil, fmt.Errorf("invalid method %v", method) } func (c *APIClient) ParameterToString(obj interface{}) string { - if reflect.TypeOf(obj).String() == "[]string" { - return strings.Join(obj.([]string), ",") - } else { - return obj.(string) - } + if reflect.TypeOf(obj).String() == "[]string" { + return strings.Join(obj.([]string), ",") + } else { + return obj.(string) + } } func prepareRequest(postBody interface{}, - headerParams map[string]string, - queryParams map[string]string, - formParams map[string]string, - fileName string, - fileBytes []byte) *resty.Request { + headerParams map[string]string, + queryParams map[string]string, + formParams map[string]string, + fileName string, + fileBytes []byte) *resty.Request { - request := resty.R() + request := resty.R() + request.SetBody(postBody) - request.SetBody(postBody) + // add header parameter, if any + if len(headerParams) > 0 { + request.SetHeaders(headerParams) + } - // add header parameter, if any - if len(headerParams) > 0 { - request.SetHeaders(headerParams) - } - - // add query parameter, if any - if len(queryParams) > 0 { - request.SetQueryParams(queryParams) - } + // add query parameter, if any + if len(queryParams) > 0 { + request.SetQueryParams(queryParams) + } - // add form parameter, if any - if len(formParams) > 0 { - request.SetFormData(formParams) - } - - if len(fileBytes) > 0 && fileName != "" { - _, fileNm := filepath.Split(fileName) - request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) - } - return request + // add form parameter, if any + if len(formParams) > 0 { + request.SetFormData(formParams) + } + + if len(fileBytes) > 0 && fileName != "" { + _, fileNm := filepath.Split(fileName) + request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) + } + return request } diff --git a/modules/swagger-codegen/src/main/resources/go/api_response.mustache b/modules/swagger-codegen/src/main/resources/go/api_response.mustache index 9f81de76d624..a15293f44021 100644 --- a/modules/swagger-codegen/src/main/resources/go/api_response.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api_response.mustache @@ -1,24 +1,22 @@ package {{packageName}} import ( - "net/http" + "net/http" ) - type APIResponse struct { - *http.Response - - Message string `json:"message,omitempty"` + *http.Response + Message string `json:"message,omitempty"` } func NewAPIResponse(r *http.Response) *APIResponse { - response := &APIResponse{Response: r} - return response + response := &APIResponse{Response: r} + return response } func NewAPIResponseWithError(errorMessage string) *APIResponse { - response := &APIResponse{Message: errorMessage} - return response -} \ No newline at end of file + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/modules/swagger-codegen/src/main/resources/go/configuration.mustache b/modules/swagger-codegen/src/main/resources/go/configuration.mustache index d971bf0373b7..463f77c54dc3 100644 --- a/modules/swagger-codegen/src/main/resources/go/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/go/configuration.mustache @@ -1,59 +1,59 @@ package {{packageName}} import ( - "encoding/base64" + "encoding/base64" ) type Configuration struct { - UserName string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` - APIKeyPrefix map[string] string `json:"APIKeyPrefix,omitempty"` - APIKey map[string] string `json:"APIKey,omitempty"` - debug bool `json:"debug,omitempty"` - DebugFile string `json:"debugFile,omitempty"` - OAuthToken string `json:"oAuthToken,omitempty"` - Timeout int `json:"timeout,omitempty"` - BasePath string `json:"basePath,omitempty"` - Host string `json:"host,omitempty"` - Scheme string `json:"scheme,omitempty"` - AccessToken string `json:"accessToken,omitempty"` - DefaultHeader map[string]string `json:"defaultHeader,omitempty"` - UserAgent string `json:"userAgent,omitempty"` - APIClient APIClient `json:"APIClient,omitempty"` + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` + APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` + APIKey map[string]string `json:"APIKey,omitempty"` + debug bool `json:"debug,omitempty"` + DebugFile string `json:"debugFile,omitempty"` + OAuthToken string `json:"oAuthToken,omitempty"` + Timeout int `json:"timeout,omitempty"` + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + AccessToken string `json:"accessToken,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + APIClient APIClient `json:"APIClient,omitempty"` } func NewConfiguration() *Configuration { - return &Configuration{ - BasePath: "{{basePath}}", - UserName: "", - debug: false, - DefaultHeader: make(map[string]string), - APIKey: make(map[string]string), - APIKeyPrefix: make(map[string]string), - UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/go{{/httpUserAgent}}", - } + return &Configuration{ + BasePath: "{{basePath}}", + UserName: "", + debug: false, + DefaultHeader: make(map[string]string), + APIKey: make(map[string]string), + APIKeyPrefix: make(map[string]string), + UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/go{{/httpUserAgent}}", + } } func (c *Configuration) GetBasicAuthEncodedString() string { - return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password)) + return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password)) } func (c *Configuration) AddDefaultHeader(key string, value string) { - c.DefaultHeader[key] = value + c.DefaultHeader[key] = value } func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { - if c.APIKeyPrefix[APIKeyIdentifier] != ""{ - return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] - } - - return c.APIKey[APIKeyIdentifier] + if c.APIKeyPrefix[APIKeyIdentifier] != "" { + return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] + } + + return c.APIKey[APIKeyIdentifier] } -func (c *Configuration) SetDebug(enable bool){ - c.debug = enable +func (c *Configuration) SetDebug(enable bool) { + c.debug = enable } func (c *Configuration) GetDebug() bool { - return c.debug -} \ No newline at end of file + return c.debug +} diff --git a/modules/swagger-codegen/src/main/resources/go/model.mustache b/modules/swagger-codegen/src/main/resources/go/model.mustache index 4102299c5e9a..fd799a0e35d6 100644 --- a/modules/swagger-codegen/src/main/resources/go/model.mustache +++ b/modules/swagger-codegen/src/main/resources/go/model.mustache @@ -1,18 +1,14 @@ package {{packageName}} - -{{#models}} -import ( -{{#imports}} "{{import}}" -{{/imports}} +{{#models}}{{#imports}} +import ({{/imports}}{{#imports}} + "{{import}}"{{/imports}}{{#imports}} ) - -{{#model}} -{{#description}}// {{{description}}}{{/description}} +{{/imports}}{{#model}}{{#description}} +// {{{description}}}{{/description}} type {{classname}} struct { - {{#vars}} - {{#description}}// {{{description}}}{{/description}} - {{name}} {{{datatype}}} `json:"{{baseName}},omitempty"` - {{/vars}} +{{#vars}}{{#description}} + // {{{description}}}{{/description}} + {{name}} {{{datatype}}} `json:"{{baseName}},omitempty"` +{{/vars}} } -{{/model}} -{{/models}} +{{/model}}{{/models}} \ No newline at end of file diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index 92a8f1b86852..d4b05313c88d 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-27T21:14:49.805-07:00 +- Build date: 2016-05-01T14:37:06.925+01:00 - Build package: class io.swagger.codegen.languages.GoClientCodegen ## Installation diff --git a/samples/client/petstore/go/go-petstore/api_client.go b/samples/client/petstore/go/go-petstore/api_client.go index 743b45a139da..100a36da7e17 100644 --- a/samples/client/petstore/go/go-petstore/api_client.go +++ b/samples/client/petstore/go/go-petstore/api_client.go @@ -1,123 +1,120 @@ package petstore import ( - "strings" - "github.com/go-resty/resty" - "fmt" - "reflect" - "bytes" - "path/filepath" + "bytes" + "fmt" + "path/filepath" + "reflect" + "strings" + + "github.com/go-resty/resty" ) type APIClient struct { - } func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { - if (len(contentTypes) == 0){ - return "" - } - if contains(contentTypes,"application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' } func (c *APIClient) SelectHeaderAccept(accepts []string) string { - if (len(accepts) == 0){ - return "" - } - if contains(accepts,"application/json"){ - return "application/json" - } - - return strings.Join(accepts,",") + if len(accepts) == 0 { + return "" + } + if contains(accepts, "application/json") { + return "application/json" + } + return strings.Join(accepts, ",") } func contains(source []string, containvalue string) bool { - for _, a := range source { - if strings.ToLower(a) == strings.ToLower(containvalue) { - return true - } - } - return false + for _, a := range source { + if strings.ToLower(a) == strings.ToLower(containvalue) { + return true + } + } + return false } - func (c *APIClient) CallAPI(path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams map[string]string, - formParams map[string]string, - fileName string, - fileBytes []byte) (*resty.Response, error) { + postBody interface{}, + headerParams map[string]string, + queryParams map[string]string, + formParams map[string]string, + fileName string, + fileBytes []byte) (*resty.Response, error) { - //set debug flag - configuration := NewConfiguration() - resty.SetDebug(configuration.GetDebug()) + //set debug flag + configuration := NewConfiguration() + resty.SetDebug(configuration.GetDebug()) - request := prepareRequest(postBody, headerParams, queryParams, formParams,fileName,fileBytes) + request := prepareRequest(postBody, headerParams, queryParams, formParams, fileName, fileBytes) - switch strings.ToUpper(method) { - case "GET": - response, err := request.Get(path) - return response, err - case "POST": - response, err := request.Post(path) - return response, err - case "PUT": - response, err := request.Put(path) - return response, err - case "PATCH": - response, err := request.Patch(path) - return response, err - case "DELETE": - response, err := request.Delete(path) - return response, err - } + switch strings.ToUpper(method) { + case "GET": + response, err := request.Get(path) + return response, err + case "POST": + response, err := request.Post(path) + return response, err + case "PUT": + response, err := request.Put(path) + return response, err + case "PATCH": + response, err := request.Patch(path) + return response, err + case "DELETE": + response, err := request.Delete(path) + return response, err + } - return nil, fmt.Errorf("invalid method %v", method) + return nil, fmt.Errorf("invalid method %v", method) } func (c *APIClient) ParameterToString(obj interface{}) string { - if reflect.TypeOf(obj).String() == "[]string" { - return strings.Join(obj.([]string), ",") - } else { - return obj.(string) - } + if reflect.TypeOf(obj).String() == "[]string" { + return strings.Join(obj.([]string), ",") + } else { + return obj.(string) + } } func prepareRequest(postBody interface{}, - headerParams map[string]string, - queryParams map[string]string, - formParams map[string]string, - fileName string, - fileBytes []byte) *resty.Request { + headerParams map[string]string, + queryParams map[string]string, + formParams map[string]string, + fileName string, + fileBytes []byte) *resty.Request { - request := resty.R() + request := resty.R() + request.SetBody(postBody) - request.SetBody(postBody) + // add header parameter, if any + if len(headerParams) > 0 { + request.SetHeaders(headerParams) + } - // add header parameter, if any - if len(headerParams) > 0 { - request.SetHeaders(headerParams) - } - - // add query parameter, if any - if len(queryParams) > 0 { - request.SetQueryParams(queryParams) - } + // add query parameter, if any + if len(queryParams) > 0 { + request.SetQueryParams(queryParams) + } - // add form parameter, if any - if len(formParams) > 0 { - request.SetFormData(formParams) - } - - if len(fileBytes) > 0 && fileName != "" { - _, fileNm := filepath.Split(fileName) - request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) - } - return request + // add form parameter, if any + if len(formParams) > 0 { + request.SetFormData(formParams) + } + + if len(fileBytes) > 0 && fileName != "" { + _, fileNm := filepath.Split(fileName) + request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) + } + return request } diff --git a/samples/client/petstore/go/go-petstore/api_response.go b/samples/client/petstore/go/go-petstore/api_response.go index b670ad101a8b..0404289f96b1 100644 --- a/samples/client/petstore/go/go-petstore/api_response.go +++ b/samples/client/petstore/go/go-petstore/api_response.go @@ -1,24 +1,22 @@ package petstore import ( - "net/http" + "net/http" ) - type APIResponse struct { - *http.Response - - Message string `json:"message,omitempty"` + *http.Response + Message string `json:"message,omitempty"` } func NewAPIResponse(r *http.Response) *APIResponse { - response := &APIResponse{Response: r} - return response + response := &APIResponse{Response: r} + return response } func NewAPIResponseWithError(errorMessage string) *APIResponse { - response := &APIResponse{Message: errorMessage} - return response -} \ No newline at end of file + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/samples/client/petstore/go/go-petstore/category.go b/samples/client/petstore/go/go-petstore/category.go index eb7157219783..197316d62efd 100644 --- a/samples/client/petstore/go/go-petstore/category.go +++ b/samples/client/petstore/go/go-petstore/category.go @@ -1,12 +1,8 @@ package petstore -import ( -) - - type Category struct { - - Id int64 `json:"id,omitempty"` - - Name string `json:"name,omitempty"` + + Id int64 `json:"id,omitempty"` + + Name string `json:"name,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/configuration.go b/samples/client/petstore/go/go-petstore/configuration.go index 51aad379b42a..5d7df91948e0 100644 --- a/samples/client/petstore/go/go-petstore/configuration.go +++ b/samples/client/petstore/go/go-petstore/configuration.go @@ -1,59 +1,59 @@ package petstore import ( - "encoding/base64" + "encoding/base64" ) type Configuration struct { - UserName string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` - APIKeyPrefix map[string] string `json:"APIKeyPrefix,omitempty"` - APIKey map[string] string `json:"APIKey,omitempty"` - debug bool `json:"debug,omitempty"` - DebugFile string `json:"debugFile,omitempty"` - OAuthToken string `json:"oAuthToken,omitempty"` - Timeout int `json:"timeout,omitempty"` - BasePath string `json:"basePath,omitempty"` - Host string `json:"host,omitempty"` - Scheme string `json:"scheme,omitempty"` - AccessToken string `json:"accessToken,omitempty"` - DefaultHeader map[string]string `json:"defaultHeader,omitempty"` - UserAgent string `json:"userAgent,omitempty"` - APIClient APIClient `json:"APIClient,omitempty"` + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` + APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` + APIKey map[string]string `json:"APIKey,omitempty"` + debug bool `json:"debug,omitempty"` + DebugFile string `json:"debugFile,omitempty"` + OAuthToken string `json:"oAuthToken,omitempty"` + Timeout int `json:"timeout,omitempty"` + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + AccessToken string `json:"accessToken,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + APIClient APIClient `json:"APIClient,omitempty"` } func NewConfiguration() *Configuration { - return &Configuration{ - BasePath: "http://petstore.swagger.io/v2", - UserName: "", - debug: false, - DefaultHeader: make(map[string]string), - APIKey: make(map[string]string), - APIKeyPrefix: make(map[string]string), - UserAgent: "Swagger-Codegen/1.0.0/go", - } + return &Configuration{ + BasePath: "http://petstore.swagger.io/v2", + UserName: "", + debug: false, + DefaultHeader: make(map[string]string), + APIKey: make(map[string]string), + APIKeyPrefix: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", + } } func (c *Configuration) GetBasicAuthEncodedString() string { - return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password)) + return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password)) } func (c *Configuration) AddDefaultHeader(key string, value string) { - c.DefaultHeader[key] = value + c.DefaultHeader[key] = value } func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { - if c.APIKeyPrefix[APIKeyIdentifier] != ""{ - return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] - } - - return c.APIKey[APIKeyIdentifier] + if c.APIKeyPrefix[APIKeyIdentifier] != "" { + return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] + } + + return c.APIKey[APIKeyIdentifier] } -func (c *Configuration) SetDebug(enable bool){ - c.debug = enable +func (c *Configuration) SetDebug(enable bool) { + c.debug = enable } func (c *Configuration) GetDebug() bool { - return c.debug -} \ No newline at end of file + return c.debug +} diff --git a/samples/client/petstore/go/go-petstore/git_push.sh b/samples/client/petstore/go/go-petstore/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/go/go-petstore/git_push.sh +++ b/samples/client/petstore/go/go-petstore/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/go/go-petstore/model_api_response.go b/samples/client/petstore/go/go-petstore/model_api_response.go index 8183399abd9f..774f781ee93c 100644 --- a/samples/client/petstore/go/go-petstore/model_api_response.go +++ b/samples/client/petstore/go/go-petstore/model_api_response.go @@ -1,14 +1,10 @@ package petstore -import ( -) - - type ModelApiResponse struct { - - Code int32 `json:"code,omitempty"` - - Type_ string `json:"type,omitempty"` - - Message string `json:"message,omitempty"` + + Code int32 `json:"code,omitempty"` + + Type_ string `json:"type,omitempty"` + + Message string `json:"message,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/order.go b/samples/client/petstore/go/go-petstore/order.go index 29b6cffeba06..582d45a747fd 100644 --- a/samples/client/petstore/go/go-petstore/order.go +++ b/samples/client/petstore/go/go-petstore/order.go @@ -1,21 +1,21 @@ package petstore import ( - "time" + "time" ) - type Order struct { - - Id int64 `json:"id,omitempty"` - - PetId int64 `json:"petId,omitempty"` - - Quantity int32 `json:"quantity,omitempty"` - - ShipDate time.Time `json:"shipDate,omitempty"` - // Order Status - Status string `json:"status,omitempty"` - - Complete bool `json:"complete,omitempty"` + + Id int64 `json:"id,omitempty"` + + PetId int64 `json:"petId,omitempty"` + + Quantity int32 `json:"quantity,omitempty"` + + ShipDate time.Time `json:"shipDate,omitempty"` + + // Order Status + Status string `json:"status,omitempty"` + + Complete bool `json:"complete,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/pet.go b/samples/client/petstore/go/go-petstore/pet.go index 99016d2d5401..88e86af73999 100644 --- a/samples/client/petstore/go/go-petstore/pet.go +++ b/samples/client/petstore/go/go-petstore/pet.go @@ -1,20 +1,17 @@ package petstore -import ( -) - - type Pet struct { - - Id int64 `json:"id,omitempty"` - - Category Category `json:"category,omitempty"` - - Name string `json:"name,omitempty"` - - PhotoUrls []string `json:"photoUrls,omitempty"` - - Tags []Tag `json:"tags,omitempty"` - // pet status in the store - Status string `json:"status,omitempty"` + + Id int64 `json:"id,omitempty"` + + Category Category `json:"category,omitempty"` + + Name string `json:"name,omitempty"` + + PhotoUrls []string `json:"photoUrls,omitempty"` + + Tags []Tag `json:"tags,omitempty"` + + // pet status in the store + Status string `json:"status,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index ac4e23656be7..aea3db2ba098 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -1,602 +1,566 @@ package petstore import ( - "strings" - "fmt" - "errors" - "os" - "io/ioutil" - "encoding/json" + "strings" + "fmt" + "errors" + "os" +"io/ioutil" +"encoding/json" ) type PetApi struct { - Configuration Configuration + Configuration Configuration } -func NewPetApi() *PetApi{ - configuration := NewConfiguration() - return &PetApi { - Configuration: *configuration, - } +func NewPetApi() *PetApi { + configuration := NewConfiguration() + return &PetApi{ + Configuration: *configuration, + } } -func NewPetApiWithBasePath(basePath string) *PetApi{ - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &PetApi { - Configuration: *configuration, - } +func NewPetApiWithBasePath(basePath string) *PetApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &PetApi{ + Configuration: *configuration, + } } /** * Add a new pet to the store * + * * @param body Pet object that needs to be added to the store * @return void */ -func (a PetApi) AddPet (body Pet) (APIResponse, error) { +func (a PetApi) AddPet(body Pet) (APIResponse, error) { - var httpMethod = "Post" - // create path and map variables - path := a.Configuration.BasePath + "/pet" + var httpMethod = "Post" + // create path and map variables + path := a.Configuration.BasePath + "/pet" - // verify the required parameter 'body' is set - if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->AddPet") - } + // verify the required parameter 'body' is set + if &body == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->AddPet") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (petstore_auth) required - // authentication (petstore_auth) required - - // oauth required - if a.Configuration.AccessToken != ""{ - headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } + // oauth required + if a.Configuration.AccessToken != ""{ + headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/xml", } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - "application/json", - "application/xml", - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - // body params - postBody = &body + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + // body params + postBody = &body - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * Deletes a pet * + * * @param petId Pet id to delete * @param apiKey * @return void */ -func (a PetApi) DeletePet (petId int64, apiKey string) (APIResponse, error) { +func (a PetApi) DeletePet(petId int64, apiKey string) (APIResponse, error) { - var httpMethod = "Delete" - // create path and map variables - path := a.Configuration.BasePath + "/pet/{petId}" - path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) + var httpMethod = "Delete" + // create path and map variables + path := a.Configuration.BasePath + "/pet/{petId}" + path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) - // verify the required parameter 'petId' is set - if &petId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") - } + // verify the required parameter 'petId' is set + if &petId == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (petstore_auth) required - // authentication (petstore_auth) required - - // oauth required - if a.Configuration.AccessToken != ""{ - headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } + // oauth required + if a.Configuration.AccessToken != ""{ + headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } - // header params "api_key" - headerParams["api_key"] = apiKey + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + + // header params "api_key" + headerParams["api_key"] = apiKey + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * 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 * @return []Pet */ -func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) { +func (a PetApi) FindPetsByStatus(status []string) ([]Pet, APIResponse, error) { - var httpMethod = "Get" - // create path and map variables - path := a.Configuration.BasePath + "/pet/findByStatus" + var httpMethod = "Get" + // create path and map variables + path := a.Configuration.BasePath + "/pet/findByStatus" - // verify the required parameter 'status' is set - if &status == nil { - return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") - } + // verify the required parameter 'status' is set + if &status == nil { + return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (petstore_auth) required - // authentication (petstore_auth) required - - // oauth required - if a.Configuration.AccessToken != ""{ - headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } + // oauth required + if a.Configuration.AccessToken != ""{ + headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - - queryParams["status"] = a.Configuration.APIClient.ParameterToString(status) + queryParams["status"] = a.Configuration.APIClient.ParameterToString(status) + - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - var successPayload = new([]Pet) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new([]Pet) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + /** * 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 * @return []Pet */ -func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) { +func (a PetApi) FindPetsByTags(tags []string) ([]Pet, APIResponse, error) { - var httpMethod = "Get" - // create path and map variables - path := a.Configuration.BasePath + "/pet/findByTags" + var httpMethod = "Get" + // create path and map variables + path := a.Configuration.BasePath + "/pet/findByTags" - // verify the required parameter 'tags' is set - if &tags == nil { - return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") - } + // verify the required parameter 'tags' is set + if &tags == nil { + return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (petstore_auth) required - // authentication (petstore_auth) required - - // oauth required - if a.Configuration.AccessToken != ""{ - headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } + // oauth required + if a.Configuration.AccessToken != ""{ + headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - - queryParams["tags"] = a.Configuration.APIClient.ParameterToString(tags) + queryParams["tags"] = a.Configuration.APIClient.ParameterToString(tags) + - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - var successPayload = new([]Pet) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new([]Pet) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + /** * Find pet by ID * Returns a single pet + * * @param petId ID of pet to return * @return Pet */ -func (a PetApi) GetPetById (petId int64) (Pet, APIResponse, error) { +func (a PetApi) GetPetById(petId int64) (Pet, APIResponse, error) { - var httpMethod = "Get" - // create path and map variables - path := a.Configuration.BasePath + "/pet/{petId}" - path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) + var httpMethod = "Get" + // create path and map variables + path := a.Configuration.BasePath + "/pet/{petId}" + path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) - // verify the required parameter 'petId' is set - if &petId == nil { - return *new(Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") - } + // verify the required parameter 'petId' is set + if &petId == nil { + return *new(Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (api_key) required - // authentication (api_key) required - - // set key with prefix in header - headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key") - + // set key with prefix in header + headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - var successPayload = new(Pet) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(Pet) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + /** * Update an existing pet * + * * @param body Pet object that needs to be added to the store * @return void */ -func (a PetApi) UpdatePet (body Pet) (APIResponse, error) { +func (a PetApi) UpdatePet(body Pet) (APIResponse, error) { - var httpMethod = "Put" - // create path and map variables - path := a.Configuration.BasePath + "/pet" + var httpMethod = "Put" + // create path and map variables + path := a.Configuration.BasePath + "/pet" - // verify the required parameter 'body' is set - if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") - } + // verify the required parameter 'body' is set + if &body == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (petstore_auth) required - // authentication (petstore_auth) required - - // oauth required - if a.Configuration.AccessToken != ""{ - headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } + // oauth required + if a.Configuration.AccessToken != ""{ + headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/xml", } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - "application/json", - "application/xml", - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - // body params - postBody = &body + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + // body params + postBody = &body - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * Updates a pet in the store with form data * + * * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet * @return void */ -func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (APIResponse, error) { +func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (APIResponse, error) { - var httpMethod = "Post" - // create path and map variables - path := a.Configuration.BasePath + "/pet/{petId}" - path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) + var httpMethod = "Post" + // create path and map variables + path := a.Configuration.BasePath + "/pet/{petId}" + path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) - // verify the required parameter 'petId' is set - if &petId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") - } + // verify the required parameter 'petId' is set + if &petId == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (petstore_auth) required - // authentication (petstore_auth) required - - // oauth required - if a.Configuration.AccessToken != ""{ - headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } + // oauth required + if a.Configuration.AccessToken != ""{ + headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/x-www-form-urlencoded", } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - "application/x-www-form-urlencoded", - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - formParams["name"] = name - formParams["status"] = status + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + formParams["name"] = name + formParams["status"] = status - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * uploads an image * + * * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload * @return ModelApiResponse */ -func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (ModelApiResponse, APIResponse, error) { +func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (ModelApiResponse, APIResponse, error) { - var httpMethod = "Post" - // create path and map variables - path := a.Configuration.BasePath + "/pet/{petId}/uploadImage" - path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) + var httpMethod = "Post" + // create path and map variables + path := a.Configuration.BasePath + "/pet/{petId}/uploadImage" + path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) - // verify the required parameter 'petId' is set - if &petId == nil { - return *new(ModelApiResponse), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") - } + // verify the required parameter 'petId' is set + if &petId == nil { + return *new(ModelApiResponse), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (petstore_auth) required - // authentication (petstore_auth) required - - // oauth required - if a.Configuration.AccessToken != ""{ - headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } + // oauth required + if a.Configuration.AccessToken != ""{ + headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "multipart/form-data", } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - "multipart/form-data", - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } - formParams["additionalMetadata"] = additionalMetadata - fbs, _ := ioutil.ReadAll(file) - fileBytes = fbs - fileName = file.Name() + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } - var successPayload = new(ModelApiResponse) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + formParams["additionalMetadata"] = additionalMetadata fbs, _ := ioutil.ReadAll(file) + fileBytes = fbs + fileName = file.Name() - - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + var successPayload = new(ModelApiResponse) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index ae0111773544..d28483051141 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -1,282 +1,264 @@ package petstore import ( - "strings" - "fmt" - "errors" - "encoding/json" + "strings" + "fmt" + "errors" + "encoding/json" ) type StoreApi struct { - Configuration Configuration + Configuration Configuration } -func NewStoreApi() *StoreApi{ - configuration := NewConfiguration() - return &StoreApi { - Configuration: *configuration, - } +func NewStoreApi() *StoreApi { + configuration := NewConfiguration() + return &StoreApi{ + Configuration: *configuration, + } } -func NewStoreApiWithBasePath(basePath string) *StoreApi{ - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &StoreApi { - Configuration: *configuration, - } +func NewStoreApiWithBasePath(basePath string) *StoreApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &StoreApi{ + Configuration: *configuration, + } } /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * * @param orderId ID of the order that needs to be deleted * @return void */ -func (a StoreApi) DeleteOrder (orderId string) (APIResponse, error) { +func (a StoreApi) DeleteOrder(orderId string) (APIResponse, error) { - var httpMethod = "Delete" - // create path and map variables - path := a.Configuration.BasePath + "/store/order/{orderId}" - path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1) + var httpMethod = "Delete" + // create path and map variables + path := a.Configuration.BasePath + "/store/order/{orderId}" + path = strings.Replace(path, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1) - // verify the required parameter 'orderId' is set - if &orderId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") - } + // verify the required parameter 'orderId' is set + if &orderId == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * Returns pet inventories by status * Returns a map of status codes to quantities + * * @return map[string]int32 */ -func (a StoreApi) GetInventory () (map[string]int32, APIResponse, error) { +func (a StoreApi) GetInventory() (map[string]int32, APIResponse, error) { - var httpMethod = "Get" - // create path and map variables - path := a.Configuration.BasePath + "/store/inventory" + var httpMethod = "Get" + // create path and map variables + path := a.Configuration.BasePath + "/store/inventory" - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte + // authentication (api_key) required - // authentication (api_key) required - - // set key with prefix in header - headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key") - + // set key with prefix in header + headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } - var successPayload = new(map[string]int32) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(map[string]int32) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + /** * Find purchase order by ID * 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 * @return Order */ -func (a StoreApi) GetOrderById (orderId int64) (Order, APIResponse, error) { +func (a StoreApi) GetOrderById(orderId int64) (Order, APIResponse, error) { - var httpMethod = "Get" - // create path and map variables - path := a.Configuration.BasePath + "/store/order/{orderId}" - path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1) + var httpMethod = "Get" + // create path and map variables + path := a.Configuration.BasePath + "/store/order/{orderId}" + path = strings.Replace(path, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1) - // verify the required parameter 'orderId' is set - if &orderId == nil { - return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") - } + // verify the required parameter 'orderId' is set + if &orderId == nil { + return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - var successPayload = new(Order) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(Order) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + /** * Place an order for a pet * + * * @param body order placed for purchasing the pet * @return Order */ -func (a StoreApi) PlaceOrder (body Order) (Order, APIResponse, error) { +func (a StoreApi) PlaceOrder(body Order) (Order, APIResponse, error) { - var httpMethod = "Post" - // create path and map variables - path := a.Configuration.BasePath + "/store/order" + var httpMethod = "Post" + // create path and map variables + path := a.Configuration.BasePath + "/store/order" - // verify the required parameter 'body' is set - if &body == nil { - return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") - } + // verify the required parameter 'body' is set + if &body == nil { + return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } - // body params - postBody = &body + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - var successPayload = new(Order) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + // body params + postBody = &body - - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + var successPayload = new(Order) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + diff --git a/samples/client/petstore/go/go-petstore/tag.go b/samples/client/petstore/go/go-petstore/tag.go index 71bb9d198a40..ae901c30ec4e 100644 --- a/samples/client/petstore/go/go-petstore/tag.go +++ b/samples/client/petstore/go/go-petstore/tag.go @@ -1,12 +1,8 @@ package petstore -import ( -) - - type Tag struct { - - Id int64 `json:"id,omitempty"` - - Name string `json:"name,omitempty"` + + Id int64 `json:"id,omitempty"` + + Name string `json:"name,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/user.go b/samples/client/petstore/go/go-petstore/user.go index 91a42e57a0ed..140a94a275b1 100644 --- a/samples/client/petstore/go/go-petstore/user.go +++ b/samples/client/petstore/go/go-petstore/user.go @@ -1,24 +1,21 @@ package petstore -import ( -) - - type User struct { - - Id int64 `json:"id,omitempty"` - - Username string `json:"username,omitempty"` - - FirstName string `json:"firstName,omitempty"` - - LastName string `json:"lastName,omitempty"` - - Email string `json:"email,omitempty"` - - Password string `json:"password,omitempty"` - - Phone string `json:"phone,omitempty"` - // User Status - UserStatus int32 `json:"userStatus,omitempty"` + + Id int64 `json:"id,omitempty"` + + Username string `json:"username,omitempty"` + + FirstName string `json:"firstName,omitempty"` + + LastName string `json:"lastName,omitempty"` + + Email string `json:"email,omitempty"` + + Password string `json:"password,omitempty"` + + Phone string `json:"phone,omitempty"` + + // User Status + UserStatus int32 `json:"userStatus,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index 8ac944e79fa1..ce23df39d690 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -1,539 +1,519 @@ package petstore import ( - "strings" - "fmt" - "errors" - "encoding/json" + "strings" + "fmt" + "errors" + "encoding/json" ) type UserApi struct { - Configuration Configuration + Configuration Configuration } -func NewUserApi() *UserApi{ - configuration := NewConfiguration() - return &UserApi { - Configuration: *configuration, - } +func NewUserApi() *UserApi { + configuration := NewConfiguration() + return &UserApi{ + Configuration: *configuration, + } } -func NewUserApiWithBasePath(basePath string) *UserApi{ - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &UserApi { - Configuration: *configuration, - } +func NewUserApiWithBasePath(basePath string) *UserApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &UserApi{ + Configuration: *configuration, + } } /** * Create user * This can only be done by the logged in user. + * * @param body Created user object * @return void */ -func (a UserApi) CreateUser (body User) (APIResponse, error) { +func (a UserApi) CreateUser(body User) (APIResponse, error) { - var httpMethod = "Post" - // create path and map variables - path := a.Configuration.BasePath + "/user" + var httpMethod = "Post" + // create path and map variables + path := a.Configuration.BasePath + "/user" - // verify the required parameter 'body' is set - if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") - } + // verify the required parameter 'body' is set + if &body == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } - // body params - postBody = &body + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + // body params + postBody = &body - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * Creates list of users with given input array * + * * @param body List of user object * @return void */ -func (a UserApi) CreateUsersWithArrayInput (body []User) (APIResponse, error) { +func (a UserApi) CreateUsersWithArrayInput(body []User) (APIResponse, error) { - var httpMethod = "Post" - // create path and map variables - path := a.Configuration.BasePath + "/user/createWithArray" + var httpMethod = "Post" + // create path and map variables + path := a.Configuration.BasePath + "/user/createWithArray" - // verify the required parameter 'body' is set - if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") - } + // verify the required parameter 'body' is set + if &body == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } - // body params - postBody = &body + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + // body params + postBody = &body - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * Creates list of users with given input array * + * * @param body List of user object * @return void */ -func (a UserApi) CreateUsersWithListInput (body []User) (APIResponse, error) { +func (a UserApi) CreateUsersWithListInput(body []User) (APIResponse, error) { - var httpMethod = "Post" - // create path and map variables - path := a.Configuration.BasePath + "/user/createWithList" + var httpMethod = "Post" + // create path and map variables + path := a.Configuration.BasePath + "/user/createWithList" - // verify the required parameter 'body' is set - if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") - } + // verify the required parameter 'body' is set + if &body == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } - // body params - postBody = &body + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + // body params + postBody = &body - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * Delete user * This can only be done by the logged in user. + * * @param username The name that needs to be deleted * @return void */ -func (a UserApi) DeleteUser (username string) (APIResponse, error) { +func (a UserApi) DeleteUser(username string) (APIResponse, error) { - var httpMethod = "Delete" - // create path and map variables - path := a.Configuration.BasePath + "/user/{username}" - path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) + var httpMethod = "Delete" + // create path and map variables + path := a.Configuration.BasePath + "/user/{username}" + path = strings.Replace(path, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) - // verify the required parameter 'username' is set - if &username == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") - } + // verify the required parameter 'username' is set + if &username == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * Get user by user name * + * * @param username The name that needs to be fetched. Use user1 for testing. * @return User */ -func (a UserApi) GetUserByName (username string) (User, APIResponse, error) { +func (a UserApi) GetUserByName(username string) (User, APIResponse, error) { - var httpMethod = "Get" - // create path and map variables - path := a.Configuration.BasePath + "/user/{username}" - path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) + var httpMethod = "Get" + // create path and map variables + path := a.Configuration.BasePath + "/user/{username}" + path = strings.Replace(path, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) - // verify the required parameter 'username' is set - if &username == nil { - return *new(User), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") - } + // verify the required parameter 'username' is set + if &username == nil { + return *new(User), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - var successPayload = new(User) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(User) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + /** * Logs user into the system * + * * @param username The user name for login * @param password The password for login in clear text * @return string */ -func (a UserApi) LoginUser (username string, password string) (string, APIResponse, error) { +func (a UserApi) LoginUser(username string, password string) (string, APIResponse, error) { - var httpMethod = "Get" - // create path and map variables - path := a.Configuration.BasePath + "/user/login" + var httpMethod = "Get" + // create path and map variables + path := a.Configuration.BasePath + "/user/login" - // verify the required parameter 'username' is set - if &username == nil { - return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") - } - // verify the required parameter 'password' is set - if &password == nil { - return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") - } + // verify the required parameter 'username' is set + if &username == nil { + return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") + } + // verify the required parameter 'password' is set + if &password == nil { + return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - - queryParams["username"] = a.Configuration.APIClient.ParameterToString(username) - queryParams["password"] = a.Configuration.APIClient.ParameterToString(password) + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + queryParams["username"] = a.Configuration.APIClient.ParameterToString(username) + + queryParams["password"] = a.Configuration.APIClient.ParameterToString(password) + - var successPayload = new(string) - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } - if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err - } - - err = json.Unmarshal(httpResponse.Body(), &successPayload) - - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(string) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + } + err = json.Unmarshal(httpResponse.Body(), &successPayload) + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } + /** * Logs out current logged in user session * + * * @return void */ -func (a UserApi) LogoutUser () (APIResponse, error) { +func (a UserApi) LogoutUser() (APIResponse, error) { - var httpMethod = "Get" - // create path and map variables - path := a.Configuration.BasePath + "/user/logout" + var httpMethod = "Get" + // create path and map variables + path := a.Configuration.BasePath + "/user/logout" - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + /** * Updated user * This can only be done by the logged in user. + * * @param username name that need to be deleted * @param body Updated user object * @return void */ -func (a UserApi) UpdateUser (username string, body User) (APIResponse, error) { +func (a UserApi) UpdateUser(username string, body User) (APIResponse, error) { - var httpMethod = "Put" - // create path and map variables - path := a.Configuration.BasePath + "/user/{username}" - path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) + var httpMethod = "Put" + // create path and map variables + path := a.Configuration.BasePath + "/user/{username}" + path = strings.Replace(path, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) - // verify the required parameter 'username' is set - if &username == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") - } - // verify the required parameter 'body' is set - if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") - } + // verify the required parameter 'username' is set + if &username == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") + } + // verify the required parameter 'body' is set + if &body == nil { + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") + } - headerParams := make(map[string]string) - queryParams := make(map[string]string) - formParams := make(map[string]string) - var postBody interface{} - var fileName string - var fileBytes []byte + headerParams := make(map[string]string) + queryParams := make(map[string]string) + formParams := make(map[string]string) + var postBody interface{} + var fileName string + var fileBytes []byte - - // add default headers if any - for key := range a.Configuration.DefaultHeader { - headerParams[key] = a.Configuration.DefaultHeader[key] - } - + // add default headers if any + for key := range a.Configuration.DefaultHeader { + headerParams[key] = a.Configuration.DefaultHeader[key] + } - // to determine the Content-Type header - localVarHttpContentTypes := []string { - } - //set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - headerParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string { - "application/xml", - "application/json", - } - //set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - headerParams["Accept"] = localVarHttpHeaderAccept - } + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } - // body params - postBody = &body + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + headerParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml", +"application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + headerParams["Accept"] = localVarHttpHeaderAccept + } + // body params + postBody = &body - httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + if err != nil { + return *NewAPIResponse(httpResponse.RawResponse), err + } - - if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err - } - - return *NewAPIResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } + From 6e8497fdb74011496204855cf43601d8ab65bf38 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Sun, 1 May 2016 16:09:02 +0100 Subject: [PATCH 042/170] Add validation to api class --- .../src/main/resources/python/api.mustache | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index 0967a2ec6b3d..1a50f753409d 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -21,6 +21,7 @@ from __future__ import absolute_import import sys import os +import re # python 2 and python 3 compatibility library from six import iteritems @@ -94,6 +95,23 @@ class {{classname}}(object): if ('{{paramName}}' not in params) or (params['{{paramName}}'] is None): raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") {{/required}} +{{/allParams}} + +{{#allParams}} +{{#hasValidation}} + {{#maximum}} + if {{#required}}{{paramName}}{{/required}}{{^required}}'{{paramName}}' in params and params['{{paramName}}']{{/required}} > {{maximum}}: + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than `{{maximum}}`") + {{/maximum}} + {{#minimum}} + if {{#required}}{{paramName}}{{/required}}{{^required}}'{{paramName}}' in params and params['{{paramName}}']{{/required}} < {{minimum}}: + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than `{{minimum}}`") + {{/minimum}} + {{#pattern}} + #if not re.match('{{pattern}}', {{#required}}{{paramName}}{{/required}}{{^required}}'{{paramName}}' in params and params['{{paramName}}']{{/required}}): + # raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{pattern}}`") + {{/pattern}} +{{/hasValidation}} {{/allParams}} resource_path = '{{path}}'.replace('{format}', 'json') From cea6bce196893d804633d0904afbb0861314b10a Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Sun, 1 May 2016 16:15:29 +0100 Subject: [PATCH 043/170] Follow convention in place when accessing attributes --- .../swagger-codegen/src/main/resources/python/api.mustache | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index 1a50f753409d..e74365399e2e 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -100,15 +100,15 @@ class {{classname}}(object): {{#allParams}} {{#hasValidation}} {{#maximum}} - if {{#required}}{{paramName}}{{/required}}{{^required}}'{{paramName}}' in params and params['{{paramName}}']{{/required}} > {{maximum}}: + if '{{paramName}}' in params and params['{{paramName}}'] > {{maximum}}: raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than `{{maximum}}`") {{/maximum}} {{#minimum}} - if {{#required}}{{paramName}}{{/required}}{{^required}}'{{paramName}}' in params and params['{{paramName}}']{{/required}} < {{minimum}}: + if '{{paramName}}' in params and params['{{paramName}}'] < {{minimum}}: raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than `{{minimum}}`") {{/minimum}} {{#pattern}} - #if not re.match('{{pattern}}', {{#required}}{{paramName}}{{/required}}{{^required}}'{{paramName}}' in params and params['{{paramName}}']{{/required}}): + #if not re.match('{{pattern}}', '{{paramName}}' in params and params['{{paramName}}']): # raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{pattern}}`") {{/pattern}} {{/hasValidation}} From 97e69aabc3ea62e913228b76a514fb61d10183cc Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Sun, 1 May 2016 16:38:56 +0100 Subject: [PATCH 044/170] Add support for max/min string length --- .../src/main/resources/python/api.mustache | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index e74365399e2e..5a38ee255ee3 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -99,6 +99,14 @@ class {{classname}}(object): {{#allParams}} {{#hasValidation}} + {{#maxLength}} + if '{{paramName}}' in params and len(params['{{paramName}}']) > {{maxLength}}: + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than `{{maxLength}}`") + {{/maxLength}} + {{#minLength}} + if '{{paramName}}' in params and len(params['{{paramName}}']) < {{minLength}}: + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than `{{minLength}}`") + {{/minLength}} {{#maximum}} if '{{paramName}}' in params and params['{{paramName}}'] > {{maximum}}: raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than `{{maximum}}`") From 7b578a4c4e0d37c866baf42dedfbc796a5804ac6 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Tue, 26 Apr 2016 22:37:40 -0400 Subject: [PATCH 045/170] Update C# client structure using common standards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aligns C# project outputs more with community accepted standards and leverges Nuget for package management. This also moves the generated C# sample code out of the test project's Lib folder. The output structure here was causing some issues with maintainability (e.g. had to update test project with generated code). (see: https://gist.github.com/davidfowl/ed7564297c61fe9ab814) Output for a project, IO.Swagger will now look like: . ├── IO.Swagger.sln ├── README.md ├── bin ├── build.bat ├── build.sh ├── docs ├── packages └── src ├── IO.Swagger │   └── packages.config └── IO.Swagger.Test └── packages.config This is a change from the Java-like src/main/csharp/IO/Swagger/etc structure and will be a breaking change for some. --- .gitignore | 10 +- bin/csharp-petstore.sh | 2 +- bin/windows/csharp-petstore.bat | 2 +- .../languages/AbstractCSharpCodegen.java | 16 +- .../languages/CSharpClientCodegen.java | 51 ++- .../main/resources/csharp/Project.mustache | 21 +- .../src/main/resources/csharp/README.mustache | 4 +- .../main/resources/csharp/Solution.mustache | 27 ++ .../resources/csharp/TestProject.mustache | 81 ++++ .../resources/csharp/compile-mono.sh.mustache | 8 +- .../main/resources/csharp/compile.mustache | 8 +- .../csharp/packages_test.config.mustache | 6 + .../Lib => }/SwaggerClient/.gitignore | 0 .../csharp/SwaggerClient/IO.Swagger.sln | 27 ++ .../Lib => }/SwaggerClient/README.md | 75 ++-- .../petstore/csharp/SwaggerClient/build.bat | 14 + .../build.sh} | 8 +- .../Lib => }/SwaggerClient/docs/Animal.md | 0 .../SwaggerClient/docs/ApiResponse.md | 0 .../Lib => }/SwaggerClient/docs/Cat.md | 0 .../Lib => }/SwaggerClient/docs/Category.md | 0 .../Lib => }/SwaggerClient/docs/Dog.md | 0 .../csharp/SwaggerClient/docs/FakeApi.md | 91 ++++ .../Lib => }/SwaggerClient/docs/FormatTest.md | 6 +- .../SwaggerClient/docs/Model200Response.md | 0 .../SwaggerClient/docs/ModelReturn.md | 0 .../Lib => }/SwaggerClient/docs/Name.md | 0 .../Lib => }/SwaggerClient/docs/Order.md | 0 .../Lib => }/SwaggerClient/docs/Pet.md | 0 .../Lib => }/SwaggerClient/docs/PetApi.md | 0 .../SwaggerClient/docs/SpecialModelName.md | 0 .../Lib => }/SwaggerClient/docs/StoreApi.md | 0 .../Lib => }/SwaggerClient/docs/Tag.md | 0 .../Lib => }/SwaggerClient/docs/User.md | 0 .../Lib => }/SwaggerClient/docs/UserApi.md | 0 .../Lib => }/SwaggerClient/git_push.sh | 0 .../src/IO.Swagger.Test/Api/FakeApiTests.cs | 80 ++++ .../src/IO.Swagger.Test/Api}/PetApiTests.cs | 0 .../src/IO.Swagger.Test/Api}/StoreApiTests.cs | 0 .../src/IO.Swagger.Test/Api}/UserApiTests.cs | 0 .../IO.Swagger.Test/IO.Swagger.Test.csproj | 73 +++ .../src/IO.Swagger.Test/Model}/AnimalTests.cs | 0 .../Model}/ApiResponseTests.cs | 0 .../src/IO.Swagger.Test/Model}/CatTests.cs | 0 .../IO.Swagger.Test/Model}/CategoryTests.cs | 0 .../src/IO.Swagger.Test/Model}/DogTests.cs | 0 .../IO.Swagger.Test/Model}/FormatTestTests.cs | 0 .../Model}/Model200ResponseTests.cs | 0 .../Model}/ModelReturnTests.cs | 0 .../src/IO.Swagger.Test/Model}/NameTests.cs | 0 .../src/IO.Swagger.Test/Model}/OrderTests.cs | 0 .../src/IO.Swagger.Test/Model}/PetTests.cs | 0 .../Model}/SpecialModelNameTests.cs | 0 .../src/IO.Swagger.Test/Model}/TagTests.cs | 0 .../src/IO.Swagger.Test/Model}/UserTests.cs | 0 .../src/IO.Swagger.Test/packages.config | 6 + .../src/IO.Swagger/Api/FakeApi.cs | 418 ++++++++++++++++++ .../src/IO.Swagger}/Api/PetApi.cs | 0 .../src/IO.Swagger}/Api/StoreApi.cs | 0 .../src/IO.Swagger}/Api/UserApi.cs | 0 .../src/IO.Swagger}/Client/ApiClient.cs | 0 .../src/IO.Swagger}/Client/ApiException.cs | 0 .../src/IO.Swagger}/Client/ApiResponse.cs | 0 .../src/IO.Swagger}/Client/Configuration.cs | 0 .../src/IO.Swagger/IO.Swagger.csproj | 61 +++ .../src/IO.Swagger}/Model/Animal.cs | 0 .../src/IO.Swagger}/Model/ApiResponse.cs | 0 .../src/IO.Swagger}/Model/Cat.cs | 0 .../src/IO.Swagger}/Model/Category.cs | 0 .../src/IO.Swagger}/Model/Dog.cs | 0 .../src/IO.Swagger}/Model/FormatTest.cs | 36 +- .../src/IO.Swagger}/Model/Model200Response.cs | 0 .../src/IO.Swagger}/Model/ModelReturn.cs | 0 .../src/IO.Swagger}/Model/Name.cs | 0 .../src/IO.Swagger}/Model/Order.cs | 0 .../src/IO.Swagger}/Model/Pet.cs | 0 .../src/IO.Swagger}/Model/SpecialModelName.cs | 0 .../src/IO.Swagger}/Model/Tag.cs | 0 .../src/IO.Swagger}/Model/User.cs | 0 .../IO.Swagger}/Properties/AssemblyInfo.cs | 0 .../src/IO.Swagger}/packages.config | 0 .../InlineResponse200Tests.cs | 104 ----- .../Lib/SwaggerClient/README.mustache | 184 -------- .../Lib/SwaggerClient/bin/Newtonsoft.Json.dll | Bin 521216 -> 0 bytes .../Lib/SwaggerClient/bin/RestSharp.dll | Bin 167936 -> 0 bytes .../Lib/SwaggerClient/compile.bat | 14 - .../SwaggerClient/docs/InlineResponse200.md | 14 - .../Lib/SwaggerClient/petstore | 0 .../IO/Swagger/Model/InlineResponse200.cs | 217 --------- .../csharp/IO/Swagger/Model/ObjectReturn.cs | 113 ----- .../src/main/csharp/IO/Swagger/Model/Task.cs | 113 ----- .../SwaggerClientTest.csproj | 46 +- .../SwaggerClientTest/SwaggerClientTest.sln | 6 + .../SwaggerClientTest.userprefs | 20 +- ...ClientTest.csproj.FilesWrittenAbsolute.txt | 20 +- .../csharp/SwaggerClientTest/packages.config | 2 + .../packages/repositories.config | 7 +- 97 files changed, 1086 insertions(+), 905 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/csharp/Solution.mustache create mode 100644 modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache create mode 100644 modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/.gitignore (100%) create mode 100644 samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/README.md (70%) create mode 100644 samples/client/petstore/csharp/SwaggerClient/build.bat rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh => SwaggerClient/build.sh} (56%) mode change 100755 => 100644 rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Animal.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/ApiResponse.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Cat.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Category.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Dog.md (100%) create mode 100644 samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/FormatTest.md (84%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Model200Response.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/ModelReturn.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Name.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Order.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Pet.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/PetApi.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/SpecialModelName.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/StoreApi.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/Tag.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/User.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/docs/UserApi.md (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib => }/SwaggerClient/git_push.sh (100%) create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Api}/PetApiTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Api}/StoreApiTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Api}/UserApiTests.cs (100%) create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/AnimalTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/ApiResponseTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/CatTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/CategoryTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/DogTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/FormatTestTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/Model200ResponseTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/ModelReturnTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/NameTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/OrderTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/PetTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/SpecialModelNameTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/TagTests.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient.Test => SwaggerClient/src/IO.Swagger.Test/Model}/UserTests.cs (100%) create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Api/PetApi.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Api/StoreApi.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Api/UserApi.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Client/ApiClient.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Client/ApiException.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Client/ApiResponse.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Client/Configuration.cs (100%) create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Animal.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/ApiResponse.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Cat.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Category.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Dog.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/FormatTest.cs (90%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Model200Response.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/ModelReturn.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Name.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Order.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Pet.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/SpecialModelName.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/Tag.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Model/User.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger => SwaggerClient/src/IO.Swagger}/Properties/AssemblyInfo.cs (100%) rename samples/client/petstore/csharp/{SwaggerClientTest/Lib/SwaggerClient/vendor => SwaggerClient/src/IO.Swagger}/packages.config (100%) delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/InlineResponse200Tests.cs delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/bin/Newtonsoft.Json.dll delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/bin/RestSharp.dll delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/compile.bat delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/InlineResponse200.md delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/petstore delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ObjectReturn.cs delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Task.cs diff --git a/.gitignore b/.gitignore index 0dc527992362..c098adc308f1 100644 --- a/.gitignore +++ b/.gitignore @@ -91,13 +91,19 @@ samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddat samples/client/petstore/csharp/SwaggerClientTest/.vs samples/client/petstore/csharp/SwaggerClientTest/obj samples/client/petstore/csharp/SwaggerClientTest/bin -samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/vendor/ +samples/client/petstore/csharp/SwaggerClientTest/packages samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/ samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/ -samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/nuget.exe samples/client/petstore/csharp/SwaggerClientTest/TestResult.xml samples/client/petstore/csharp/SwaggerClientTest/nuget.exe samples/client/petstore/csharp/SwaggerClientTest/testrunner/ +samples/client/petstore/csharp/SwaggerClient/.vs +samples/client/petstore/csharp/SwaggerClient/nuget.exe +samples/client/petstore/csharp/SwaggerClient/obj +samples/client/petstore/csharp/SwaggerClient/bin +samples/client/petstore/csharp/SwaggerClient/obj/Debug/ +samples/client/petstore/csharp/SwaggerClient/bin/Debug/ +samples/client/petstore/csharp/SwaggerClient/packages # Python *.pyc diff --git a/bin/csharp-petstore.sh b/bin/csharp-petstore.sh index c042dd9c0cd0..15b80bc71f7c 100755 --- a/bin/csharp-petstore.sh +++ b/bin/csharp-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClient -DoptionalProjectFile=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/csharp-petstore.bat b/bin/windows/csharp-petstore.bat index 227ed319441d..29338524c020 100755 --- a/bin/windows/csharp-petstore.bat +++ b/bin/windows/csharp-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -t modules\swagger-codegen\src\main\resources\csharp -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l csharp -o samples\client\petstore\csharp\SwaggerClientTest\Lib\SwaggerClient +set ags=generate -t modules\swagger-codegen\src\main\resources\csharp -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l csharp -o samples\client\petstore\csharp\SwaggerClient -DoptionalProjectFile=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java index df23c1f22753..cd9bbc728fc8 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java @@ -21,7 +21,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co protected String packageVersion = "1.0.0"; protected String packageName = "IO.Swagger"; - protected String sourceFolder = "src" + File.separator + packageName; + + protected String sourceFolder = "src"; + + // TODO: Add option for test folder output location. Nice to allow e.g. ./test instead of ./src. + // This would require updating relative paths (e.g. path to main project file in test project file) + protected String testFolder = sourceFolder; protected Set collectionTypes; protected Set mapTypes; @@ -277,12 +282,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co @Override public String apiFileFolder() { - return outputFolder + File.separator + sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar); + return outputFolder + File.separator + sourceFolder + File.separator + packageName + File.separator + apiPackage(); } @Override public String modelFileFolder() { - return outputFolder + File.separator + sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar); + return outputFolder + File.separator + sourceFolder + File.separator + packageName + File.separator + modelPackage(); } @Override @@ -532,7 +537,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co return toModelName(name) + "Tests"; } - public void setPackageName(String packageName) { this.packageName = packageName; } @@ -544,4 +548,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co public void setSourceFolder(String sourceFolder) { this.sourceFolder = sourceFolder; } + + public String testPackageName() { + return this.packageName + ".Test"; + } } 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 b8f2b187a6ab..a71905b3eb6d 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 @@ -68,9 +68,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); - // C# client default - setSourceFolder("src" + File.separator + "main" + File.separator + "csharp"); - cliOptions.clear(); // CLI options @@ -141,9 +138,9 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { public void processOpts() { super.processOpts(); - apiPackage = packageName + ".Api"; - modelPackage = packageName + ".Model"; - clientPackage = packageName + ".Client"; + apiPackage = "Api"; + modelPackage = "Model"; + clientPackage = "Client"; additionalProperties.put("clientPackage", clientPackage); @@ -157,6 +154,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { if (additionalProperties.containsKey(CodegenConstants.DOTNET_FRAMEWORK)) { setTargetFramework((String) additionalProperties.get(CodegenConstants.DOTNET_FRAMEWORK)); + } else { + // Ensure default is set. + setTargetFramework(NET45); + additionalProperties.put("targetFramework", this.targetFramework); } if (NET35.equals(this.targetFramework)) { @@ -201,8 +202,12 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { .get(CodegenConstants.OPTIONAL_ASSEMBLY_INFO).toString())); } - String packageFolder = sourceFolder + File.separator + packageName.replace(".", java.io.File.separator); - String clientPackageDir = sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator); + final String testPackageName = testPackageName(); + String packageFolder = sourceFolder + File.separator + packageName; + String clientPackageDir = packageFolder + File.separator + clientPackage; + String testPackageFolder = testFolder + File.separator + testPackageName; + + additionalProperties.put("testPackageName", testPackageName); //Compute the relative path to the bin directory where the external assemblies live //This is necessary to properly generate the project file @@ -210,7 +215,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { String binRelativePath = "..\\"; for (int i = 0; i < packageDepth; i = i + 1) binRelativePath += "..\\"; - binRelativePath += "vendor\\"; + binRelativePath += "vendor"; additionalProperties.put("binRelativePath", binRelativePath); supportingFiles.add(new SupportingFile("Configuration.mustache", @@ -222,9 +227,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("ApiResponse.mustache", clientPackageDir, "ApiResponse.cs")); - supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat")); - supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh")); - supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor" + java.io.File.separator, "packages.config")); + supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat")); + supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh")); + + // copy package.config to nuget's standard location for project-level installs + supportingFiles.add(new SupportingFile("packages.config.mustache", packageFolder + File.separator, "packages.config")); + supportingFiles.add(new SupportingFile("packages_test.config.mustache", testPackageFolder + File.separator, "packages.config")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); @@ -233,7 +242,14 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs")); } if (optionalProjectFileFlag) { - supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, clientPackage + ".csproj")); + supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln")); + supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, packageName + ".csproj")); + + // TODO: Check if test project output is enabled, partially related to #2506. Should have options for: + // 1) No test project + // 2) No model tests + // 3) No api tests + supportingFiles.add(new SupportingFile("TestProject.mustache", testPackageFolder, testPackageName + ".csproj")); } additionalProperties.put("apiDocPath", apiDocPath); @@ -491,4 +507,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); } + @Override + public String apiTestFileFolder() { + return outputFolder + File.separator + testFolder + File.separator + testPackageName() + File.separator + apiPackage(); + } + + @Override + public String modelTestFileFolder() { + return outputFolder + File.separator + testFolder + File.separator + testPackageName() + File.separator + modelPackage(); + } } diff --git a/modules/swagger-codegen/src/main/resources/csharp/Project.mustache b/modules/swagger-codegen/src/main/resources/csharp/Project.mustache index d38e5d92d1e7..141d541a5b5f 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Project.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Project.mustache @@ -39,8 +39,6 @@ - - @@ -48,18 +46,23 @@ - False - {{binRelativePath}}/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + {{binRelativePath}}\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - {{binRelativePath}}/RestSharp.105.2.3/lib/{{targetFrameworkNuget}}/RestSharp.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll + ..\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll + ..\..\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll + {{binRelativePath}}\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll - - - - + + + + diff --git a/modules/swagger-codegen/src/main/resources/csharp/README.mustache b/modules/swagger-codegen/src/main/resources/csharp/README.mustache index 06660a3c615c..56b36dcc6a7f 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/README.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/README.mustache @@ -37,8 +37,8 @@ NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploa ## Installation Run the following command to generate the DLL -- [Mac/Linux] `/bin/sh compile-mono.sh` -- [Windows] `compile.bat` +- [Mac/Linux] `/bin/sh build.sh` +- [Windows] `build.bat` Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: ```csharp diff --git a/modules/swagger-codegen/src/main/resources/csharp/Solution.mustache b/modules/swagger-codegen/src/main/resources/csharp/Solution.mustache new file mode 100644 index 000000000000..57f6201600f0 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/Solution.mustache @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "{{packageName}}", "src\{{packageName}}\{{packageName}}.csproj", "{{packageGuid}}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "{{testPackageName}}", "src\{{testPackageName}}\{{testPackageName}}.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global +GlobalSection(SolutionConfigurationPlatforms) = preSolution +Debug|Any CPU = Debug|Any CPU +Release|Any CPU = Release|Any CPU +EndGlobalSection +GlobalSection(ProjectConfigurationPlatforms) = postSolution +{{packageGuid}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{{packageGuid}}.Debug|Any CPU.Build.0 = Debug|Any CPU +{{packageGuid}}.Release|Any CPU.ActiveCfg = Release|Any CPU +{{packageGuid}}.Release|Any CPU.Build.0 = Release|Any CPU +{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU +{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU +{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU +EndGlobalSection +GlobalSection(SolutionProperties) = preSolution +HideSolutionNode = FALSE +EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache b/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache new file mode 100644 index 000000000000..0e0bd6c16713 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + {19F1DEBC-DE5E-4517-8062-F000CD499087} + Library + Properties + {{testPackageName}} + {{testPackageName}} + {{^supportsUWP}} + {{targetFramework}} + {{/supportsUWP}} + {{#supportsUWP}} + UAP + 10.0.10240.0 + 10.0.10240.0 + 14 + {{/supportsUWP}} + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + {{binRelativePath}}\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + + + $(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll + ..\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll + ..\..\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll + {{binRelativePath}}\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll + + + $(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll + ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll + {{binRelativePath}}\NUnit.2.6.3\lib\nunit.framework.dll + + + + + + + + + + + + {{packageGuid}} + {{packageName}} + + + + diff --git a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache index b1b0c4f0c73a..f93437eb0c81 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache @@ -4,17 +4,17 @@ netfx=${frameworkVersion#net} wget -nc https://nuget.org/nuget.exe; mozroots --import --sync -mono nuget.exe install vendor/packages.config -o vendor; +mono nuget.exe install src/{{packageName}}/packages.config -o packages; mkdir -p bin; -cp vendor/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; -cp vendor/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll; +cp packages/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll; mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ bin/RestSharp.dll,\ System.Runtime.Serialization.dll \ -target:library \ -out:bin/{{packageName}}.dll \ --recurse:'src/*.cs' \ +-recurse:'src/{{packageName}}/*.cs' \ -doc:bin/{{packageName}}.xml \ -platform:anycpu diff --git a/modules/swagger-codegen/src/main/resources/csharp/compile.mustache b/modules/swagger-codegen/src/main/resources/csharp/compile.mustache index 76b94cad5a1e..7f6dcfe0713d 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/compile.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/compile.mustache @@ -4,11 +4,11 @@ {{^supportsAsync}}SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5{{/supportsAsync}} if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')" -.\nuget.exe install vendor/packages.config -o vendor +.\nuget.exe install src\{{packageName}}\packages.config -o packages if not exist ".\bin" mkdir bin -copy vendor\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy vendor\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll bin\RestSharp.dll +copy packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll bin\RestSharp.dll -%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\{{packageName}}.dll /recurse:src\*.cs /doc:bin\{{packageName}}.xml +%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\{{packageName}}.dll /recurse:src\{{packageName}}\*.cs /doc:bin\{{packageName}}.xml diff --git a/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache b/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache new file mode 100644 index 000000000000..5464714bcef7 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache @@ -0,0 +1,6 @@ + + + + + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/.gitignore b/samples/client/petstore/csharp/SwaggerClient/.gitignore similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/.gitignore rename to samples/client/petstore/csharp/SwaggerClient/.gitignore diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln new file mode 100644 index 000000000000..d0a367de899d --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{C22D7F6C-D698-469A-A3C9-5A499DE213B8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global +GlobalSection(SolutionConfigurationPlatforms) = preSolution +Debug|Any CPU = Debug|Any CPU +Release|Any CPU = Release|Any CPU +EndGlobalSection +GlobalSection(ProjectConfigurationPlatforms) = postSolution +{C22D7F6C-D698-469A-A3C9-5A499DE213B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{C22D7F6C-D698-469A-A3C9-5A499DE213B8}.Debug|Any CPU.Build.0 = Debug|Any CPU +{C22D7F6C-D698-469A-A3C9-5A499DE213B8}.Release|Any CPU.ActiveCfg = Release|Any CPU +{C22D7F6C-D698-469A-A3C9-5A499DE213B8}.Release|Any CPU.Build.0 = Release|Any CPU +{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU +{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU +{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU +EndGlobalSection +GlobalSection(SolutionProperties) = preSolution +HideSolutionNode = FALSE +EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md similarity index 70% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md rename to samples/client/petstore/csharp/SwaggerClient/README.md index a5c2cd333598..c1c35320e657 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-04-21T17:22:44.115+08:00 +- Build date: 2016-05-01T19:55:27.477-04:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -27,14 +27,14 @@ NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploa ## Installation Run the following command to generate the DLL -- [Mac/Linux] `/bin/sh compile-mono.sh` -- [Windows] `compile.bat` +- [Mac/Linux] `/bin/sh build.sh` +- [Windows] `build.bat` Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: ```csharp using IO.Swagger.Api; using IO.Swagger.Client; -using IO.Swagger.Model; +using Model; ``` ## Getting Started @@ -44,7 +44,7 @@ using System; using System.Diagnostics; using IO.Swagger.Api; using IO.Swagger.Client; -using IO.Swagger.Model; +using Model; namespace Example { @@ -53,20 +53,28 @@ namespace Example public void main() { - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; - - var apiInstance = new PetApi(); - var body = new Pet(); // Pet | Pet object that needs to be added to the store + var apiInstance = new FakeApi(); + var number = number_example; // string | None + var _double = 1.2; // double? | None + var _string = _string_example; // string | None + var _byte = B; // byte[] | None + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4; // float? | None (optional) + var binary = B; // byte[] | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) + var password = password_example; // string | None (optional) try { - // Add a new pet to the store - apiInstance.AddPet(body); + // Fake endpoint for testing various parameters + apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } catch (Exception e) { - Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message ); } } } @@ -79,6 +87,7 @@ 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* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -103,31 +112,25 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [IO.Swagger.Model.Animal](docs/Animal.md) - - [IO.Swagger.Model.ApiResponse](docs/ApiResponse.md) - - [IO.Swagger.Model.Cat](docs/Cat.md) - - [IO.Swagger.Model.Category](docs/Category.md) - - [IO.Swagger.Model.Dog](docs/Dog.md) - - [IO.Swagger.Model.FormatTest](docs/FormatTest.md) - - [IO.Swagger.Model.Model200Response](docs/Model200Response.md) - - [IO.Swagger.Model.ModelReturn](docs/ModelReturn.md) - - [IO.Swagger.Model.Name](docs/Name.md) - - [IO.Swagger.Model.Order](docs/Order.md) - - [IO.Swagger.Model.Pet](docs/Pet.md) - - [IO.Swagger.Model.SpecialModelName](docs/SpecialModelName.md) - - [IO.Swagger.Model.Tag](docs/Tag.md) - - [IO.Swagger.Model.User](docs/User.md) + - [Model.Animal](docs/Animal.md) + - [Model.ApiResponse](docs/ApiResponse.md) + - [Model.Cat](docs/Cat.md) + - [Model.Category](docs/Category.md) + - [Model.Dog](docs/Dog.md) + - [Model.FormatTest](docs/FormatTest.md) + - [Model.Model200Response](docs/Model200Response.md) + - [Model.ModelReturn](docs/ModelReturn.md) + - [Model.Name](docs/Name.md) + - [Model.Order](docs/Order.md) + - [Model.Pet](docs/Pet.md) + - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.Tag](docs/Tag.md) + - [Model.User](docs/User.md) ## Documentation for Authorization -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -137,3 +140,9 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + diff --git a/samples/client/petstore/csharp/SwaggerClient/build.bat b/samples/client/petstore/csharp/SwaggerClient/build.bat new file mode 100644 index 000000000000..80a13e482317 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/build.bat @@ -0,0 +1,14 @@ +@echo off + +SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 + + +if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')" +.\nuget.exe install src\IO.Swagger\packages.config -o packages + +if not exist ".\bin" mkdir bin + +copy packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll + +%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh b/samples/client/petstore/csharp/SwaggerClient/build.sh old mode 100755 new mode 100644 similarity index 56% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh rename to samples/client/petstore/csharp/SwaggerClient/build.sh index d768c892f314..159673fd60c1 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh +++ b/samples/client/petstore/csharp/SwaggerClient/build.sh @@ -4,17 +4,17 @@ netfx=${frameworkVersion#net} wget -nc https://nuget.org/nuget.exe; mozroots --import --sync -mono nuget.exe install vendor/packages.config -o vendor; +mono nuget.exe install src/IO.Swagger/packages.config -o packages; mkdir -p bin; -cp vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; -cp vendor/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; +cp packages/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ bin/RestSharp.dll,\ System.Runtime.Serialization.dll \ -target:library \ -out:bin/IO.Swagger.dll \ --recurse:'src/*.cs' \ +-recurse:'src/IO.Swagger/*.cs' \ -doc:bin/IO.Swagger.xml \ -platform:anycpu diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Animal.md b/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Animal.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Animal.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md b/samples/client/petstore/csharp/SwaggerClient/docs/ApiResponse.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md rename to samples/client/petstore/csharp/SwaggerClient/docs/ApiResponse.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Cat.md b/samples/client/petstore/csharp/SwaggerClient/docs/Cat.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Cat.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Cat.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md b/samples/client/petstore/csharp/SwaggerClient/docs/Category.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Category.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md b/samples/client/petstore/csharp/SwaggerClient/docs/Dog.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Dog.md diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md new file mode 100644 index 000000000000..f688b755c228 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md @@ -0,0 +1,91 @@ +# IO.Swagger.Api.FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters + + +# **TestEndpointParameters** +> void TestEndpointParameters (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class TestEndpointParametersExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var number = number_example; // string | None + var _double = 1.2; // double? | None + var _string = _string_example; // string | None + var _byte = B; // byte[] | None + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4; // float? | None (optional) + var binary = B; // byte[] | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) + var password = password_example; // string | None (optional) + + try + { + // Fake endpoint for testing various parameters + apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **string**| None | + **_double** | **double?**| None | + **_string** | **string**| None | + **_byte** | **byte[]**| None | + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] + **binary** | **byte[]**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] + **password** | **string**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md similarity index 84% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md rename to samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md index d29dc6b5d795..c5dc3cf53f3b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md @@ -10,11 +10,11 @@ Name | Type | Description | Notes **_Float** | **float?** | | [optional] **_Double** | **double?** | | [optional] **_String** | **string** | | [optional] -**_Byte** | **byte[]** | | [optional] +**_Byte** | **byte[]** | | **Binary** | **byte[]** | | [optional] -**Date** | **DateTime?** | | [optional] +**Date** | **DateTime?** | | **DateTime** | **DateTime?** | | [optional] -**Password** | **string** | | [optional] +**Password** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md b/samples/client/petstore/csharp/SwaggerClient/docs/Model200Response.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Model200Response.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md b/samples/client/petstore/csharp/SwaggerClient/docs/ModelReturn.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md rename to samples/client/petstore/csharp/SwaggerClient/docs/ModelReturn.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md b/samples/client/petstore/csharp/SwaggerClient/docs/Name.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Name.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md b/samples/client/petstore/csharp/SwaggerClient/docs/Order.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Order.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md b/samples/client/petstore/csharp/SwaggerClient/docs/Pet.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Pet.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/PetApi.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md rename to samples/client/petstore/csharp/SwaggerClient/docs/PetApi.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md b/samples/client/petstore/csharp/SwaggerClient/docs/SpecialModelName.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md rename to samples/client/petstore/csharp/SwaggerClient/docs/SpecialModelName.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/StoreApi.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md rename to samples/client/petstore/csharp/SwaggerClient/docs/StoreApi.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md b/samples/client/petstore/csharp/SwaggerClient/docs/Tag.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md rename to samples/client/petstore/csharp/SwaggerClient/docs/Tag.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md b/samples/client/petstore/csharp/SwaggerClient/docs/User.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md rename to samples/client/petstore/csharp/SwaggerClient/docs/User.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/UserApi.md similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md rename to samples/client/petstore/csharp/SwaggerClient/docs/UserApi.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/git_push.sh b/samples/client/petstore/csharp/SwaggerClient/git_push.sh similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/git_push.sh rename to samples/client/petstore/csharp/SwaggerClient/git_push.sh diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs new file mode 100644 index 000000000000..8da6571f24a2 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs @@ -0,0 +1,80 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using NUnit.Framework; + +using IO.Swagger.Client; +using IO.Swagger.Api; + +namespace IO.Swagger.Test +{ + ///

+ /// Class for testing FakeApi + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the API endpoint. + /// + [TestFixture] + public class FakeApiTests + { + private FakeApi instance; + + /// + /// Setup before each unit test + /// + [SetUp] + public void Init() + { + instance = new FakeApi(); + } + + /// + /// Clean up after each unit test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of FakeApi + /// + [Test] + public void InstanceTest() + { + Assert.IsInstanceOf (instance, "instance is a FakeApi"); + } + + + /// + /// Test TestEndpointParameters + /// + [Test] + public void TestEndpointParametersTest() + { + // TODO: add unit test for the method 'TestEndpointParameters' + string number = null; // TODO: replace null with proper value + double? _double = null; // TODO: replace null with proper value + string _string = null; // TODO: replace null with proper value + byte[] _byte = null; // TODO: replace null with proper value + int? integer = null; // TODO: replace null with proper value + int? int32 = null; // TODO: replace null with proper value + long? int64 = null; // TODO: replace null with proper value + float? _float = null; // TODO: replace null with proper value + byte[] binary = null; // TODO: replace null with proper value + DateTime? date = null; // TODO: replace null with proper value + DateTime? dateTime = null; // TODO: replace null with proper value + string password = null; // TODO: replace null with proper value + instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj new file mode 100644 index 000000000000..0c34dbda2f9d --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -0,0 +1,73 @@ + + + + Debug + AnyCPU + {19F1DEBC-DE5E-4517-8062-F000CD499087} + Library + Properties + IO.Swagger.Test + IO.Swagger.Test + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + + + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll + + + $(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll + ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll + ..\..\vendor\NUnit.2.6.3\lib\nunit.framework.dll + + + + + + + + + + + + {C22D7F6C-D698-469A-A3C9-5A499DE213B8} + IO.Swagger + + + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/AnimalTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/AnimalTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ApiResponseTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ApiResponseTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/CatTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/CatTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/CategoryTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/CategoryTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/DogTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/DogTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/FormatTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/FormatTestTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/Model200ResponseTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/Model200ResponseTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ModelReturnTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ModelReturnTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/OrderTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/OrderTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/SpecialModelNameTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/SpecialModelNameTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/TagTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/TagTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserTests.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config new file mode 100644 index 000000000000..a8a3491f63d9 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs new file mode 100644 index 000000000000..18b61d64e459 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -0,0 +1,418 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using IO.Swagger.Client; + +namespace IO.Swagger.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApi + { + #region Synchronous Operations + /// + /// Fake endpoint for testing various parameters + /// + /// + /// Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// + void TestEndpointParameters (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + + /// + /// Fake endpoint for testing various parameters + /// + /// + /// Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// ApiResponse of Object(void) + ApiResponse TestEndpointParametersWithHttpInfo (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// Fake endpoint for testing various parameters + /// + /// + /// Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of void + System.Threading.Tasks.Task TestEndpointParametersAsync (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + + /// + /// Fake endpoint for testing various parameters + /// + /// + /// Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeApi : IFakeApi + { + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(String basePath) + { + this.Configuration = new Configuration(new ApiClient(basePath)); + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeApi(Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Configuration.Default; + else + this.Configuration = configuration; + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath(String basePath) + { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Configuration Configuration {get; set;} + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public Dictionary DefaultHeader() + { + return this.Configuration.DefaultHeader; + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader(string key, string value) + { + this.Configuration.AddDefaultHeader(key, value); + } + + /// + /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// + public void TestEndpointParameters (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + { + TestEndpointParametersWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + } + + /// + /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// ApiResponse of Object(void) + public ApiResponse TestEndpointParametersWithHttpInfo (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + { + // verify the required parameter 'number' is set + if (number == null) + throw new ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_double' is set + if (_double == null) + throw new ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_string' is set + if (_string == null) + throw new ApiException(400, "Missing required parameter '_string' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_byte' is set + if (_byte == null) + throw new ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters"); + + var localVarPath = "/fake"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/xml", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter + if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter + if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter + if (number != null) localVarFormParams.Add("number", Configuration.ApiClient.ParameterToString(number)); // form parameter + if (_float != null) localVarFormParams.Add("float", Configuration.ApiClient.ParameterToString(_float)); // form parameter + if (_double != null) localVarFormParams.Add("double", Configuration.ApiClient.ParameterToString(_double)); // form parameter + if (_string != null) localVarFormParams.Add("string", Configuration.ApiClient.ParameterToString(_string)); // form parameter + if (_byte != null) localVarFormParams.Add("byte", Configuration.ApiClient.ParameterToString(_byte)); // form parameter + if (binary != null) localVarFormParams.Add("binary", Configuration.ApiClient.ParameterToString(binary)); // form parameter + if (date != null) localVarFormParams.Add("date", Configuration.ApiClient.ParameterToString(date)); // form parameter + if (dateTime != null) localVarFormParams.Add("dateTime", Configuration.ApiClient.ParameterToString(dateTime)); // form parameter + if (password != null) localVarFormParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // form parameter + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (localVarStatusCode >= 400) + throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.Content, localVarResponse.Content); + else if (localVarStatusCode == 0) + throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + /// + /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of void + public async System.Threading.Tasks.Task TestEndpointParametersAsync (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + { + await TestEndpointParametersAsyncWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + + } + + /// + /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + { + // verify the required parameter 'number' is set + if (number == null) + throw new ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_double' is set + if (_double == null) + throw new ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_string' is set + if (_string == null) + throw new ApiException(400, "Missing required parameter '_string' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_byte' is set + if (_byte == null) + throw new ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters"); + + var localVarPath = "/fake"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/xml", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter + if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter + if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter + if (number != null) localVarFormParams.Add("number", Configuration.ApiClient.ParameterToString(number)); // form parameter + if (_float != null) localVarFormParams.Add("float", Configuration.ApiClient.ParameterToString(_float)); // form parameter + if (_double != null) localVarFormParams.Add("double", Configuration.ApiClient.ParameterToString(_double)); // form parameter + if (_string != null) localVarFormParams.Add("string", Configuration.ApiClient.ParameterToString(_string)); // form parameter + if (_byte != null) localVarFormParams.Add("byte", Configuration.ApiClient.ParameterToString(_byte)); // form parameter + if (binary != null) localVarFormParams.Add("binary", Configuration.ApiClient.ParameterToString(binary)); // form parameter + if (date != null) localVarFormParams.Add("date", Configuration.ApiClient.ParameterToString(date)); // form parameter + if (dateTime != null) localVarFormParams.Add("dateTime", Configuration.ApiClient.ParameterToString(dateTime)); // form parameter + if (password != null) localVarFormParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // form parameter + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (localVarStatusCode >= 400) + throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.Content, localVarResponse.Content); + else if (localVarStatusCode == 0) + throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiException.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiException.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiException.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiException.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiResponse.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiResponse.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj new file mode 100644 index 000000000000..b94d66454c47 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -0,0 +1,61 @@ + + + + Debug + AnyCPU + {C22D7F6C-D698-469A-A3C9-5A499DE213B8} + Library + Properties + Swagger Library + Swagger Library + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + + + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs similarity index 90% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs index 6d50426bad01..c1291a2e4f61 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs @@ -29,11 +29,11 @@ namespace IO.Swagger.Model /// _Float. /// _Double. /// _String. - /// _Byte. + /// _Byte (required). /// Binary. - /// Date. + /// Date (required). /// DateTime. - /// Password. + /// Password (required). public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, string Password = null) { @@ -46,17 +46,41 @@ namespace IO.Swagger.Model { this.Number = Number; } + // to ensure "_Byte" is required (not null) + if (_Byte == null) + { + throw new InvalidDataException("_Byte is a required property for FormatTest and cannot be null"); + } + else + { + this._Byte = _Byte; + } + // to ensure "Date" is required (not null) + if (Date == null) + { + throw new InvalidDataException("Date is a required property for FormatTest and cannot be null"); + } + else + { + this.Date = Date; + } + // to ensure "Password" is required (not null) + if (Password == null) + { + throw new InvalidDataException("Password is a required property for FormatTest and cannot be null"); + } + else + { + this.Password = Password; + } this.Integer = Integer; this.Int32 = Int32; this.Int64 = Int64; this._Float = _Float; this._Double = _Double; this._String = _String; - this._Byte = _Byte; this.Binary = Binary; - this.Date = Date; this.DateTime = DateTime; - this.Password = Password; } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Properties/AssemblyInfo.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Properties/AssemblyInfo.cs similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Properties/AssemblyInfo.cs rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Properties/AssemblyInfo.cs diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config similarity index 100% rename from samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config rename to samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/InlineResponse200Tests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/InlineResponse200Tests.cs deleted file mode 100644 index a4930b02df30..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/InlineResponse200Tests.cs +++ /dev/null @@ -1,104 +0,0 @@ -using NUnit.Framework; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using IO.Swagger.Api; -using IO.Swagger.Model; -using IO.Swagger.Client; -using System.Reflection; - -namespace IO.Swagger.Test -{ - /// - /// Class for testing InlineResponse200 - /// - /// - /// This file is automatically generated by Swagger Codegen. - /// Please update the test case below to test the model. - /// - [TestFixture] - public class InlineResponse200Tests - { - private InlineResponse200 instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - instance = new InlineResponse200(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - - /// - /// Test an instance of InlineResponse200 - /// - [Test] - public void InlineResponse200InstanceTest() - { - Assert.IsInstanceOf (instance, "instance is a InlineResponse200"); - } - - /// - /// Test the property 'PhotoUrls' - /// - [Test] - public void PhotoUrlsTest() - { - // TODO: unit test for the property 'PhotoUrls' - } - /// - /// Test the property 'Name' - /// - [Test] - public void NameTest() - { - // TODO: unit test for the property 'Name' - } - /// - /// Test the property 'Id' - /// - [Test] - public void IdTest() - { - // TODO: unit test for the property 'Id' - } - /// - /// Test the property 'Category' - /// - [Test] - public void CategoryTest() - { - // TODO: unit test for the property 'Category' - } - /// - /// Test the property 'Tags' - /// - [Test] - public void TagsTest() - { - // TODO: unit test for the property 'Tags' - } - /// - /// Test the property 'Status' - /// - [Test] - public void StatusTest() - { - // TODO: unit test for the property 'Status' - } - - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache deleted file mode 100644 index d5f5ce413b39..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache +++ /dev/null @@ -1,184 +0,0 @@ - - the C# library for the Swagger Petstore - - This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters - -This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - -- API version: 1.0.0 -- Package version: -- Build date: 2016-04-14T06:55:47.468-04:00 -- Build package: class io.swagger.codegen.languages.CSharpClientCodegen - -## Frameworks supported -- .NET 4.0 or later -- Windows Phone 7.1 (Mango) - -## Dependencies -- [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later -- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later - -The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: -``` -Install-Package RestSharp -Install-Package Newtonsoft.Json -``` - -NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) - -## Installation -Run the following command to generate the DLL -- [Mac/Linux] compile-mono.sh -- [Windows] compile.bat - -Then include the DLL (under the `bin` folder) in the C# project - - -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Module; - -namespace Example -{ -public class Example -{ -public void main(){ - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; - // Configure API key authorization: test_api_client_id - Configuration.Default.ApiKey.Add('x-test_api_client_id', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_id', 'BEARER'); - // Configure API key authorization: test_api_client_secret - Configuration.Default.ApiKey.Add('x-test_api_client_secret', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_secret', 'BEARER'); - // Configure API key authorization: api_key - Configuration.Default.ApiKey.Add('api_key', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('api_key', 'BEARER'); - // Configure HTTP basic authorization: test_http_basic - Configuration.Default.Username = 'YOUR_USERNAME'; - Configuration.Default.Password = 'YOUR_PASSWORD'; - // Configure API key authorization: test_api_key_query - Configuration.Default.ApiKey.Add('test_api_key_query', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('test_api_key_query', 'BEARER'); - // Configure API key authorization: test_api_key_header - Configuration.Default.ApiKey.Add('test_api_key_header', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('test_api_key_header', 'BEARER'); - -var apiInstance = new (); - -try { -apiInstance.(); -} catch (Exception e) { -Debug.Print("Exception when calling .: " + e.Message ); -} -} -} -} -``` - -## Documentation for API Endpoints - -All URIs are relative to *http://petstore.swagger.io/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*::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 -*::UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#CreateUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array -*::UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#CreateUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array -*::UserApi* | [**DeleteUser**](docs/UserApi.md#DeleteUser) | **DELETE** /user/{username} | Delete user -*::UserApi* | [**GetUserByName**](docs/UserApi.md#GetUserByName) | **GET** /user/{username} | Get user by user name -*::UserApi* | [**LoginUser**](docs/UserApi.md#LoginUser) | **GET** /user/login | Logs user into the system -*::UserApi* | [**LogoutUser**](docs/UserApi.md#LogoutUser) | **GET** /user/logout | Logs out current logged in user session -*::UserApi* | [**UpdateUser**](docs/UserApi.md#UpdateUser) | **PUT** /user/{username} | Updated user - - -## Documentation for Models - - - [::Animal](docs/Animal.md) - - [::Cat](docs/Cat.md) - - [::Category](docs/Category.md) - - [::Dog](docs/Dog.md) - - [::FormatTest](docs/FormatTest.md) - - [::InlineResponse200](docs/InlineResponse200.md) - - [::Model200Response](docs/Model200Response.md) - - [::ModelReturn](docs/ModelReturn.md) - - [::Name](docs/Name.md) - - [::Order](docs/Order.md) - - [::Pet](docs/Pet.md) - - [::SpecialModelName](docs/SpecialModelName.md) - - [::Tag](docs/Tag.md) - - [::User](docs/User.md) - - -## Documentation for Authorization - - -### petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - -### test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -### test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **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_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - -### test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - - diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/bin/Newtonsoft.Json.dll b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/bin/Newtonsoft.Json.dll deleted file mode 100644 index 4d42dd9c5fe55c70c56fa235e6a509595cf7b52d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 521216 zcmb@v2YejG*+0IT-P>zwr*fxa`($I;>$}rQmTZtMiYcZzgaj}k8B7Z};1Dmlvr{Zf zm~@Cu2qujL0wkpO-g_l)66a0Nn>c|aB!Rr7k{Uwaec_2XcxcId=tav5C1MjJm7y`lR&vHeSu}Q z%YV%^L5+=s3F}GpgYH%eVgBEygw+h#mz{*QWPaRZg$F{`1uKE@=@I<$?kk_Y8{x#S zQAWf`S;2SoZvdq!SE`k#04Th%>@4VSkS6lC3Ds4uTzQQTMDl8ZXUf3(Lj&GPjE?@T zqg?Sv-jo%yeqOY#=I=UIQlOUgyQYLS30kM4{QC{;v7BXUI*(c@tWfrhc$O(|8Mr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YMS- diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/bin/RestSharp.dll b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/bin/RestSharp.dll deleted file mode 100644 index 59d82f94198e053a62d648c27671eaf45fff0dad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 167936 zcmb@P37lM2mH(^XtA17Ws=Jfw>Qr|Y(w#uUqpG^eA~6XN!j7nH3I=4~gor$>3aB*Q zG>fPRD5!{06cG?NL_|f!4V6(xorsDXM%-r{$I;Po9LEX&@9*6As_P|@zy3e}eA4yK z{oQl7bI-l^+~wW(+*4kk^K-dep1-G_%Ho_vwFT@E#cb#6a%B($|(e)bpIL zEqVS07q-VPX~i#Uo%NEjbI!W>;&{v0+2@V5F1>i{!i&caJN9{FFNx1RZ=%0H+$)Lt zxWjX~=k)lw;%g5+F-`5soVTRhQ_kgH?d5WTLpQt|dJOurJaf6ZMnfv!`j@alQ5s_r zb>=I@s{gak#3_h>KfA}vy+8!<{z-z^`QMXXt`F?}cYC=-JNrGIdn}hLcKH`^AJyfa z*mB;>x8OePRY|#2)+FC48$r&TXti7C09fA0qZRo2EaS#pZsSDjyo+KOmDe13wzzKE zh3^n~cmErcT=}QGdAZ))ir${w6?gRHdJO&hf2u3;xn~fJ@D(qbpUZ{O0)AS!FY)uy zLg*MdhS47UgkGxx9z=_AOu>?`AMM4@^K(IK8Ti6@47~p5d>jHzlhOQmWoSo0od@kD zc+ChhJR)#oyqdRg-lU?MACD7id3}`^?FnyGAXI(5=jYq#UgB)IEc)Z+*1;s$Ce`qA z&!0jO^7S=&Z&E}&pLptvy-Cu|*O%gL1VC>J7y*D5Iu0WMNYnvF0H6~NFan^I0!9FY zDPRNu4Z#I50)RSpfDr)wDPRP^KnfTEFee3!0H8^@IE(ahjUq%jd{Rl3uZ3@~`_Z?f9#`yZp|E?~TpBE1v(i ze4~TP_i{bvXY##Ed?U{LZxDA@97x^C;XcZN%2wLnA+<79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H;ztKOV|J*qwn#8oy-Rn=MJJfE_ z;)$)#y|C@jp{gyuG|=;t?KN)JtI9s~(=<{vZz&K4dL_SpKj7L!XWD zd1y{Q#ho|j+E1D5VD((tHf}yp5Adko-=m-2V4%lD_3i`xtn<`sHh-|vy>hMp(7Ltw zqq08D;e*rQaldOJU1DIL5BU|pGd#!&4S0!dmvTM)uGew6=blkKK+`Li^fDwp{P!@k z)+=4R{l^S^UAqb}upL^3bPN_8uN!P|99L$%{#Z??d?*di+!)7rartC*ykb z8Q|^cVR#*{owH~gG4AR9%}!q`?+<2bnfTv UfQN`Z?|xnr{r`Xd-=o0)0_Pd&8~^|S diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/compile.bat b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/compile.bat deleted file mode 100644 index 8d07d021131b..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/compile.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off - -SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 - - -if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')" -.\nuget.exe install vendor/packages.config -o vendor - -if not exist ".\bin" mkdir bin - -copy vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll - -%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\*.cs /doc:bin\IO.Swagger.xml diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/InlineResponse200.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/InlineResponse200.md deleted file mode 100644 index 6380096b06bf..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/InlineResponse200.md +++ /dev/null @@ -1,14 +0,0 @@ -# InlineResponse200 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**PhotoUrls** | **List<string>** | | [optional] -**Name** | **string** | | [optional] -**Id** | **long?** | | -**Category** | **Object** | | [optional] -**Tags** | [**List<Tag>**](Tag.md) | | [optional] -**Status** | **string** | pet status in the store | [optional] - - diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/petstore b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/petstore deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs deleted file mode 100644 index e98ca7342ccb..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs +++ /dev/null @@ -1,217 +0,0 @@ -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// - /// - [DataContract] - public partial class InlineResponse200 : IEquatable - { - - /// - /// pet status in the store - /// - /// pet status in the store - [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum { - - [EnumMember(Value = "available")] - Available, - - [EnumMember(Value = "pending")] - Pending, - - [EnumMember(Value = "sold")] - Sold - } - - - /// - /// pet status in the store - /// - /// pet status in the store - [DataMember(Name="status", EmitDefaultValue=false)] - public StatusEnum? Status { get; set; } - - /// - /// Initializes a new instance of the class. - /// Initializes a new instance of the class. - /// - /// PhotoUrls. - /// Name. - /// Id (required). - /// Category. - /// Tags. - /// pet status in the store. - - public InlineResponse200(List PhotoUrls = null, string Name = null, long? Id = null, Object Category = null, List Tags = null, StatusEnum? Status = null) - { - // to ensure "Id" is required (not null) - if (Id == null) - { - throw new InvalidDataException("Id is a required property for InlineResponse200 and cannot be null"); - } - else - { - this.Id = Id; - } - this.PhotoUrls = PhotoUrls; - this.Name = Name; - this.Category = Category; - this.Tags = Tags; - this.Status = Status; - - } - - - /// - /// Gets or Sets PhotoUrls - /// - [DataMember(Name="photoUrls", EmitDefaultValue=false)] - public List PhotoUrls { get; set; } - - /// - /// Gets or Sets Name - /// - [DataMember(Name="name", EmitDefaultValue=false)] - public string Name { get; set; } - - /// - /// Gets or Sets Id - /// - [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; set; } - - /// - /// Gets or Sets Category - /// - [DataMember(Name="category", EmitDefaultValue=false)] - public Object Category { get; set; } - - /// - /// Gets or Sets Tags - /// - [DataMember(Name="tags", EmitDefaultValue=false)] - public List Tags { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class InlineResponse200 {\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Tags: ").Append(Tags).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as InlineResponse200); - } - - /// - /// Returns true if InlineResponse200 instances are equal - /// - /// Instance of InlineResponse200 to be compared - /// Boolean - public bool Equals(InlineResponse200 other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.PhotoUrls == other.PhotoUrls || - this.PhotoUrls != null && - this.PhotoUrls.SequenceEqual(other.PhotoUrls) - ) && - ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) - ) && - ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) - ) && - ( - this.Category == other.Category || - this.Category != null && - this.Category.Equals(other.Category) - ) && - ( - this.Tags == other.Tags || - this.Tags != null && - this.Tags.SequenceEqual(other.Tags) - ) && - ( - this.Status == other.Status || - this.Status != null && - this.Status.Equals(other.Status) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.PhotoUrls != null) - hash = hash * 59 + this.PhotoUrls.GetHashCode(); - if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); - if (this.Category != null) - hash = hash * 59 + this.Category.GetHashCode(); - if (this.Tags != null) - hash = hash * 59 + this.Tags.GetHashCode(); - if (this.Status != null) - hash = hash * 59 + this.Status.GetHashCode(); - return hash; - } - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ObjectReturn.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ObjectReturn.cs deleted file mode 100644 index 1ea3dea45c50..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ObjectReturn.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// - /// - [DataContract] - public partial class ObjectReturn : IEquatable - { - - /// - /// Initializes a new instance of the class. - /// Initializes a new instance of the class. - /// - /// _Return. - - public ObjectReturn(int? _Return = null) - { - this._Return = _Return; - - } - - - /// - /// Gets or Sets _Return - /// - [DataMember(Name="return", EmitDefaultValue=false)] - public int? _Return { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class ObjectReturn {\n"); - sb.Append(" _Return: ").Append(_Return).Append("\n"); - - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ObjectReturn); - } - - /// - /// Returns true if ObjectReturn instances are equal - /// - /// Instance of ObjectReturn to be compared - /// Boolean - public bool Equals(ObjectReturn other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this._Return == other._Return || - this._Return != null && - this._Return.Equals(other._Return) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - - if (this._Return != null) - hash = hash * 59 + this._Return.GetHashCode(); - - return hash; - } - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Task.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Task.cs deleted file mode 100644 index b2182f2f712d..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Task.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// - /// - [DataContract] - public partial class Task : IEquatable - { - - /// - /// Initializes a new instance of the class. - /// Initializes a new instance of the class. - /// - /// _Return. - - public Task(int? _Return = null) - { - this._Return = _Return; - - } - - - /// - /// Gets or Sets _Return - /// - [DataMember(Name="return", EmitDefaultValue=false)] - public int? _Return { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Task {\n"); - sb.Append(" _Return: ").Append(_Return).Append("\n"); - - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Task); - } - - /// - /// Returns true if Task instances are equal - /// - /// Instance of Task to be compared - /// Boolean - public bool Equals(Task other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this._Return == other._Return || - this._Return != null && - this._Return.Equals(other._Return) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - - if (this._Return != null) - hash = hash * 59 + this._Return.GetHashCode(); - - return hash; - } - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index 7b777ba6a271..ba55b6b16d65 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -30,7 +30,10 @@ - Lib\SwaggerClient\bin\Newtonsoft.Json.dll + packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + + + packages\RestSharp.105.1.0\lib\net45\RestSharp.dll @@ -38,53 +41,30 @@ packages\NUnit.2.6.4\lib\nunit.framework.dll - - Lib\SwaggerClient\bin\RestSharp.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + {0862164F-97E9-4226-B458-E09905B21F2F} + IO.Swagger + + \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.sln b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.sln index dfb6e762ce27..5274859c30a0 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.sln +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.sln @@ -3,12 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwaggerClientTest", "SwaggerClientTest.csproj", "{1011E844-3414-4D65-BF1F-7C8CE0167174}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "..\SwaggerClient\src\IO.Swagger\IO.Swagger.csproj", "{0862164F-97E9-4226-B458-E09905B21F2F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0862164F-97E9-4226-B458-E09905B21F2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0862164F-97E9-4226-B458-E09905B21F2F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0862164F-97E9-4226-B458-E09905B21F2F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0862164F-97E9-4226-B458-E09905B21F2F}.Release|Any CPU.Build.0 = Release|Any CPU {1011E844-3414-4D65-BF1F-7C8CE0167174}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1011E844-3414-4D65-BF1F-7C8CE0167174}.Debug|Any CPU.Build.0 = Debug|Any CPU {1011E844-3414-4D65-BF1F-7C8CE0167174}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index 0b91bb4ae32d..65a0da9f0400 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,25 +1,15 @@  - + - - - + + + - - - - - - - - - - - + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt index 323cad108c6b..8e1a7e18f36a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt +++ b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt @@ -1,9 +1,11 @@ -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Swagger Library.dll +/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Swagger Library.dll.mdb diff --git a/samples/client/petstore/csharp/SwaggerClientTest/packages.config b/samples/client/petstore/csharp/SwaggerClientTest/packages.config index 09300da2fcd8..0a536655794d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/packages.config +++ b/samples/client/petstore/csharp/SwaggerClientTest/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientTest/packages/repositories.config b/samples/client/petstore/csharp/SwaggerClientTest/packages/repositories.config index ba8d0d576a8c..c109c8ad2e5b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/packages/repositories.config +++ b/samples/client/petstore/csharp/SwaggerClientTest/packages/repositories.config @@ -1,4 +1,5 @@ - - - + + + + \ No newline at end of file From aa778edbd816df9fa26e9acf8dcb899f67f4e178 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Sun, 1 May 2016 20:28:50 -0400 Subject: [PATCH 046/170] [csharp] Regenerate sample client In this commit, FormatTest.cs was modified manually. Unrelated to this commit, a Guid with default parameter of null was not marked nullable. --- .../csharp/SwaggerClient/IO.Swagger.sln | 10 +++++----- .../petstore/csharp/SwaggerClient/README.md | 4 ++-- .../csharp/SwaggerClient/docs/FakeApi.md | 6 +++--- .../csharp/SwaggerClient/docs/FormatTest.md | 1 + .../petstore/csharp/SwaggerClient/git_push.sh | 4 ++-- .../src/IO.Swagger.Test/Api/FakeApiTests.cs | 2 +- .../src/IO.Swagger.Test/IO.Swagger.Test.csproj | 2 +- .../IO.Swagger.Test/Model/FormatTestTests.cs | 8 ++++++++ .../src/IO.Swagger/Api/FakeApi.cs | 16 ++++++++-------- .../src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/Model/FormatTest.cs | 18 +++++++++++++++++- 11 files changed, 49 insertions(+), 24 deletions(-) diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index d0a367de899d..08cd5875c2e6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{C22D7F6C-D698-469A-A3C9-5A499DE213B8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{C22D7F6C-D698-469A-A3C9-5A499DE213B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{C22D7F6C-D698-469A-A3C9-5A499DE213B8}.Debug|Any CPU.Build.0 = Debug|Any CPU -{C22D7F6C-D698-469A-A3C9-5A499DE213B8}.Release|Any CPU.ActiveCfg = Release|Any CPU -{C22D7F6C-D698-469A-A3C9-5A499DE213B8}.Release|Any CPU.Build.0 = Release|Any CPU +{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}.Debug|Any CPU.Build.0 = Debug|Any CPU +{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}.Release|Any CPU.ActiveCfg = Release|Any CPU +{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index c1c35320e657..174b3292633c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-05-01T19:55:27.477-04:00 +- Build date: 2016-05-01T20:17:48.968-04:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -54,7 +54,7 @@ namespace Example { var apiInstance = new FakeApi(); - var number = number_example; // string | None + var number = 3.4; // double? | None var _double = 1.2; // double? | None var _string = _string_example; // string | None var _byte = B; // byte[] | None diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md index f688b755c228..ae9fd8c3d36d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **TestEndpointParameters** -> void TestEndpointParameters (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) +> void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) Fake endpoint for testing various parameters @@ -30,7 +30,7 @@ namespace Example { var apiInstance = new FakeApi(); - var number = number_example; // string | None + var number = 3.4; // double? | None var _double = 1.2; // double? | None var _string = _string_example; // string | None var _byte = B; // byte[] | None @@ -61,7 +61,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **string**| None | + **number** | **double?**| None | **_double** | **double?**| None | **_string** | **string**| None | **_byte** | **byte[]**| None | diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md index c5dc3cf53f3b..2672fee238c8 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md @@ -14,6 +14,7 @@ Name | Type | Description | Notes **Binary** | **byte[]** | | [optional] **Date** | **DateTime?** | | **DateTime** | **DateTime?** | | [optional] +**Uuid** | **Guid** | | [optional] **Password** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/git_push.sh b/samples/client/petstore/csharp/SwaggerClient/git_push.sh index 13d463698c50..792320114fbe 100644 --- a/samples/client/petstore/csharp/SwaggerClient/git_push.sh +++ b/samples/client/petstore/csharp/SwaggerClient/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs index 8da6571f24a2..478311b649e6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs @@ -59,7 +59,7 @@ namespace IO.Swagger.Test public void TestEndpointParametersTest() { // TODO: add unit test for the method 'TestEndpointParameters' - string number = null; // TODO: replace null with proper value + double? number = null; // TODO: replace null with proper value double? _double = null; // TODO: replace null with proper value string _string = null; // TODO: replace null with proper value byte[] _byte = null; // TODO: replace null with proper value diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 0c34dbda2f9d..618cc1885753 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -65,7 +65,7 @@ - {C22D7F6C-D698-469A-A3C9-5A499DE213B8} + {27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs index a6eec9197798..7676fcae9b98 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs @@ -139,6 +139,14 @@ namespace IO.Swagger.Test // TODO: unit test for the property 'DateTime' } /// + /// Test the property 'Uuid' + /// + [Test] + public void UuidTest() + { + // TODO: unit test for the property 'Uuid' + } + /// /// Test the property 'Password' /// [Test] diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index 18b61d64e459..1c92dc3bbda7 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -33,7 +33,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// - void TestEndpointParameters (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); /// /// Fake endpoint for testing various parameters @@ -55,7 +55,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// ApiResponse of Object(void) - ApiResponse TestEndpointParametersWithHttpInfo (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + ApiResponse TestEndpointParametersWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -78,7 +78,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// Task of void - System.Threading.Tasks.Task TestEndpointParametersAsync (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); /// /// Fake endpoint for testing various parameters @@ -100,7 +100,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// Task of ApiResponse - System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); #endregion Asynchronous Operations } @@ -208,7 +208,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// - public void TestEndpointParameters (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + public void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) { TestEndpointParametersWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } @@ -230,7 +230,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// ApiResponse of Object(void) - public ApiResponse TestEndpointParametersWithHttpInfo (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + public ApiResponse TestEndpointParametersWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) { // verify the required parameter 'number' is set if (number == null) @@ -319,7 +319,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// Task of void - public async System.Threading.Tasks.Task TestEndpointParametersAsync (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + public async System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) { await TestEndpointParametersAsyncWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); @@ -342,7 +342,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (string number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + public async System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) { // verify the required parameter 'number' is set if (number == null) diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index b94d66454c47..36e6f0008e9c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {C22D7F6C-D698-469A-A3C9-5A499DE213B8} + {27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9} Library Properties Swagger Library diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs index c1291a2e4f61..49e7d1041aad 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs @@ -33,9 +33,10 @@ namespace IO.Swagger.Model /// Binary. /// Date (required). /// DateTime. + /// Uuid. /// Password (required). - public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, string Password = null) + public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, Guid? Uuid = null, string Password = null) { // to ensure "Number" is required (not null) if (Number == null) @@ -81,6 +82,7 @@ namespace IO.Swagger.Model this._String = _String; this.Binary = Binary; this.DateTime = DateTime; + this.Uuid = Uuid; } @@ -151,6 +153,12 @@ namespace IO.Swagger.Model [DataMember(Name="dateTime", EmitDefaultValue=false)] public DateTime? DateTime { get; set; } + /// + /// Gets or Sets Uuid + /// + [DataMember(Name="uuid", EmitDefaultValue=false)] + public Guid? Uuid { get; set; } + /// /// Gets or Sets Password /// @@ -176,6 +184,7 @@ namespace IO.Swagger.Model sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -268,6 +277,11 @@ namespace IO.Swagger.Model this.DateTime != null && this.DateTime.Equals(other.DateTime) ) && + ( + this.Uuid == other.Uuid || + this.Uuid != null && + this.Uuid.Equals(other.Uuid) + ) && ( this.Password == other.Password || this.Password != null && @@ -308,6 +322,8 @@ namespace IO.Swagger.Model hash = hash * 59 + this.Date.GetHashCode(); if (this.DateTime != null) hash = hash * 59 + this.DateTime.GetHashCode(); + if (this.Uuid != null) + hash = hash * 59 + this.Uuid.GetHashCode(); if (this.Password != null) hash = hash * 59 + this.Password.GetHashCode(); return hash; From 3ed715b26eacba7223b63e7073f23561586fc165 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Sun, 1 May 2016 20:42:10 -0400 Subject: [PATCH 047/170] [csharp] Fix ASP.NET Core 1.0 src location --- .../java/io/swagger/codegen/languages/AspNet5ServerCodegen.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java index cf8915974e63..790891d38bb1 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java @@ -11,6 +11,8 @@ import java.util.*; public class AspNet5ServerCodegen extends AbstractCSharpCodegen { + protected String sourceFolder = "src" + File.separator + packageName; + @SuppressWarnings("hiding") protected Logger LOGGER = LoggerFactory.getLogger(AspNet5ServerCodegen.class); From b1c030d69844b4ec468eb1dce22256c96caed4d8 Mon Sep 17 00:00:00 2001 From: Mikolaj Przybysz Date: Mon, 2 May 2016 11:37:17 +0200 Subject: [PATCH 048/170] issue-2743 generating unit tests in root/test directory --- .../swagger/codegen/languages/PhpClientCodegen.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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 0aed793fc090..db28b251836f 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 @@ -35,6 +35,9 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { protected String packagePath = "SwaggerClient-php"; protected String artifactVersion = "1.0.0"; protected String srcBasePath = "lib"; + protected String testBasePath = "test"; + protected String apiDirName = "Api"; + protected String modelDirName = "Model"; protected String variableNamingConvention= "snake_case"; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; @@ -49,9 +52,8 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { modelTestTemplateFiles.put("model_test.mustache", ".php"); apiTestTemplateFiles.put("api_test.mustache", ".php"); embeddedTemplateDir = templateDir = "php"; - apiPackage = invokerPackage + "\\Api"; - modelPackage = invokerPackage + "\\Model"; - testPackage = invokerPackage + "\\Tests"; + apiPackage = invokerPackage + "\\" + apiDirName; + modelPackage = invokerPackage + "\\" + modelDirName; modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); @@ -259,12 +261,12 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String apiTestFileFolder() { - return (outputFolder + "/" + toPackagePath(testPackage, srcBasePath)); + return (outputFolder + "/" + getPackagePath() + "/" + testBasePath + "/" + apiDirName); } @Override public String modelTestFileFolder() { - return (outputFolder + "/" + toPackagePath(testPackage, srcBasePath)); + return (outputFolder + "/" + getPackagePath() + "/" + testBasePath + "/" + modelDirName); } @Override From ce6dd4b2c21b897cc0fe70c6dc1f331dfe5aa112 Mon Sep 17 00:00:00 2001 From: Mikolaj Przybysz Date: Mon, 2 May 2016 11:39:56 +0200 Subject: [PATCH 049/170] issue-2743 added autoloading of tests into composer while in dev (ref.: https://getcomposer.org/doc/04-schema.md#autoload-dev) --- .../swagger-codegen/src/main/resources/php/composer.mustache | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/php/composer.mustache b/modules/swagger-codegen/src/main/resources/php/composer.mustache index 6ab42751a57c..510303ac2484 100644 --- a/modules/swagger-codegen/src/main/resources/php/composer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/composer.mustache @@ -29,5 +29,8 @@ }, "autoload": { "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } + }, + "autoload-dev": { + "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } } } From 9bf4e120568b0eccfd29fde1c131bd32b9916ab2 Mon Sep 17 00:00:00 2001 From: Mikolaj Przybysz Date: Mon, 2 May 2016 11:40:56 +0200 Subject: [PATCH 050/170] issue-2743 generating docs in root/docs(Api/Model) --- .../io/swagger/codegen/languages/PhpClientCodegen.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 db28b251836f..9ad33e1d18aa 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 @@ -36,11 +36,12 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { protected String artifactVersion = "1.0.0"; protected String srcBasePath = "lib"; protected String testBasePath = "test"; + protected String docsBasePath = "docs"; protected String apiDirName = "Api"; protected String modelDirName = "Model"; protected String variableNamingConvention= "snake_case"; - protected String apiDocPath = "docs/"; - protected String modelDocPath = "docs/"; + protected String apiDocPath = docsBasePath + "/" + apiDirName; + protected String modelDocPath = docsBasePath + "docs/" + modelDirName; public PhpClientCodegen() { super(); @@ -271,13 +272,11 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String apiDocFileFolder() { - //return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); return (outputFolder + "/" + getPackagePath() + "/" + apiDocPath); } @Override public String modelDocFileFolder() { - //return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); return (outputFolder + "/" + getPackagePath() + "/" + modelDocPath); } From d6158c4c55377bff8a2fbd0c7304ab1964c8e6f2 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 2 May 2016 22:06:33 +0800 Subject: [PATCH 051/170] fix uuid for java, php, ruby and csharp --- .../languages/AbstractCSharpCodegen.java | 4 +- .../codegen/languages/JavaClientCodegen.java | 1 + .../codegen/languages/PhpClientCodegen.java | 1 + .../codegen/languages/RubyClientCodegen.java | 1 + .../Lib/SwaggerClient.Test/FormatTestTests.cs | 8 + .../Lib/SwaggerClient/README.md | 27 ++- .../Lib/SwaggerClient/docs/FormatTest.md | 7 +- .../Lib/SwaggerClient/git_push.sh | 4 +- .../csharp/IO/Swagger/Model/CatDogTest.cs | 175 ++++++++++++++++++ .../csharp/IO/Swagger/Model/FormatTest.cs | 54 +++++- .../IO/Swagger/Model/TagCategoryTest.cs | 143 ++++++++++++++ .../SwaggerClientTest.csproj | 4 +- .../SwaggerClientTest.userprefs | 26 +-- ...ClientTest.csproj.FilesWrittenAbsolute.txt | 18 +- .../petstore/java/default/docs/FormatTest.md | 7 +- .../client/petstore/java/default/git_push.sh | 4 +- .../io/swagger/client/model/FormatTest.java | 38 +++- .../petstore/php/SwaggerClient-php/README.md | 8 +- .../php/SwaggerClient-php/composer.json | 2 +- .../php/SwaggerClient-php/docs/FakeApi.md | 4 +- .../php/SwaggerClient-php/docs/FormatTest.md | 1 + .../php/SwaggerClient-php/git_push.sh | 4 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 4 +- .../lib/Model/FormatTest.php | 30 +++ samples/client/petstore/ruby/README.md | 6 +- .../client/petstore/ruby/docs/FormatTest.md | 2 +- samples/client/petstore/ruby/git_push.sh | 4 +- .../ruby/lib/petstore/models/format_test.rb | 2 +- .../petstore/ruby/spec/api/store_api_spec.rb | 2 +- .../petstore/ruby/spec/api/user_api_spec.rb | 2 +- .../petstore/ruby/spec/models/dog_spec.rb | 4 +- .../ruby/spec/models/format_test_spec.rb | 10 + 32 files changed, 522 insertions(+), 85 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/CatDogTest.cs create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/TagCategoryTest.cs diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java index df23c1f22753..51977861922f 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java @@ -88,7 +88,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co "Int32", "Int64", "Float", - "Guid", + "Guid?", "System.IO.Stream", // not really a primitive, we include it to avoid model import "Object") ); @@ -115,7 +115,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co typeMapping.put("list", "List"); typeMapping.put("map", "Dictionary"); typeMapping.put("object", "Object"); - typeMapping.put("uuid", "Guid"); + typeMapping.put("uuid", "Guid?"); } public void setReturnICollection(boolean returnICollection) { 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 2bd79dbf015e..3d9b890d0587 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 @@ -89,6 +89,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { instantiationTypes.put("map", "HashMap"); typeMapping.put("date", "Date"); typeMapping.put("file", "File"); + typeMapping.put("UUID", "String"); cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); 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 0aed793fc090..15dfd889cdd9 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 @@ -111,6 +111,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { typeMapping.put("object", "object"); typeMapping.put("binary", "string"); typeMapping.put("ByteArray", "string"); + typeMapping.put("UUID", "string"); cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java index e81aa717262e..f9c0990c182b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java @@ -117,6 +117,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { typeMapping.put("file", "File"); typeMapping.put("binary", "String"); typeMapping.put("ByteArray", "String"); + typeMapping.put("UUID", "String"); // remove modelPackage and apiPackage added by default Iterator itr = cliOptions.iterator(); diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/FormatTestTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/FormatTestTests.cs index a6eec9197798..7676fcae9b98 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/FormatTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/FormatTestTests.cs @@ -139,6 +139,14 @@ namespace IO.Swagger.Test // TODO: unit test for the property 'DateTime' } /// + /// Test the property 'Uuid' + /// + [Test] + public void UuidTest() + { + // TODO: unit test for the property 'Uuid' + } + /// /// Test the property 'Password' /// [Test] diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md index a5c2cd333598..e5c57a92595a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-04-21T17:22:44.115+08:00 +- Build date: 2016-05-02T22:02:29.555+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -53,20 +53,28 @@ namespace Example public void main() { - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; - - var apiInstance = new PetApi(); - var body = new Pet(); // Pet | Pet object that needs to be added to the store + var apiInstance = new FakeApi(); + var number = 3.4; // double? | None + var _double = 1.2; // double? | None + var _string = _string_example; // string | None + var _byte = B; // byte[] | None + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4; // float? | None (optional) + var binary = B; // byte[] | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) + var password = password_example; // string | None (optional) try { - // Add a new pet to the store - apiInstance.AddPet(body); + // Fake endpoint for testing various parameters + apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } catch (Exception e) { - Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message ); } } } @@ -79,6 +87,7 @@ 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* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md index d29dc6b5d795..7ddfad04d05e 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md @@ -10,11 +10,12 @@ Name | Type | Description | Notes **_Float** | **float?** | | [optional] **_Double** | **double?** | | [optional] **_String** | **string** | | [optional] -**_Byte** | **byte[]** | | [optional] +**_Byte** | **byte[]** | | **Binary** | **byte[]** | | [optional] -**Date** | **DateTime?** | | [optional] +**Date** | **DateTime?** | | **DateTime** | **DateTime?** | | [optional] -**Password** | **string** | | [optional] +**Uuid** | **Guid?** | | [optional] +**Password** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/git_push.sh b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/git_push.sh index 13d463698c50..792320114fbe 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/git_push.sh +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/CatDogTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/CatDogTest.cs new file mode 100644 index 000000000000..7868fef3f390 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/CatDogTest.cs @@ -0,0 +1,175 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace IO.Swagger.Model +{ + + /// + /// + /// + [DataContract] + public class CatDogTest : Cat, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + public CatDogTest() + { + this.CatDogInteger = 0; + + } + + + /// + /// Gets or Sets CatId + /// + [DataMember(Name="cat_id", EmitDefaultValue=false)] + public long? CatId { get; set; } + + + /// + /// Gets or Sets DogId + /// + [DataMember(Name="dog_id", EmitDefaultValue=false)] + public long? DogId { get; set; } + + + /// + /// integer property for testing allOf + /// + /// integer property for testing allOf + [DataMember(Name="CatDogInteger", EmitDefaultValue=false)] + public int? CatDogInteger { get; set; } + + + /// + /// Gets or Sets DogName + /// + [DataMember(Name="dog_name", EmitDefaultValue=false)] + public string DogName { get; set; } + + + /// + /// Gets or Sets CatName + /// + [DataMember(Name="cat_name", EmitDefaultValue=false)] + public string CatName { get; set; } + + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class CatDogTest {\n"); + sb.Append(" CatId: ").Append(CatId).Append("\n"); + sb.Append(" DogId: ").Append(DogId).Append("\n"); + sb.Append(" CatDogInteger: ").Append(CatDogInteger).Append("\n"); + sb.Append(" DogName: ").Append(DogName).Append("\n"); + sb.Append(" CatName: ").Append(CatName).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public new string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as CatDogTest); + } + + /// + /// Returns true if CatDogTest instances are equal + /// + /// Instance of CatDogTest to be compared + /// Boolean + public bool Equals(CatDogTest other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.CatId == other.CatId || + this.CatId != null && + this.CatId.Equals(other.CatId) + ) && + ( + this.DogId == other.DogId || + this.DogId != null && + this.DogId.Equals(other.DogId) + ) && + ( + this.CatDogInteger == other.CatDogInteger || + this.CatDogInteger != null && + this.CatDogInteger.Equals(other.CatDogInteger) + ) && + ( + this.DogName == other.DogName || + this.DogName != null && + this.DogName.Equals(other.DogName) + ) && + ( + this.CatName == other.CatName || + this.CatName != null && + this.CatName.Equals(other.CatName) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this.CatId != null) + hash = hash * 57 + this.CatId.GetHashCode(); + + if (this.DogId != null) + hash = hash * 57 + this.DogId.GetHashCode(); + + if (this.CatDogInteger != null) + hash = hash * 57 + this.CatDogInteger.GetHashCode(); + + if (this.DogName != null) + hash = hash * 57 + this.DogName.GetHashCode(); + + if (this.CatName != null) + hash = hash * 57 + this.CatName.GetHashCode(); + + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs index 6d50426bad01..49e7d1041aad 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs @@ -29,13 +29,14 @@ namespace IO.Swagger.Model /// _Float. /// _Double. /// _String. - /// _Byte. + /// _Byte (required). /// Binary. - /// Date. + /// Date (required). /// DateTime. - /// Password. + /// Uuid. + /// Password (required). - public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, string Password = null) + public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, Guid? Uuid = null, string Password = null) { // to ensure "Number" is required (not null) if (Number == null) @@ -46,17 +47,42 @@ namespace IO.Swagger.Model { this.Number = Number; } + // to ensure "_Byte" is required (not null) + if (_Byte == null) + { + throw new InvalidDataException("_Byte is a required property for FormatTest and cannot be null"); + } + else + { + this._Byte = _Byte; + } + // to ensure "Date" is required (not null) + if (Date == null) + { + throw new InvalidDataException("Date is a required property for FormatTest and cannot be null"); + } + else + { + this.Date = Date; + } + // to ensure "Password" is required (not null) + if (Password == null) + { + throw new InvalidDataException("Password is a required property for FormatTest and cannot be null"); + } + else + { + this.Password = Password; + } this.Integer = Integer; this.Int32 = Int32; this.Int64 = Int64; this._Float = _Float; this._Double = _Double; this._String = _String; - this._Byte = _Byte; this.Binary = Binary; - this.Date = Date; this.DateTime = DateTime; - this.Password = Password; + this.Uuid = Uuid; } @@ -127,6 +153,12 @@ namespace IO.Swagger.Model [DataMember(Name="dateTime", EmitDefaultValue=false)] public DateTime? DateTime { get; set; } + /// + /// Gets or Sets Uuid + /// + [DataMember(Name="uuid", EmitDefaultValue=false)] + public Guid? Uuid { get; set; } + /// /// Gets or Sets Password /// @@ -152,6 +184,7 @@ namespace IO.Swagger.Model sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -244,6 +277,11 @@ namespace IO.Swagger.Model this.DateTime != null && this.DateTime.Equals(other.DateTime) ) && + ( + this.Uuid == other.Uuid || + this.Uuid != null && + this.Uuid.Equals(other.Uuid) + ) && ( this.Password == other.Password || this.Password != null && @@ -284,6 +322,8 @@ namespace IO.Swagger.Model hash = hash * 59 + this.Date.GetHashCode(); if (this.DateTime != null) hash = hash * 59 + this.DateTime.GetHashCode(); + if (this.Uuid != null) + hash = hash * 59 + this.Uuid.GetHashCode(); if (this.Password != null) hash = hash * 59 + this.Password.GetHashCode(); return hash; diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/TagCategoryTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/TagCategoryTest.cs new file mode 100644 index 000000000000..2cf870ffd774 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/TagCategoryTest.cs @@ -0,0 +1,143 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace IO.Swagger.Model +{ + + /// + /// + /// + [DataContract] + public class TagCategoryTest : Category, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + public TagCategoryTest() + { + this.TagCategoryInteger = 0; + + } + + + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + public long? Id { get; set; } + + + /// + /// integer property for testing allOf + /// + /// integer property for testing allOf + [DataMember(Name="TagCategoryInteger", EmitDefaultValue=false)] + public int? TagCategoryInteger { get; set; } + + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TagCategoryTest {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" TagCategoryInteger: ").Append(TagCategoryInteger).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public new string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as TagCategoryTest); + } + + /// + /// Returns true if TagCategoryTest instances are equal + /// + /// Instance of TagCategoryTest to be compared + /// Boolean + public bool Equals(TagCategoryTest other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.Id == other.Id || + this.Id != null && + this.Id.Equals(other.Id) + ) && + ( + this.TagCategoryInteger == other.TagCategoryInteger || + this.TagCategoryInteger != null && + this.TagCategoryInteger.Equals(other.TagCategoryInteger) + ) && + ( + this.Name == other.Name || + this.Name != null && + this.Name.Equals(other.Name) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this.Id != null) + hash = hash * 57 + this.Id.GetHashCode(); + + if (this.TagCategoryInteger != null) + hash = hash * 57 + this.TagCategoryInteger.GetHashCode(); + + if (this.Name != null) + hash = hash * 57 + this.Name.GetHashCode(); + + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index 7b777ba6a271..4a76d4a8d2f0 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -69,8 +69,10 @@ - + + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index 0b91bb4ae32d..28096724f7a1 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,28 +1,12 @@  - + - - - + + + + - - - - - - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt index 323cad108c6b..7d68ff048e5d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt +++ b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt @@ -1,9 +1,9 @@ -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb diff --git a/samples/client/petstore/java/default/docs/FormatTest.md b/samples/client/petstore/java/default/docs/FormatTest.md index 8e400e7bcd77..dc2b559dad28 100644 --- a/samples/client/petstore/java/default/docs/FormatTest.md +++ b/samples/client/petstore/java/default/docs/FormatTest.md @@ -11,11 +11,12 @@ Name | Type | Description | Notes **_float** | **Float** | | [optional] **_double** | **Double** | | [optional] **string** | **String** | | [optional] -**_byte** | **byte[]** | | [optional] +**_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] -**date** | [**Date**](Date.md) | | [optional] +**date** | [**Date**](Date.md) | | **dateTime** | [**Date**](Date.md) | | [optional] -**password** | **String** | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | diff --git a/samples/client/petstore/java/default/git_push.sh b/samples/client/petstore/java/default/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/java/default/git_push.sh +++ b/samples/client/petstore/java/default/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java index e578af2af431..6c3bcfbca9f8 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java @@ -25,10 +25,13 @@ public class FormatTest { private byte[] binary = null; private Date date = null; private Date dateTime = null; + private String uuid = null; private String password = null; /** + * minimum: 10.0 + * maximum: 100.0 **/ public FormatTest integer(Integer integer) { this.integer = integer; @@ -46,6 +49,8 @@ public class FormatTest { /** + * minimum: 20.0 + * maximum: 200.0 **/ public FormatTest int32(Integer int32) { this.int32 = int32; @@ -80,6 +85,8 @@ public class FormatTest { /** + * minimum: 32.1 + * maximum: 543.2 **/ public FormatTest number(BigDecimal number) { this.number = number; @@ -97,6 +104,8 @@ public class FormatTest { /** + * minimum: 54.3 + * maximum: 987.6 **/ public FormatTest _float(Float _float) { this._float = _float; @@ -114,6 +123,8 @@ public class FormatTest { /** + * minimum: 67.8 + * maximum: 123.4 **/ public FormatTest _double(Double _double) { this._double = _double; @@ -154,7 +165,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("byte") public byte[] getByte() { return _byte; @@ -188,7 +199,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("date") public Date getDate() { return date; @@ -215,6 +226,23 @@ public class FormatTest { } + /** + **/ + public FormatTest uuid(String uuid) { + this.uuid = uuid; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** **/ public FormatTest password(String password) { @@ -222,7 +250,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("password") public String getPassword() { return password; @@ -252,12 +280,13 @@ public class FormatTest { Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, password); + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } @Override @@ -276,6 +305,7 @@ public class FormatTest { sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index e7d9b552b043..a9c21234369c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-29T03:01:58.276Z +- Build date: 2016-05-02T21:49:03.153+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/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git" + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" } ], "require": { - "YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID": "*@dev" + "GIT_USER_ID/GIT_REPO_ID": "*@dev" } } ``` @@ -59,7 +59,7 @@ Please follow the [installation procedure](#installation--usage) and then run th require_once(__DIR__ . '/vendor/autoload.php'); $api_instance = new Swagger\Client\Api\FakeApi(); -$number = "number_example"; // string | None +$number = 3.4; // float | None $double = 1.2; // double | None $string = "string_example"; // string | None $byte = "B"; // string | None diff --git a/samples/client/petstore/php/SwaggerClient-php/composer.json b/samples/client/petstore/php/SwaggerClient-php/composer.json index 2c63b2c8ba06..3822037d7504 100644 --- a/samples/client/petstore/php/SwaggerClient-php/composer.json +++ b/samples/client/petstore/php/SwaggerClient-php/composer.json @@ -1,5 +1,5 @@ { - "name": "YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID", + "name": "GIT_USER_ID/GIT_REPO_ID", "version": "1.0.0", "description": "", "keywords": [ diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md index bc47365c9e0d..93c24ef7eebc 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md @@ -20,7 +20,7 @@ Fake endpoint for testing various parameters require_once(__DIR__ . '/vendor/autoload.php'); $api_instance = new Swagger\Client\Api\FakeApi(); -$number = "number_example"; // string | None +$number = 3.4; // float | None $double = 1.2; // double | None $string = "string_example"; // string | None $byte = "B"; // string | None @@ -45,7 +45,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **string**| None | + **number** | **float**| None | **double** | **double**| None | **string** | **string**| None | **byte** | **string**| None | diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md index e043ee8d2b8e..c31305010fc4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md @@ -14,6 +14,7 @@ Name | Type | Description | Notes **binary** | **string** | | [optional] **date** | [**\DateTime**](Date.md) | | **date_time** | [**\DateTime**](\DateTime.md) | | [optional] +**uuid** | **string** | | [optional] **password** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/git_push.sh b/samples/client/petstore/php/SwaggerClient-php/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/php/SwaggerClient-php/git_push.sh +++ b/samples/client/petstore/php/SwaggerClient-php/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index ee15a10d025a..2938beaf9ced 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -95,7 +95,7 @@ class FakeApi * * Fake endpoint for testing various parameters * - * @param string $number None (required) + * @param float $number None (required) * @param double $double None (required) * @param string $string None (required) * @param string $byte None (required) @@ -122,7 +122,7 @@ class FakeApi * * Fake endpoint for testing various parameters * - * @param string $number None (required) + * @param float $number None (required) * @param double $double None (required) * @param string $string None (required) * @param string $byte None (required) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 7bfe30c0ef76..78c0d8124474 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -68,6 +68,7 @@ class FormatTest implements ArrayAccess 'binary' => 'string', 'date' => '\DateTime', 'date_time' => '\DateTime', + 'uuid' => 'string', 'password' => 'string' ); @@ -91,6 +92,7 @@ class FormatTest implements ArrayAccess 'binary' => 'binary', 'date' => 'date', 'date_time' => 'dateTime', + 'uuid' => 'uuid', 'password' => 'password' ); @@ -114,6 +116,7 @@ class FormatTest implements ArrayAccess 'binary' => 'setBinary', 'date' => 'setDate', 'date_time' => 'setDateTime', + 'uuid' => 'setUuid', 'password' => 'setPassword' ); @@ -137,6 +140,7 @@ class FormatTest implements ArrayAccess 'binary' => 'getBinary', 'date' => 'getDate', 'date_time' => 'getDateTime', + 'uuid' => 'getUuid', 'password' => 'getPassword' ); @@ -199,6 +203,11 @@ class FormatTest implements ArrayAccess * @var \DateTime */ protected $date_time; + /** + * $uuid + * @var string + */ + protected $uuid; /** * $password * @var string @@ -225,6 +234,7 @@ class FormatTest implements ArrayAccess $this->binary = $data["binary"]; $this->date = $data["date"]; $this->date_time = $data["date_time"]; + $this->uuid = $data["uuid"]; $this->password = $data["password"]; } } @@ -448,6 +458,26 @@ class FormatTest implements ArrayAccess $this->date_time = $date_time; return $this; } + /** + * Gets uuid + * @return string + */ + public function getUuid() + { + return $this->uuid; + } + + /** + * Sets uuid + * @param string $uuid + * @return $this + */ + public function setUuid($uuid) + { + + $this->uuid = $uuid; + return $this; + } /** * Gets password * @return string diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index da8816ec7113..62b0d52dc7b1 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-29T11:03:36.514+08:00 +- Build date: 2016-05-02T21:47:16.723+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -36,9 +36,9 @@ Finally add this to the Gemfile: ### Install from Git -If the Ruby gem is hosted at a git repository: https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID, then add the following in the Gemfile: +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: - gem 'petstore', :git => 'https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git' + gem 'petstore', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' ### Include the Ruby code directly diff --git a/samples/client/petstore/ruby/docs/FormatTest.md b/samples/client/petstore/ruby/docs/FormatTest.md index 014f2431f122..79cf9b5a8663 100644 --- a/samples/client/petstore/ruby/docs/FormatTest.md +++ b/samples/client/petstore/ruby/docs/FormatTest.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **binary** | **String** | | [optional] **date** | **Date** | | **date_time** | **DateTime** | | [optional] -**uuid** | [**UUID**](UUID.md) | | [optional] +**uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/ruby/git_push.sh b/samples/client/petstore/ruby/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/ruby/git_push.sh +++ b/samples/client/petstore/ruby/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index 807a8f4d605b..946e00015552 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -77,7 +77,7 @@ module Petstore :'binary' => :'String', :'date' => :'Date', :'date_time' => :'DateTime', - :'uuid' => :'UUID', + :'uuid' => :'String', :'password' => :'String' } end diff --git a/samples/client/petstore/ruby/spec/api/store_api_spec.rb b/samples/client/petstore/ruby/spec/api/store_api_spec.rb index 479891e9308c..015d1d8e39d4 100644 --- a/samples/client/petstore/ruby/spec/api/store_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/store_api_spec.rb @@ -69,7 +69,7 @@ describe 'StoreApi' do # unit tests for get_order_by_id # 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 order_id ID of pet that needs to be fetched # @param [Hash] opts the optional parameters # @return [Order] diff --git a/samples/client/petstore/ruby/spec/api/user_api_spec.rb b/samples/client/petstore/ruby/spec/api/user_api_spec.rb index 4564491d5076..272980a6db02 100644 --- a/samples/client/petstore/ruby/spec/api/user_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/user_api_spec.rb @@ -103,7 +103,7 @@ describe 'UserApi' do # unit tests for get_user_by_name # Get user by user name # - # @param username The name that needs to be fetched. Use user1 for testing. + # @param username The name that needs to be fetched. Use user1 for testing. # @param [Hash] opts the optional parameters # @return [User] describe 'get_user_by_name test' do diff --git a/samples/client/petstore/ruby/spec/models/dog_spec.rb b/samples/client/petstore/ruby/spec/models/dog_spec.rb index 20375338c7ee..b319d72b80aa 100644 --- a/samples/client/petstore/ruby/spec/models/dog_spec.rb +++ b/samples/client/petstore/ruby/spec/models/dog_spec.rb @@ -36,7 +36,7 @@ describe 'Dog' do @instance.should be_a(Petstore::Dog) end end - describe 'test attribute "class_name"' do + describe 'test attribute "breed"' do it 'should work' do # assertion here # should be_a() @@ -46,7 +46,7 @@ describe 'Dog' do end end - describe 'test attribute "breed"' do + describe 'test attribute "class_name"' do it 'should work' do # assertion here # should be_a() diff --git a/samples/client/petstore/ruby/spec/models/format_test_spec.rb b/samples/client/petstore/ruby/spec/models/format_test_spec.rb index e44131192a35..50b2980d17bf 100644 --- a/samples/client/petstore/ruby/spec/models/format_test_spec.rb +++ b/samples/client/petstore/ruby/spec/models/format_test_spec.rb @@ -146,6 +146,16 @@ describe 'FormatTest' do end end + describe 'test attribute "uuid"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + describe 'test attribute "password"' do it 'should work' do # assertion here From d64af1b8362ef21d2d267e276b430d07db047348 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 2 May 2016 22:16:07 +0800 Subject: [PATCH 052/170] fix typescript tmeplate folder --- .../AbstractTypeScriptClientCodegen.java | 1 + .../languages/JavascriptClientCodegen.java | 1 + samples/client/petstore/javascript/README.md | 2 +- .../typescript-angular/API/Client/PetApi.ts | 125 ++---------------- .../typescript-angular/API/Client/StoreApi.ts | 73 +--------- .../typescript-angular/API/Client/UserApi.ts | 34 ++--- .../typescript-angular/API/Client/api.d.ts | 5 - .../petstore/typescript-angular/git_push.sh | 4 +- .../petstore/typescript-node/default/api.ts | 10 +- .../typescript-node/default/git_push.sh | 4 +- .../petstore/typescript-node/npm/api.ts | 10 +- .../petstore/typescript-node/npm/git_push.sh | 4 +- .../petstore/typescript-node/npm/package.json | 2 +- 13 files changed, 44 insertions(+), 231 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index 0676372e64a7..a5e62fc30535 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -60,6 +60,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp // mapped to String as a workaround typeMapping.put("binary", "string"); typeMapping.put("ByteArray", "string"); + typeMapping.put("UUID", "string"); cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase")); 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 175f3eab0c19..9ca4589be5df 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 @@ -136,6 +136,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo // binary not supported in JavaScript client right now, using String as a workaround typeMapping.put("ByteArray", "String"); // I don't see ByteArray defined in the Swagger docs. typeMapping.put("binary", "String"); + typeMapping.put("UUID", "String"); importMapping.clear(); diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 2d707697bf27..2ddda0aa3515 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-01T12:06:44.623+08:00 +- Build date: 2016-05-02T22:07:48.077+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation diff --git a/samples/client/petstore/typescript-angular/API/Client/PetApi.ts b/samples/client/petstore/typescript-angular/API/Client/PetApi.ts index d11e0d780ed7..62492c17d805 100644 --- a/samples/client/petstore/typescript-angular/API/Client/PetApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/PetApi.ts @@ -41,36 +41,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * 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 - */ - public addPetUsingByteArray (body?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - const localVarPath = this.basePath + '/pet?testing_byte_array=true'; - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let httpRequestParams: any = { - method: 'POST', - url: localVarPath, - json: true, - data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -102,9 +73,7 @@ namespace API.Client { method: 'DELETE', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -116,8 +85,8 @@ namespace API.Client { } /** * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter */ public findPetsByStatus (status?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { const localVarPath = this.basePath + '/pet/findByStatus'; @@ -132,9 +101,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -162,9 +129,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -193,71 +158,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * 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 - */ - public getPetByIdInObject (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise { - const localVarPath = this.basePath + '/pet/{petId}?response=inline_arbitrary_object' - .replace('{' + 'petId' + '}', String(petId)); - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling getPetByIdInObject'); - } - let httpRequestParams: any = { - method: 'GET', - url: localVarPath, - json: true, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * 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 - */ - public petPetIdtestingByteArraytrueGet (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise { - const localVarPath = this.basePath + '/pet/{petId}?testing_byte_array=true' - .replace('{' + 'petId' + '}', String(petId)); - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling petPetIdtestingByteArraytrueGet'); - } - let httpRequestParams: any = { - method: 'GET', - url: localVarPath, - json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -282,9 +183,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -323,9 +222,7 @@ namespace API.Client { method: 'POST', url: localVarPath, json: false, - - data: this.$httpParamSerializer(formParams), - + data: this.$httpParamSerializer(formParams), params: queryParameters, headers: headerParams }; @@ -365,9 +262,7 @@ namespace API.Client { method: 'POST', url: localVarPath, json: false, - - data: this.$httpParamSerializer(formParams), - + data: this.$httpParamSerializer(formParams), params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts b/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts index 193e12fe5e5f..976ee7acd486 100644 --- a/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts @@ -45,39 +45,7 @@ namespace API.Client { method: 'DELETE', url: localVarPath, json: true, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * 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 - */ - public findOrdersByStatus (status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise> { - const localVarPath = this.basePath + '/store/findByStatus'; - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - if (status !== undefined) { - queryParameters['status'] = status; - } - - let httpRequestParams: any = { - method: 'GET', - url: localVarPath, - json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -100,34 +68,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - */ - public getInventoryInObject (extraHttpRequestParams?: any ) : ng.IHttpPromise { - const localVarPath = this.basePath + '/store/inventory?response=arbitrary_object'; - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let httpRequestParams: any = { - method: 'GET', - url: localVarPath, - json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -139,7 +80,7 @@ namespace API.Client { } /** * 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 */ public getOrderById (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { @@ -156,9 +97,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -183,9 +122,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-angular/API/Client/UserApi.ts b/samples/client/petstore/typescript-angular/API/Client/UserApi.ts index c1111e146ad6..79f6326b99c6 100644 --- a/samples/client/petstore/typescript-angular/API/Client/UserApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/UserApi.ts @@ -41,9 +41,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -68,9 +66,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -95,9 +91,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -126,9 +120,7 @@ namespace API.Client { method: 'DELETE', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -141,7 +133,7 @@ namespace API.Client { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. */ public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { const localVarPath = this.basePath + '/user/{username}' @@ -157,9 +149,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -192,9 +182,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -217,9 +205,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -250,9 +236,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-angular/API/Client/api.d.ts b/samples/client/petstore/typescript-angular/API/Client/api.d.ts index c9e5e7a2f57f..f2a86d96e963 100644 --- a/samples/client/petstore/typescript-angular/API/Client/api.d.ts +++ b/samples/client/petstore/typescript-angular/API/Client/api.d.ts @@ -1,11 +1,6 @@ /// -/// -/// -/// -/// /// /// -/// /// /// diff --git a/samples/client/petstore/typescript-angular/git_push.sh b/samples/client/petstore/typescript-angular/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/typescript-angular/git_push.sh +++ b/samples/client/petstore/typescript-angular/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/typescript-node/default/api.ts b/samples/client/petstore/typescript-node/default/api.ts index 3e25b5e718c0..c2bd53e8ca29 100644 --- a/samples/client/petstore/typescript-node/default/api.ts +++ b/samples/client/petstore/typescript-node/default/api.ts @@ -129,8 +129,8 @@ export class PetApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); @@ -409,10 +409,10 @@ export class PetApi { json: true, } - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { @@ -632,8 +632,8 @@ export class StoreApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); @@ -881,8 +881,8 @@ export class UserApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); diff --git a/samples/client/petstore/typescript-node/default/git_push.sh b/samples/client/petstore/typescript-node/default/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/typescript-node/default/git_push.sh +++ b/samples/client/petstore/typescript-node/default/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/typescript-node/npm/api.ts b/samples/client/petstore/typescript-node/npm/api.ts index 3e25b5e718c0..c2bd53e8ca29 100644 --- a/samples/client/petstore/typescript-node/npm/api.ts +++ b/samples/client/petstore/typescript-node/npm/api.ts @@ -129,8 +129,8 @@ export class PetApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); @@ -409,10 +409,10 @@ export class PetApi { json: true, } - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { @@ -632,8 +632,8 @@ export class StoreApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); @@ -881,8 +881,8 @@ export class UserApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); diff --git a/samples/client/petstore/typescript-node/npm/git_push.sh b/samples/client/petstore/typescript-node/npm/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/typescript-node/npm/git_push.sh +++ b/samples/client/petstore/typescript-node/npm/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/typescript-node/npm/package.json b/samples/client/petstore/typescript-node/npm/package.json index 67a7cc03a361..5654c9ed4a31 100644 --- a/samples/client/petstore/typescript-node/npm/package.json +++ b/samples/client/petstore/typescript-node/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201604282147", + "version": "0.0.1-SNAPSHOT.201605022215", "description": "NodeJS client for @swagger/angular2-typescript-petstore", "main": "api.js", "scripts": { From 2111e9ef8d6ba65c15c3bf0143a2a1f469b5cfd0 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 2 May 2016 22:41:50 +0800 Subject: [PATCH 053/170] add new sample files --- .../Lib/SwaggerClient/docs/FakeApi.md | 91 ++++ .../src/main/csharp/IO/Swagger/Api/FakeApi.cs | 418 ++++++++++++++++++ .../petstore/java/default/docs/FakeApi.md | 75 ++++ .../java/io/swagger/client/api/FakeApi.java | 128 ++++++ .../client/petstore/ruby/docs/200Response.md | 8 + 5 files changed, 720 insertions(+) create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FakeApi.md create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/FakeApi.cs create mode 100644 samples/client/petstore/java/default/docs/FakeApi.md create mode 100644 samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java create mode 100644 samples/client/petstore/ruby/docs/200Response.md diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FakeApi.md new file mode 100644 index 000000000000..ae9fd8c3d36d --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FakeApi.md @@ -0,0 +1,91 @@ +# IO.Swagger.Api.FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters + + +# **TestEndpointParameters** +> void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class TestEndpointParametersExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var number = 3.4; // double? | None + var _double = 1.2; // double? | None + var _string = _string_example; // string | None + var _byte = B; // byte[] | None + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4; // float? | None (optional) + var binary = B; // byte[] | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) + var password = password_example; // string | None (optional) + + try + { + // Fake endpoint for testing various parameters + apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **double?**| None | + **_double** | **double?**| None | + **_string** | **string**| None | + **_byte** | **byte[]**| None | + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] + **binary** | **byte[]**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] + **password** | **string**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/FakeApi.cs new file mode 100644 index 000000000000..1c92dc3bbda7 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/FakeApi.cs @@ -0,0 +1,418 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using IO.Swagger.Client; + +namespace IO.Swagger.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApi + { + #region Synchronous Operations + /// + /// Fake endpoint for testing various parameters + /// + /// + /// Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// + void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + + /// + /// Fake endpoint for testing various parameters + /// + /// + /// Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// ApiResponse of Object(void) + ApiResponse TestEndpointParametersWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// Fake endpoint for testing various parameters + /// + /// + /// Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of void + System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + + /// + /// Fake endpoint for testing various parameters + /// + /// + /// Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeApi : IFakeApi + { + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(String basePath) + { + this.Configuration = new Configuration(new ApiClient(basePath)); + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeApi(Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Configuration.Default; + else + this.Configuration = configuration; + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath(String basePath) + { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Configuration Configuration {get; set;} + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public Dictionary DefaultHeader() + { + return this.Configuration.DefaultHeader; + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader(string key, string value) + { + this.Configuration.AddDefaultHeader(key, value); + } + + /// + /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// + public void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + { + TestEndpointParametersWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + } + + /// + /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// ApiResponse of Object(void) + public ApiResponse TestEndpointParametersWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + { + // verify the required parameter 'number' is set + if (number == null) + throw new ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_double' is set + if (_double == null) + throw new ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_string' is set + if (_string == null) + throw new ApiException(400, "Missing required parameter '_string' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_byte' is set + if (_byte == null) + throw new ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters"); + + var localVarPath = "/fake"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/xml", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter + if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter + if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter + if (number != null) localVarFormParams.Add("number", Configuration.ApiClient.ParameterToString(number)); // form parameter + if (_float != null) localVarFormParams.Add("float", Configuration.ApiClient.ParameterToString(_float)); // form parameter + if (_double != null) localVarFormParams.Add("double", Configuration.ApiClient.ParameterToString(_double)); // form parameter + if (_string != null) localVarFormParams.Add("string", Configuration.ApiClient.ParameterToString(_string)); // form parameter + if (_byte != null) localVarFormParams.Add("byte", Configuration.ApiClient.ParameterToString(_byte)); // form parameter + if (binary != null) localVarFormParams.Add("binary", Configuration.ApiClient.ParameterToString(binary)); // form parameter + if (date != null) localVarFormParams.Add("date", Configuration.ApiClient.ParameterToString(date)); // form parameter + if (dateTime != null) localVarFormParams.Add("dateTime", Configuration.ApiClient.ParameterToString(dateTime)); // form parameter + if (password != null) localVarFormParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // form parameter + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (localVarStatusCode >= 400) + throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.Content, localVarResponse.Content); + else if (localVarStatusCode == 0) + throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + /// + /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of void + public async System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + { + await TestEndpointParametersAsyncWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + + } + + /// + /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + { + // verify the required parameter 'number' is set + if (number == null) + throw new ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_double' is set + if (_double == null) + throw new ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_string' is set + if (_string == null) + throw new ApiException(400, "Missing required parameter '_string' when calling FakeApi->TestEndpointParameters"); + // verify the required parameter '_byte' is set + if (_byte == null) + throw new ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters"); + + var localVarPath = "/fake"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/xml", + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter + if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter + if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter + if (number != null) localVarFormParams.Add("number", Configuration.ApiClient.ParameterToString(number)); // form parameter + if (_float != null) localVarFormParams.Add("float", Configuration.ApiClient.ParameterToString(_float)); // form parameter + if (_double != null) localVarFormParams.Add("double", Configuration.ApiClient.ParameterToString(_double)); // form parameter + if (_string != null) localVarFormParams.Add("string", Configuration.ApiClient.ParameterToString(_string)); // form parameter + if (_byte != null) localVarFormParams.Add("byte", Configuration.ApiClient.ParameterToString(_byte)); // form parameter + if (binary != null) localVarFormParams.Add("binary", Configuration.ApiClient.ParameterToString(binary)); // form parameter + if (date != null) localVarFormParams.Add("date", Configuration.ApiClient.ParameterToString(date)); // form parameter + if (dateTime != null) localVarFormParams.Add("dateTime", Configuration.ApiClient.ParameterToString(dateTime)); // form parameter + if (password != null) localVarFormParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // form parameter + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (localVarStatusCode >= 400) + throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.Content, localVarResponse.Content); + else if (localVarStatusCode == 0) + throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + } +} diff --git a/samples/client/petstore/java/default/docs/FakeApi.md b/samples/client/petstore/java/default/docs/FakeApi.md new file mode 100644 index 000000000000..c1fdd3103218 --- /dev/null +++ b/samples/client/petstore/java/default/docs/FakeApi.md @@ -0,0 +1,75 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters + + + +# **testEndpointParameters** +> testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal number = new BigDecimal(); // BigDecimal | None +Double _double = 3.4D; // Double | None +String string = "string_example"; // String | None +byte[] _byte = B; // byte[] | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 789L; // Long | None +Float _float = 3.4F; // Float | None +byte[] binary = B; // byte[] | None +Date date = new Date(); // Date | None +Date dateTime = new Date(); // Date | None +String password = "password_example"; // String | None +try { + apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **string** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **binary** | **byte[]**| None | [optional] + **date** | **Date**| None | [optional] + **dateTime** | **Date**| None | [optional] + **password** | **String**| None | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java new file mode 100644 index 000000000000..59d58fc6c7d7 --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java @@ -0,0 +1,128 @@ +package io.swagger.client.api; + +import com.sun.jersey.api.client.GenericType; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import java.util.Date; +import java.math.BigDecimal; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeApi { + private ApiClient apiClient; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @throws ApiException if fails to make API call + */ + public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + } + + // verify the required parameter 'string' is set + if (string == null) { + throw new ApiException(400, "Missing the required parameter 'string' when calling testEndpointParameters"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + } + + // create path and map variables + String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + if (integer != null) + localVarFormParams.put("integer", integer); +if (int32 != null) + localVarFormParams.put("int32", int32); +if (int64 != null) + localVarFormParams.put("int64", int64); +if (number != null) + localVarFormParams.put("number", number); +if (_float != null) + localVarFormParams.put("float", _float); +if (_double != null) + localVarFormParams.put("double", _double); +if (string != null) + localVarFormParams.put("string", string); +if (_byte != null) + localVarFormParams.put("byte", _byte); +if (binary != null) + localVarFormParams.put("binary", binary); +if (date != null) + localVarFormParams.put("date", date); +if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); +if (password != null) + localVarFormParams.put("password", password); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } +} diff --git a/samples/client/petstore/ruby/docs/200Response.md b/samples/client/petstore/ruby/docs/200Response.md new file mode 100644 index 000000000000..2e0f1ec92f36 --- /dev/null +++ b/samples/client/petstore/ruby/docs/200Response.md @@ -0,0 +1,8 @@ +# Petstore::200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] + + From 803c62e0dc7f74086e7a9c5ca37de5c21046a701 Mon Sep 17 00:00:00 2001 From: Neil O'Toole Date: Mon, 2 May 2016 15:53:19 +0100 Subject: [PATCH 054/170] fixed new line issue --- modules/swagger-codegen/src/main/resources/go/api.mustache | 3 ++- samples/client/petstore/go/go-petstore/README.md | 2 +- samples/client/petstore/go/go-petstore/pet_api.go | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 6e3b5481f8cf..6ca3a39324f4 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -102,7 +102,8 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{ {{#headerParams}} // header params "{{baseName}}" headerParams["{{baseName}}"] = {{paramName}} {{/headerParams}}{{/hasHeaderParams}}{{#hasFormParams}} -{{#formParams}}{{#isFile}} fbs, _ := ioutil.ReadAll(file) +{{#formParams}}{{#isFile}} + fbs, _ := ioutil.ReadAll(file) fileBytes = fbs fileName = file.Name(){{/isFile}} {{^isFile}} formParams["{{paramName}}"] = {{paramName}}{{/isFile}}{{/formParams}}{{/hasFormParams}}{{#hasBodyParam}} diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index d4b05313c88d..9130ec599b62 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-01T14:37:06.925+01:00 +- Build date: 2016-05-02T15:51:26.331+01:00 - Build package: class io.swagger.codegen.languages.GoClientCodegen ## Installation diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index aea3db2ba098..0e252159fd02 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -551,7 +551,8 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File headerParams["Accept"] = localVarHttpHeaderAccept } - formParams["additionalMetadata"] = additionalMetadata fbs, _ := ioutil.ReadAll(file) + formParams["additionalMetadata"] = additionalMetadata + fbs, _ := ioutil.ReadAll(file) fileBytes = fbs fileName = file.Name() From 3dbdc839811f27e85d35277d33cbc40a915a7ec4 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Mon, 2 May 2016 16:25:46 +0100 Subject: [PATCH 055/170] Add validation to model --- .../src/main/resources/python/model.mustache | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index bd33a997c3ec..340c73687f50 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -79,7 +79,32 @@ class {{classname}}(object): "Invalid value for `{{name}}`, must be one of {0}" .format(allowed_values) ) - {{/isEnum}}self._{{name}} = {{name}} + {{/isEnum}} + {{^isEnum}} + + {{#hasValidation}} + {{#maxLength}} + if len({{name}}) > {{maxLength}}: + raise ValueError("Invalid value for `{{name}}`, length must be less than `{{maxLength}}`") + {{/maxLength}} + {{#minLength}} + if len({{name}}) < {{minLength}}: + raise ValueError("Invalid value for `{{name}}`, length must be greater than `{{minLength}}`") + {{/minLength}} + {{#maximum}} + if {{name}} > {{maximum}}: + raise ValueError("Invalid value for `{{name}}`, must be a value less than `{{maximum}}`") + {{/maximum}} + {{#minimum}} + if {{name}} < {{minimum}}: + raise ValueError("Invalid value for `{{name}}`, must be a value greater than `{{minimum}}`") + {{/minimum}} + {{#pattern}} + #Check pattern + {{/pattern}} + {{/hasValidation}} + {{/isEnum}} + self._{{name}} = {{name}} {{/vars}} def to_dict(self): From 4a440f4ee4cdf19f7cf427625359bde363affb2e Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Mon, 2 May 2016 16:37:32 +0100 Subject: [PATCH 056/170] Fix excpetion message to include --- .../src/main/resources/python/api.mustache | 8 ++++---- .../src/main/resources/python/model.mustache | 14 +++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index 5a38ee255ee3..7902754e5fb3 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -101,19 +101,19 @@ class {{classname}}(object): {{#hasValidation}} {{#maxLength}} if '{{paramName}}' in params and len(params['{{paramName}}']) > {{maxLength}}: - raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than `{{maxLength}}`") + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") {{/maxLength}} {{#minLength}} if '{{paramName}}' in params and len(params['{{paramName}}']) < {{minLength}}: - raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than `{{minLength}}`") + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") {{/minLength}} {{#maximum}} if '{{paramName}}' in params and params['{{paramName}}'] > {{maximum}}: - raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than `{{maximum}}`") + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than or equal to `{{maximum}}`") {{/maximum}} {{#minimum}} if '{{paramName}}' in params and params['{{paramName}}'] < {{minimum}}: - raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than `{{minimum}}`") + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than or equal to `{{minimum}}`") {{/minimum}} {{#pattern}} #if not re.match('{{pattern}}', '{{paramName}}' in params and params['{{paramName}}']): diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 340c73687f50..78fe2ff2acd5 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -21,7 +21,8 @@ Copyright 2016 SmartBear Software {{#models}} {{#model}} from pprint import pformat -from six import iteritems +from six import +import re class {{classname}}(object): @@ -83,24 +84,27 @@ class {{classname}}(object): {{^isEnum}} {{#hasValidation}} + if not {{name}}: + raise ValueError("Invalid value for `{{name}}`, must not be `None`") {{#maxLength}} if len({{name}}) > {{maxLength}}: raise ValueError("Invalid value for `{{name}}`, length must be less than `{{maxLength}}`") {{/maxLength}} {{#minLength}} if len({{name}}) < {{minLength}}: - raise ValueError("Invalid value for `{{name}}`, length must be greater than `{{minLength}}`") + raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`") {{/minLength}} {{#maximum}} if {{name}} > {{maximum}}: - raise ValueError("Invalid value for `{{name}}`, must be a value less than `{{maximum}}`") + raise ValueError("Invalid value for `{{name}}`, must be a value less than or equal to `{{maximum}}`") {{/maximum}} {{#minimum}} if {{name}} < {{minimum}}: - raise ValueError("Invalid value for `{{name}}`, must be a value greater than `{{minimum}}`") + raise ValueError("Invalid value for `{{name}}`, must be a value greater than or equal to `{{minimum}}`") {{/minimum}} {{#pattern}} - #Check pattern + #if not re.match('/[a-z]/i', {{name}}): + # raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{pattern}}`") {{/pattern}} {{/hasValidation}} {{/isEnum}} From 1fef0ef691e5c8d3075711d0c333670e23590a64 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Mon, 2 May 2016 16:39:25 +0100 Subject: [PATCH 057/170] Fix import statement --- .../swagger-codegen/src/main/resources/python/model.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 78fe2ff2acd5..3fce2b476971 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -21,7 +21,7 @@ Copyright 2016 SmartBear Software {{#models}} {{#model}} from pprint import pformat -from six import +from six import iteritems import re From d6941186858a148676a1318f047ca75976d33c65 Mon Sep 17 00:00:00 2001 From: Ben Herila Date: Sun, 27 Mar 2016 19:10:18 -0700 Subject: [PATCH 058/170] Rewrite Promise.defer in new style, resolves swagger-api/swagger-codegen#2251 --- .../resources/TypeScript-node/api.mustache | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache index 25e152a9e344..a4a1f6876169 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache @@ -216,8 +216,6 @@ export class {{classname}} { {{/isFile}} {{/formParams}} - let localVarDeferred = promise.defer<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>(); - let requestOptions: request.Options = { method: '{{httpMethod}}', qs: queryParameters, @@ -242,20 +240,21 @@ export class {{classname}} { requestOptions.form = formParams; } } - - request(requestOptions, (error, response, body) => { - if (error) { - localVarDeferred.reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - localVarDeferred.resolve({ response: response, body: body }); + + return new Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => { + request(requestOptions, (error, response, body) => { + if (error) { + reject(error); } else { - localVarDeferred.reject({ response: response, body: body }); + if (response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } } - } + }); }); - return localVarDeferred.promise; } {{/operation}} } From 282f49783986d51fcb01f8638d57b7b1bc8ac9a5 Mon Sep 17 00:00:00 2001 From: Ben Herila Date: Thu, 7 Apr 2016 15:07:49 -0700 Subject: [PATCH 059/170] Specify default base path in file, rather than hard-coded in each class --- .../src/main/resources/TypeScript-node/api.mustache | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache index a4a1f6876169..93f4a84acc79 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache @@ -2,6 +2,8 @@ import request = require('request'); import promise = require('bluebird'); import http = require('http'); +let defaultBasePath = '{{basePath}}'; + // =============================================== // This file is autogenerated - Please do not edit // =============================================== @@ -105,7 +107,7 @@ export enum {{classname}}ApiKeys { } export class {{classname}} { - protected basePath = '{{basePath}}'; + protected basePath = defaultBasePath; protected defaultHeaders : any = {}; protected authentications = { From 3fba32573c96ae934c99f2cec1bac7f01006c3c2 Mon Sep 17 00:00:00 2001 From: Ben Herila Date: Sat, 9 Apr 2016 13:00:44 -0700 Subject: [PATCH 060/170] Ensure generated enum values are valid, resolves #2457 --- .../src/main/resources/TypeScript-node/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache index 93f4a84acc79..b93783fc0982 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache @@ -33,7 +33,7 @@ export namespace {{classname}} { {{#vars}} {{#isEnum}} export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} - {{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} + VALUE_{{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} } {{/isEnum}} {{/vars}} From 6c3701a4039f1710519bc9fd944f68e5a8311be5 Mon Sep 17 00:00:00 2001 From: Ben Herila Date: Sat, 9 Apr 2016 13:38:45 -0700 Subject: [PATCH 061/170] ES6-ify typescript promises, update tests, remove bluebird dependency in favor of ES6 promises --- .../src/main/resources/TypeScript-node/api.mustache | 11 +++++------ .../client/petstore/typescript-angular/package.json | 3 ++- samples/client/petstore/typescript-angular/tsd.json | 11 ++++++++++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache index b93783fc0982..a85c170082e8 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache @@ -1,5 +1,4 @@ import request = require('request'); -import promise = require('bluebird'); import http = require('http'); let defaultBasePath = '{{basePath}}'; @@ -24,7 +23,7 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ * {{{description}}} */ {{/description}} - "{{name}}": {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; + '{{name}}': {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; {{/vars}} } @@ -33,7 +32,7 @@ export namespace {{classname}} { {{#vars}} {{#isEnum}} export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} - VALUE_{{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} + {{datatypeWithEnum}}_{{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} } {{/isEnum}} {{/vars}} @@ -184,7 +183,7 @@ export class {{classname}} { * {{notes}} {{#allParams}}* @param {{paramName}} {{description}} {{/allParams}}*/ - public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { + public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { const localVarPath = this.basePath + '{{path}}'{{#pathParams}} .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; let queryParameters: any = {}; @@ -227,7 +226,7 @@ export class {{classname}} { {{#bodyParam}} body: {{paramName}}, {{/bodyParam}} - } + }; {{#authMethods}} this.authentications.{{name}}.applyToRequest(requestOptions); @@ -243,7 +242,7 @@ export class {{classname}} { } } - return new Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => { + return new Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => { request(requestOptions, (error, response, body) => { if (error) { reject(error); diff --git a/samples/client/petstore/typescript-angular/package.json b/samples/client/petstore/typescript-angular/package.json index f50b782c09f2..0819b27f295c 100644 --- a/samples/client/petstore/typescript-angular/package.json +++ b/samples/client/petstore/typescript-angular/package.json @@ -5,12 +5,13 @@ "main": "api.js", "scripts": { "postinstall": "tsd reinstall --overwrite", - "test": "tsc", + "test": "tsc --target ES6 && node client.js", "clean": "rm -Rf node_modules/ typings/ *.js" }, "author": "Mads M. Tandrup", "license": "Apache 2.0", "dependencies": { + "request": "^2.60.0", "angular": "^1.4.3" }, "devDependencies": { diff --git a/samples/client/petstore/typescript-angular/tsd.json b/samples/client/petstore/typescript-angular/tsd.json index 182b9f68fa2a..c4cfa3f1bacd 100644 --- a/samples/client/petstore/typescript-angular/tsd.json +++ b/samples/client/petstore/typescript-angular/tsd.json @@ -5,11 +5,20 @@ "path": "typings", "bundle": "typings/tsd.d.ts", "installed": { - "angularjs/angular.d.ts": { + "angularjs/angular.d.ts": { "commit": "f6c8ca47193fb67947944a3170912672ac3e908e" }, "jquery/jquery.d.ts": { "commit": "f6c8ca47193fb67947944a3170912672ac3e908e" + }, + "request/request.d.ts": { + "commit": "f6c8ca47193fb67947944a3170912672ac3e908e" + }, + "form-data/form-data.d.ts": { + "commit": "f6c8ca47193fb67947944a3170912672ac3e908e" + }, + "node/node.d.ts": { + "commit": "f6c8ca47193fb67947944a3170912672ac3e908e" } } } From 800a858acb7d97a4fa99a236a277f6eef75a147b Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 2 Apr 2016 19:03:32 +0800 Subject: [PATCH 062/170] add enum support to php, refactor post process model enum --- .../io/swagger/codegen/DefaultCodegen.java | 93 ++++ .../languages/CSharpClientCodegen.java | 6 +- .../codegen/languages/JavaClientCodegen.java | 64 +-- .../languages/JavascriptClientCodegen.java | 6 +- .../codegen/languages/PhpClientCodegen.java | 12 + .../src/main/resources/php/ApiClient.mustache | 2 +- .../src/main/resources/php/api.mustache | 4 +- .../src/main/resources/php/model.mustache | 36 +- .../src/test/resources/2_0/petstore.json | 458 +++++++++++++++++- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 271 ++++++++--- .../java/io/swagger/client/api/StoreApi.java | 142 +++++- .../java/io/swagger/client/api/UserApi.java | 125 ++--- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../io/swagger/client/auth/HttpBasicAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../io/swagger/client/model/Category.java | 5 +- .../client/model/Model200Response.java | 6 +- .../io/swagger/client/model/ModelReturn.java | 6 +- .../java/io/swagger/client/model/Name.java | 42 +- .../java/io/swagger/client/model/Order.java | 25 +- .../java/io/swagger/client/model/Pet.java | 13 +- .../client/model/SpecialModelName.java | 3 +- .../java/io/swagger/client/model/Tag.java | 5 +- .../java/io/swagger/client/model/User.java | 17 +- .../client/model/InlineResponse200.java | 13 +- .../petstore/php/SwaggerClient-php/README.md | 70 ++- .../php/SwaggerClient-php/lib/Api/PetApi.php | 4 +- .../SwaggerClient-php/lib/Api/StoreApi.php | 4 +- .../php/SwaggerClient-php/lib/Api/UserApi.php | 4 +- .../php/SwaggerClient-php/lib/ApiClient.php | 2 +- .../SwaggerClient-php/lib/Model/Animal.php | 44 +- .../php/SwaggerClient-php/lib/Model/Cat.php | 41 +- .../SwaggerClient-php/lib/Model/Category.php | 45 +- .../php/SwaggerClient-php/lib/Model/Dog.php | 41 +- .../lib/Model/InlineResponse200.php | 64 ++- .../lib/Model/Model200Response.php | 43 +- .../lib/Model/ModelReturn.php | 43 +- .../php/SwaggerClient-php/lib/Model/Name.php | 85 ++-- .../php/SwaggerClient-php/lib/Model/Order.php | 66 ++- .../php/SwaggerClient-php/lib/Model/Pet.php | 64 ++- .../lib/Model/SpecialModelName.php | 41 +- .../php/SwaggerClient-php/lib/Model/Tag.php | 45 +- .../php/SwaggerClient-php/lib/Model/User.php | 69 +-- 47 files changed, 1480 insertions(+), 663 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 9f13b0fdb01d..9949834d24bd 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 b8f2b187a6ab..d5a095c0c76a 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 3d9b890d0587..bd770a1e509f 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 9ca4589be5df..bc8b162c44be 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 15dfd889cdd9..6bf5a2568b0c 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 7945137c6649..5b8b9b21632a 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 c0401940b484..c8b16b460523 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 6f292e854afe..32fe44e0af5c 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 838b3c8b2da1..5f5156bbfee1 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 27395e86ba98..8fede114081d 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 19b0ebeae4e7..5d1cf18a00fa 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 d8d32210b105..05f7d31ae5a6 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 1383dd0decb0..5e872f5bdc3e 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 c4ff05ec24f8..1aaaa92d13ee 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 59a1a58266eb..e38b4831f5db 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 7ab75eabd344..b2ecae1e675a 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 6882dbc41c08..0fc49a435f10 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 64f2c887377b..76af4a37c692 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 76d2917f24ea..6ce226b5dea7 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 08a0de3e889f..5fb583a8eb65 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 4f44da640727..89b6fc761104 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 0f4279af8d3e..48aaeeec3618 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 e93e3c3ee72b..d851de25cbe3 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 94be5295f5df..02adc174d7a6 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 7a4eca82fe03..1899cf69d9ad 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 f1a153e79a06..3f44bcc50e83 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 86cb5f48b09b..aa94e125d8b1 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 f960f1461ddb..be60c56a233a 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 721faf5189e9..4eb4016563a6 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 a9c21234369c..5851cf5af7cf 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 1154b72929c7..4ab1529c7c09 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 27253a09f4fc..a238eb41312b 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 96c9fa6fc09a..ed9744b82558 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 65ee9d27f297..b28f2f261405 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 3f01e789547e..a6dbe683be30 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 e0eaf7a106d6..8fefbd62c108 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 fb6eed3af292..ad1d379a8a31 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 6fd43d3a9447..a42516417491 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 3bd2106ba0e5..69bc6d72dcf7 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 8d62f9531ec6..0a3ec1bc34cf 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 d4660e118fde..f3391fb9c883 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 9e1c4b927620..5154866eb62e 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 7ee5c124d2cd..1335d16c4729 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 3a9e46cd3fb4..52d18a8150b4 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 fb748811cf27..e3f0430e6f69 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 4bb56401c48b..e96ed199fa6e 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 da9cc20ff4cc..3a56a1e66d94 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)); } } From 2c9e9ee425d9ebcdd5caef17ab963ad967aac1d5 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 2 Apr 2016 19:18:49 +0800 Subject: [PATCH 063/170] fix getter for allowableValues for php enum --- .../src/main/resources/php/model.mustache | 32 ++++----- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../SwaggerClient-php/lib/Model/Animal.php | 30 ++++---- .../php/SwaggerClient-php/lib/Model/Cat.php | 30 ++++---- .../SwaggerClient-php/lib/Model/Category.php | 36 +++++----- .../php/SwaggerClient-php/lib/Model/Dog.php | 30 ++++---- .../lib/Model/InlineResponse200.php | 72 +++++++++++-------- .../lib/Model/Model200Response.php | 30 ++++---- .../lib/Model/ModelReturn.php | 30 ++++---- .../php/SwaggerClient-php/lib/Model/Name.php | 36 +++++----- .../php/SwaggerClient-php/lib/Model/Order.php | 72 +++++++++++-------- .../php/SwaggerClient-php/lib/Model/Pet.php | 72 +++++++++++-------- .../lib/Model/SpecialModelName.php | 30 ++++---- .../php/SwaggerClient-php/lib/Model/Tag.php | 36 +++++----- .../php/SwaggerClient-php/lib/Model/User.php | 72 +++++++++---------- 15 files changed, 323 insertions(+), 287 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 32fe44e0af5c..7cf71a77aa71 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -68,9 +68,9 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, {{/hasMore}}{{/vars}} @@ -81,9 +81,9 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, {{/hasMore}}{{/vars}} @@ -94,9 +94,9 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( {{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}}, {{/hasMore}}{{/vars}} @@ -109,24 +109,24 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA {{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = "{{{value}}}"; {{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}} - {{#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}} + {{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}} + {{/-last}}{{/enumVars}}{{/allowableValues}} ]; } - {{/isEnum}} + {{/isEnum}}{{/vars}} {{#vars}} /** - * ${{name}} {{#description}}{{{description}}}{{/description}} - * @var {{datatype}} - */ + * ${{name}} {{#description}}{{{description}}}{{/description}} + * @var {{datatype}} + */ protected ${{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}; {{/vars}} diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 5851cf5af7cf..ff8c9322ed7c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-02T19:03:06.710+08:00 +- Build date: 2016-04-02T19:17:12.338+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements 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 a6dbe683be30..4826f8dbbe27 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Animal implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'class_name' => 'string' ); @@ -59,9 +59,9 @@ class Animal implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'class_name' => 'className' ); @@ -71,9 +71,9 @@ class Animal implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'class_name' => 'setClassName' ); @@ -83,9 +83,9 @@ class Animal implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'class_name' => 'getClassName' ); @@ -100,9 +100,9 @@ class Animal implements ArrayAccess /** - * $class_name - * @var string - */ + * $class_name + * @var string + */ protected $class_name; 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 8fefbd62c108..272f79ab02c4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Cat extends Animal implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'declawed' => 'bool' ); @@ -59,9 +59,9 @@ class Cat extends Animal implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'declawed' => 'declawed' ); @@ -71,9 +71,9 @@ class Cat extends Animal implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'declawed' => 'setDeclawed' ); @@ -83,9 +83,9 @@ class Cat extends Animal implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'declawed' => 'getDeclawed' ); @@ -100,9 +100,9 @@ class Cat extends Animal implements ArrayAccess /** - * $declawed - * @var bool - */ + * $declawed + * @var bool + */ protected $declawed; 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 ad1d379a8a31..f6dfe3d5d798 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Category implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'name' => 'string' @@ -60,9 +60,9 @@ class Category implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'id' => 'id', 'name' => 'name' @@ -73,9 +73,9 @@ class Category implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'id' => 'setId', 'name' => 'setName' @@ -86,9 +86,9 @@ class Category implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'id' => 'getId', 'name' => 'getName' @@ -104,15 +104,15 @@ class Category implements ArrayAccess /** - * $id - * @var int - */ + * $id + * @var int + */ protected $id; /** - * $name - * @var string - */ + * $name + * @var string + */ protected $name; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php index a42516417491..289bee51b2fb 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Dog extends Animal implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'breed' => 'string' ); @@ -59,9 +59,9 @@ class Dog extends Animal implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'breed' => 'breed' ); @@ -71,9 +71,9 @@ class Dog extends Animal implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'breed' => 'setBreed' ); @@ -83,9 +83,9 @@ class Dog extends Animal implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'breed' => 'getBreed' ); @@ -100,9 +100,9 @@ class Dog extends Animal implements ArrayAccess /** - * $breed - * @var string - */ + * $breed + * @var string + */ protected $breed; 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 69bc6d72dcf7..b2bc6d527393 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -47,9 +47,9 @@ use \ArrayAccess; class InlineResponse200 implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'tags' => '\Swagger\Client\Model\Tag[]', 'id' => 'int', @@ -64,9 +64,9 @@ class InlineResponse200 implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'tags' => 'tags', 'id' => 'id', @@ -81,9 +81,9 @@ class InlineResponse200 implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'tags' => 'setTags', 'id' => 'setId', @@ -98,9 +98,9 @@ class InlineResponse200 implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'tags' => 'getTags', 'id' => 'getId', @@ -120,42 +120,54 @@ class InlineResponse200 implements ArrayAccess + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getStatusAllowableValues() { + return [ + self::STATUS_AVAILABLE, + self::STATUS_PENDING, + self::STATUS_SOLD, + ]; + } + /** - * $tags - * @var \Swagger\Client\Model\Tag[] - */ + * $tags + * @var \Swagger\Client\Model\Tag[] + */ protected $tags; /** - * $id - * @var int - */ + * $id + * @var int + */ protected $id; /** - * $category - * @var object - */ + * $category + * @var object + */ protected $category; /** - * $status pet status in the store - * @var string - */ + * $status pet status in the store + * @var string + */ protected $status; /** - * $name - * @var string - */ + * $name + * @var string + */ protected $name; /** - * $photo_urls - * @var string[] - */ + * $photo_urls + * @var string[] + */ protected $photo_urls; 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 0a3ec1bc34cf..a08f17478e2e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Model200Response implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'name' => 'int' ); @@ -59,9 +59,9 @@ class Model200Response implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'name' => 'name' ); @@ -71,9 +71,9 @@ class Model200Response implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'name' => 'setName' ); @@ -83,9 +83,9 @@ class Model200Response implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'name' => 'getName' ); @@ -100,9 +100,9 @@ class Model200Response implements ArrayAccess /** - * $name - * @var int - */ + * $name + * @var int + */ protected $name; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php index f3391fb9c883..e696b4085c8f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -47,9 +47,9 @@ use \ArrayAccess; class ModelReturn implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'return' => 'int' ); @@ -59,9 +59,9 @@ class ModelReturn implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'return' => 'return' ); @@ -71,9 +71,9 @@ class ModelReturn implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'return' => 'setReturn' ); @@ -83,9 +83,9 @@ class ModelReturn implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'return' => 'getReturn' ); @@ -100,9 +100,9 @@ class ModelReturn implements ArrayAccess /** - * $return - * @var int - */ + * $return + * @var int + */ protected $return; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php index 5154866eb62e..52dcfc4abdfd 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Name implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'name' => 'int', 'snake_case' => 'int' @@ -60,9 +60,9 @@ class Name implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'name' => 'name', 'snake_case' => 'snake_case' @@ -73,9 +73,9 @@ class Name implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'name' => 'setName', 'snake_case' => 'setSnakeCase' @@ -86,9 +86,9 @@ class Name implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'name' => 'getName', 'snake_case' => 'getSnakeCase' @@ -104,15 +104,15 @@ class Name implements ArrayAccess /** - * $name - * @var int - */ + * $name + * @var int + */ protected $name; /** - * $snake_case - * @var int - */ + * $snake_case + * @var int + */ protected $snake_case; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index 1335d16c4729..7566c22776af 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Order implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'pet_id' => 'int', @@ -64,9 +64,9 @@ class Order implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'id' => 'id', 'pet_id' => 'petId', @@ -81,9 +81,9 @@ class Order implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'id' => 'setId', 'pet_id' => 'setPetId', @@ -98,9 +98,9 @@ class Order implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'id' => 'getId', 'pet_id' => 'getPetId', @@ -120,42 +120,54 @@ class Order implements ArrayAccess + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getStatusAllowableValues() { + return [ + self::STATUS_PLACED, + self::STATUS_APPROVED, + self::STATUS_DELIVERED, + ]; + } + /** - * $id - * @var int - */ + * $id + * @var int + */ protected $id; /** - * $pet_id - * @var int - */ + * $pet_id + * @var int + */ protected $pet_id; /** - * $quantity - * @var int - */ + * $quantity + * @var int + */ protected $quantity; /** - * $ship_date - * @var \DateTime - */ + * $ship_date + * @var \DateTime + */ protected $ship_date; /** - * $status Order Status - * @var string - */ + * $status Order Status + * @var string + */ protected $status; /** - * $complete - * @var bool - */ + * $complete + * @var bool + */ protected $complete; 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 52d18a8150b4..36a0c9dcc948 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Pet implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'category' => '\Swagger\Client\Model\Category', @@ -64,9 +64,9 @@ class Pet implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'id' => 'id', 'category' => 'category', @@ -81,9 +81,9 @@ class Pet implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'id' => 'setId', 'category' => 'setCategory', @@ -98,9 +98,9 @@ class Pet implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'id' => 'getId', 'category' => 'getCategory', @@ -120,42 +120,54 @@ class Pet implements ArrayAccess + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getStatusAllowableValues() { + return [ + self::STATUS_AVAILABLE, + self::STATUS_PENDING, + self::STATUS_SOLD, + ]; + } + /** - * $id - * @var int - */ + * $id + * @var int + */ protected $id; /** - * $category - * @var \Swagger\Client\Model\Category - */ + * $category + * @var \Swagger\Client\Model\Category + */ protected $category; /** - * $name - * @var string - */ + * $name + * @var string + */ protected $name; /** - * $photo_urls - * @var string[] - */ + * $photo_urls + * @var string[] + */ protected $photo_urls; /** - * $tags - * @var \Swagger\Client\Model\Tag[] - */ + * $tags + * @var \Swagger\Client\Model\Tag[] + */ protected $tags; /** - * $status pet status in the store - * @var string - */ + * $status pet status in the store + * @var string + */ protected $status; 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 e3f0430e6f69..891796ff7835 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -47,9 +47,9 @@ use \ArrayAccess; class SpecialModelName implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'special_property_name' => 'int' ); @@ -59,9 +59,9 @@ class SpecialModelName implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'special_property_name' => '$special[property.name]' ); @@ -71,9 +71,9 @@ class SpecialModelName implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'special_property_name' => 'setSpecialPropertyName' ); @@ -83,9 +83,9 @@ class SpecialModelName implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'special_property_name' => 'getSpecialPropertyName' ); @@ -100,9 +100,9 @@ class SpecialModelName implements ArrayAccess /** - * $special_property_name - * @var int - */ + * $special_property_name + * @var int + */ protected $special_property_name; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php index e96ed199fa6e..90bf901355ae 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -47,9 +47,9 @@ use \ArrayAccess; class Tag implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'name' => 'string' @@ -60,9 +60,9 @@ class Tag implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'id' => 'id', 'name' => 'name' @@ -73,9 +73,9 @@ class Tag implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'id' => 'setId', 'name' => 'setName' @@ -86,9 +86,9 @@ class Tag implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'id' => 'getId', 'name' => 'getName' @@ -104,15 +104,15 @@ class Tag implements ArrayAccess /** - * $id - * @var int - */ + * $id + * @var int + */ protected $id; /** - * $name - * @var string - */ + * $name + * @var string + */ protected $name; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php index 3a56a1e66d94..10580a05eb46 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -47,9 +47,9 @@ use \ArrayAccess; class User implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'username' => 'string', @@ -66,9 +66,9 @@ class User implements ArrayAccess } /** - * Array of attributes where the key is the local name, and the value is the original name - * @var string[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'id' => 'id', 'username' => 'username', @@ -85,9 +85,9 @@ class User implements ArrayAccess } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'id' => 'setId', 'username' => 'setUsername', @@ -104,9 +104,9 @@ class User implements ArrayAccess } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'id' => 'getId', 'username' => 'getUsername', @@ -128,51 +128,51 @@ class User implements ArrayAccess /** - * $id - * @var int - */ + * $id + * @var int + */ protected $id; /** - * $username - * @var string - */ + * $username + * @var string + */ protected $username; /** - * $first_name - * @var string - */ + * $first_name + * @var string + */ protected $first_name; /** - * $last_name - * @var string - */ + * $last_name + * @var string + */ protected $last_name; /** - * $email - * @var string - */ + * $email + * @var string + */ protected $email; /** - * $password - * @var string - */ + * $password + * @var string + */ protected $password; /** - * $phone - * @var string - */ + * $phone + * @var string + */ protected $phone; /** - * $user_status User Status - * @var int - */ + * $user_status User Status + * @var int + */ protected $user_status; From 11deb438290483410b34ddf8dc10a858dc215244 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 3 Apr 2016 00:32:13 +0800 Subject: [PATCH 064/170] add enum class support to php --- .../java/io/swagger/codegen/CodegenModel.java | 2 +- .../io/swagger/codegen/DefaultCodegen.java | 50 +++++++++++++++++-- .../codegen/languages/PhpClientCodegen.java | 23 ++++++++- .../src/test/resources/2_0/petstore.json | 4 ++ .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../java/io/swagger/client/api/StoreApi.java | 2 +- .../java/io/swagger/client/api/UserApi.java | 2 +- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../io/swagger/client/auth/HttpBasicAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../io/swagger/client/model/Category.java | 2 +- .../client/model/Model200Response.java | 2 +- .../io/swagger/client/model/ModelReturn.java | 2 +- .../java/io/swagger/client/model/Name.java | 2 +- .../java/io/swagger/client/model/Order.java | 2 +- .../java/io/swagger/client/model/Pet.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../java/io/swagger/client/model/Tag.java | 2 +- .../java/io/swagger/client/model/User.java | 2 +- .../client/model/InlineResponse200.java | 2 +- .../petstore/php/SwaggerClient-php/README.md | 3 +- .../SwaggerClient-php/lib/Model/Animal.php | 8 +-- .../php/SwaggerClient-php/lib/Model/Cat.php | 8 +-- .../SwaggerClient-php/lib/Model/Category.php | 12 +++-- .../php/SwaggerClient-php/lib/Model/Dog.php | 8 +-- .../lib/Model/InlineResponse200.php | 34 +++++++------ .../lib/Model/Model200Response.php | 8 +-- .../lib/Model/ModelReturn.php | 8 +-- .../php/SwaggerClient-php/lib/Model/Name.php | 12 +++-- .../php/SwaggerClient-php/lib/Model/Order.php | 34 +++++++------ .../php/SwaggerClient-php/lib/Model/Pet.php | 34 +++++++------ .../lib/Model/SpecialModelName.php | 8 +-- .../php/SwaggerClient-php/lib/Model/Tag.php | 12 +++-- .../php/SwaggerClient-php/lib/Model/User.php | 36 ++++++------- 38 files changed, 219 insertions(+), 125 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java index 945388b25886..ccea2ee070e9 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java @@ -20,7 +20,7 @@ public class CodegenModel { public List requiredVars = new ArrayList(); // a list of required properties public List optionalVars = new ArrayList(); // a list of optional properties public List allVars; - public List allowableValues; + public Map allowableValues; // Sorted sets of required parameters. public Set mandatory = new TreeSet(); 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 9949834d24bd..877bf7443661 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 @@ -145,6 +145,33 @@ public class DefaultCodegen { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + Map allowableValues = cm.allowableValues; + + List values = (List) allowableValues.get("values"); + 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", toEnumValue(value, cm.dataType)); + enumVars.add(enumVar); + } + cm.allowableValues.put("enumVars", enumVars); + } + + // for enum model's properties for (CodegenProperty var : cm.vars) { Map allowableValues = var.allowableValues; @@ -177,7 +204,7 @@ public class DefaultCodegen { } } enumVar.put("name", toEnumVarName(enumName)); - enumVar.put("value", value); + enumVar.put("value", toEnumValue(value, var.datatype)); enumVars.add(enumVar); } allowableValues.put("enumVars", enumVars); @@ -212,6 +239,21 @@ public class DefaultCodegen { return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); } + /** + * Return the value in the language specifed format + * e.g. status => "status" + * + * @param value enum variable name + * @return the sanitized variable name for enum + */ + public String toEnumValue(String value, String datatype) { + if ("number".equalsIgnoreCase(datatype)) { + return value; + } else { + return "\"" + escapeText(value) + "\""; + } + } + /** * Return the sanitized variable name for enum * @@ -549,7 +591,7 @@ public class DefaultCodegen { /** * Return the Enum name (e.g. StatusEnum given 'status') * - * @param property Codegen property object + * @param property Codegen property * @return the Enum name */ @SuppressWarnings("static-method") @@ -1105,7 +1147,9 @@ public class DefaultCodegen { ModelImpl impl = (ModelImpl) model; if(impl.getEnum() != null && impl.getEnum().size() > 0) { m.isEnum = true; - m.allowableValues = impl.getEnum(); + // comment out below as allowableValues is not set in post processing model enum + m.allowableValues = new HashMap(); + m.allowableValues.put("values", impl.getEnum()); Property p = PropertyBuilder.build(impl.getType(), impl.getFormat(), null); m.dataType = getSwaggerType(p); } 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 6bf5a2568b0c..83e6495399d6 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 @@ -569,10 +569,29 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { p.example = example; } + @Override + public String toEnumVarName(String name) { + String enumName = sanitizeName(underscore(name).toUpperCase()); + + enumName = enumName.replaceFirst("^_", ""); + enumName = enumName.replaceFirst("_$", ""); + + if (enumName.matches("\\d.*")) { // starts with number + return "_" + enumName; + } else { + return enumName; + } + } + @Override public String toEnumName(CodegenProperty property) { - LOGGER.info("php toEnumName:" + underscore(property.name).toUpperCase()); - return underscore(property.name).toUpperCase(); + String enumName = toModelName(property.name) + "Enum"; + + if (enumName.matches("\\d.*")) { // starts with number + return "_" + enumName; + } else { + return enumName; + } } @Override 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 5f5156bbfee1..e31d5604601c 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -1376,6 +1376,10 @@ } } }, + "EnumClass" : { + "type": "string", + "enum": ["_abc", "-efg", "(xyz)"] + }, "Enum_Test" : { "type" : "object", "properties" : { 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 8fede114081d..d2bcf57f9970 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+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 5d1cf18a00fa..0b7cad9f8a94 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+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 05f7d31ae5a6..a6144d708158 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+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 5e872f5bdc3e..8da35dc644bf 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+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 1aaaa92d13ee..5c0338370a93 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 @@ -16,7 +16,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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class PetApi { private ApiClient apiClient; 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 e38b4831f5db..b7ad7afc2dc5 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class StoreApi { private ApiClient apiClient; 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 b2ecae1e675a..d247fb435864 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class UserApi { private ApiClient apiClient; 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 0fc49a435f10..01322f38b251 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+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 76af4a37c692..35bc9c1d9434 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+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 6ce226b5dea7..46da5bd364a6 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+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 5fb583a8eb65..13be49047e9c 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class Category { private Long id = null; 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 89b6fc761104..18740d47fbd4 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 @@ -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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class Model200Response { private Integer name = null; 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 48aaeeec3618..78f04885a05d 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 @@ -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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class ModelReturn { private Integer _return = null; 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 d851de25cbe3..3b459f7ffcad 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 @@ -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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class Name { private Integer name = null; 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 02adc174d7a6..4d3412483f03 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class Order { private Long id = null; 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 1899cf69d9ad..b339acc50ff6 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class Pet { private Long id = null; 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 3f44bcc50e83..ee6d1580578a 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class SpecialModelName { private Long specialPropertyName = null; 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 aa94e125d8b1..a23e8b8894f0 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class Tag { private Long id = null; 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 be60c56a233a..9cb8783e8be0 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") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class User { private Long id = null; 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 4eb4016563a6..c60909b93b86 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-02T17:10:39.649+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") public class InlineResponse200 { private List tags = new ArrayList(); diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index ff8c9322ed7c..1eaa868a0521 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-02T19:17:12.338+08:00 +- Build date: 2016-04-03T00:07:22.143+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -112,6 +112,7 @@ Class | Method | HTTP request | Description - [Cat](docs/Cat.md) - [Category](docs/Category.md) - [Dog](docs/Dog.md) + - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) - [InlineResponse200](docs/InlineResponse200.md) - [Model200Response](docs/Model200Response.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php index 4826f8dbbe27..e41c38c535a3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -119,7 +119,7 @@ class Animal implements ArrayAccess } /** - * Gets class_name + * Gets class_name. * @return string */ public function getClassName() @@ -128,7 +128,7 @@ class Animal implements ArrayAccess } /** - * Sets class_name + * Sets class_name. * @param string $class_name * @return $this */ @@ -181,7 +181,7 @@ class Animal implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -193,3 +193,5 @@ class Animal implements ArrayAccess } } } + +?> 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 272f79ab02c4..078b57049ec6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -119,7 +119,7 @@ class Cat extends Animal implements ArrayAccess } /** - * Gets declawed + * Gets declawed. * @return bool */ public function getDeclawed() @@ -128,7 +128,7 @@ class Cat extends Animal implements ArrayAccess } /** - * Sets declawed + * Sets declawed. * @param bool $declawed * @return $this */ @@ -181,7 +181,7 @@ class Cat extends Animal implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -193,3 +193,5 @@ class Cat extends Animal implements ArrayAccess } } } + +?> 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 f6dfe3d5d798..b2fd2c3c3d6f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -130,7 +130,7 @@ class Category implements ArrayAccess } /** - * Gets id + * Gets id. * @return int */ public function getId() @@ -139,7 +139,7 @@ class Category implements ArrayAccess } /** - * Sets id + * Sets id. * @param int $id * @return $this */ @@ -151,7 +151,7 @@ class Category implements ArrayAccess } /** - * Gets name + * Gets name. * @return string */ public function getName() @@ -160,7 +160,7 @@ class Category implements ArrayAccess } /** - * Sets name + * Sets name. * @param string $name * @return $this */ @@ -213,7 +213,7 @@ class Category implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -225,3 +225,5 @@ class Category implements ArrayAccess } } } + +?> 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 289bee51b2fb..c854b06a9371 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -119,7 +119,7 @@ class Dog extends Animal implements ArrayAccess } /** - * Gets breed + * Gets breed. * @return string */ public function getBreed() @@ -128,7 +128,7 @@ class Dog extends Animal implements ArrayAccess } /** - * Sets breed + * Sets breed. * @param string $breed * @return $this */ @@ -181,7 +181,7 @@ class Dog extends Animal implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -193,3 +193,5 @@ class Dog extends Animal implements ArrayAccess } } } + +?> 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 b2bc6d527393..85e140a5eb90 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -114,9 +114,9 @@ class InlineResponse200 implements ArrayAccess return self::$getters; } - const STATUS_AVAILABLE = "available"; - const STATUS_PENDING = "pending"; - const STATUS_SOLD = "sold"; + const STATUS_AVAILABLE = ""available""; + const STATUS_PENDING = ""pending""; + const STATUS_SOLD = ""sold""; @@ -189,7 +189,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Gets tags + * Gets tags. * @return \Swagger\Client\Model\Tag[] */ public function getTags() @@ -198,7 +198,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Sets tags + * Sets tags. * @param \Swagger\Client\Model\Tag[] $tags * @return $this */ @@ -210,7 +210,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Gets id + * Gets id. * @return int */ public function getId() @@ -219,7 +219,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Sets id + * Sets id. * @param int $id * @return $this */ @@ -231,7 +231,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Gets category + * Gets category. * @return object */ public function getCategory() @@ -240,7 +240,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Sets category + * Sets category. * @param object $category * @return $this */ @@ -252,7 +252,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Gets status + * Gets status. * @return string */ public function getStatus() @@ -261,7 +261,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Sets status + * Sets status. * @param string $status pet status in the store * @return $this */ @@ -276,7 +276,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Gets name + * Gets name. * @return string */ public function getName() @@ -285,7 +285,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Sets name + * Sets name. * @param string $name * @return $this */ @@ -297,7 +297,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Gets photo_urls + * Gets photo_urls. * @return string[] */ public function getPhotoUrls() @@ -306,7 +306,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Sets photo_urls + * Sets photo_urls. * @param string[] $photo_urls * @return $this */ @@ -359,7 +359,7 @@ class InlineResponse200 implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -371,3 +371,5 @@ class InlineResponse200 implements ArrayAccess } } } + +?> 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 a08f17478e2e..8ea916fcc1e0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -119,7 +119,7 @@ class Model200Response implements ArrayAccess } /** - * Gets name + * Gets name. * @return int */ public function getName() @@ -128,7 +128,7 @@ class Model200Response implements ArrayAccess } /** - * Sets name + * Sets name. * @param int $name * @return $this */ @@ -181,7 +181,7 @@ class Model200Response implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -193,3 +193,5 @@ class Model200Response implements ArrayAccess } } } + +?> 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 e696b4085c8f..1453c1a947ae 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -119,7 +119,7 @@ class ModelReturn implements ArrayAccess } /** - * Gets return + * Gets return. * @return int */ public function getReturn() @@ -128,7 +128,7 @@ class ModelReturn implements ArrayAccess } /** - * Sets return + * Sets return. * @param int $return * @return $this */ @@ -181,7 +181,7 @@ class ModelReturn implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -193,3 +193,5 @@ class ModelReturn implements ArrayAccess } } } + +?> 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 52dcfc4abdfd..a9a5b42831b0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -130,7 +130,7 @@ class Name implements ArrayAccess } /** - * Gets name + * Gets name. * @return int */ public function getName() @@ -139,7 +139,7 @@ class Name implements ArrayAccess } /** - * Sets name + * Sets name. * @param int $name * @return $this */ @@ -151,7 +151,7 @@ class Name implements ArrayAccess } /** - * Gets snake_case + * Gets snake_case. * @return int */ public function getSnakeCase() @@ -160,7 +160,7 @@ class Name implements ArrayAccess } /** - * Sets snake_case + * Sets snake_case. * @param int $snake_case * @return $this */ @@ -213,7 +213,7 @@ class Name implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -225,3 +225,5 @@ class Name implements ArrayAccess } } } + +?> 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 7566c22776af..0be579b8c5a1 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -114,9 +114,9 @@ class Order implements ArrayAccess return self::$getters; } - const STATUS_PLACED = "placed"; - const STATUS_APPROVED = "approved"; - const STATUS_DELIVERED = "delivered"; + const STATUS_PLACED = ""placed""; + const STATUS_APPROVED = ""approved""; + const STATUS_DELIVERED = ""delivered""; @@ -189,7 +189,7 @@ class Order implements ArrayAccess } /** - * Gets id + * Gets id. * @return int */ public function getId() @@ -198,7 +198,7 @@ class Order implements ArrayAccess } /** - * Sets id + * Sets id. * @param int $id * @return $this */ @@ -210,7 +210,7 @@ class Order implements ArrayAccess } /** - * Gets pet_id + * Gets pet_id. * @return int */ public function getPetId() @@ -219,7 +219,7 @@ class Order implements ArrayAccess } /** - * Sets pet_id + * Sets pet_id. * @param int $pet_id * @return $this */ @@ -231,7 +231,7 @@ class Order implements ArrayAccess } /** - * Gets quantity + * Gets quantity. * @return int */ public function getQuantity() @@ -240,7 +240,7 @@ class Order implements ArrayAccess } /** - * Sets quantity + * Sets quantity. * @param int $quantity * @return $this */ @@ -252,7 +252,7 @@ class Order implements ArrayAccess } /** - * Gets ship_date + * Gets ship_date. * @return \DateTime */ public function getShipDate() @@ -261,7 +261,7 @@ class Order implements ArrayAccess } /** - * Sets ship_date + * Sets ship_date. * @param \DateTime $ship_date * @return $this */ @@ -273,7 +273,7 @@ class Order implements ArrayAccess } /** - * Gets status + * Gets status. * @return string */ public function getStatus() @@ -282,7 +282,7 @@ class Order implements ArrayAccess } /** - * Sets status + * Sets status. * @param string $status Order Status * @return $this */ @@ -297,7 +297,7 @@ class Order implements ArrayAccess } /** - * Gets complete + * Gets complete. * @return bool */ public function getComplete() @@ -306,7 +306,7 @@ class Order implements ArrayAccess } /** - * Sets complete + * Sets complete. * @param bool $complete * @return $this */ @@ -359,7 +359,7 @@ class Order implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -371,3 +371,5 @@ class Order implements ArrayAccess } } } + +?> 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 36a0c9dcc948..6154dc36fe65 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -114,9 +114,9 @@ class Pet implements ArrayAccess return self::$getters; } - const STATUS_AVAILABLE = "available"; - const STATUS_PENDING = "pending"; - const STATUS_SOLD = "sold"; + const STATUS_AVAILABLE = ""available""; + const STATUS_PENDING = ""pending""; + const STATUS_SOLD = ""sold""; @@ -189,7 +189,7 @@ class Pet implements ArrayAccess } /** - * Gets id + * Gets id. * @return int */ public function getId() @@ -198,7 +198,7 @@ class Pet implements ArrayAccess } /** - * Sets id + * Sets id. * @param int $id * @return $this */ @@ -210,7 +210,7 @@ class Pet implements ArrayAccess } /** - * Gets category + * Gets category. * @return \Swagger\Client\Model\Category */ public function getCategory() @@ -219,7 +219,7 @@ class Pet implements ArrayAccess } /** - * Sets category + * Sets category. * @param \Swagger\Client\Model\Category $category * @return $this */ @@ -231,7 +231,7 @@ class Pet implements ArrayAccess } /** - * Gets name + * Gets name. * @return string */ public function getName() @@ -240,7 +240,7 @@ class Pet implements ArrayAccess } /** - * Sets name + * Sets name. * @param string $name * @return $this */ @@ -252,7 +252,7 @@ class Pet implements ArrayAccess } /** - * Gets photo_urls + * Gets photo_urls. * @return string[] */ public function getPhotoUrls() @@ -261,7 +261,7 @@ class Pet implements ArrayAccess } /** - * Sets photo_urls + * Sets photo_urls. * @param string[] $photo_urls * @return $this */ @@ -273,7 +273,7 @@ class Pet implements ArrayAccess } /** - * Gets tags + * Gets tags. * @return \Swagger\Client\Model\Tag[] */ public function getTags() @@ -282,7 +282,7 @@ class Pet implements ArrayAccess } /** - * Sets tags + * Sets tags. * @param \Swagger\Client\Model\Tag[] $tags * @return $this */ @@ -294,7 +294,7 @@ class Pet implements ArrayAccess } /** - * Gets status + * Gets status. * @return string */ public function getStatus() @@ -303,7 +303,7 @@ class Pet implements ArrayAccess } /** - * Sets status + * Sets status. * @param string $status pet status in the store * @return $this */ @@ -359,7 +359,7 @@ class Pet implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -371,3 +371,5 @@ class Pet implements ArrayAccess } } } + +?> 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 891796ff7835..daaa6f92624d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -119,7 +119,7 @@ class SpecialModelName implements ArrayAccess } /** - * Gets special_property_name + * Gets special_property_name. * @return int */ public function getSpecialPropertyName() @@ -128,7 +128,7 @@ class SpecialModelName implements ArrayAccess } /** - * Sets special_property_name + * Sets special_property_name. * @param int $special_property_name * @return $this */ @@ -181,7 +181,7 @@ class SpecialModelName implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -193,3 +193,5 @@ class SpecialModelName implements ArrayAccess } } } + +?> 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 90bf901355ae..d0b5da095cc9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -130,7 +130,7 @@ class Tag implements ArrayAccess } /** - * Gets id + * Gets id. * @return int */ public function getId() @@ -139,7 +139,7 @@ class Tag implements ArrayAccess } /** - * Sets id + * Sets id. * @param int $id * @return $this */ @@ -151,7 +151,7 @@ class Tag implements ArrayAccess } /** - * Gets name + * Gets name. * @return string */ public function getName() @@ -160,7 +160,7 @@ class Tag implements ArrayAccess } /** - * Sets name + * Sets name. * @param string $name * @return $this */ @@ -213,7 +213,7 @@ class Tag implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -225,3 +225,5 @@ class Tag implements ArrayAccess } } } + +?> 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 10580a05eb46..0d934a735136 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -196,7 +196,7 @@ class User implements ArrayAccess } /** - * Gets id + * Gets id. * @return int */ public function getId() @@ -205,7 +205,7 @@ class User implements ArrayAccess } /** - * Sets id + * Sets id. * @param int $id * @return $this */ @@ -217,7 +217,7 @@ class User implements ArrayAccess } /** - * Gets username + * Gets username. * @return string */ public function getUsername() @@ -226,7 +226,7 @@ class User implements ArrayAccess } /** - * Sets username + * Sets username. * @param string $username * @return $this */ @@ -238,7 +238,7 @@ class User implements ArrayAccess } /** - * Gets first_name + * Gets first_name. * @return string */ public function getFirstName() @@ -247,7 +247,7 @@ class User implements ArrayAccess } /** - * Sets first_name + * Sets first_name. * @param string $first_name * @return $this */ @@ -259,7 +259,7 @@ class User implements ArrayAccess } /** - * Gets last_name + * Gets last_name. * @return string */ public function getLastName() @@ -268,7 +268,7 @@ class User implements ArrayAccess } /** - * Sets last_name + * Sets last_name. * @param string $last_name * @return $this */ @@ -280,7 +280,7 @@ class User implements ArrayAccess } /** - * Gets email + * Gets email. * @return string */ public function getEmail() @@ -289,7 +289,7 @@ class User implements ArrayAccess } /** - * Sets email + * Sets email. * @param string $email * @return $this */ @@ -301,7 +301,7 @@ class User implements ArrayAccess } /** - * Gets password + * Gets password. * @return string */ public function getPassword() @@ -310,7 +310,7 @@ class User implements ArrayAccess } /** - * Sets password + * Sets password. * @param string $password * @return $this */ @@ -322,7 +322,7 @@ class User implements ArrayAccess } /** - * Gets phone + * Gets phone. * @return string */ public function getPhone() @@ -331,7 +331,7 @@ class User implements ArrayAccess } /** - * Sets phone + * Sets phone. * @param string $phone * @return $this */ @@ -343,7 +343,7 @@ class User implements ArrayAccess } /** - * Gets user_status + * Gets user_status. * @return int */ public function getUserStatus() @@ -352,7 +352,7 @@ class User implements ArrayAccess } /** - * Sets user_status + * Sets user_status. * @param int $user_status User Status * @return $this */ @@ -405,7 +405,7 @@ class User implements ArrayAccess } /** - * Gets the string presentation of the object + * Gets the string presentation of the object. * @return string */ public function __toString() @@ -417,3 +417,5 @@ class User implements ArrayAccess } } } + +?> From 217d93401b208fcc7e635693867b8782e705b455 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 3 Apr 2016 17:05:32 +0800 Subject: [PATCH 065/170] better php enum naming --- .../swagger/codegen/languages/PhpClientCodegen.java | 3 ++- .../client/petstore/php/SwaggerClient-php/README.md | 2 +- .../lib/Model/InlineResponse200.php | 12 ++++++------ .../php/SwaggerClient-php/lib/Model/Order.php | 12 ++++++------ .../petstore/php/SwaggerClient-php/lib/Model/Pet.php | 12 ++++++------ 5 files changed, 21 insertions(+), 20 deletions(-) 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 83e6495399d6..8f8ad281f6cc 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 @@ -585,7 +585,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toEnumName(CodegenProperty property) { - String enumName = toModelName(property.name) + "Enum"; + String enumName = toModelName(property.name); if (enumName.matches("\\d.*")) { // starts with number return "_" + enumName; @@ -596,6 +596,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public Map postProcessModels(Map objs) { + // process enum in models return postProcessModelsEnum(objs); } } diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 1eaa868a0521..e829f2643a4f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-03T00:07:22.143+08:00 +- Build date: 2016-04-03T17:03:15.368+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements 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 85e140a5eb90..7aa1610cb969 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -114,9 +114,9 @@ class InlineResponse200 implements ArrayAccess return self::$getters; } - const STATUS_AVAILABLE = ""available""; - const STATUS_PENDING = ""pending""; - const STATUS_SOLD = ""sold""; + const Status_AVAILABLE = "available"; + const Status_PENDING = "pending"; + const Status_SOLD = "sold"; @@ -126,9 +126,9 @@ class InlineResponse200 implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::STATUS_AVAILABLE, - self::STATUS_PENDING, - self::STATUS_SOLD, + self::Status_AVAILABLE, + self::Status_PENDING, + self::Status_SOLD, ]; } 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 0be579b8c5a1..b9aeed01894a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -114,9 +114,9 @@ class Order implements ArrayAccess return self::$getters; } - const STATUS_PLACED = ""placed""; - const STATUS_APPROVED = ""approved""; - const STATUS_DELIVERED = ""delivered""; + const Status_PLACED = "placed"; + const Status_APPROVED = "approved"; + const Status_DELIVERED = "delivered"; @@ -126,9 +126,9 @@ class Order implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::STATUS_PLACED, - self::STATUS_APPROVED, - self::STATUS_DELIVERED, + self::Status_PLACED, + self::Status_APPROVED, + self::Status_DELIVERED, ]; } 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 6154dc36fe65..dfad9032e3d7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -114,9 +114,9 @@ class Pet implements ArrayAccess return self::$getters; } - const STATUS_AVAILABLE = ""available""; - const STATUS_PENDING = ""pending""; - const STATUS_SOLD = ""sold""; + const Status_AVAILABLE = "available"; + const Status_PENDING = "pending"; + const Status_SOLD = "sold"; @@ -126,9 +126,9 @@ class Pet implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::STATUS_AVAILABLE, - self::STATUS_PENDING, - self::STATUS_SOLD, + self::Status_AVAILABLE, + self::Status_PENDING, + self::Status_SOLD, ]; } From 45f3cfd5cfbaa9691b78ba87508b2dfc2bfeb63a Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 3 Apr 2016 20:03:58 +0800 Subject: [PATCH 066/170] better enum support for csharp --- .../io/swagger/codegen/DefaultCodegen.java | 1 + .../languages/AbstractCSharpCodegen.java | 58 ++++++- .../languages/CSharpClientCodegen.java | 20 ++- .../main/resources/csharp/enumClass.mustache | 4 +- .../main/csharp/IO/Swagger/Model/Animal.cs | 3 +- .../src/main/csharp/IO/Swagger/Model/Cat.cs | 3 +- .../main/csharp/IO/Swagger/Model/Category.cs | 3 +- .../src/main/csharp/IO/Swagger/Model/Dog.cs | 3 +- .../main/csharp/IO/Swagger/Model/EnumClass.cs | 27 +++ .../main/csharp/IO/Swagger/Model/EnumTest.cs | 162 ++++++++++++++++++ .../IO/Swagger/Model/InlineResponse200.cs | 3 +- .../IO/Swagger/Model/Model200Response.cs | 3 +- .../csharp/IO/Swagger/Model/ModelReturn.cs | 3 +- .../src/main/csharp/IO/Swagger/Model/Name.cs | 3 +- .../src/main/csharp/IO/Swagger/Model/Order.cs | 3 +- .../src/main/csharp/IO/Swagger/Model/Pet.cs | 3 +- .../IO/Swagger/Model/SpecialModelName.cs | 3 +- .../src/main/csharp/IO/Swagger/Model/Tag.cs | 3 +- .../src/main/csharp/IO/Swagger/Model/User.cs | 3 +- .../SwaggerClientTest.csproj | 2 +- 20 files changed, 284 insertions(+), 29 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs 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 877bf7443661..23a28b87afe4 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 @@ -262,6 +262,7 @@ public class DefaultCodegen { */ public String toEnumVarName(String value) { String var = value.replaceAll("\\W+", "_").toUpperCase(); + LOGGER.info("toEnumVarName: " + value + " => " + var); if (var.matches("\\d.*")) { return "_" + var; } else { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java index 51977861922f..86ca4fcd634d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java @@ -203,11 +203,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co } } - @Override - public String toEnumName(CodegenProperty property) { - return StringUtils.capitalize(property.name) + "Enum?"; - } - @Override public Map postProcessModels(Map objs) { List models = (List) objs.get("models"); @@ -223,7 +218,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co } } } - return objs; + // process enum in models + return postProcessModelsEnum(objs); } @Override @@ -544,4 +540,54 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co public void setSourceFolder(String sourceFolder) { this.sourceFolder = sourceFolder; } + + + @Override + public String toEnumVarName(String name) { + String enumName = sanitizeName(name); + + enumName = enumName.replaceFirst("^_", ""); + enumName = enumName.replaceFirst("_$", ""); + + enumName = camelize(enumName) + "Enum"; + + LOGGER.info("toEnumVarName = " + enumName); + + if (enumName.matches("\\d.*")) { // starts with number + return "_" + enumName; + } else { + return enumName; + } + } + + @Override + public String toEnumName(CodegenProperty property) { + return sanitizeName(camelize(property.name)) + "Enum"; + } + + /* + @Override + public String toEnumName(CodegenProperty property) { + String enumName = sanitizeName(property.name); + if (!StringUtils.isEmpty(modelNamePrefix)) { + enumName = modelNamePrefix + "_" + enumName; + } + + if (!StringUtils.isEmpty(modelNameSuffix)) { + enumName = enumName + "_" + modelNameSuffix; + } + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(enumName)) { + LOGGER.warn(enumName + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + enumName)); + enumName = "model_" + enumName; // e.g. return => ModelReturn (after camelize) + } + + if (enumName.matches("\\d.*")) { // starts with number + return "_" + enumName; + } else { + return enumName; + } + } + */ } 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 d5a095c0c76a..ba9f461fd1f3 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 @@ -306,11 +306,14 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { this.packageGuid = packageGuid; } + /* + * + */ @Override public Map postProcessModels(Map objMap) { - Map objs = super.postProcessModels(objMap); - - List models = (List) objs.get("models"); + objMap = super.postProcessModels(objMap); + + List models = (List) objMap.get("models"); for (Object _mo : models) { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); @@ -325,11 +328,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { 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); @@ -351,6 +356,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { enumVars.add(enumVar); } allowableValues.put("enumVars", enumVars); + // handle default value for enum, e.g. available => StatusEnum.AVAILABLE // HACK: strip ? from enum @@ -362,21 +368,21 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { String enumName = null; for (Map enumVar : enumVars) { - if (var.defaultValue.replace("\"", "").equals(enumVar.get("value"))) { enumName = enumVar.get("name"); break; } } + if (enumName != null && var.vendorExtensions.containsKey(DATA_TYPE_WITH_ENUM_EXTENSION)) { var.defaultValue = var.vendorExtensions.get(DATA_TYPE_WITH_ENUM_EXTENSION) + "." + enumName; } } - } } - return objs; + return super.postProcessModels(objMap); + //return objs; } public void setTargetFramework(String dotnetFramework) { diff --git a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache index d882e33595c9..47620c623c6c 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache @@ -1,6 +1,6 @@ - public enum {{vendorExtensions.plainDatatypeWithEnum}} { + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}}{{#enumVars}} - [EnumMember(Value = "{{jsonname}}")] + [EnumMember(Value = {{{value}}})] {{name}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}} } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs index b2db1964a52f..147884b19aa2 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -113,6 +114,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs index 3b05bcc03382..dd03e5a6c3eb 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -129,6 +130,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs index f5dd0154fbc7..89e8bfae7cc4 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -121,6 +122,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs index 4d7539638160..0cd6e0891d71 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -129,6 +130,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs new file mode 100644 index 000000000000..a514468625a6 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs @@ -0,0 +1,27 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + public enum EnumClass { + + [EnumMember(Value = "_abc")] + Abc, + + [EnumMember(Value = "-efg")] + efg, + + [EnumMember(Value = "(xyz)")] + xyz + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs new file mode 100644 index 000000000000..c845ee695ca5 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs @@ -0,0 +1,162 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// + /// + [DataContract] + public partial class EnumTest : IEquatable + { + + /// + /// Gets or Sets EnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumStringEnum { + + [EnumMember(Value = "UPPER")] + Upper, + + [EnumMember(Value = "lower")] + Lower + } + + + /// + /// Gets or Sets EnumString + /// + [DataMember(Name="enum_string", EmitDefaultValue=false)] + public EnumStringEnum? EnumString { get; set; } + + /// + /// Initializes a new instance of the class. + /// Initializes a new instance of the class. + /// + /// EnumString. + /// EnumInteger. + /// EnumNumber. + + public EnumTest(EnumStringEnum? EnumString = null, int? EnumInteger = null, double? EnumNumber = null) + { + this.EnumString = EnumString; + this.EnumInteger = EnumInteger; + this.EnumNumber = EnumNumber; + + } + + + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public int? EnumInteger { get; set; } + + /// + /// Gets or Sets EnumNumber + /// + [DataMember(Name="enum_number", EmitDefaultValue=false)] + public double? EnumNumber { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class EnumTest {\n"); + sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); + sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as EnumTest); + } + + /// + /// Returns true if EnumTest instances are equal + /// + /// Instance of EnumTest to be compared + /// Boolean + public bool Equals(EnumTest other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.EnumString == other.EnumString || + this.EnumString != null && + this.EnumString.Equals(other.EnumString) + ) && + ( + this.EnumInteger == other.EnumInteger || + this.EnumInteger != null && + this.EnumInteger.Equals(other.EnumInteger) + ) && + ( + this.EnumNumber == other.EnumNumber || + this.EnumNumber != null && + this.EnumNumber.Equals(other.EnumNumber) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this.EnumString != null) + hash = hash * 59 + this.EnumString.GetHashCode(); + + if (this.EnumInteger != null) + hash = hash * 59 + this.EnumInteger.GetHashCode(); + + if (this.EnumNumber != null) + hash = hash * 59 + this.EnumNumber.GetHashCode(); + + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs index e98ca7342ccb..fd53579cc1b8 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -212,6 +213,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs index 9199732c8e7a..06dfb9b97a70 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -105,6 +106,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs index a65c14309534..67224e50a51e 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -105,6 +106,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs index fe9c89588c98..1f16afaa8970 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -143,6 +144,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs index 78276f0e3137..f83a9d451f0f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -212,6 +213,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs index a878f83be04a..b732e687dce1 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -220,6 +221,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs index 7912fffa1fc4..7ea43dabbd72 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -105,6 +106,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs index 6824a99836cd..8054698b8f92 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -121,6 +122,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs index d8b8c491a18d..5c5f3daa33ea 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs @@ -5,6 +5,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -218,6 +219,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index 4a76d4a8d2f0..58b8c393a37f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -89,4 +89,4 @@ - \ No newline at end of file + From 00e15b76ecea81ebc94ed7cec728a4cf012681a6 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 3 Apr 2016 23:06:43 +0800 Subject: [PATCH 067/170] clean up post process model in csharp, add default value for enum --- .../languages/CSharpClientCodegen.java | 74 ------------ .../main/resources/csharp/enumClass.mustache | 11 +- .../src/test/resources/2_0/petstore.json | 2 + .../main/csharp/IO/Swagger/Model/Animal.cs | 2 +- .../src/main/csharp/IO/Swagger/Model/Cat.cs | 2 +- .../main/csharp/IO/Swagger/Model/Category.cs | 2 +- .../src/main/csharp/IO/Swagger/Model/Dog.cs | 2 +- .../main/csharp/IO/Swagger/Model/EnumClass.cs | 36 ++++-- .../main/csharp/IO/Swagger/Model/EnumTest.cs | 12 +- .../IO/Swagger/Model/InlineResponse200.cs | 113 ++++++++++-------- .../IO/Swagger/Model/Model200Response.cs | 9 +- .../csharp/IO/Swagger/Model/ModelReturn.cs | 9 +- .../src/main/csharp/IO/Swagger/Model/Name.cs | 44 ++----- .../src/main/csharp/IO/Swagger/Model/Order.cs | 47 +++++--- .../src/main/csharp/IO/Swagger/Model/Pet.cs | 27 ++++- .../IO/Swagger/Model/SpecialModelName.cs | 2 +- .../src/main/csharp/IO/Swagger/Model/Tag.cs | 2 +- .../src/main/csharp/IO/Swagger/Model/User.cs | 2 +- .../petstore/php/SwaggerClient-php/README.md | 2 +- 19 files changed, 197 insertions(+), 203 deletions(-) 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 ba9f461fd1f3..01ba4168fdc1 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 @@ -306,83 +306,9 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { this.packageGuid = packageGuid; } - /* - * - */ @Override public Map postProcessModels(Map objMap) { - objMap = super.postProcessModels(objMap); - - List models = (List) objMap.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("jsonname", value); - enumVar.put("value", value); - enumVars.add(enumVar); - } - allowableValues.put("enumVars", enumVars); - - // handle default value for enum, e.g. available => StatusEnum.AVAILABLE - - // HACK: strip ? from enum - if (var.datatypeWithEnum != null) { - var.vendorExtensions.put(DATA_TYPE_WITH_ENUM_EXTENSION, var.datatypeWithEnum.substring(0, var.datatypeWithEnum.length() - 1)); - } - - if (var.defaultValue != null) { - String enumName = null; - - for (Map enumVar : enumVars) { - if (var.defaultValue.replace("\"", "").equals(enumVar.get("value"))) { - enumName = enumVar.get("name"); - break; - } - } - - if (enumName != null && var.vendorExtensions.containsKey(DATA_TYPE_WITH_ENUM_EXTENSION)) { - var.defaultValue = var.vendorExtensions.get(DATA_TYPE_WITH_ENUM_EXTENSION) + "." + enumName; - } - } - } - } - return super.postProcessModels(objMap); - //return objs; } public void setTargetFramework(String dotnetFramework) { diff --git a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache index 47620c623c6c..2c853cea25cb 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache @@ -1,5 +1,14 @@ - public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + /// {{#description}} + /// {{{description}}}{{/description}} + [JsonConverter(typeof(StringEnumConverter))] + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} + { {{#allowableValues}}{{#enumVars}} + /// + /// Enum {{name}} for {{{value}}} + /// [EnumMember(Value = {{{value}}})] {{name}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}} 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 e31d5604601c..3ac7a6294bb5 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -1274,6 +1274,7 @@ }, "status": { "type": "string", + "default": "placed", "description": "Order Status", "enum": [ "placed", @@ -1378,6 +1379,7 @@ }, "EnumClass" : { "type": "string", + "default": "-efg", "enum": ["_abc", "-efg", "(xyz)"] }, "Enum_Test" : { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs index 147884b19aa2..11d93aabd20d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Animal /// [DataContract] public partial class Animal : IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs index dd03e5a6c3eb..235889c9864b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Cat /// [DataContract] public partial class Cat : Animal, IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs index 89e8bfae7cc4..223bec6d0ab0 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Category /// [DataContract] public partial class Category : IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs index 0cd6e0891d71..7fefac6e26d3 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Dog /// [DataContract] public partial class Dog : Animal, IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs index a514468625a6..be3b7a17c5f4 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs @@ -12,16 +12,30 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { - public enum EnumClass { - - [EnumMember(Value = "_abc")] - Abc, - - [EnumMember(Value = "-efg")] - efg, - - [EnumMember(Value = "(xyz)")] - xyz - } + /// + /// Gets or Sets EnumClass + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumClass + { + + /// + /// Enum Abc for "_abc" + /// + [EnumMember(Value = "_abc")] + Abc, + + /// + /// Enum efg for "-efg" + /// + [EnumMember(Value = "-efg")] + efg, + + /// + /// Enum xyz for "(xyz)" + /// + [EnumMember(Value = "(xyz)")] + xyz + } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs index c845ee695ca5..2ab24be8371c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs @@ -13,21 +13,27 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// EnumTest /// [DataContract] public partial class EnumTest : IEquatable { - /// /// Gets or Sets EnumString /// [JsonConverter(typeof(StringEnumConverter))] - public enum EnumStringEnum { + public enum EnumStringEnum + { + /// + /// Enum Upper for "UPPER" + /// [EnumMember(Value = "UPPER")] Upper, + /// + /// Enum Lower for "lower" + /// [EnumMember(Value = "lower")] Lower } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs index fd53579cc1b8..32d3db25e58e 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs @@ -13,25 +13,34 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// InlineResponse200 /// [DataContract] public partial class InlineResponse200 : IEquatable { - /// /// pet status in the store /// /// pet status in the store [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum { + public enum StatusEnum + { + /// + /// Enum Available for "available" + /// [EnumMember(Value = "available")] Available, + /// + /// Enum Pending for "pending" + /// [EnumMember(Value = "pending")] Pending, + /// + /// Enum Sold for "sold" + /// [EnumMember(Value = "sold")] Sold } @@ -48,14 +57,14 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// Initializes a new instance of the class. /// - /// PhotoUrls. - /// Name. + /// Tags. /// Id (required). /// Category. - /// Tags. /// pet status in the store. + /// Name. + /// PhotoUrls. - public InlineResponse200(List PhotoUrls = null, string Name = null, long? Id = null, Object Category = null, List Tags = null, StatusEnum? Status = null) + public InlineResponse200(List Tags = null, long? Id = null, Object Category = null, StatusEnum? Status = null, string Name = null, List PhotoUrls = null) { // to ensure "Id" is required (not null) if (Id == null) @@ -66,26 +75,20 @@ namespace IO.Swagger.Model { this.Id = Id; } - this.PhotoUrls = PhotoUrls; - this.Name = Name; - this.Category = Category; this.Tags = Tags; + this.Category = Category; this.Status = Status; + this.Name = Name; + this.PhotoUrls = PhotoUrls; } - + /// - /// Gets or Sets PhotoUrls + /// Gets or Sets Tags /// - [DataMember(Name="photoUrls", EmitDefaultValue=false)] - public List PhotoUrls { get; set; } - - /// - /// Gets or Sets Name - /// - [DataMember(Name="name", EmitDefaultValue=false)] - public string Name { get; set; } + [DataMember(Name="tags", EmitDefaultValue=false)] + public List Tags { get; set; } /// /// Gets or Sets Id @@ -100,10 +103,16 @@ namespace IO.Swagger.Model public Object Category { get; set; } /// - /// Gets or Sets Tags + /// Gets or Sets Name /// - [DataMember(Name="tags", EmitDefaultValue=false)] - public List Tags { get; set; } + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [DataMember(Name="photoUrls", EmitDefaultValue=false)] + public List PhotoUrls { get; set; } /// /// Returns the string presentation of the object @@ -113,16 +122,17 @@ namespace IO.Swagger.Model { var sb = new StringBuilder(); sb.Append("class InlineResponse200 {\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -156,14 +166,9 @@ namespace IO.Swagger.Model return ( - this.PhotoUrls == other.PhotoUrls || - this.PhotoUrls != null && - this.PhotoUrls.SequenceEqual(other.PhotoUrls) - ) && - ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) + this.Tags == other.Tags || + this.Tags != null && + this.Tags.SequenceEqual(other.Tags) ) && ( this.Id == other.Id || @@ -175,15 +180,20 @@ namespace IO.Swagger.Model this.Category != null && this.Category.Equals(other.Category) ) && - ( - this.Tags == other.Tags || - this.Tags != null && - this.Tags.SequenceEqual(other.Tags) - ) && ( this.Status == other.Status || this.Status != null && this.Status.Equals(other.Status) + ) && + ( + this.Name == other.Name || + this.Name != null && + this.Name.Equals(other.Name) + ) && + ( + this.PhotoUrls == other.PhotoUrls || + this.PhotoUrls != null && + this.PhotoUrls.SequenceEqual(other.PhotoUrls) ); } @@ -198,18 +208,25 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this.PhotoUrls != null) - hash = hash * 59 + this.PhotoUrls.GetHashCode(); - if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); - if (this.Category != null) - hash = hash * 59 + this.Category.GetHashCode(); + if (this.Tags != null) hash = hash * 59 + this.Tags.GetHashCode(); + + if (this.Id != null) + hash = hash * 59 + this.Id.GetHashCode(); + + if (this.Category != null) + hash = hash * 59 + this.Category.GetHashCode(); + if (this.Status != null) hash = hash * 59 + this.Status.GetHashCode(); + + if (this.Name != null) + hash = hash * 59 + this.Name.GetHashCode(); + + if (this.PhotoUrls != null) + hash = hash * 59 + this.PhotoUrls.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs index 06dfb9b97a70..52a19ff2f225 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// Model for testing model name starting with number + /// Model200Response /// [DataContract] public partial class Model200Response : IEquatable @@ -30,7 +30,7 @@ namespace IO.Swagger.Model this.Name = Name; } - + /// /// Gets or Sets Name @@ -47,10 +47,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Model200Response {\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -101,8 +102,10 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) + if (this.Name != null) hash = hash * 59 + this.Name.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs index 67224e50a51e..3b74f1ba729d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// Model for testing reserved words + /// ModelReturn /// [DataContract] public partial class ModelReturn : IEquatable @@ -30,7 +30,7 @@ namespace IO.Swagger.Model this._Return = _Return; } - + /// /// Gets or Sets _Return @@ -47,10 +47,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class ModelReturn {\n"); sb.Append(" _Return: ").Append(_Return).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -101,8 +102,10 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) + if (this._Return != null) hash = hash * 59 + this._Return.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs index 1f16afaa8970..01592253e246 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// Model for testing model name same as property name + /// Name /// [DataContract] public partial class Name : IEquatable @@ -23,24 +23,16 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// Initializes a new instance of the class. /// - /// _Name (required). - /// Property. + /// _Name. + /// SnakeCase. - public Name(int? _Name = null, string Property = null) + public Name(int? _Name = null, int? SnakeCase = null) { - // to ensure "_Name" is required (not null) - if (_Name == null) - { - throw new InvalidDataException("_Name is a required property for Name and cannot be null"); - } - else - { - this._Name = _Name; - } - this.Property = Property; + this._Name = _Name; + this.SnakeCase = SnakeCase; } - + /// /// Gets or Sets _Name @@ -52,13 +44,7 @@ namespace IO.Swagger.Model /// Gets or Sets SnakeCase /// [DataMember(Name="snake_case", EmitDefaultValue=false)] - public int? SnakeCase { get; private set; } - - /// - /// Gets or Sets Property - /// - [DataMember(Name="property", EmitDefaultValue=false)] - public string Property { get; set; } + public int? SnakeCase { get; set; } /// /// Returns the string presentation of the object @@ -70,11 +56,11 @@ namespace IO.Swagger.Model sb.Append("class Name {\n"); sb.Append(" _Name: ").Append(_Name).Append("\n"); sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); - sb.Append(" Property: ").Append(Property).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -116,11 +102,6 @@ namespace IO.Swagger.Model this.SnakeCase == other.SnakeCase || this.SnakeCase != null && this.SnakeCase.Equals(other.SnakeCase) - ) && - ( - this.Property == other.Property || - this.Property != null && - this.Property.Equals(other.Property) ); } @@ -135,12 +116,13 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) + if (this._Name != null) hash = hash * 59 + this._Name.GetHashCode(); + if (this.SnakeCase != null) hash = hash * 59 + this.SnakeCase.GetHashCode(); - if (this.Property != null) - hash = hash * 59 + this.Property.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs index f83a9d451f0f..5561095be767 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs @@ -13,25 +13,34 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Order /// [DataContract] public partial class Order : IEquatable { - /// /// Order Status /// /// Order Status [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum { + public enum StatusEnum + { + /// + /// Enum Placed for "placed" + /// [EnumMember(Value = "placed")] Placed, + /// + /// Enum Approved for "approved" + /// [EnumMember(Value = "approved")] Approved, + /// + /// Enum Delivered for "delivered" + /// [EnumMember(Value = "delivered")] Delivered } @@ -48,38 +57,36 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// Initializes a new instance of the class. /// - /// Id. /// PetId. /// Quantity. /// ShipDate. - /// Order Status. - /// Complete (default to false). + /// Order Status (default to StatusEnum.Placed). + /// Complete. - public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) + public Order(long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) { - this.Id = Id; this.PetId = PetId; this.Quantity = Quantity; this.ShipDate = ShipDate; - this.Status = Status; - // use default value if no "Complete" provided - if (Complete == null) + // use default value if no "Status" provided + if (Status == null) { - this.Complete = false; + this.Status = StatusEnum.Placed; } else { - this.Complete = Complete; + this.Status = Status; } + this.Complete = Complete; } - + /// /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; set; } + public long? Id { get; private set; } /// /// Gets or Sets PetId @@ -119,10 +126,11 @@ namespace IO.Swagger.Model sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Complete: ").Append(Complete).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -198,18 +206,25 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) + if (this.Id != null) hash = hash * 59 + this.Id.GetHashCode(); + if (this.PetId != null) hash = hash * 59 + this.PetId.GetHashCode(); + if (this.Quantity != null) hash = hash * 59 + this.Quantity.GetHashCode(); + if (this.ShipDate != null) hash = hash * 59 + this.ShipDate.GetHashCode(); + if (this.Status != null) hash = hash * 59 + this.Status.GetHashCode(); + if (this.Complete != null) hash = hash * 59 + this.Complete.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs index b732e687dce1..db790ad8ab1e 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs @@ -13,25 +13,34 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Pet /// [DataContract] public partial class Pet : IEquatable { - /// /// pet status in the store /// /// pet status in the store [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum { + public enum StatusEnum + { + /// + /// Enum Available for "available" + /// [EnumMember(Value = "available")] Available, + /// + /// Enum Pending for "pending" + /// [EnumMember(Value = "pending")] Pending, + /// + /// Enum Sold for "sold" + /// [EnumMember(Value = "sold")] Sold } @@ -81,7 +90,7 @@ namespace IO.Swagger.Model this.Status = Status; } - + /// /// Gets or Sets Id @@ -127,10 +136,11 @@ namespace IO.Swagger.Model sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -206,18 +216,25 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) + if (this.Id != null) hash = hash * 59 + this.Id.GetHashCode(); + if (this.Category != null) hash = hash * 59 + this.Category.GetHashCode(); + if (this.Name != null) hash = hash * 59 + this.Name.GetHashCode(); + if (this.PhotoUrls != null) hash = hash * 59 + this.PhotoUrls.GetHashCode(); + if (this.Tags != null) hash = hash * 59 + this.Tags.GetHashCode(); + if (this.Status != null) hash = hash * 59 + this.Status.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs index 7ea43dabbd72..17451359d82a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// SpecialModelName /// [DataContract] public partial class SpecialModelName : IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs index 8054698b8f92..93c7b4deb06d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Tag /// [DataContract] public partial class Tag : IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs index 5c5f3daa33ea..3336da10d73a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// User /// [DataContract] public partial class User : IEquatable diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index e829f2643a4f..ead713aa68d3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-03T17:03:15.368+08:00 +- Build date: 2016-04-03T22:11:31.470+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements From 531b536ffb5fc1d4beb547409688d5f6a92db10f Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 6 Apr 2016 18:09:27 +0800 Subject: [PATCH 068/170] add enum number support to C# --- .../io/swagger/codegen/DefaultCodegen.java | 48 +++++++++++-------- .../languages/AbstractCSharpCodegen.java | 2 +- .../languages/CSharpClientCodegen.java | 44 ++++++++++++++--- .../codegen/languages/JavaClientCodegen.java | 6 +-- .../languages/JavascriptClientCodegen.java | 20 ++++---- .../codegen/languages/PhpClientCodegen.java | 2 +- .../src/test/resources/2_0/petstore.json | 1 + .../main/csharp/IO/Swagger/Model/EnumTest.cs | 34 ++++++++++--- .../SwaggerClientTest.csproj | 9 ++-- .../csharp/SwaggerClientTest/TestEnum.cs | 39 +++++++++++++++ .../csharp/SwaggerClientTest/TestOrder.cs | 17 ++++--- 11 files changed, 162 insertions(+), 60 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs 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 23a28b87afe4..7521090a8b1e 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 @@ -149,23 +149,23 @@ public class DefaultCodegen { if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { Map allowableValues = cm.allowableValues; - List values = (List) allowableValues.get("values"); + List values = (List) allowableValues.get("values"); List> enumVars = new ArrayList>(); String commonPrefix = findCommonPrefixOfVars(values); int truncateIdx = commonPrefix.length(); - for (String value : values) { + for (Object value : values) { Map enumVar = new HashMap(); String enumName; if (truncateIdx == 0) { - enumName = value; + enumName = value.toString(); } else { - enumName = value.substring(truncateIdx); + enumName = value.toString().substring(truncateIdx); if ("".equals(enumName)) { - enumName = value; + enumName = value.toString(); } } - enumVar.put("name", toEnumVarName(enumName)); - enumVar.put("value", toEnumValue(value, cm.dataType)); + enumVar.put("name", toEnumVarName(enumName, cm.dataType)); + enumVar.put("value", toEnumValue(value.toString(), cm.dataType)); enumVars.add(enumVar); } cm.allowableValues.put("enumVars", enumVars); @@ -183,7 +183,8 @@ public class DefaultCodegen { if (allowableValues == null) { continue; } - List values = (List) allowableValues.get("values"); + //List values = (List) allowableValues.get("values"); + List values = (List) allowableValues.get("values"); if (values == null) { continue; } @@ -192,19 +193,19 @@ public class DefaultCodegen { List> enumVars = new ArrayList>(); String commonPrefix = findCommonPrefixOfVars(values); int truncateIdx = commonPrefix.length(); - for (String value : values) { + for (Object value : values) { Map enumVar = new HashMap(); String enumName; if (truncateIdx == 0) { - enumName = value; + enumName = value.toString(); } else { - enumName = value.substring(truncateIdx); + enumName = value.toString().substring(truncateIdx); if ("".equals(enumName)) { - enumName = value; + enumName = value.toString(); } } - enumVar.put("name", toEnumVarName(enumName)); - enumVar.put("value", toEnumValue(value, var.datatype)); + enumVar.put("name", toEnumVarName(enumName, var.datatype)); + enumVar.put("value", toEnumValue(value.toString(), var.datatype)); enumVars.add(enumVar); } allowableValues.put("enumVars", enumVars); @@ -232,11 +233,17 @@ public class DefaultCodegen { * @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", ""); + public String findCommonPrefixOfVars(List vars) { + try { + String[] listStr = vars.toArray(new String[vars.size()]); + + String prefix = StringUtils.getCommonPrefix(listStr); + // 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", ""); + } catch (ArrayStoreException e) { + return ""; + } } /** @@ -260,9 +267,8 @@ public class DefaultCodegen { * @param value enum variable name * @return the sanitized variable name for enum */ - public String toEnumVarName(String value) { + public String toEnumVarName(String value, String datatype) { String var = value.replaceAll("\\W+", "_").toUpperCase(); - LOGGER.info("toEnumVarName: " + value + " => " + var); if (var.matches("\\d.*")) { return "_" + var; } else { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java index 86ca4fcd634d..e9d6457f6f0c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java @@ -543,7 +543,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co @Override - public String toEnumVarName(String name) { + public String toEnumVarName(String name, String datatype) { String enumName = sanitizeName(name); enumName = enumName.replaceFirst("^_", ""); 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 01ba4168fdc1..f76fc74870e2 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 @@ -367,21 +367,53 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { return codegenModel; } - +/* @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") + public String findCommonPrefixOfVars(List vars) { + try { + 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", ""); + } catch (ArrayStoreException e) { + return ""; + } + } +*/ + /** + * Return the value in the language specifed format + * e.g. status => "status" + * + * @param value enum variable name + * @return the sanitized variable name for enum + */ + public String toEnumValue(String value, String datatype) { + if ("int?".equalsIgnoreCase(datatype) || "long?".equalsIgnoreCase(datatype) || + "double?".equalsIgnoreCase(datatype) || "float?".equalsIgnoreCase(datatype)) { + return value; + } else { + return "\"" + escapeText(value) + "\""; + } } @Override - public String toEnumVarName(String value) { + public String toEnumVarName(String value, String datatype) { + // number + if ("int?".equals(datatype) || "long?".equals(datatype) || + "double?".equals(datatype) || "float?".equals(datatype)) { + String varName = "NUMBER_" + value; + varName = varName.replaceAll("-", "MINUS"); + varName = varName.replaceAll("\\+", "PLUS"); + varName = varName.replaceAll("\\.", "DOT"); + return varName; + } + + // string String var = value.replaceAll("_", " "); var = WordUtils.capitalizeFully(var); var = var.replaceAll("\\W+", ""); + if (var.matches("\\d.*")) { return "_" + var; } else { 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 bd770a1e509f..bdd970ff0af0 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 @@ -793,7 +793,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { protected boolean needToImport(String type) { return super.needToImport(type) && type.indexOf(".") < 0; } - +/* @Override public String findCommonPrefixOfVars(List vars) { String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()])); @@ -801,9 +801,9 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { // e.g. ["status-on", "status-off"] => "status-" (not "status-o") return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); } - +*/ @Override - public String toEnumVarName(String value) { + public String toEnumVarName(String value, String datatype) { 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 bc8b162c44be..4ba6a2247819 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 @@ -871,7 +871,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo if (allowableValues == null) { continue; } - List values = (List) allowableValues.get("values"); + List values = (List) allowableValues.get("values"); if (values == null) { continue; } @@ -880,19 +880,19 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo List> enumVars = new ArrayList>(); String commonPrefix = findCommonPrefixOfVars(values); int truncateIdx = commonPrefix.length(); - for (String value : values) { + for (Object value : values) { Map enumVar = new HashMap(); String enumName; if (truncateIdx == 0) { - enumName = value; + enumName = value.toString(); } else { - enumName = value.substring(truncateIdx); + enumName = value.toString().substring(truncateIdx); if ("".equals(enumName)) { - enumName = value; + enumName = value.toString(); } } - enumVar.put("name", toEnumVarName(enumName)); - enumVar.put("value", value); + enumVar.put("name", toEnumVarName(enumName, var.datatype)); + enumVar.put("value", value.toString()); enumVars.add(enumVar); } allowableValues.put("enumVars", enumVars); @@ -929,7 +929,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo return !defaultIncludes.contains(type) && !languageSpecificPrimitives.contains(type); } - +/* @Override public String findCommonPrefixOfVars(List vars) { String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()])); @@ -937,9 +937,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo // e.g. ["status-on", "status-off"] => "status-" (not "status-o") return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); } - +*/ @Override - public String toEnumVarName(String value) { + public String toEnumVarName(String value, String datatype) { 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 8f8ad281f6cc..1f90c8735d5c 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 @@ -570,7 +570,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { } @Override - public String toEnumVarName(String name) { + public String toEnumVarName(String name, String datatype) { String enumName = sanitizeName(underscore(name).toUpperCase()); enumName = enumName.replaceFirst("^_", ""); 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 3ac7a6294bb5..7f2400da9b00 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -1391,6 +1391,7 @@ }, "enum_integer" : { "type" : "integer", + "format" : "int32", "enum" : [1, -1] }, "enum_number" : { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs index 2ab24be8371c..7a5e4f5a5a08 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs @@ -38,6 +38,26 @@ namespace IO.Swagger.Model Lower } + /// + /// Gets or Sets EnumInteger + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumIntegerEnum + { + + /// + /// Enum NUMBER_1 for 1 + /// + [EnumMember(Value = "1")] + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS1 for -1 + /// + [EnumMember(Value = "-1")] + NUMBER_MINUS1 = -1 + } + /// /// Gets or Sets EnumString @@ -45,6 +65,12 @@ namespace IO.Swagger.Model [DataMember(Name="enum_string", EmitDefaultValue=false)] public EnumStringEnum? EnumString { get; set; } + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public EnumIntegerEnum? EnumInteger { get; set; } + /// /// Initializes a new instance of the class. /// Initializes a new instance of the class. @@ -53,7 +79,7 @@ namespace IO.Swagger.Model /// EnumInteger. /// EnumNumber. - public EnumTest(EnumStringEnum? EnumString = null, int? EnumInteger = null, double? EnumNumber = null) + public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, double? EnumNumber = null) { this.EnumString = EnumString; this.EnumInteger = EnumInteger; @@ -62,12 +88,6 @@ namespace IO.Swagger.Model } - /// - /// Gets or Sets EnumInteger - /// - [DataMember(Name="enum_integer", EmitDefaultValue=false)] - public int? EnumInteger { get; set; } - /// /// Gets or Sets EnumNumber /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index 58b8c393a37f..0d3c33168db3 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -69,10 +69,9 @@ - - - - + + + @@ -89,4 +88,4 @@ - + \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs new file mode 100644 index 000000000000..9764536f05f4 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs @@ -0,0 +1,39 @@ +using NUnit.Framework; +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace SwaggerClientTest.TestEnum +{ + [TestFixture ()] + public class TestEnum + { + public TestEnum () + { + } + + /// + /// Test EnumClass + /// + [Test ()] + public void TestEnumClass () + { + // test serialization for string + Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumClass.Abc), "\"_abc\""); + + // test serialization for number + Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumTest.EnumIntegerEnum.NUMBER_MINUS1), "\"-1\""); + + // test cast to int + Assert.AreEqual ((int)EnumTest.EnumIntegerEnum.NUMBER_MINUS1, -1); + + } + } +} + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs index 6af386ff2ba6..e7bf8428eec2 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs @@ -73,14 +73,11 @@ namespace SwaggerClientTest.TestOrder } - /* comment out the test case as the method is not defined in original petstore spec - * we will re-enable this after updating the petstore server - * /// - /// Test GetInvetoryInObject + /// Test TestGetInventoryInObject /// [Test ()] - public void TestGetInventoryInObject () + public void TestGetInventoryInObject() { // set timeout to 10 seconds Configuration c1 = new Configuration (timeout: 10000); @@ -95,9 +92,17 @@ namespace SwaggerClientTest.TestOrder { Assert.IsInstanceOf (typeof(int?), Int32.Parse(entry.Value)); } + } - }*/ + /// + /// Test Enum + /// + [Test ()] + public void TestEnum () + { + Assert.AreEqual (Order.StatusEnum.Approved.ToString(), "Approved"); + } } } From a7ca0ad11f7f6358a87de66156677789b5b5b1f6 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 6 Apr 2016 22:03:50 +0800 Subject: [PATCH 069/170] add enum number support to php --- .../io/swagger/codegen/DefaultCodegen.java | 16 +++++++-- .../codegen/languages/PhpClientCodegen.java | 34 +++++++++++++++++-- .../src/test/resources/2_0/petstore.json | 1 + .../SwaggerClientTest.userprefs | 23 ++++++++++--- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../php/SwaggerClient-php/docs/Order.md | 4 +-- .../lib/Model/InlineResponse200.php | 12 +++---- .../php/SwaggerClient-php/lib/Model/Order.php | 14 ++++---- .../php/SwaggerClient-php/lib/Model/Pet.php | 12 +++---- .../SwaggerClient-php/tests/OrderApiTest.php | 7 ++++ 10 files changed, 95 insertions(+), 30 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 7521090a8b1e..fdae9c95e0fb 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 @@ -219,7 +219,7 @@ public class DefaultCodegen { } } if (enumName != null) { - var.defaultValue = var.datatypeWithEnum + "." + enumName; + var.defaultValue = toEnumDefaultValue(enumName, var.datatypeWithEnum); } } } @@ -245,12 +245,24 @@ public class DefaultCodegen { return ""; } } + + /** + * Return the enum default value in the language specifed format + * + * @param value enum variable name + * @param datatype data type + * @return the sanitized variable name for enum + */ + public String toEnumDefaultValue(String value, String datatype) { + return datatype + "." + value; + } /** - * Return the value in the language specifed format + * Return the enum value in the language specifed format * e.g. status => "status" * * @param value enum variable name + * @param datatype data type * @return the sanitized variable name for enum */ public String toEnumValue(String value, String datatype) { 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 1f90c8735d5c..20b488f4bd40 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 @@ -569,10 +569,40 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { p.example = example; } + /** + * Return the value in the language specifed format + * e.g. status => "status" + * + * @param value enum variable name + * @return the sanitized variable name for enum + */ + @Override + public String toEnumValue(String value, String datatype) { + if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) { + return value; + } else { + return "\'" + escapeText(value) + "\'"; + } + } + + @Override + public String toEnumDefaultValue(String value, String datatype) { + return datatype + "_" + value; + } + @Override public String toEnumVarName(String name, String datatype) { - String enumName = sanitizeName(underscore(name).toUpperCase()); + // number + if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) { + String varName = new String(name); + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); + return varName; + } + // string + String enumName = sanitizeName(underscore(name).toUpperCase()); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -585,7 +615,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toEnumName(CodegenProperty property) { - String enumName = toModelName(property.name); + String enumName = underscore(toModelName(property.name)).toUpperCase(); if (enumName.matches("\\d.*")) { // starts with number return "_" + enumName; 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 7f2400da9b00..19d0e72419df 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -1396,6 +1396,7 @@ }, "enum_number" : { "type" : "number", + "format" : "double", "enum" : [1.1, -1.2] } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index 28096724f7a1..1db4ce02fe77 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,12 +1,27 @@  - + - + - - + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index ead713aa68d3..3082b7f1847f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-03T22:11:31.470+08:00 +- Build date: 2016-04-06T21:53:32.791+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md index ddae5cc2b571..cde24fe43cc4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md @@ -7,8 +7,8 @@ Name | Type | Description | Notes **pet_id** | **int** | | [optional] **quantity** | **int** | | [optional] **ship_date** | [**\DateTime**](\DateTime.md) | | [optional] -**status** | **string** | Order Status | [optional] -**complete** | **bool** | | [optional] [default to false] +**status** | **string** | Order Status | [optional] [default to STATUS_PLACED] +**complete** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php index 7aa1610cb969..d66a078a4e0d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -114,9 +114,9 @@ class InlineResponse200 implements ArrayAccess return self::$getters; } - const Status_AVAILABLE = "available"; - const Status_PENDING = "pending"; - const Status_SOLD = "sold"; + const STATUS_AVAILABLE = 'available'; + const STATUS_PENDING = 'pending'; + const STATUS_SOLD = 'sold'; @@ -126,9 +126,9 @@ class InlineResponse200 implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::Status_AVAILABLE, - self::Status_PENDING, - self::Status_SOLD, + self::STATUS_AVAILABLE, + self::STATUS_PENDING, + self::STATUS_SOLD, ]; } 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 b9aeed01894a..e2983766141c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -114,9 +114,9 @@ class Order implements ArrayAccess return self::$getters; } - const Status_PLACED = "placed"; - const Status_APPROVED = "approved"; - const Status_DELIVERED = "delivered"; + const STATUS_PLACED = 'placed'; + const STATUS_APPROVED = 'approved'; + const STATUS_DELIVERED = 'delivered'; @@ -126,9 +126,9 @@ class Order implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::Status_PLACED, - self::Status_APPROVED, - self::Status_DELIVERED, + self::STATUS_PLACED, + self::STATUS_APPROVED, + self::STATUS_DELIVERED, ]; } @@ -162,7 +162,7 @@ class Order implements ArrayAccess * $status Order Status * @var string */ - protected $status; + protected $status = STATUS_PLACED; /** * $complete 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 dfad9032e3d7..3f717048b0ac 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -114,9 +114,9 @@ class Pet implements ArrayAccess return self::$getters; } - const Status_AVAILABLE = "available"; - const Status_PENDING = "pending"; - const Status_SOLD = "sold"; + const STATUS_AVAILABLE = 'available'; + const STATUS_PENDING = 'pending'; + const STATUS_SOLD = 'sold'; @@ -126,9 +126,9 @@ class Pet implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::Status_AVAILABLE, - self::Status_PENDING, - self::Status_SOLD, + self::STATUS_AVAILABLE, + self::STATUS_PENDING, + self::STATUS_SOLD, ]; } diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/OrderApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/OrderApiTest.php index 51b82a695d68..8ef5a8e50580 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/OrderApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/OrderApiTest.php @@ -12,6 +12,13 @@ class OrderApiTest extends \PHPUnit_Framework_TestCase //error_reporting(~0); } + // test get inventory + public function testOrderEnum() + { + $this->assertSame(Swagger\Client\Model\Order::STATUS_PLACED, "placed"); + $this->assertSame(Swagger\Client\Model\Order::STATUS_APPROVED, "approved"); + } + // test get inventory public function testOrder() { From 2942ef8b736aa19b0cb3d8af1198201eb56be577 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 6 Apr 2016 22:32:52 +0800 Subject: [PATCH 070/170] add double enum support to C# --- .../languages/CSharpClientCodegen.java | 6 +-- .../main/csharp/IO/Swagger/Model/EnumTest.cs | 38 ++++++++++++++----- .../SwaggerClientTest.userprefs | 23 +++-------- .../csharp/SwaggerClientTest/TestEnum.cs | 4 +- 4 files changed, 39 insertions(+), 32 deletions(-) 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 f76fc74870e2..755f06b2023e 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 @@ -402,9 +402,9 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { if ("int?".equals(datatype) || "long?".equals(datatype) || "double?".equals(datatype) || "float?".equals(datatype)) { String varName = "NUMBER_" + value; - varName = varName.replaceAll("-", "MINUS"); - varName = varName.replaceAll("\\+", "PLUS"); - varName = varName.replaceAll("\\.", "DOT"); + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); return varName; } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs index 7a5e4f5a5a08..a1fe812415d5 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs @@ -52,10 +52,30 @@ namespace IO.Swagger.Model NUMBER_1 = 1, /// - /// Enum NUMBER_MINUS1 for -1 + /// Enum NUMBER_MINUS_1 for -1 /// [EnumMember(Value = "-1")] - NUMBER_MINUS1 = -1 + NUMBER_MINUS_1 = -1 + } + + /// + /// Gets or Sets EnumNumber + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumNumberEnum + { + + /// + /// Enum NUMBER_1_DOT_1 for 1.1 + /// + [EnumMember(Value = "1.1")] + NUMBER_1_DOT_1, + + /// + /// Enum NUMBER_MINUS_1_DOT_2 for -1.2 + /// + [EnumMember(Value = "-1.2")] + NUMBER_MINUS_1_DOT_2 } @@ -71,6 +91,12 @@ namespace IO.Swagger.Model [DataMember(Name="enum_integer", EmitDefaultValue=false)] public EnumIntegerEnum? EnumInteger { get; set; } + /// + /// Gets or Sets EnumNumber + /// + [DataMember(Name="enum_number", EmitDefaultValue=false)] + public EnumNumberEnum? EnumNumber { get; set; } + /// /// Initializes a new instance of the class. /// Initializes a new instance of the class. @@ -79,7 +105,7 @@ namespace IO.Swagger.Model /// EnumInteger. /// EnumNumber. - public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, double? EnumNumber = null) + public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, EnumNumberEnum? EnumNumber = null) { this.EnumString = EnumString; this.EnumInteger = EnumInteger; @@ -88,12 +114,6 @@ namespace IO.Swagger.Model } - /// - /// Gets or Sets EnumNumber - /// - [DataMember(Name="enum_number", EmitDefaultValue=false)] - public double? EnumNumber { get; set; } - /// /// Returns the string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index 1db4ce02fe77..3c3b0624157a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,27 +1,14 @@  - + - + - - - + + + - - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs index 9764536f05f4..0ca6bb6c2a68 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs @@ -28,10 +28,10 @@ namespace SwaggerClientTest.TestEnum Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumClass.Abc), "\"_abc\""); // test serialization for number - Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumTest.EnumIntegerEnum.NUMBER_MINUS1), "\"-1\""); + Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1), "\"-1\""); // test cast to int - Assert.AreEqual ((int)EnumTest.EnumIntegerEnum.NUMBER_MINUS1, -1); + Assert.AreEqual ((int)EnumTest.EnumIntegerEnum.NUMBER_MINUS_1, -1); } } From f5bee0c1b7295b6f17274f1556e014d9384790f4 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 6 Apr 2016 22:40:50 +0800 Subject: [PATCH 071/170] fix java docstring --- .../io/swagger/codegen/DefaultCodegen.java | 7 ++++--- .../languages/CSharpClientCodegen.java | 20 +------------------ .../codegen/languages/PhpClientCodegen.java | 7 ------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index fdae9c95e0fb..fe0d97ce5450 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 @@ -251,7 +251,7 @@ public class DefaultCodegen { * * @param value enum variable name * @param datatype data type - * @return the sanitized variable name for enum + * @return the default value for the enum */ public String toEnumDefaultValue(String value, String datatype) { return datatype + "." + value; @@ -259,11 +259,11 @@ public class DefaultCodegen { /** * Return the enum value in the language specifed format - * e.g. status => "status" + * e.g. status becomes "status" * * @param value enum variable name * @param datatype data type - * @return the sanitized variable name for enum + * @return the sanitized value for enum */ public String toEnumValue(String value, String datatype) { if ("number".equalsIgnoreCase(datatype)) { @@ -277,6 +277,7 @@ public class DefaultCodegen { * Return the sanitized variable name for enum * * @param value enum variable name + * @param datatype data type * @return the sanitized variable name for enum */ public String toEnumVarName(String value, String datatype) { 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 755f06b2023e..1212795e1bbb 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 @@ -367,26 +367,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { return codegenModel; } -/* + @Override - public String findCommonPrefixOfVars(List vars) { - try { - 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", ""); - } catch (ArrayStoreException e) { - return ""; - } - } -*/ - /** - * Return the value in the language specifed format - * e.g. status => "status" - * - * @param value enum variable name - * @return the sanitized variable name for enum - */ public String toEnumValue(String value, String datatype) { if ("int?".equalsIgnoreCase(datatype) || "long?".equalsIgnoreCase(datatype) || "double?".equalsIgnoreCase(datatype) || "float?".equalsIgnoreCase(datatype)) { 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 20b488f4bd40..91346cad696e 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 @@ -569,13 +569,6 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { p.example = example; } - /** - * Return the value in the language specifed format - * e.g. status => "status" - * - * @param value enum variable name - * @return the sanitized variable name for enum - */ @Override public String toEnumValue(String value, String datatype) { if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) { From be83c0cc3cdc4775baa77410a61779cacd232c2d Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 7 Apr 2016 23:16:42 +0800 Subject: [PATCH 072/170] add new enum file for csharp and php --- .../main/resources/csharp/modelEnum.mustache | 15 ++ .../resources/csharp/modelGeneric.mustache | 131 ++++++++++++++ .../resources/csharp/modelInnerEnum.mustache | 15 ++ .../main/resources/php/model_enum.mustache | 17 ++ .../main/resources/php/model_generic.mustache | 169 ++++++++++++++++++ 5 files changed, 347 insertions(+) create mode 100644 modules/swagger-codegen/src/main/resources/csharp/modelEnum.mustache create mode 100644 modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache create mode 100644 modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache create mode 100644 modules/swagger-codegen/src/main/resources/php/model_enum.mustache create mode 100644 modules/swagger-codegen/src/main/resources/php/model_generic.mustache diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelEnum.mustache new file mode 100644 index 000000000000..ff38385c7852 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/modelEnum.mustache @@ -0,0 +1,15 @@ + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + /// {{#description}} + /// {{{description}}}{{/description}} + [JsonConverter(typeof(StringEnumConverter))] + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} + { + {{#allowableValues}}{{#enumVars}} + /// + /// Enum {{name}} for {{{value}}} + /// + [EnumMember(Value = {{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})] + {{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, + {{/-last}}{{/enumVars}}{{/allowableValues}} + } diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache new file mode 100644 index 000000000000..8affc932a46b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -0,0 +1,131 @@ + /// + /// {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} + /// + [DataContract] + public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}> + { {{#vars}}{{#isEnum}} +{{>modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} +{{>modelInnerEnum}}{{/items}}{{/items.isEnum}}{{/vars}} + {{#vars}}{{#isEnum}} + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + /// {{#description}} + /// {{{description}}}{{/description}} + [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] + public {{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} { get; set; } + {{/isEnum}}{{/vars}} + /// + /// Initializes a new instance of the class. + /// Initializes a new instance of the class. + /// +{{#vars}}{{^isReadOnly}} /// {{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}. +{{/isReadOnly}}{{/vars}} + public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{#hasMore}}, {{/hasMore}}{{/isReadOnly}}{{/vars}}) + { + {{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null) + if ({{name}} == null) + { + throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null"); + } + else + { + this.{{name}} = {{name}}; + } + {{/required}}{{/isReadOnly}}{{/vars}}{{#vars}}{{^isReadOnly}}{{^required}}{{#defaultValue}}// use default value if no "{{name}}" provided + if ({{name}} == null) + { + this.{{name}} = {{{defaultValue}}}; + } + else + { + this.{{name}} = {{name}}; + } + {{/defaultValue}}{{^defaultValue}}this.{{name}} = {{name}}; + {{/defaultValue}}{{/required}}{{/isReadOnly}}{{/vars}} + } + + {{#vars}}{{^isEnum}} + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// {{#description}} + /// {{description}}{{/description}} + [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] + public {{{datatype}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; } + {{/isEnum}}{{/vars}} + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class {{classname}} {\n"); + {{#vars}}sb.Append(" {{name}}: ").Append({{name}}).Append("\n"); + {{/vars}} + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public {{#parent}} new {{/parent}}string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as {{classname}}); + } + + /// + /// Returns true if {{classname}} instances are equal + /// + /// Instance of {{classname}} to be compared + /// Boolean + public bool Equals({{classname}} other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return {{#vars}}{{#isNotContainer}} + ( + this.{{name}} == other.{{name}} || + this.{{name}} != null && + this.{{name}}.Equals(other.{{name}}) + ){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}} + ( + this.{{name}} == other.{{name}} || + this.{{name}} != null && + this.{{name}}.SequenceEqual(other.{{name}}) + ){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}}{{^vars}}false{{/vars}}; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + {{#vars}} + if (this.{{name}} != null) + hash = hash * 59 + this.{{name}}.GetHashCode(); + {{/vars}} + return hash; + } + } + } diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache new file mode 100644 index 000000000000..4715fd071a48 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache @@ -0,0 +1,15 @@ + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + /// {{#description}} + /// {{{description}}}{{/description}} + [JsonConverter(typeof(StringEnumConverter))] + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} + { + {{#allowableValues}}{{#enumVars}} + /// + /// Enum {{name}} for {{{value}}} + /// + [EnumMember(Value = {{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})] + {{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, + {{/-last}}{{/enumVars}}{{/allowableValues}} + } diff --git a/modules/swagger-codegen/src/main/resources/php/model_enum.mustache b/modules/swagger-codegen/src/main/resources/php/model_enum.mustache new file mode 100644 index 000000000000..4598f9fdff94 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/php/model_enum.mustache @@ -0,0 +1,17 @@ +class {{classname}} { + {{#allowableValues}}{{#enumVars}}const {{{name}}} = {{{value}}}; + {{/enumVars}}{{/allowableValues}} + + {{#vars}}{{#isEnum}} + /** + * Gets allowable values of the enum + * @return string[] + */ + public function {{getter}}AllowableValues() { + return [ + {{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}} + {{/-last}}{{/enumVars}}{{/allowableValues}} + ]; + } + {{/isEnum}}{{/vars}} +} diff --git a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache new file mode 100644 index 000000000000..006cd09c62a5 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache @@ -0,0 +1,169 @@ +class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayAccess +{ + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ + static $swaggerTypes = array( + {{#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[] + */ + static $attributeMap = array( + {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, + {{/hasMore}}{{/vars}} + ); + + static function attributeMap() { + return {{#parent}}parent::attributeMap() + {{/parent}}self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, + {{/hasMore}}{{/vars}} + ); + + static function setters() { + return {{#parent}}parent::setters() + {{/parent}}self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + {{#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}} + + {{#vars}}{{#isEnum}} + /** + * Gets allowable values of the enum + * @return string[] + */ + public function {{getter}}AllowableValues() { + return [ + {{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}} + {{/-last}}{{/enumVars}}{{/allowableValues}} + ]; + } + {{/isEnum}}{{/vars}} + + {{#vars}} + /** + * ${{name}} {{#description}}{{{description}}}{{/description}} + * @var {{datatype}} + */ + protected ${{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}; + {{/vars}} + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + {{#parent}}parent::__construct($data);{{/parent}} + if ($data != null) { + {{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}} + {{/hasMore}}{{/vars}} + } + } + {{#vars}} + /** + * Gets {{name}}. + * @return {{datatype}} + */ + public function {{getter}}() + { + return $this->{{name}}; + } + + /** + * Sets {{name}}. + * @param {{datatype}} ${{name}} {{#description}}{{{description}}}{{/description}} + * @return $this + */ + public function {{setter}}(${{name}}) + { + {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + if (!in_array(${{{name}}}, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}"); + }{{/isEnum}} + $this->{{name}} = ${{name}}; + return $this; + } + {{/vars}} + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->$offset); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->$offset; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + $this->$offset = $value; + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->$offset); + } + + /** + * Gets the string presentation of the object. + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { + return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } else { + return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this)); + } + } +} From 8588c5ce0a85ade459bae46dde088757bb22b097 Mon Sep 17 00:00:00 2001 From: xhh Date: Tue, 12 Apr 2016 23:10:16 +0800 Subject: [PATCH 073/170] add enum support to java --- .../io/swagger/codegen/DefaultCodegen.java | 2 +- .../codegen/languages/JavaClientCodegen.java | 52 ++++- .../main/resources/Java/enumClass.mustache | 17 -- .../resources/Java/enumOuterClass.mustache | 3 - .../src/main/resources/Java/model.mustache | 8 +- .../main/resources/Java/modelEnum.mustache | 19 ++ .../resources/Java/modelInnerEnum.mustache | 19 ++ .../src/main/resources/Java/pojo.mustache | 9 +- .../java/io/swagger/client/model/Animal.java | 9 +- .../java/io/swagger/client/model/Cat.java | 11 +- .../io/swagger/client/model/Category.java | 8 +- .../java/io/swagger/client/model/Dog.java | 11 +- .../io/swagger/client/model/EnumClass.java | 27 +++ .../io/swagger/client/model/EnumTest.java | 178 ++++++++++++++++++ .../client/model/Model200Response.java | 8 +- .../io/swagger/client/model/ModelReturn.java | 8 +- .../java/io/swagger/client/model/Name.java | 8 +- .../java/io/swagger/client/model/Order.java | 16 +- .../java/io/swagger/client/model/Pet.java | 14 +- .../client/model/SpecialModelName.java | 8 +- .../java/io/swagger/client/model/Tag.java | 8 +- .../java/io/swagger/client/model/User.java | 8 +- .../java/io/swagger/client/api/PetApi.java | 78 ++++++-- .../java/io/swagger/client/api/StoreApi.java | 40 +++- .../java/io/swagger/client/api/UserApi.java | 31 +-- .../java/io/swagger/client/model/Animal.java | 9 +- .../java/io/swagger/client/model/Cat.java | 11 +- .../io/swagger/client/model/Category.java | 11 +- .../java/io/swagger/client/model/Dog.java | 11 +- .../io/swagger/client/model/EnumClass.java | 27 +++ .../io/swagger/client/model/EnumTest.java | 178 ++++++++++++++++++ .../client/model/InlineResponse200.java | 118 ++++++------ .../client/model/Model200Response.java | 10 +- .../io/swagger/client/model/ModelReturn.java | 10 +- .../java/io/swagger/client/model/Name.java | 46 ++--- .../java/io/swagger/client/model/Order.java | 39 ++-- .../java/io/swagger/client/model/Pet.java | 25 +-- .../client/model/SpecialModelName.java | 9 +- .../java/io/swagger/client/model/Tag.java | 11 +- .../java/io/swagger/client/model/User.java | 23 +-- .../java/io/swagger/client/model/Animal.java | 9 +- .../java/io/swagger/client/model/Cat.java | 11 +- .../io/swagger/client/model/Category.java | 11 +- .../java/io/swagger/client/model/Dog.java | 11 +- .../io/swagger/client/model/EnumClass.java | 27 +++ .../io/swagger/client/model/EnumTest.java | 178 ++++++++++++++++++ .../client/model/Model200Response.java | 10 +- .../io/swagger/client/model/ModelReturn.java | 10 +- .../java/io/swagger/client/model/Name.java | 46 ++--- .../java/io/swagger/client/model/Order.java | 39 ++-- .../java/io/swagger/client/model/Pet.java | 25 +-- .../client/model/SpecialModelName.java | 9 +- .../java/io/swagger/client/model/Tag.java | 11 +- .../java/io/swagger/client/model/User.java | 23 +-- .../src/gen/java/io/swagger/model/Pet.java | 172 ++++++++--------- .../src/gen/java/io/swagger/model/Pet.java | 173 +++++++++-------- 56 files changed, 1316 insertions(+), 587 deletions(-) delete mode 100644 modules/swagger-codegen/src/main/resources/Java/enumClass.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/Java/enumOuterClass.mustache create mode 100644 modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache create mode 100644 modules/swagger-codegen/src/main/resources/Java/modelInnerEnum.mustache create mode 100644 samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java 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 fe0d97ce5450..3d667cd1741e 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 @@ -213,7 +213,7 @@ public class DefaultCodegen { if (var.defaultValue != null) { String enumName = null; for (Map enumVar : enumVars) { - if (var.defaultValue.equals(enumVar.get("value"))) { + if (toEnumValue(var.defaultValue, var.datatype).equals(enumVar.get("value"))) { enumName = enumVar.get("name"); break; } 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 bdd970ff0af0..e607670313c2 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 @@ -11,6 +11,7 @@ import io.swagger.models.parameters.Parameter; import io.swagger.models.properties.*; import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.WordUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -652,6 +653,28 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { return codegenModel; } + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + String lib = getLibrary(); + if (StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { + List> imports = (List>)objs.get("imports"); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); + } + } + } + return objs; + } + @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { if(serializeBigDecimalAsString) { @@ -802,9 +825,26 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); } */ + + @Override + public String toEnumName(CodegenProperty property) { + return sanitizeName(camelize(property.name)) + "Enum"; + } + @Override public String toEnumVarName(String value, String datatype) { - String var = value.replaceAll("\\W+", "_").toUpperCase(); + // number + if ("Integer".equals(datatype) || "Long".equals(datatype) || + "Float".equals(datatype) || "Double".equals(datatype)) { + String varName = "NUMBER_" + value; + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); + return varName; + } + + // string + String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase(); if (var.matches("\\d.*")) { return "_" + var; } else { @@ -812,6 +852,16 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { } } + @Override + public String toEnumValue(String value, String datatype) { + if ("Integer".equals(datatype) || "Long".equals(datatype) || + "Float".equals(datatype) || "Double".equals(datatype)) { + return value; + } else { + return "\"" + escapeText(value) + "\""; + } + } + private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) { // This generator uses inline classes to define enums, which breaks when // dealing with models that have subTypes. To clean this up, we will analyze diff --git a/modules/swagger-codegen/src/main/resources/Java/enumClass.mustache b/modules/swagger-codegen/src/main/resources/Java/enumClass.mustache deleted file mode 100644 index 6010e26704f5..000000000000 --- a/modules/swagger-codegen/src/main/resources/Java/enumClass.mustache +++ /dev/null @@ -1,17 +0,0 @@ - - public enum {{{datatypeWithEnum}}} { - {{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}}, - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} - - private String value; - - {{{datatypeWithEnum}}}(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } diff --git a/modules/swagger-codegen/src/main/resources/Java/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/Java/enumOuterClass.mustache deleted file mode 100644 index 7aea7b92f22f..000000000000 --- a/modules/swagger-codegen/src/main/resources/Java/enumOuterClass.mustache +++ /dev/null @@ -1,3 +0,0 @@ -public enum {{classname}} { - {{#allowableValues}}{{.}}{{^-last}}, {{/-last}}{{/allowableValues}} -} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/Java/model.mustache b/modules/swagger-codegen/src/main/resources/Java/model.mustache index b9512d2b83cb..66ba76bcbc59 100644 --- a/modules/swagger-codegen/src/main/resources/Java/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/model.mustache @@ -6,11 +6,7 @@ import java.util.Objects; {{#serializableModel}}import java.io.Serializable;{{/serializableModel}} {{#models}} -{{#model}}{{#description}} -/** - * {{description}} - **/{{/description}} -{{#isEnum}}{{>enumOuterClass}}{{/isEnum}} -{{^isEnum}}{{>pojo}}{{/isEnum}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}} {{/model}} {{/models}} diff --git a/modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache new file mode 100644 index 000000000000..f93504c4a98a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache @@ -0,0 +1,19 @@ +/** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ +public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{dataType}} value; + + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{dataType}} value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } +} diff --git a/modules/swagger-codegen/src/main/resources/Java/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/modelInnerEnum.mustache new file mode 100644 index 000000000000..54a97faab35d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/modelInnerEnum.mustache @@ -0,0 +1,19 @@ + /** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{datatype}} value; + + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache index 1a1f455ed31a..f250035a422e 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache @@ -1,11 +1,14 @@ -{{#description}}@ApiModel(description = "{{{description}}}"){{/description}} +/** + * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} + */{{#description}} +@ApiModel(description = "{{{description}}}"){{/description}} {{>generatedAnnotation}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}} -{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} +{{>modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} -{{>enumClass}}{{/items}}{{/items.isEnum}} +{{>modelInnerEnum}}{{/items}}{{/items.isEnum}} private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} {{#vars}}{{^isReadOnly}} diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java index e1e3604ad6b1..dda573cf5d07 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - - +/** + * Animal + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Animal { private String className = null; @@ -31,6 +31,7 @@ public class Animal { this.className = className; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java index 6b4875cda38f..7010d6130f76 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java @@ -7,10 +7,10 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - - - - +/** + * Cat + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Cat extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Cat extends Animal { this.className = className; } - + /** **/ public Cat declawed(Boolean declawed) { @@ -50,6 +50,7 @@ public class Cat extends Animal { this.declawed = declawed; } + @Override public boolean equals(java.lang.Object o) { 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 13be49047e9c..c44784cdb730 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 @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * Category + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java index 5aa516879964..1367e218733c 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java @@ -7,10 +7,10 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - - - - +/** + * Dog + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Dog extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Dog extends Animal { this.className = className; } - + /** **/ public Dog breed(String breed) { @@ -50,6 +50,7 @@ public class Dog extends Animal { this.breed = breed; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumClass.java new file mode 100644 index 000000000000..716bfbbc85e1 --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumClass.java @@ -0,0 +1,27 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; + + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + _ABC("_abc"), + _EFG("-efg"), + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } +} + diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java new file mode 100644 index 000000000000..3d9aac156f34 --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java @@ -0,0 +1,178 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + +/** + * EnumTest + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") +public class EnumTest { + + + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + LOWER("lower"); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumStringEnum enumString = null; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumIntegerEnum enumInteger = null; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumNumberEnum enumNumber = null; + + + /** + **/ + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_string") + public EnumStringEnum getEnumString() { + return enumString; + } + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + + /** + **/ + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_integer") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + /** + **/ + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_number") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + 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 18740d47fbd4..ec3ad40a40ec 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 @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * Model200Response + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Model200Response { private Integer name = null; 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 78f04885a05d..1bf22a5873cb 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 @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * ModelReturn + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class ModelReturn { private Integer _return = null; 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 3b459f7ffcad..fee1c239f7cd 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 @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * Name + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Name { private Integer name = null; 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 4d3412483f03..6af4a4c55dc4 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 @@ -8,10 +8,10 @@ import io.swagger.annotations.ApiModelProperty; import java.util.Date; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * Order + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Order { private Long id = null; @@ -19,7 +19,9 @@ public class Order { private Integer quantity = null; private Date shipDate = null; - + /** + * Order Status + */ public enum StatusEnum { PLACED("placed"), APPROVED("approved"), @@ -34,11 +36,11 @@ public class Order { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } - private StatusEnum status = null; + private StatusEnum status = StatusEnum.PLACED; private Boolean complete = null; 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 b339acc50ff6..11eec4d83480 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 @@ -11,10 +11,10 @@ import java.util.ArrayList; import java.util.List; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * Pet + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Pet { private Long id = null; @@ -23,7 +23,9 @@ public class Pet { private List photoUrls = new ArrayList(); private List tags = new ArrayList(); - + /** + * pet status in the store + */ public enum StatusEnum { AVAILABLE("available"), PENDING("pending"), @@ -38,7 +40,7 @@ public class Pet { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } 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 ee6d1580578a..acb1c4e5e15b 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 @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * SpecialModelName + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class SpecialModelName { private Long specialPropertyName = null; 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 a23e8b8894f0..b0b42521af12 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 @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * Tag + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class Tag { private Long id = null; 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 9cb8783e8be0..545b009bf72e 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 @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * User + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") public class User { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index e1a0e57b005f..c0bf61b63b69 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -3,8 +3,8 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; 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; @@ -12,14 +12,14 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public interface PetApi extends ApiClient.Api { /** * 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) * @return void */ @RequestLine("POST /pet") @@ -28,7 +28,20 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) void addPet(Pet body); - + + /** + * 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) + * @return void + */ + @RequestLine("POST /pet?testing_byte_array=true") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + void addPetUsingByteArray(byte[] body); + /** * Deletes a pet * @@ -43,11 +56,11 @@ public interface PetApi extends ApiClient.Api { "apiKey: {apiKey}" }) void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); - + /** * 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 */ @RequestLine("GET /pet/findByStatus?status={status}") @@ -56,11 +69,11 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) List findPetsByStatus(@Param("status") List status); - + /** * 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 */ @RequestLine("GET /pet/findByTags?tags={tags}") @@ -69,11 +82,11 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) List findPetsByTags(@Param("tags") List tags); - + /** * 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 */ @RequestLine("GET /pet/{petId}") @@ -82,11 +95,37 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) Pet getPetById(@Param("petId") Long petId); - + + /** + * 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 + */ + @RequestLine("GET /pet/{petId}?response=inline_arbitrary_object") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + InlineResponse200 getPetByIdInObject(@Param("petId") Long petId); + + /** + * 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[] + */ + @RequestLine("GET /pet/{petId}?testing_byte_array=true") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + byte[] petPetIdtestingByteArraytrueGet(@Param("petId") Long petId); + /** * 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) * @return void */ @RequestLine("PUT /pet") @@ -95,7 +134,7 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) void updatePet(Pet body); - + /** * Updates a pet in the store with form data * @@ -109,20 +148,21 @@ public interface PetApi extends ApiClient.Api { "Content-type: application/x-www-form-urlencoded", "Accepts: application/json", }) - void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); - + void updatePetWithForm(@Param("petId") String petId, @Param("name") String name, @Param("status") String status); + /** * 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 + * @return void */ @RequestLine("POST /pet/{petId}/uploadImage") @Headers({ "Content-type: multipart/form-data", "Accepts: application/json", }) - ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index 6b124765369f..a16bc537ce03 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public interface StoreApi extends ApiClient.Api { @@ -26,7 +26,20 @@ public interface StoreApi extends ApiClient.Api { "Accepts: application/json", }) void deleteOrder(@Param("orderId") String orderId); - + + /** + * 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 + */ + @RequestLine("GET /store/findByStatus?status={status}") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + List findOrdersByStatus(@Param("status") String status); + /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -38,10 +51,22 @@ public interface StoreApi extends ApiClient.Api { "Accepts: application/json", }) Map getInventory(); - + + /** + * 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 + */ + @RequestLine("GET /store/inventory?response=arbitrary_object") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + Object getInventoryInObject(); + /** * 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 */ @@ -50,12 +75,12 @@ public interface StoreApi extends ApiClient.Api { "Content-type: application/json", "Accepts: application/json", }) - Order getOrderById(@Param("orderId") Long orderId); - + Order getOrderById(@Param("orderId") String orderId); + /** * 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 */ @RequestLine("POST /store/order") @@ -64,4 +89,5 @@ public interface StoreApi extends ApiClient.Api { "Accepts: application/json", }) Order placeOrder(Order body); + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index 281cf2df46a3..3ae5900b51dc 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -10,14 +10,14 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public interface UserApi extends ApiClient.Api { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (required) + * @param body Created user object (optional) * @return void */ @RequestLine("POST /user") @@ -26,11 +26,11 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void createUser(User body); - + /** * Creates list of users with given input array * - * @param body List of user object (required) + * @param body List of user object (optional) * @return void */ @RequestLine("POST /user/createWithArray") @@ -39,11 +39,11 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void createUsersWithArrayInput(List body); - + /** * Creates list of users with given input array * - * @param body List of user object (required) + * @param body List of user object (optional) * @return void */ @RequestLine("POST /user/createWithList") @@ -52,7 +52,7 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void createUsersWithListInput(List body); - + /** * Delete user * This can only be done by the logged in user. @@ -65,11 +65,11 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void deleteUser(@Param("username") String username); - + /** * 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 */ @RequestLine("GET /user/{username}") @@ -78,12 +78,12 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) User getUserByName(@Param("username") String username); - + /** * 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 */ @RequestLine("GET /user/login?username={username}&password={password}") @@ -92,7 +92,7 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) String loginUser(@Param("username") String username, @Param("password") String password); - + /** * Logs out current logged in user session * @@ -104,12 +104,12 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void logoutUser(); - + /** * 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) * @return void */ @RequestLine("PUT /user/{username}") @@ -118,4 +118,5 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void updateUser(@Param("username") String username, User body); + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java index 6b79f42855b0..eb4d93dcba00 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * Animal + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public class Animal { private String className = null; @@ -31,6 +31,7 @@ public class Animal { this.className = className; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java index 09e48e27ad52..e229b0c1b5bd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java @@ -7,10 +7,10 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * Cat + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public class Cat extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Cat extends Animal { this.className = className; } - + /** **/ public Cat declawed(Boolean declawed) { @@ -50,6 +50,7 @@ public class Cat extends Animal { this.declawed = declawed; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index 6d4ffb945a09..0c808ad68608 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * Category + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+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/feign/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java index 5ff3690685f5..9374d677f950 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java @@ -7,10 +7,10 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * Dog + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public class Dog extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Dog extends Animal { this.className = className; } - + /** **/ public Dog breed(String breed) { @@ -50,6 +50,7 @@ public class Dog extends Animal { this.breed = breed; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumClass.java new file mode 100644 index 000000000000..716bfbbc85e1 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumClass.java @@ -0,0 +1,27 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; + + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + _ABC("_abc"), + _EFG("-efg"), + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } +} + diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java new file mode 100644 index 000000000000..6ed9e0f09f28 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java @@ -0,0 +1,178 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + +/** + * EnumTest + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +public class EnumTest { + + + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + LOWER("lower"); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumStringEnum enumString = null; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumIntegerEnum enumInteger = null; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumNumberEnum enumNumber = null; + + + /** + **/ + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_string") + public EnumStringEnum getEnumString() { + return enumString; + } + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + + /** + **/ + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_integer") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + /** + **/ + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_number") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + 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 c60909b93b86..9a9a655bc6f8 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 @@ -10,17 +10,21 @@ import java.util.ArrayList; import java.util.List; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-02T22:36:41.205+08:00") +/** + * InlineResponse200 + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public class InlineResponse200 { - private List tags = new ArrayList(); + private List photoUrls = new ArrayList(); + private String name = null; private Long id = null; private Object category = null; + private List tags = new ArrayList(); - + /** + * pet status in the store + */ public enum StatusEnum { AVAILABLE("available"), PENDING("pending"), @@ -35,29 +39,44 @@ public class InlineResponse200 { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } private StatusEnum status = null; - private String name = null; - private List photoUrls = new ArrayList(); /** **/ - public InlineResponse200 tags(List tags) { - this.tags = tags; + public InlineResponse200 photoUrls(List photoUrls) { + this.photoUrls = photoUrls; return this; } @ApiModelProperty(example = "null", value = "") - @JsonProperty("tags") - public List getTags() { - return tags; + @JsonProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; } - public void setTags(List tags) { - this.tags = tags; + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + + /** + **/ + public InlineResponse200 name(String name) { + this.name = name; + return this; + } + + @ApiModelProperty(example = "doggie", value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; } @@ -95,6 +114,23 @@ public class InlineResponse200 { } + /** + **/ + public InlineResponse200 tags(List tags) { + this.tags = tags; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("tags") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + + /** * pet status in the store **/ @@ -113,40 +149,6 @@ public class InlineResponse200 { } - /** - **/ - public InlineResponse200 name(String name) { - this.name = name; - return this; - } - - @ApiModelProperty(example = "doggie", value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - public InlineResponse200 photoUrls(List photoUrls) { - this.photoUrls = photoUrls; - return this; - } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - @Override public boolean equals(java.lang.Object o) { @@ -157,17 +159,17 @@ public class InlineResponse200 { return false; } InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.tags, inlineResponse200.tags) && + return Objects.equals(this.photoUrls, inlineResponse200.photoUrls) && + Objects.equals(this.name, inlineResponse200.name) && Objects.equals(this.id, inlineResponse200.id) && Objects.equals(this.category, inlineResponse200.category) && - Objects.equals(this.status, inlineResponse200.status) && - Objects.equals(this.name, inlineResponse200.name) && - Objects.equals(this.photoUrls, inlineResponse200.photoUrls); + Objects.equals(this.tags, inlineResponse200.tags) && + Objects.equals(this.status, inlineResponse200.status); } @Override public int hashCode() { - return Objects.hash(tags, id, category, status, name, photoUrls); + return Objects.hash(photoUrls, name, id, category, tags, status); } @Override @@ -175,12 +177,12 @@ public class InlineResponse200 { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index e3d07e1b4417..25318de289ad 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -6,13 +6,10 @@ import io.swagger.annotations.ApiModel; 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-23T12:48:24.088+08:00") + * Model200Response + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+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/feign/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java index b8b35a723829..969f0515ebdd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java @@ -6,13 +6,10 @@ import io.swagger.annotations.ApiModel; 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-23T12:48:24.088+08:00") + * ModelReturn + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+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/feign/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java index d993ca024559..d86bb6a5394c 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java @@ -6,18 +6,14 @@ import io.swagger.annotations.ApiModel; 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-23T12:48:24.088+08:00") + * Name + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+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/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index 9004aa13a10d..5fa2f4173c66 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -8,10 +8,10 @@ import io.swagger.annotations.ApiModelProperty; import java.util.Date; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * Order + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public class Order { private Long id = null; @@ -19,7 +19,9 @@ public class Order { private Integer quantity = null; private Date shipDate = null; - + /** + * Order Status + */ public enum StatusEnum { PLACED("placed"), APPROVED("approved"), @@ -34,31 +36,21 @@ public class Order { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } - private StatusEnum status = null; - private Boolean complete = false; + private StatusEnum status = StatusEnum.PLACED; + 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 +67,7 @@ public class Order { this.petId = petId; } - + /** **/ public Order quantity(Integer quantity) { @@ -92,7 +84,7 @@ public class Order { this.quantity = quantity; } - + /** **/ public Order shipDate(Date shipDate) { @@ -109,7 +101,7 @@ public class Order { this.shipDate = shipDate; } - + /** * Order Status **/ @@ -127,7 +119,7 @@ public class Order { this.status = status; } - + /** **/ public Order complete(Boolean complete) { @@ -144,6 +136,7 @@ public class Order { this.complete = complete; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index f23c91248823..24e261c0a2ad 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -11,10 +11,10 @@ import java.util.ArrayList; import java.util.List; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * Pet + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") public class Pet { private Long id = null; @@ -23,7 +23,9 @@ public class Pet { private List photoUrls = new ArrayList(); private List tags = new ArrayList(); - + /** + * pet status in the store + */ public enum StatusEnum { AVAILABLE("available"), PENDING("pending"), @@ -38,7 +40,7 @@ public class Pet { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } @@ -61,7 +63,7 @@ public class Pet { this.id = id; } - + /** **/ public Pet category(Category category) { @@ -78,7 +80,7 @@ public class Pet { this.category = category; } - + /** **/ public Pet name(String name) { @@ -95,7 +97,7 @@ public class Pet { this.name = name; } - + /** **/ public Pet photoUrls(List photoUrls) { @@ -112,7 +114,7 @@ public class Pet { this.photoUrls = photoUrls; } - + /** **/ public Pet tags(List tags) { @@ -129,7 +131,7 @@ public class Pet { this.tags = tags; } - + /** * pet status in the store **/ @@ -147,6 +149,7 @@ public class Pet { this.status = status; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java index b2b87fad3a44..2306d2324689 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * SpecialModelName + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+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/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index 55bef8324de1..f9e7c8d8c765 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * Tag + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+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/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index d8657dda7f5d..dab32a22f8d2 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * User + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+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/jersey2/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java index a4dfdc3bc569..1a3029ec9229 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * Animal + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") public class Animal { private String className = null; @@ -31,6 +31,7 @@ public class Animal { this.className = className; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java index f150e8d31210..c877047cd458 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java @@ -7,10 +7,10 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * Cat + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") public class Cat extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Cat extends Animal { this.className = className; } - + /** **/ public Cat declawed(Boolean declawed) { @@ -50,6 +50,7 @@ public class Cat extends Animal { this.declawed = declawed; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java index 78f437829199..b9cb49513463 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * Category + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+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/jersey2/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java index 45c85698089b..15d3ce320b2c 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java @@ -7,10 +7,10 @@ import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * Dog + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") public class Dog extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Dog extends Animal { this.className = className; } - + /** **/ public Dog breed(String breed) { @@ -50,6 +50,7 @@ public class Dog extends Animal { this.breed = breed; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumClass.java new file mode 100644 index 000000000000..716bfbbc85e1 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumClass.java @@ -0,0 +1,27 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; + + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + _ABC("_abc"), + _EFG("-efg"), + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } +} + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java new file mode 100644 index 000000000000..6b8ee8102be9 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java @@ -0,0 +1,178 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + +/** + * EnumTest + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +public class EnumTest { + + + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + LOWER("lower"); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumStringEnum enumString = null; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumIntegerEnum enumInteger = null; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + private EnumNumberEnum enumNumber = null; + + + /** + **/ + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_string") + public EnumStringEnum getEnumString() { + return enumString; + } + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + + /** + **/ + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_integer") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + /** + **/ + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("enum_number") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java index cd6a37772e09..36f04c225f61 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java @@ -6,13 +6,10 @@ import io.swagger.annotations.ApiModel; 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-23T12:58:40.273+08:00") + * Model200Response + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+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/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java index e62148627911..62224f3b2c38 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java @@ -6,13 +6,10 @@ import io.swagger.annotations.ApiModel; 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-23T12:58:40.273+08:00") + * ModelReturn + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+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/jersey2/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java index f710f6122e42..92bf36a79524 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java @@ -6,18 +6,14 @@ import io.swagger.annotations.ApiModel; 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-23T12:58:40.273+08:00") + * Name + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+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/jersey2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java index c2fbdbcc9f94..116f07dc14d5 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java @@ -8,10 +8,10 @@ import io.swagger.annotations.ApiModelProperty; import java.util.Date; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * Order + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") public class Order { private Long id = null; @@ -19,7 +19,9 @@ public class Order { private Integer quantity = null; private Date shipDate = null; - + /** + * Order Status + */ public enum StatusEnum { PLACED("placed"), APPROVED("approved"), @@ -34,31 +36,21 @@ public class Order { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } - private StatusEnum status = null; - private Boolean complete = false; + private StatusEnum status = StatusEnum.PLACED; + 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 +67,7 @@ public class Order { this.petId = petId; } - + /** **/ public Order quantity(Integer quantity) { @@ -92,7 +84,7 @@ public class Order { this.quantity = quantity; } - + /** **/ public Order shipDate(Date shipDate) { @@ -109,7 +101,7 @@ public class Order { this.shipDate = shipDate; } - + /** * Order Status **/ @@ -127,7 +119,7 @@ public class Order { this.status = status; } - + /** **/ public Order complete(Boolean complete) { @@ -144,6 +136,7 @@ public class Order { this.complete = complete; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java index 100c8f265f01..82dc1e9a1a40 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java @@ -11,10 +11,10 @@ import java.util.ArrayList; import java.util.List; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * Pet + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") public class Pet { private Long id = null; @@ -23,7 +23,9 @@ public class Pet { private List photoUrls = new ArrayList(); private List tags = new ArrayList(); - + /** + * pet status in the store + */ public enum StatusEnum { AVAILABLE("available"), PENDING("pending"), @@ -38,7 +40,7 @@ public class Pet { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } @@ -61,7 +63,7 @@ public class Pet { this.id = id; } - + /** **/ public Pet category(Category category) { @@ -78,7 +80,7 @@ public class Pet { this.category = category; } - + /** **/ public Pet name(String name) { @@ -95,7 +97,7 @@ public class Pet { this.name = name; } - + /** **/ public Pet photoUrls(List photoUrls) { @@ -112,7 +114,7 @@ public class Pet { this.photoUrls = photoUrls; } - + /** **/ public Pet tags(List tags) { @@ -129,7 +131,7 @@ public class Pet { this.tags = tags; } - + /** * pet status in the store **/ @@ -147,6 +149,7 @@ public class Pet { this.status = status; } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java index fa2813e9c426..12e360e83a46 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * SpecialModelName + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+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/jersey2/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java index f82159f2111e..0c579b9ed7e7 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * Tag + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+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/jersey2/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java index 56bfb774ccb0..48933177c5f6 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * User + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+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/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java index 24092cbee254..6a4ce4398843 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java @@ -1,29 +1,30 @@ -package io.swagger.model; +package io.swagger.client.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.swagger.model.Category; -import io.swagger.model.Tag; +import io.swagger.client.model.Tag; import java.util.ArrayList; import java.util.List; - - - - -public class Pet { +/** + * InlineResponse200 + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +public class InlineResponse200 { - private Long id = null; - private Category category = null; - private String name = null; private List photoUrls = new ArrayList(); + private String name = null; + private Long id = null; + private Object category = null; private List tags = new ArrayList(); - + /** + * pet status in the store + */ public enum StatusEnum { AVAILABLE("available"), PENDING("pending"), @@ -38,72 +39,21 @@ public class Pet { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } private StatusEnum status = null; - /** - **/ - public Pet id(Long id) { - this.id = id; - return this; - } - - @ApiModelProperty(value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - /** **/ - public Pet category(Category category) { - this.category = category; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("category") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - /** - **/ - public Pet name(String name) { - this.name = name; - return this; - } - - - @ApiModelProperty(example = "doggie", required = true, value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - public Pet photoUrls(List photoUrls) { + public InlineResponse200 photoUrls(List photoUrls) { this.photoUrls = photoUrls; return this; } - - @ApiModelProperty(required = true, value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("photoUrls") public List getPhotoUrls() { return photoUrls; @@ -112,15 +62,66 @@ public class Pet { this.photoUrls = photoUrls; } + /** **/ - public Pet tags(List tags) { - this.tags = tags; + public InlineResponse200 name(String name) { + this.name = name; return this; } + + @ApiModelProperty(example = "doggie", value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } - @ApiModelProperty(value = "") + /** + **/ + public InlineResponse200 id(Long id) { + this.id = id; + return this; + } + + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + + /** + **/ + public InlineResponse200 category(Object category) { + this.category = category; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("category") + public Object getCategory() { + return category; + } + public void setCategory(Object category) { + this.category = category; + } + + + /** + **/ + public InlineResponse200 tags(List tags) { + this.tags = tags; + return this; + } + + @ApiModelProperty(example = "null", value = "") @JsonProperty("tags") public List getTags() { return tags; @@ -129,16 +130,16 @@ public class Pet { this.tags = tags; } + /** * pet status in the store **/ - public Pet status(StatusEnum status) { + public InlineResponse200 status(StatusEnum status) { this.status = status; return this; } - - @ApiModelProperty(value = "pet status in the store") + @ApiModelProperty(example = "null", value = "pet status in the store") @JsonProperty("status") public StatusEnum getStatus() { return status; @@ -147,38 +148,39 @@ public class Pet { this.status = status; } + @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } - Pet pet = (Pet) o; - return Objects.equals(id, pet.id) && - Objects.equals(category, pet.category) && - Objects.equals(name, pet.name) && - Objects.equals(photoUrls, pet.photoUrls) && - Objects.equals(tags, pet.tags) && - Objects.equals(status, pet.status); + InlineResponse200 inlineResponse200 = (InlineResponse200) o; + return Objects.equals(this.photoUrls, inlineResponse200.photoUrls) && + Objects.equals(this.name, inlineResponse200.name) && + Objects.equals(this.id, inlineResponse200.id) && + Objects.equals(this.category, inlineResponse200.category) && + Objects.equals(this.tags, inlineResponse200.tags) && + Objects.equals(this.status, inlineResponse200.status); } @Override public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); + return Objects.hash(photoUrls, name, id, category, tags, status); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); + sb.append("class InlineResponse200 {\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); @@ -189,7 +191,7 @@ public class Pet { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/samples/server/petstore/jersey2/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jersey2/src/gen/java/io/swagger/model/Pet.java index 514bb24508d1..64032c00f8b4 100644 --- a/samples/server/petstore/jersey2/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jersey2/src/gen/java/io/swagger/model/Pet.java @@ -1,29 +1,30 @@ -package io.swagger.model; +package io.swagger.client.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.swagger.model.Category; -import io.swagger.model.Tag; +import io.swagger.client.model.Tag; import java.util.ArrayList; import java.util.List; - - - - -public class Pet { +/** + * InlineResponse200 + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") +public class InlineResponse200 { - private Long id = null; - private Category category = null; - private String name = null; private List photoUrls = new ArrayList(); + private String name = null; + private Long id = null; + private Object category = null; private List tags = new ArrayList(); - + /** + * pet status in the store + */ public enum StatusEnum { AVAILABLE("available"), PENDING("pending"), @@ -38,7 +39,7 @@ public class Pet { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } @@ -47,67 +48,12 @@ public class Pet { /** **/ - public Pet id(Long id) { - this.id = id; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - public Pet category(Category category) { - this.category = category; - return this; - } - - - @ApiModelProperty(value = "") - @JsonProperty("category") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - - /** - **/ - public Pet name(String name) { - this.name = name; - return this; - } - - - @ApiModelProperty(example = "doggie", required = true, value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - public Pet photoUrls(List photoUrls) { + public InlineResponse200 photoUrls(List photoUrls) { this.photoUrls = photoUrls; return this; } - - @ApiModelProperty(required = true, value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("photoUrls") public List getPhotoUrls() { return photoUrls; @@ -119,13 +65,63 @@ public class Pet { /** **/ - public Pet tags(List tags) { - this.tags = tags; + public InlineResponse200 name(String name) { + this.name = name; return this; } + + @ApiModelProperty(example = "doggie", value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } - @ApiModelProperty(value = "") + /** + **/ + public InlineResponse200 id(Long id) { + this.id = id; + return this; + } + + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + + /** + **/ + public InlineResponse200 category(Object category) { + this.category = category; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("category") + public Object getCategory() { + return category; + } + public void setCategory(Object category) { + this.category = category; + } + + + /** + **/ + public InlineResponse200 tags(List tags) { + this.tags = tags; + return this; + } + + @ApiModelProperty(example = "null", value = "") @JsonProperty("tags") public List getTags() { return tags; @@ -138,13 +134,12 @@ public class Pet { /** * pet status in the store **/ - public Pet status(StatusEnum status) { + public InlineResponse200 status(StatusEnum status) { this.status = status; return this; } - - @ApiModelProperty(value = "pet status in the store") + @ApiModelProperty(example = "null", value = "pet status in the store") @JsonProperty("status") public StatusEnum getStatus() { return status; @@ -156,36 +151,36 @@ public class Pet { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } - Pet pet = (Pet) o; - return Objects.equals(id, pet.id) && - Objects.equals(category, pet.category) && - Objects.equals(name, pet.name) && - Objects.equals(photoUrls, pet.photoUrls) && - Objects.equals(tags, pet.tags) && - Objects.equals(status, pet.status); + InlineResponse200 inlineResponse200 = (InlineResponse200) o; + return Objects.equals(this.photoUrls, inlineResponse200.photoUrls) && + Objects.equals(this.name, inlineResponse200.name) && + Objects.equals(this.id, inlineResponse200.id) && + Objects.equals(this.category, inlineResponse200.category) && + Objects.equals(this.tags, inlineResponse200.tags) && + Objects.equals(this.status, inlineResponse200.status); } @Override public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); + return Objects.hash(photoUrls, name, id, category, tags, status); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); + sb.append("class InlineResponse200 {\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); @@ -196,7 +191,7 @@ public class Pet { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } From 4419e71d4b503ab1a4c4138e18192ab0a7fe03a5 Mon Sep 17 00:00:00 2001 From: xhh Date: Fri, 22 Apr 2016 16:49:03 +0800 Subject: [PATCH 074/170] improve enum support in java okhttp-gson client --- .../libraries/okhttp-gson/enumClass.mustache | 17 -- .../Java/libraries/okhttp-gson/model.mustache | 75 +------- .../libraries/okhttp-gson/modelEnum.mustache | 20 ++ .../okhttp-gson/modelInnerEnum.mustache | 20 ++ .../Java/libraries/okhttp-gson/pojo.mustache | 71 ++++++++ .../petstore/java/okhttp-gson/git_push.sh | 6 +- .../java/io/swagger/client/model/Animal.java | 10 +- .../java/io/swagger/client/model/Cat.java | 13 +- .../io/swagger/client/model/Category.java | 7 +- .../java/io/swagger/client/model/Dog.java | 13 +- .../io/swagger/client/model/EnumClass.java | 32 ++++ .../io/swagger/client/model/EnumTest.java | 171 ++++++++++++++++++ .../client/model/Model200Response.java | 11 +- .../io/swagger/client/model/ModelReturn.java | 11 +- .../java/io/swagger/client/model/Name.java | 36 ++-- .../java/io/swagger/client/model/Order.java | 65 ++++--- .../java/io/swagger/client/model/Pet.java | 42 +++-- .../client/model/SpecialModelName.java | 7 +- .../java/io/swagger/client/model/Tag.java | 7 +- .../java/io/swagger/client/model/User.java | 7 +- .../java/io/swagger/client/model/Pet.java | 153 ++++++++-------- 21 files changed, 527 insertions(+), 267 deletions(-) delete mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enumClass.mustache create mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache create mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache create mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache create mode 100644 samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enumClass.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enumClass.mustache deleted file mode 100644 index 0fed02b67a36..000000000000 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enumClass.mustache +++ /dev/null @@ -1,17 +0,0 @@ -public enum {{{datatypeWithEnum}}} { - {{#allowableValues}}{{#enumVars}}@SerializedName("{{{value}}}") - {{{name}}}("{{{value}}}"){{^-last}}, - - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} - - private String value; - - {{{datatypeWithEnum}}}(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } -} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache index 0b544b9e06cd..4bd6d5638b42 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache @@ -8,78 +8,7 @@ import com.google.gson.annotations.SerializedName; {{#serializableModel}}import java.io.Serializable;{{/serializableModel}} {{#models}} - -{{#model}}{{#description}} -/** - * {{description}} - **/{{/description}} -{{#description}}@ApiModel(description = "{{{description}}}"){{/description}} -public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { - {{#vars}}{{#isEnum}} - -{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} - -{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}} - @SerializedName("{{baseName}}") - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; - {{/vars}} - - {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} - **/ - @ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") - public {{{datatypeWithEnum}}} {{getter}}() { - return {{name}}; - }{{^isReadOnly}} - public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { - this.{{name}} = {{name}}; - }{{/isReadOnly}} - - {{/vars}} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - }{{#hasVars}} - {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && - {{/hasMore}}{{/vars}}{{#parent}} && - super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} - return true;{{/hasVars}} - } - - @Override - public int hashCode() { - return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class {{classname}} {\n"); - {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} - {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); - {{/vars}}sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}} {{/model}} {{/models}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache new file mode 100644 index 000000000000..a24100f5cc03 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache @@ -0,0 +1,20 @@ +/** + * {{^description}}Gets or Sets {{name}}{{/description}}{{#description}}{{description}}{{/description}} + */ +public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}) + {{{name}}}({{{value}}}){{^-last}}, + + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{dataType}} value; + + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{dataType}} value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } +} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache new file mode 100644 index 000000000000..a95fd93249d7 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache @@ -0,0 +1,20 @@ + /** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}) + {{{name}}}({{{value}}}){{^-last}}, + + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{datatype}} value; + + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache new file mode 100644 index 000000000000..1c9e06fa556c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache @@ -0,0 +1,71 @@ +/** + * {{#description}}{{description}}{{/description}}{{^description}}{{classname}}{{/description}} + */{{#description}} +@ApiModel(description = "{{{description}}}"){{/description}} +public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { + {{#vars}}{{#isEnum}} + +{{>libraries/okhttp-gson/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} + +{{>libraries/okhttp-gson/modelInnerEnum}}{{/items}}{{/items.isEnum}} + @SerializedName("{{baseName}}") + private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + {{/vars}} + + {{#vars}} + /**{{#description}} + * {{{description}}}{{/description}}{{#minimum}} + * minimum: {{minimum}}{{/minimum}}{{#maximum}} + * maximum: {{maximum}}{{/maximum}} + **/ + @ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") + public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + }{{^isReadOnly}} + public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + }{{/isReadOnly}} + + {{/vars}} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && + {{/hasMore}}{{/vars}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return true;{{/hasVars}} + } + + @Override + public int hashCode() { + return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} + {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}}sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/okhttp-gson/git_push.sh b/samples/client/petstore/java/okhttp-gson/git_push.sh index 1a36388db023..6ca091b49d95 100644 --- a/samples/client/petstore/java/okhttp-gson/git_push.sh +++ b/samples/client/petstore/java/okhttp-gson/git_push.sh @@ -8,17 +8,17 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi if [ "$release_note" = "" ]; then - release_note="Minor update" + release_note="" echo "[INFO] No command line input provided. Set \$release_note to $release_note" fi diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java index 87997d9de3f5..5425d324f504 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java @@ -7,14 +7,16 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - - +/** + * Animal + */ public class Animal { @SerializedName("className") private String className = null; + + /** **/ @ApiModelProperty(required = true, value = "") @@ -25,6 +27,7 @@ public class Animal { this.className = className; } + @Override public boolean equals(Object o) { @@ -64,3 +67,4 @@ public class Animal { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java index 45a322f7d9bd..11806f89e9bd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java @@ -8,17 +8,19 @@ import io.swagger.client.model.Animal; import com.google.gson.annotations.SerializedName; - - - +/** + * Cat + */ public class Cat extends Animal { @SerializedName("className") private String className = null; - + @SerializedName("declawed") private Boolean declawed = null; + + /** **/ @ApiModelProperty(required = true, value = "") @@ -29,6 +31,7 @@ public class Cat extends Animal { this.className = className; } + /** **/ @ApiModelProperty(value = "") @@ -39,6 +42,7 @@ public class Cat extends Animal { this.declawed = declawed; } + @Override public boolean equals(Object o) { @@ -81,3 +85,4 @@ public class Cat extends Animal { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java index 61151088a7de..f72d42a57466 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java @@ -7,9 +7,9 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - - +/** + * Category + */ public class Category { @SerializedName("id") @@ -79,3 +79,4 @@ public class Category { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java index aa1bde7d22a2..25eab6c979e3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java @@ -8,17 +8,19 @@ import io.swagger.client.model.Animal; import com.google.gson.annotations.SerializedName; - - - +/** + * Dog + */ public class Dog extends Animal { @SerializedName("className") private String className = null; - + @SerializedName("breed") private String breed = null; + + /** **/ @ApiModelProperty(required = true, value = "") @@ -29,6 +31,7 @@ public class Dog extends Animal { this.className = className; } + /** **/ @ApiModelProperty(value = "") @@ -39,6 +42,7 @@ public class Dog extends Animal { this.breed = breed; } + @Override public boolean equals(Object o) { @@ -81,3 +85,4 @@ public class Dog extends Animal { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java new file mode 100644 index 000000000000..6426f26867c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java @@ -0,0 +1,32 @@ +package io.swagger.client.model; + +import java.util.Objects; + +import com.google.gson.annotations.SerializedName; + + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + @SerializedName("_abc") + _ABC("_abc"), + + @SerializedName("-efg") + _EFG("-efg"), + + @SerializedName("(xyz)") + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java new file mode 100644 index 000000000000..1c46e1fadf07 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java @@ -0,0 +1,171 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + +/** + * EnumTest + */ +public class EnumTest { + + + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + @SerializedName("UPPER") + UPPER("UPPER"), + + @SerializedName("lower") + LOWER("lower"); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_string") + private EnumStringEnum enumString = null; + + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + @SerializedName("1") + NUMBER_1(1), + + @SerializedName("-1") + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_integer") + private EnumIntegerEnum enumInteger = null; + + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + @SerializedName("1.1") + NUMBER_1_DOT_1(1.1), + + @SerializedName("-1.2") + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_number") + private EnumNumberEnum enumNumber = null; + + + + /** + **/ + @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { + return enumString; + } + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + + /** + **/ + @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + /** + **/ + @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java index ca0c5871388f..87c625704131 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java @@ -7,17 +7,16 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - /** - * Model for testing model name starting with number - **/ -@ApiModel(description = "Model for testing model name starting with number") + * Model200Response + */ public class Model200Response { @SerializedName("name") private Integer name = null; + + /** **/ @ApiModelProperty(value = "") @@ -28,6 +27,7 @@ public class Model200Response { this.name = name; } + @Override public boolean equals(Object o) { @@ -67,3 +67,4 @@ public class Model200Response { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java index 071c5e7de14e..dadb010290ac 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java @@ -7,17 +7,16 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - /** - * Model for testing reserved words - **/ -@ApiModel(description = "Model for testing reserved words") + * ModelReturn + */ public class ModelReturn { @SerializedName("return") private Integer _return = null; + + /** **/ @ApiModelProperty(value = "") @@ -28,6 +27,7 @@ public class ModelReturn { this._return = _return; } + @Override public boolean equals(Object o) { @@ -67,3 +67,4 @@ public class ModelReturn { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java index 7ba516f17ec3..5e23e13bd91d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java @@ -7,26 +7,22 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - /** - * Model for testing model name same as property name - **/ -@ApiModel(description = "Model for testing model name same as property name") + * Name + */ public class Name { @SerializedName("name") private Integer name = null; - + @SerializedName("snake_case") private Integer snakeCase = null; + - @SerializedName("property") - private String property = null; - + /** **/ - @ApiModelProperty(required = true, value = "") + @ApiModelProperty(value = "") public Integer getName() { return name; } @@ -34,23 +30,18 @@ public class Name { this.name = name; } + /** **/ @ApiModelProperty(value = "") public Integer getSnakeCase() { return snakeCase; } - - /** - **/ - @ApiModelProperty(value = "") - public String getProperty() { - return property; - } - public void setProperty(String property) { - this.property = property; + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; } + @Override public boolean equals(Object o) { @@ -62,13 +53,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 @@ -78,7 +68,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(); } @@ -94,3 +83,4 @@ public class Name { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java index b0ebd0e87581..004432790745 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java @@ -8,62 +8,65 @@ import java.util.Date; import com.google.gson.annotations.SerializedName; - - - +/** + * Order + */ public class Order { @SerializedName("id") private Long id = null; - + @SerializedName("petId") private Long petId = null; - + @SerializedName("quantity") private Integer quantity = null; - + @SerializedName("shipDate") private Date shipDate = null; + + /** + * Order Status + */ + public enum StatusEnum { + @SerializedName("placed") + PLACED("placed"), -public enum StatusEnum { - @SerializedName("placed") - PLACED("placed"), + @SerializedName("approved") + APPROVED("approved"), - @SerializedName("approved") - APPROVED("approved"), + @SerializedName("delivered") + DELIVERED("delivered"); - @SerializedName("delivered") - DELIVERED("delivered"); + private String value; - private String value; + StatusEnum(String value) { + this.value = value; + } - StatusEnum(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") - private StatusEnum status = null; - + private StatusEnum status = StatusEnum.PLACED; + @SerializedName("complete") - private Boolean complete = false; + private Boolean complete = null; + + /** **/ @ApiModelProperty(value = "") public Long getId() { return id; } - public void setId(Long id) { - this.id = id; - } + /** **/ @ApiModelProperty(value = "") @@ -74,6 +77,7 @@ public enum StatusEnum { this.petId = petId; } + /** **/ @ApiModelProperty(value = "") @@ -84,6 +88,7 @@ public enum StatusEnum { this.quantity = quantity; } + /** **/ @ApiModelProperty(value = "") @@ -94,6 +99,7 @@ public enum StatusEnum { this.shipDate = shipDate; } + /** * Order Status **/ @@ -105,6 +111,7 @@ public enum StatusEnum { this.status = status; } + /** **/ @ApiModelProperty(value = "") @@ -115,6 +122,7 @@ public enum StatusEnum { this.complete = complete; } + @Override public boolean equals(Object o) { @@ -164,3 +172,4 @@ public enum StatusEnum { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java index fe1f0a34aa3c..bc18c39e75fc 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java @@ -11,9 +11,9 @@ import java.util.List; import com.google.gson.annotations.SerializedName; - - - +/** + * Pet + */ public class Pet { @SerializedName("id") @@ -32,28 +32,31 @@ public class Pet { private List tags = new ArrayList(); -public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), + /** + * pet status in the store + */ + public enum StatusEnum { + @SerializedName("available") + AVAILABLE("available"), - @SerializedName("pending") - PENDING("pending"), + @SerializedName("pending") + PENDING("pending"), - @SerializedName("sold") - SOLD("sold"); + @SerializedName("sold") + SOLD("sold"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") private StatusEnum status = null; @@ -167,3 +170,4 @@ public enum StatusEnum { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java index 1f9bc95113ec..46cee3c51f8e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -7,9 +7,9 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - - +/** + * SpecialModelName + */ public class SpecialModelName { @SerializedName("$special[property.name]") @@ -64,3 +64,4 @@ public class SpecialModelName { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java index d605f0195692..600acee2ba7a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java @@ -7,9 +7,9 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - - +/** + * Tag + */ public class Tag { @SerializedName("id") @@ -79,3 +79,4 @@ public class Tag { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java index a9f6b63a2f42..c8b44ce65624 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java @@ -7,9 +7,9 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - - +/** + * User + */ public class User { @SerializedName("id") @@ -170,3 +170,4 @@ public class User { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java index bcee581aa978..78cb97945058 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java @@ -3,7 +3,6 @@ package io.swagger.client.model; import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.swagger.client.model.Category; import io.swagger.client.model.Tag; import java.util.ArrayList; import java.util.List; @@ -11,85 +10,60 @@ import java.util.List; import com.google.gson.annotations.SerializedName; - - - -public class Pet { +/** + * InlineResponse200 + */ +public class InlineResponse200 { + + @SerializedName("photoUrls") + private List photoUrls = new ArrayList(); + + @SerializedName("name") + private String name = null; @SerializedName("id") private Long id = null; - + @SerializedName("category") - private Category category = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("photoUrls") - private List photoUrls = new ArrayList(); - + private Object category = null; + @SerializedName("tags") private List tags = new ArrayList(); + + /** + * pet status in the store + */ + public enum StatusEnum { + @SerializedName("available") + AVAILABLE("available"), -public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), + @SerializedName("pending") + PENDING("pending"), - @SerializedName("pending") - PENDING("pending"), + @SerializedName("sold") + SOLD("sold"); - @SerializedName("sold") - SOLD("sold"); + private String value; - private String value; + StatusEnum(String value) { + this.value = value; + } - StatusEnum(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") private StatusEnum status = null; + + /** **/ @ApiModelProperty(value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") public List getPhotoUrls() { return photoUrls; } @@ -97,6 +71,40 @@ public enum StatusEnum { this.photoUrls = photoUrls; } + + /** + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + /** + **/ + @ApiModelProperty(required = true, value = "") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + + /** + **/ + @ApiModelProperty(value = "") + public Object getCategory() { + return category; + } + public void setCategory(Object category) { + this.category = category; + } + + /** **/ @ApiModelProperty(value = "") @@ -107,6 +115,7 @@ public enum StatusEnum { this.tags = tags; } + /** * pet status in the store **/ @@ -118,6 +127,7 @@ public enum StatusEnum { this.status = status; } + @Override public boolean equals(Object o) { @@ -127,29 +137,29 @@ public enum StatusEnum { if (o == null || getClass() != o.getClass()) { return false; } - Pet pet = (Pet) o; - return Objects.equals(id, pet.id) && - Objects.equals(category, pet.category) && - Objects.equals(name, pet.name) && - Objects.equals(photoUrls, pet.photoUrls) && - Objects.equals(tags, pet.tags) && - Objects.equals(status, pet.status); + InlineResponse200 inlineResponse200 = (InlineResponse200) o; + return Objects.equals(this.photoUrls, inlineResponse200.photoUrls) && + Objects.equals(this.name, inlineResponse200.name) && + Objects.equals(this.id, inlineResponse200.id) && + Objects.equals(this.category, inlineResponse200.category) && + Objects.equals(this.tags, inlineResponse200.tags) && + Objects.equals(this.status, inlineResponse200.status); } @Override public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); + return Objects.hash(photoUrls, name, id, category, tags, status); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); + sb.append("class InlineResponse200 {\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); @@ -167,3 +177,4 @@ public enum StatusEnum { return o.toString().replace("\n", "\n "); } } + From 0310d958006337365847949e3bd4b7429664cd3b Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 27 Apr 2016 22:06:47 +0800 Subject: [PATCH 075/170] fix csharp enum issue after rebase --- .../io/swagger/codegen/DefaultCodegen.java | 6 +- .../main/resources/csharp/enumClass.mustache | 6 +- .../src/main/resources/csharp/model.mustache | 140 +-------------- .../resources/csharp/modelGeneric.mustache | 45 +++-- .../resources/csharp/modelInnerEnum.mustache | 4 +- .../src/main/resources/php/model.mustache | 2 +- ...ith-fake-endpoints-models-for-testing.yaml | 27 +++ .../Lib/SwaggerClient/README.md | 6 +- .../Lib/SwaggerClient/docs/FormatTest.md | 1 - .../main/csharp/IO/Swagger/Model/Animal.cs | 13 +- .../csharp/IO/Swagger/Model/ApiResponse.cs | 31 ++-- .../src/main/csharp/IO/Swagger/Model/Cat.cs | 19 +- .../main/csharp/IO/Swagger/Model/Category.cs | 22 +-- .../src/main/csharp/IO/Swagger/Model/Dog.cs | 19 +- .../main/csharp/IO/Swagger/Model/EnumClass.cs | 1 - .../main/csharp/IO/Swagger/Model/EnumTest.cs | 29 ++-- .../csharp/IO/Swagger/Model/FormatTest.cs | 91 ++++------ .../IO/Swagger/Model/Model200Response.cs | 17 +- .../csharp/IO/Swagger/Model/ModelReturn.cs | 17 +- .../src/main/csharp/IO/Swagger/Model/Name.cs | 52 +++--- .../src/main/csharp/IO/Swagger/Model/Order.cs | 64 +++---- .../src/main/csharp/IO/Swagger/Model/Pet.cs | 44 ++--- .../IO/Swagger/Model/SpecialModelName.cs | 16 +- .../src/main/csharp/IO/Swagger/Model/Tag.cs | 22 +-- .../src/main/csharp/IO/Swagger/Model/User.cs | 58 +++---- .../SwaggerClientTest.csproj | 2 + .../csharp/SwaggerClientTest/TestOrder.cs | 4 + ...ClientTest.csproj.FilesWrittenAbsolute.txt | 9 - .../petstore/php/SwaggerClient-php/README.md | 65 +++---- .../php/SwaggerClient-php/docs/Order.md | 4 +- .../SwaggerClient-php/lib/Model/Animal.php | 34 ++-- .../lib/Model/ApiResponse.php | 62 +++---- .../php/SwaggerClient-php/lib/Model/Cat.php | 31 ++-- .../SwaggerClient-php/lib/Model/Category.php | 37 ++-- .../php/SwaggerClient-php/lib/Model/Dog.php | 31 ++-- .../lib/Model/FormatTest.php | 164 ++++++++---------- .../lib/Model/Model200Response.php | 33 ++-- .../lib/Model/ModelReturn.php | 33 ++-- .../php/SwaggerClient-php/lib/Model/Name.php | 77 +++++--- .../php/SwaggerClient-php/lib/Model/Order.php | 65 +++---- .../php/SwaggerClient-php/lib/Model/Pet.php | 61 +++---- .../lib/Model/SpecialModelName.php | 31 ++-- .../php/SwaggerClient-php/lib/Model/Tag.php | 37 ++-- .../php/SwaggerClient-php/lib/Model/User.php | 73 ++++---- 44 files changed, 690 insertions(+), 915 deletions(-) delete mode 100644 samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt 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 3d667cd1741e..db000e9c63ed 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 @@ -1301,7 +1301,8 @@ public class DefaultCodegen { } } - if (p instanceof BaseIntegerProperty) { + // type is integer and without format + if (p instanceof BaseIntegerProperty && !(p instanceof IntegerProperty) && !(p instanceof LongProperty)) { BaseIntegerProperty sp = (BaseIntegerProperty) p; property.isInteger = true; /*if (sp.getEnum() != null) { @@ -1367,7 +1368,8 @@ public class DefaultCodegen { property.isByteArray = true; } - if (p instanceof DecimalProperty) { + // type is number and without format + if (p instanceof DecimalProperty && !(p instanceof DoubleProperty) && !(p instanceof FloatProperty)) { DecimalProperty sp = (DecimalProperty) p; property.isFloat = true; /*if (sp.getEnum() != null) { diff --git a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache index 2c853cea25cb..5249d7545777 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache @@ -9,7 +9,7 @@ /// /// Enum {{name}} for {{{value}}} /// - [EnumMember(Value = {{{value}}})] - {{name}}{{^-last}}, - {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}} + [EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})] + {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, + {{/-last}}{{/enumVars}}{{/allowableValues}} } diff --git a/modules/swagger-codegen/src/main/resources/csharp/model.mustache b/modules/swagger-codegen/src/main/resources/csharp/model.mustache index 6d0878958471..6c6ae8fdbb69 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/model.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/model.mustache @@ -13,145 +13,7 @@ using Newtonsoft.Json.Converters; {{#model}} namespace {{packageName}}.Model { - /// - /// {{description}} - /// - [DataContract] - public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}> - { {{#vars}}{{#isEnum}} - - /// - /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - /// {{#description}} - /// {{{description}}}{{/description}} - [JsonConverter(typeof(StringEnumConverter))] -{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} -{{>enumClass}}{{/items}}{{/items.isEnum}}{{/vars}} - {{#vars}}{{#isEnum}} - /// - /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - /// {{#description}} - /// {{{description}}}{{/description}} - [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] - public {{{datatypeWithEnum}}} {{name}} { get; set; } - {{/isEnum}}{{/vars}} - /// - /// Initializes a new instance of the class. - /// Initializes a new instance of the class. - /// -{{#vars}}{{^isReadOnly}} /// {{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}. -{{/isReadOnly}}{{/vars}} - public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}}) - { - {{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null) - if ({{name}} == null) - { - throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null"); - } - else - { - this.{{name}} = {{name}}; - } - {{/required}}{{/isReadOnly}}{{/vars}}{{#vars}}{{^isReadOnly}}{{^required}}{{#defaultValue}}// use default value if no "{{name}}" provided - if ({{name}} == null) - { - this.{{name}} = {{{defaultValue}}}; - } - else - { - this.{{name}} = {{name}}; - } - {{/defaultValue}}{{^defaultValue}}this.{{name}} = {{name}}; - {{/defaultValue}}{{/required}}{{/isReadOnly}}{{/vars}} - } - - {{#vars}}{{^isEnum}} - /// - /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} - /// {{#description}} - /// {{description}}{{/description}} - [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] - public {{{datatype}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; } - {{/isEnum}}{{/vars}} - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class {{classname}} {\n"); -{{#vars}} - sb.Append(" {{name}}: ").Append({{name}}).Append("\n"); -{{/vars}} - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public {{#parent}} new {{/parent}}string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as {{classname}}); - } - - /// - /// Returns true if {{classname}} instances are equal - /// - /// Instance of {{classname}} to be compared - /// Boolean - public bool Equals({{classname}} other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return {{#vars}}{{#isNotContainer}} - ( - this.{{name}} == other.{{name}} || - this.{{name}} != null && - this.{{name}}.Equals(other.{{name}}) - ){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}} - ( - this.{{name}} == other.{{name}} || - this.{{name}} != null && - this.{{name}}.SequenceEqual(other.{{name}}) - ){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}}{{^vars}}false{{/vars}}; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - {{#vars}} - if (this.{{name}} != null) - hash = hash * 59 + this.{{name}}.GetHashCode(); - {{/vars}} - return hash; - } - } - - } +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}} {{/model}} {{/models}} } diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index 8affc932a46b..6c5da5e4f56b 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -3,23 +3,35 @@ /// [DataContract] public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}> - { {{#vars}}{{#isEnum}} -{{>modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} -{{>modelInnerEnum}}{{/items}}{{/items.isEnum}}{{/vars}} - {{#vars}}{{#isEnum}} + { + {{#vars}} + {{#isEnum}} +{{>modelInnerEnum}} + {{/isEnum}} + {{#items.isEnum}} + {{#items}} +{{>modelInnerEnum}} + {{/items}} + {{/items.isEnum}} + {{/vars}} + {{#vars}} + {{#isEnum}} /// /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} /// {{#description}} /// {{{description}}}{{/description}} [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] public {{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} { get; set; } - {{/isEnum}}{{/vars}} + {{/isEnum}} + {{/vars}} /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// -{{#vars}}{{^isReadOnly}} /// {{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}. -{{/isReadOnly}}{{/vars}} + {{#vars}} + {{^isReadOnly}} + /// {{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}. + {{/isReadOnly}} + {{/vars}} public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{#hasMore}}, {{/hasMore}}{{/isReadOnly}}{{/vars}}) { {{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null) @@ -31,7 +43,9 @@ { this.{{name}} = {{name}}; } - {{/required}}{{/isReadOnly}}{{/vars}}{{#vars}}{{^isReadOnly}}{{^required}}{{#defaultValue}}// use default value if no "{{name}}" provided + {{/required}}{{/isReadOnly}}{{/vars}} + {{#vars}}{{^isReadOnly}}{{^required}} + {{#defaultValue}}// use default value if no "{{name}}" provided if ({{name}} == null) { this.{{name}} = {{{defaultValue}}}; @@ -40,18 +54,23 @@ { this.{{name}} = {{name}}; } - {{/defaultValue}}{{^defaultValue}}this.{{name}} = {{name}}; - {{/defaultValue}}{{/required}}{{/isReadOnly}}{{/vars}} + {{/defaultValue}} + {{^defaultValue}} + this.{{name}} = {{name}}; + {{/defaultValue}} + {{/required}}{{/isReadOnly}}{{/vars}} } - {{#vars}}{{^isEnum}} + {{#vars}} + {{^isEnum}} /// /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} /// {{#description}} /// {{description}}{{/description}} [DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})] public {{{datatype}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; } - {{/isEnum}}{{/vars}} + {{/isEnum}} + {{/vars}} /// /// Returns the string presentation of the object /// diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache index 4715fd071a48..5249d7545777 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelInnerEnum.mustache @@ -9,7 +9,7 @@ /// /// Enum {{name}} for {{{value}}} /// - [EnumMember(Value = {{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})] - {{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, + [EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})] + {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} } diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 7cf71a77aa71..2a7894ab860e 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -106,7 +106,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA return {{#parent}}parent::getters() + {{/parent}}self::$getters; } - {{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = "{{{value}}}"; + {{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = {{{value}}}; {{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}} {{#vars}}{{#isEnum}} diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 4160e59cc48a..cf95a2612e2b 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -899,6 +899,33 @@ definitions: format: password maxLength: 64 minLength: 10 + EnumClass: + type: string + default: '-efg' + enum: + - _abc + - '-efg' + - (xyz) + Enum_Test: + type: object + properties: + enum_string: + type: string + enum: + - UPPER + - lower + enum_integer: + type: integer + format: int32 + enum: + - 1 + - -1 + enum_number: + type: number + format: double + enum: + - 1.1 + - -1.2 externalDocs: description: Find out more about Swagger url: 'http://swagger.io' diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md index e5c57a92595a..aceb18e3396b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-05-02T22:02:29.555+08:00 +- Build date: 2016-04-27T22:04:12.906+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -54,7 +54,7 @@ namespace Example { var apiInstance = new FakeApi(); - var number = 3.4; // double? | None + var number = number_example; // string | None var _double = 1.2; // double? | None var _string = _string_example; // string | None var _byte = B; // byte[] | None @@ -117,6 +117,8 @@ Class | Method | HTTP request | Description - [IO.Swagger.Model.Cat](docs/Cat.md) - [IO.Swagger.Model.Category](docs/Category.md) - [IO.Swagger.Model.Dog](docs/Dog.md) + - [IO.Swagger.Model.EnumClass](docs/EnumClass.md) + - [IO.Swagger.Model.EnumTest](docs/EnumTest.md) - [IO.Swagger.Model.FormatTest](docs/FormatTest.md) - [IO.Swagger.Model.Model200Response](docs/Model200Response.md) - [IO.Swagger.Model.ModelReturn](docs/ModelReturn.md) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md index 7ddfad04d05e..c5dc3cf53f3b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md @@ -14,7 +14,6 @@ Name | Type | Description | Notes **Binary** | **byte[]** | | [optional] **Date** | **DateTime?** | | **DateTime** | **DateTime?** | | [optional] -**Uuid** | **Guid?** | | [optional] **Password** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs index 11d93aabd20d..f5b9a3efee0f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,14 +16,11 @@ namespace IO.Swagger.Model /// [DataContract] public partial class Animal : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// ClassName (required). - public Animal(string ClassName = null) { // to ensure "ClassName" is required (not null) @@ -37,15 +33,14 @@ namespace IO.Swagger.Model this.ClassName = ClassName; } + } - - + /// /// Gets or Sets ClassName /// [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } - /// /// Returns the string presentation of the object /// @@ -58,7 +53,7 @@ namespace IO.Swagger.Model sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs index de8b24e69e98..8a0f40369fb7 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs @@ -12,47 +12,44 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// ApiResponse /// [DataContract] public partial class ApiResponse : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// Code. /// Type. /// Message. - public ApiResponse(int? Code = null, string Type = null, string Message = null) { - this.Code = Code; - this.Type = Type; - this.Message = Message; + + + this.Code = Code; + + this.Type = Type; + + this.Message = Message; } - - + /// /// Gets or Sets Code /// [DataMember(Name="code", EmitDefaultValue=false)] public int? Code { get; set; } - /// /// Gets or Sets Type /// [DataMember(Name="type", EmitDefaultValue=false)] public string Type { get; set; } - /// /// Gets or Sets Message /// [DataMember(Name="message", EmitDefaultValue=false)] public string Message { get; set; } - /// /// Returns the string presentation of the object /// @@ -62,12 +59,12 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class ApiResponse {\n"); sb.Append(" Code: ").Append(Code).Append("\n"); - sb.Append(" Type: ").Append(Type).Append("\n"); - sb.Append(" Message: ").Append(Message).Append("\n"); +sb.Append(" Type: ").Append(Type).Append("\n"); +sb.Append(" Message: ").Append(Message).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -137,6 +134,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs index 235889c9864b..74bd81aee05f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,15 +16,12 @@ namespace IO.Swagger.Model /// [DataContract] public partial class Cat : Animal, IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// ClassName (required). /// Declawed. - public Cat(string ClassName = null, bool? Declawed = null) { // to ensure "ClassName" is required (not null) @@ -37,23 +33,22 @@ namespace IO.Swagger.Model { this.ClassName = ClassName; } - this.Declawed = Declawed; + + + this.Declawed = Declawed; } - - + /// /// Gets or Sets ClassName /// [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } - /// /// Gets or Sets Declawed /// [DataMember(Name="declawed", EmitDefaultValue=false)] public bool? Declawed { get; set; } - /// /// Returns the string presentation of the object /// @@ -63,11 +58,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Cat {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" Declawed: ").Append(Declawed).Append("\n"); +sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs index 223bec6d0ab0..51a3f971b38c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,35 +16,32 @@ namespace IO.Swagger.Model /// [DataContract] public partial class Category : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// Id. /// Name. - public Category(long? Id = null, string Name = null) { - this.Id = Id; - this.Name = Name; + + + this.Id = Id; + + this.Name = Name; } - - + /// /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] public long? Id { get; set; } - /// /// Gets or Sets Name /// [DataMember(Name="name", EmitDefaultValue=false)] public string Name { get; set; } - /// /// Returns the string presentation of the object /// @@ -55,11 +51,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Category {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); +sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs index 7fefac6e26d3..6ab8c9ad69f1 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,15 +16,12 @@ namespace IO.Swagger.Model /// [DataContract] public partial class Dog : Animal, IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// ClassName (required). /// Breed. - public Dog(string ClassName = null, string Breed = null) { // to ensure "ClassName" is required (not null) @@ -37,23 +33,22 @@ namespace IO.Swagger.Model { this.ClassName = ClassName; } - this.Breed = Breed; + + + this.Breed = Breed; } - - + /// /// Gets or Sets ClassName /// [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } - /// /// Gets or Sets Breed /// [DataMember(Name="breed", EmitDefaultValue=false)] public string Breed { get; set; } - /// /// Returns the string presentation of the object /// @@ -63,11 +58,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Dog {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" Breed: ").Append(Breed).Append("\n"); +sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs index be3b7a17c5f4..1fb5f0b66263 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs index a1fe812415d5..f8bebd6b2d76 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,7 +16,7 @@ namespace IO.Swagger.Model /// [DataContract] public partial class EnumTest : IEquatable - { + { /// /// Gets or Sets EnumString /// @@ -78,42 +77,39 @@ namespace IO.Swagger.Model NUMBER_MINUS_1_DOT_2 } - /// /// Gets or Sets EnumString /// [DataMember(Name="enum_string", EmitDefaultValue=false)] public EnumStringEnum? EnumString { get; set; } - /// /// Gets or Sets EnumInteger /// [DataMember(Name="enum_integer", EmitDefaultValue=false)] public EnumIntegerEnum? EnumInteger { get; set; } - /// /// Gets or Sets EnumNumber /// [DataMember(Name="enum_number", EmitDefaultValue=false)] public EnumNumberEnum? EnumNumber { get; set; } - /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// EnumString. /// EnumInteger. /// EnumNumber. - public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, EnumNumberEnum? EnumNumber = null) { - this.EnumString = EnumString; - this.EnumInteger = EnumInteger; - this.EnumNumber = EnumNumber; + + + this.EnumString = EnumString; + + this.EnumInteger = EnumInteger; + + this.EnumNumber = EnumNumber; } - /// /// Returns the string presentation of the object /// @@ -123,9 +119,8 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class EnumTest {\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); - sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); - +sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); +sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -190,16 +185,12 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this.EnumString != null) hash = hash * 59 + this.EnumString.GetHashCode(); - if (this.EnumInteger != null) hash = hash * 59 + this.EnumInteger.GetHashCode(); - if (this.EnumNumber != null) hash = hash * 59 + this.EnumNumber.GetHashCode(); - return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs index 49e7d1041aad..c5a99d45af05 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs @@ -12,15 +12,13 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// FormatTest /// [DataContract] public partial class FormatTest : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// Integer. /// Int32. @@ -33,10 +31,8 @@ namespace IO.Swagger.Model /// Binary. /// Date (required). /// DateTime. - /// Uuid. /// Password (required). - - public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, Guid? Uuid = null, string Password = null) + public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, string Password = null) { // to ensure "Number" is required (not null) if (Number == null) @@ -74,97 +70,86 @@ namespace IO.Swagger.Model { this.Password = Password; } - this.Integer = Integer; - this.Int32 = Int32; - this.Int64 = Int64; - this._Float = _Float; - this._Double = _Double; - this._String = _String; - this.Binary = Binary; - this.DateTime = DateTime; - this.Uuid = Uuid; + + + this.Integer = Integer; + + this.Int32 = Int32; + + this.Int64 = Int64; + + this._Float = _Float; + + this._Double = _Double; + + this._String = _String; + + this.Binary = Binary; + + this.DateTime = DateTime; } - - + /// /// Gets or Sets Integer /// [DataMember(Name="integer", EmitDefaultValue=false)] public int? Integer { get; set; } - /// /// Gets or Sets Int32 /// [DataMember(Name="int32", EmitDefaultValue=false)] public int? Int32 { get; set; } - /// /// Gets or Sets Int64 /// [DataMember(Name="int64", EmitDefaultValue=false)] public long? Int64 { get; set; } - /// /// Gets or Sets Number /// [DataMember(Name="number", EmitDefaultValue=false)] public double? Number { get; set; } - /// /// Gets or Sets _Float /// [DataMember(Name="float", EmitDefaultValue=false)] public float? _Float { get; set; } - /// /// Gets or Sets _Double /// [DataMember(Name="double", EmitDefaultValue=false)] public double? _Double { get; set; } - /// /// Gets or Sets _String /// [DataMember(Name="string", EmitDefaultValue=false)] public string _String { get; set; } - /// /// Gets or Sets _Byte /// [DataMember(Name="byte", EmitDefaultValue=false)] public byte[] _Byte { get; set; } - /// /// Gets or Sets Binary /// [DataMember(Name="binary", EmitDefaultValue=false)] public byte[] Binary { get; set; } - /// /// Gets or Sets Date /// [DataMember(Name="date", EmitDefaultValue=false)] public DateTime? Date { get; set; } - /// /// Gets or Sets DateTime /// [DataMember(Name="dateTime", EmitDefaultValue=false)] public DateTime? DateTime { get; set; } - - /// - /// Gets or Sets Uuid - /// - [DataMember(Name="uuid", EmitDefaultValue=false)] - public Guid? Uuid { get; set; } - /// /// Gets or Sets Password /// [DataMember(Name="password", EmitDefaultValue=false)] public string Password { get; set; } - /// /// Returns the string presentation of the object /// @@ -174,22 +159,21 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class FormatTest {\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Int32: ").Append(Int32).Append("\n"); - sb.Append(" Int64: ").Append(Int64).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" _Float: ").Append(_Float).Append("\n"); - sb.Append(" _Double: ").Append(_Double).Append("\n"); - sb.Append(" _String: ").Append(_String).Append("\n"); - sb.Append(" _Byte: ").Append(_Byte).Append("\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); - sb.Append(" Date: ").Append(Date).Append("\n"); - sb.Append(" DateTime: ").Append(DateTime).Append("\n"); - sb.Append(" Uuid: ").Append(Uuid).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); +sb.Append(" Int32: ").Append(Int32).Append("\n"); +sb.Append(" Int64: ").Append(Int64).Append("\n"); +sb.Append(" Number: ").Append(Number).Append("\n"); +sb.Append(" _Float: ").Append(_Float).Append("\n"); +sb.Append(" _Double: ").Append(_Double).Append("\n"); +sb.Append(" _String: ").Append(_String).Append("\n"); +sb.Append(" _Byte: ").Append(_Byte).Append("\n"); +sb.Append(" Binary: ").Append(Binary).Append("\n"); +sb.Append(" Date: ").Append(Date).Append("\n"); +sb.Append(" DateTime: ").Append(DateTime).Append("\n"); +sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -277,11 +261,6 @@ namespace IO.Swagger.Model this.DateTime != null && this.DateTime.Equals(other.DateTime) ) && - ( - this.Uuid == other.Uuid || - this.Uuid != null && - this.Uuid.Equals(other.Uuid) - ) && ( this.Password == other.Password || this.Password != null && @@ -322,13 +301,11 @@ namespace IO.Swagger.Model hash = hash * 59 + this.Date.GetHashCode(); if (this.DateTime != null) hash = hash * 59 + this.DateTime.GetHashCode(); - if (this.Uuid != null) - hash = hash * 59 + this.Uuid.GetHashCode(); if (this.Password != null) hash = hash * 59 + this.Password.GetHashCode(); return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs index 52a19ff2f225..cec5ee75e2fd 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -13,31 +12,28 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// Model200Response + /// Model for testing model name starting with number /// [DataContract] public partial class Model200Response : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// Name. - public Model200Response(int? Name = null) { - this.Name = Name; + + + this.Name = Name; } - /// /// Gets or Sets Name /// [DataMember(Name="name", EmitDefaultValue=false)] public int? Name { get; set; } - /// /// Returns the string presentation of the object /// @@ -47,7 +43,6 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Model200Response {\n"); sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append("}\n"); return sb.ToString(); } @@ -102,10 +97,8 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this.Name != null) hash = hash * 59 + this.Name.GetHashCode(); - return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs index 3b74f1ba729d..3cfa6c0a77eb 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -13,31 +12,28 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// ModelReturn + /// Model for testing reserved words /// [DataContract] public partial class ModelReturn : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// _Return. - public ModelReturn(int? _Return = null) { - this._Return = _Return; + + + this._Return = _Return; } - /// /// Gets or Sets _Return /// [DataMember(Name="return", EmitDefaultValue=false)] public int? _Return { get; set; } - /// /// Returns the string presentation of the object /// @@ -47,7 +43,6 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class ModelReturn {\n"); sb.Append(" _Return: ").Append(_Return).Append("\n"); - sb.Append("}\n"); return sb.ToString(); } @@ -102,10 +97,8 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this._Return != null) hash = hash * 59 + this._Return.GetHashCode(); - return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs index 01592253e246..b0e819fec201 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -13,39 +12,48 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// Name + /// Model for testing model name same as property name /// [DataContract] public partial class Name : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// - /// _Name. - /// SnakeCase. - - public Name(int? _Name = null, int? SnakeCase = null) + /// _Name (required). + /// Property. + public Name(int? _Name = null, string Property = null) { - this._Name = _Name; - this.SnakeCase = SnakeCase; + // to ensure "_Name" is required (not null) + if (_Name == null) + { + throw new InvalidDataException("_Name is a required property for Name and cannot be null"); + } + else + { + this._Name = _Name; + } + + + this.Property = Property; } - /// /// Gets or Sets _Name /// [DataMember(Name="name", EmitDefaultValue=false)] public int? _Name { get; set; } - /// /// Gets or Sets SnakeCase /// [DataMember(Name="snake_case", EmitDefaultValue=false)] - public int? SnakeCase { get; set; } - + public int? SnakeCase { get; private set; } + /// + /// Gets or Sets Property + /// + [DataMember(Name="property", EmitDefaultValue=false)] + public string Property { get; set; } /// /// Returns the string presentation of the object /// @@ -55,8 +63,8 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Name {\n"); sb.Append(" _Name: ").Append(_Name).Append("\n"); - sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); - +sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); +sb.Append(" Property: ").Append(Property).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -102,6 +110,11 @@ namespace IO.Swagger.Model this.SnakeCase == other.SnakeCase || this.SnakeCase != null && this.SnakeCase.Equals(other.SnakeCase) + ) && + ( + this.Property == other.Property || + this.Property != null && + this.Property.Equals(other.Property) ); } @@ -116,13 +129,12 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this._Name != null) hash = hash * 59 + this._Name.GetHashCode(); - if (this.SnakeCase != null) hash = hash * 59 + this.SnakeCase.GetHashCode(); - + if (this.Property != null) + hash = hash * 59 + this.Property.GetHashCode(); return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs index 5561095be767..652128a33a1f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,7 +16,7 @@ namespace IO.Swagger.Model /// [DataContract] public partial class Order : IEquatable - { + { /// /// Order Status /// @@ -45,73 +44,72 @@ namespace IO.Swagger.Model Delivered } - /// /// Order Status /// /// Order Status [DataMember(Name="status", EmitDefaultValue=false)] public StatusEnum? Status { get; set; } - /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// + /// Id. /// PetId. /// Quantity. /// ShipDate. - /// Order Status (default to StatusEnum.Placed). - /// Complete. - - public Order(long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) + /// Order Status. + /// Complete (default to false). + public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) { - this.PetId = PetId; - this.Quantity = Quantity; - this.ShipDate = ShipDate; - // use default value if no "Status" provided - if (Status == null) + + + this.Id = Id; + + this.PetId = PetId; + + this.Quantity = Quantity; + + this.ShipDate = ShipDate; + + this.Status = Status; + + // use default value if no "Complete" provided + if (Complete == null) { - this.Status = StatusEnum.Placed; + this.Complete = false; } else { - this.Status = Status; + this.Complete = Complete; } - this.Complete = Complete; } - /// /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; private set; } - + public long? Id { get; set; } /// /// Gets or Sets PetId /// [DataMember(Name="petId", EmitDefaultValue=false)] public long? PetId { get; set; } - /// /// Gets or Sets Quantity /// [DataMember(Name="quantity", EmitDefaultValue=false)] public int? Quantity { get; set; } - /// /// Gets or Sets ShipDate /// [DataMember(Name="shipDate", EmitDefaultValue=false)] public DateTime? ShipDate { get; set; } - /// /// Gets or Sets Complete /// [DataMember(Name="complete", EmitDefaultValue=false)] public bool? Complete { get; set; } - /// /// Returns the string presentation of the object /// @@ -121,12 +119,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Order {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" PetId: ").Append(PetId).Append("\n"); - sb.Append(" Quantity: ").Append(Quantity).Append("\n"); - sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" Complete: ").Append(Complete).Append("\n"); - +sb.Append(" PetId: ").Append(PetId).Append("\n"); +sb.Append(" Quantity: ").Append(Quantity).Append("\n"); +sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); +sb.Append(" Status: ").Append(Status).Append("\n"); +sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -206,25 +203,18 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this.Id != null) hash = hash * 59 + this.Id.GetHashCode(); - if (this.PetId != null) hash = hash * 59 + this.PetId.GetHashCode(); - if (this.Quantity != null) hash = hash * 59 + this.Quantity.GetHashCode(); - if (this.ShipDate != null) hash = hash * 59 + this.ShipDate.GetHashCode(); - if (this.Status != null) hash = hash * 59 + this.Status.GetHashCode(); - if (this.Complete != null) hash = hash * 59 + this.Complete.GetHashCode(); - return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs index db790ad8ab1e..420ab138b071 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,7 +16,7 @@ namespace IO.Swagger.Model /// [DataContract] public partial class Pet : IEquatable - { + { /// /// pet status in the store /// @@ -45,17 +44,14 @@ namespace IO.Swagger.Model Sold } - /// /// pet status in the store /// /// pet status in the store [DataMember(Name="status", EmitDefaultValue=false)] public StatusEnum? Status { get; set; } - /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// Id. /// Category. @@ -63,7 +59,6 @@ namespace IO.Swagger.Model /// PhotoUrls (required). /// Tags. /// pet status in the store. - public Pet(long? Id = null, Category Category = null, string Name = null, List PhotoUrls = null, List Tags = null, StatusEnum? Status = null) { // to ensure "Name" is required (not null) @@ -84,44 +79,43 @@ namespace IO.Swagger.Model { this.PhotoUrls = PhotoUrls; } - this.Id = Id; - this.Category = Category; - this.Tags = Tags; - this.Status = Status; + + + this.Id = Id; + + this.Category = Category; + + this.Tags = Tags; + + this.Status = Status; } - /// /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] public long? Id { get; set; } - /// /// Gets or Sets Category /// [DataMember(Name="category", EmitDefaultValue=false)] public Category Category { get; set; } - /// /// Gets or Sets Name /// [DataMember(Name="name", EmitDefaultValue=false)] public string Name { get; set; } - /// /// Gets or Sets PhotoUrls /// [DataMember(Name="photoUrls", EmitDefaultValue=false)] public List PhotoUrls { get; set; } - /// /// Gets or Sets Tags /// [DataMember(Name="tags", EmitDefaultValue=false)] public List Tags { get; set; } - /// /// Returns the string presentation of the object /// @@ -131,12 +125,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Pet {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); - sb.Append(" Tags: ").Append(Tags).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - +sb.Append(" Category: ").Append(Category).Append("\n"); +sb.Append(" Name: ").Append(Name).Append("\n"); +sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); +sb.Append(" Tags: ").Append(Tags).Append("\n"); +sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -216,25 +209,18 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this.Id != null) hash = hash * 59 + this.Id.GetHashCode(); - if (this.Category != null) hash = hash * 59 + this.Category.GetHashCode(); - if (this.Name != null) hash = hash * 59 + this.Name.GetHashCode(); - if (this.PhotoUrls != null) hash = hash * 59 + this.PhotoUrls.GetHashCode(); - if (this.Tags != null) hash = hash * 59 + this.Tags.GetHashCode(); - if (this.Status != null) hash = hash * 59 + this.Status.GetHashCode(); - return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs index 17451359d82a..68a92724b1f0 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,27 +16,24 @@ namespace IO.Swagger.Model /// [DataContract] public partial class SpecialModelName : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// SpecialPropertyName. - public SpecialModelName(long? SpecialPropertyName = null) { - this.SpecialPropertyName = SpecialPropertyName; + + + this.SpecialPropertyName = SpecialPropertyName; } - - + /// /// Gets or Sets SpecialPropertyName /// [DataMember(Name="$special[property.name]", EmitDefaultValue=false)] public long? SpecialPropertyName { get; set; } - /// /// Returns the string presentation of the object /// @@ -50,7 +46,7 @@ namespace IO.Swagger.Model sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs index 93c7b4deb06d..ffb42e09df97 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,35 +16,32 @@ namespace IO.Swagger.Model /// [DataContract] public partial class Tag : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// Id. /// Name. - public Tag(long? Id = null, string Name = null) { - this.Id = Id; - this.Name = Name; + + + this.Id = Id; + + this.Name = Name; } - - + /// /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] public long? Id { get; set; } - /// /// Gets or Sets Name /// [DataMember(Name="name", EmitDefaultValue=false)] public string Name { get; set; } - /// /// Returns the string presentation of the object /// @@ -55,11 +51,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Tag {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); +sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs index 3336da10d73a..3931afbf0f84 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs @@ -5,7 +5,6 @@ using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -17,11 +16,9 @@ namespace IO.Swagger.Model /// [DataContract] public partial class User : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// Id. /// Username. @@ -31,70 +28,69 @@ namespace IO.Swagger.Model /// Password. /// Phone. /// User Status. - public User(long? Id = null, string Username = null, string FirstName = null, string LastName = null, string Email = null, string Password = null, string Phone = null, int? UserStatus = null) { - this.Id = Id; - this.Username = Username; - this.FirstName = FirstName; - this.LastName = LastName; - this.Email = Email; - this.Password = Password; - this.Phone = Phone; - this.UserStatus = UserStatus; + + + this.Id = Id; + + this.Username = Username; + + this.FirstName = FirstName; + + this.LastName = LastName; + + this.Email = Email; + + this.Password = Password; + + this.Phone = Phone; + + this.UserStatus = UserStatus; } - - + /// /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] public long? Id { get; set; } - /// /// Gets or Sets Username /// [DataMember(Name="username", EmitDefaultValue=false)] public string Username { get; set; } - /// /// Gets or Sets FirstName /// [DataMember(Name="firstName", EmitDefaultValue=false)] public string FirstName { get; set; } - /// /// Gets or Sets LastName /// [DataMember(Name="lastName", EmitDefaultValue=false)] public string LastName { get; set; } - /// /// Gets or Sets Email /// [DataMember(Name="email", EmitDefaultValue=false)] public string Email { get; set; } - /// /// Gets or Sets Password /// [DataMember(Name="password", EmitDefaultValue=false)] public string Password { get; set; } - /// /// Gets or Sets Phone /// [DataMember(Name="phone", EmitDefaultValue=false)] public string Phone { get; set; } - /// /// User Status /// /// User Status [DataMember(Name="userStatus", EmitDefaultValue=false)] public int? UserStatus { get; set; } - /// /// Returns the string presentation of the object /// @@ -104,17 +100,17 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class User {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Username: ").Append(Username).Append("\n"); - sb.Append(" FirstName: ").Append(FirstName).Append("\n"); - sb.Append(" LastName: ").Append(LastName).Append("\n"); - sb.Append(" Email: ").Append(Email).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" Phone: ").Append(Phone).Append("\n"); - sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); +sb.Append(" Username: ").Append(Username).Append("\n"); +sb.Append(" FirstName: ").Append(FirstName).Append("\n"); +sb.Append(" LastName: ").Append(LastName).Append("\n"); +sb.Append(" Email: ").Append(Email).Append("\n"); +sb.Append(" Password: ").Append(Password).Append("\n"); +sb.Append(" Phone: ").Append(Phone).Append("\n"); +sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index 0d3c33168db3..389c142e1bdb 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -72,6 +72,8 @@ + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs index e7bf8428eec2..59411416a760 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs @@ -73,6 +73,9 @@ namespace SwaggerClientTest.TestOrder } + /* + * Skip the following test as the fake endpiont has been removed from the swagger spec + * We'll uncomment below after we update the Petstore server /// /// Test TestGetInventoryInObject /// @@ -93,6 +96,7 @@ namespace SwaggerClientTest.TestOrder Assert.IsInstanceOf (typeof(int?), Int32.Parse(entry.Value)); } } + */ /// /// Test Enum diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt deleted file mode 100644 index 7d68ff048e5d..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt +++ /dev/null @@ -1,9 +0,0 @@ -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll -/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 3082b7f1847f..a0db472b07fc 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 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 spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. 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-04-06T21:53:32.791+08:00 +- Build date: 2016-04-27T17:54:12.143+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -58,16 +58,24 @@ 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 +$api_instance = new Swagger\Client\Api\FakeApi(); +$number = "number_example"; // string | None +$double = 1.2; // double | None +$string = "string_example"; // string | None +$byte = "B"; // string | None +$integer = 56; // int | None +$int32 = 56; // int | None +$int64 = 789; // int | None +$float = 3.4; // float | None +$binary = "B"; // string | None +$date = new \DateTime(); // \DateTime | None +$date_time = new \DateTime(); // \DateTime | None +$password = "password_example"; // string | None try { - $api_instance->addPet($body); + $api_instance->testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); } catch (Exception $e) { - echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), "\n"; + echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), "\n"; } ?> @@ -79,21 +87,17 @@ 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 @@ -109,12 +113,13 @@ 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) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) - - [InlineResponse200](docs/InlineResponse200.md) + - [FormatTest](docs/FormatTest.md) - [Model200Response](docs/Model200Response.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) @@ -128,45 +133,17 @@ 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 -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Authorization 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/docs/Order.md b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md index cde24fe43cc4..ddae5cc2b571 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md @@ -7,8 +7,8 @@ Name | Type | Description | Notes **pet_id** | **int** | | [optional] **quantity** | **int** | | [optional] **ship_date** | [**\DateTime**](\DateTime.md) | | [optional] -**status** | **string** | Order Status | [optional] [default to STATUS_PLACED] -**complete** | **bool** | | [optional] +**status** | **string** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php index e41c38c535a3..12224679ac76 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -47,9 +47,15 @@ use \ArrayAccess; class Animal implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'Animal'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'class_name' => 'string' ); @@ -98,13 +104,11 @@ class Animal implements ArrayAccess - /** * $class_name * @var string */ protected $class_name; - /** * Constructor @@ -113,13 +117,16 @@ 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. + * Gets class_name * @return string */ public function getClassName() @@ -128,7 +135,7 @@ class Animal implements ArrayAccess } /** - * Sets class_name. + * Sets class_name * @param string $class_name * @return $this */ @@ -138,7 +145,6 @@ class Animal implements ArrayAccess $this->class_name = $class_name; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -181,17 +187,15 @@ class Animal implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 4f467a5aab55..1e96648c7c17 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -61,67 +61,71 @@ class ApiResponse implements ArrayAccess 'type' => 'string', 'message' => '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[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'code' => 'code', 'type' => 'type', 'message' => 'message' ); - + static function attributeMap() { return self::$attributeMap; } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'code' => 'setCode', 'type' => 'setType', 'message' => 'setMessage' ); - + static function setters() { return self::$setters; } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'code' => 'getCode', 'type' => 'getType', 'message' => 'getMessage' ); - + static function getters() { return self::$getters; } + + + + /** - * $code - * @var int - */ + * $code + * @var int + */ protected $code; /** - * $type - * @var string - */ + * $type + * @var string + */ protected $type; /** - * $message - * @var string - */ + * $message + * @var string + */ protected $message; /** @@ -146,7 +150,7 @@ class ApiResponse implements ArrayAccess { return $this->code; } - + /** * Sets code * @param int $code @@ -166,7 +170,7 @@ class ApiResponse implements ArrayAccess { return $this->type; } - + /** * Sets type * @param string $type @@ -186,7 +190,7 @@ class ApiResponse implements ArrayAccess { return $this->message; } - + /** * Sets message * @param string $message @@ -207,7 +211,7 @@ class ApiResponse implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -217,7 +221,7 @@ class ApiResponse implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -228,7 +232,7 @@ class ApiResponse implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -238,7 +242,7 @@ class ApiResponse implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string 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 078b57049ec6..cf85b9fb5bc8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -47,9 +47,15 @@ use \ArrayAccess; class Cat extends Animal implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'Cat'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'declawed' => 'bool' ); @@ -98,13 +104,11 @@ class Cat extends Animal implements ArrayAccess - /** * $declawed * @var bool */ protected $declawed; - /** * Constructor @@ -113,13 +117,13 @@ class Cat extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); + if ($data != null) { $this->declawed = $data["declawed"]; } } - /** - * Gets declawed. + * Gets declawed * @return bool */ public function getDeclawed() @@ -128,7 +132,7 @@ class Cat extends Animal implements ArrayAccess } /** - * Sets declawed. + * Sets declawed * @param bool $declawed * @return $this */ @@ -138,7 +142,6 @@ class Cat extends Animal implements ArrayAccess $this->declawed = $declawed; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -181,17 +184,15 @@ class Cat extends Animal implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 b2fd2c3c3d6f..ddc52637051d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -47,9 +47,15 @@ use \ArrayAccess; class Category implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'Category'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'name' => 'string' @@ -102,19 +108,16 @@ class Category implements ArrayAccess - /** * $id * @var int */ protected $id; - /** * $name * @var string */ protected $name; - /** * Constructor @@ -123,14 +126,14 @@ class Category implements ArrayAccess public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->name = $data["name"]; } } - /** - * Gets id. + * Gets id * @return int */ public function getId() @@ -139,7 +142,7 @@ class Category implements ArrayAccess } /** - * Sets id. + * Sets id * @param int $id * @return $this */ @@ -149,9 +152,8 @@ class Category implements ArrayAccess $this->id = $id; return $this; } - /** - * Gets name. + * Gets name * @return string */ public function getName() @@ -160,7 +162,7 @@ class Category implements ArrayAccess } /** - * Sets name. + * Sets name * @param string $name * @return $this */ @@ -170,7 +172,6 @@ class Category implements ArrayAccess $this->name = $name; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -213,17 +214,15 @@ class Category implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 c854b06a9371..15b5c22e0ce2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -47,9 +47,15 @@ use \ArrayAccess; class Dog extends Animal implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'Dog'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'breed' => 'string' ); @@ -98,13 +104,11 @@ class Dog extends Animal implements ArrayAccess - /** * $breed * @var string */ protected $breed; - /** * Constructor @@ -113,13 +117,13 @@ class Dog extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); + if ($data != null) { $this->breed = $data["breed"]; } } - /** - * Gets breed. + * Gets breed * @return string */ public function getBreed() @@ -128,7 +132,7 @@ class Dog extends Animal implements ArrayAccess } /** - * Sets breed. + * Sets breed * @param string $breed * @return $this */ @@ -138,7 +142,6 @@ class Dog extends Animal implements ArrayAccess $this->breed = $breed; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -181,17 +184,15 @@ class Dog extends Animal implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 78c0d8124474..6888cac7cd35 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -68,18 +68,17 @@ class FormatTest implements ArrayAccess 'binary' => 'string', 'date' => '\DateTime', 'date_time' => '\DateTime', - 'uuid' => 'string', 'password' => '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[] - */ + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ static $attributeMap = array( 'integer' => 'integer', 'int32' => 'int32', @@ -92,18 +91,17 @@ class FormatTest implements ArrayAccess 'binary' => 'binary', 'date' => 'date', 'date_time' => 'dateTime', - 'uuid' => 'uuid', 'password' => 'password' ); - + static function attributeMap() { return self::$attributeMap; } /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ static $setters = array( 'integer' => 'setInteger', 'int32' => 'setInt32', @@ -116,18 +114,17 @@ class FormatTest implements ArrayAccess 'binary' => 'setBinary', 'date' => 'setDate', 'date_time' => 'setDateTime', - 'uuid' => 'setUuid', 'password' => 'setPassword' ); - + static function setters() { return self::$setters; } /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ static $getters = array( 'integer' => 'getInteger', 'int32' => 'getInt32', @@ -140,78 +137,76 @@ class FormatTest implements ArrayAccess 'binary' => 'getBinary', 'date' => 'getDate', 'date_time' => 'getDateTime', - 'uuid' => 'getUuid', 'password' => 'getPassword' ); - + static function getters() { return self::$getters; } + + + + /** - * $integer - * @var int - */ + * $integer + * @var int + */ protected $integer; /** - * $int32 - * @var int - */ + * $int32 + * @var int + */ protected $int32; /** - * $int64 - * @var int - */ + * $int64 + * @var int + */ protected $int64; /** - * $number - * @var float - */ + * $number + * @var float + */ protected $number; /** - * $float - * @var float - */ + * $float + * @var float + */ protected $float; /** - * $double - * @var double - */ + * $double + * @var double + */ protected $double; /** - * $string - * @var string - */ + * $string + * @var string + */ protected $string; /** - * $byte - * @var string - */ + * $byte + * @var string + */ protected $byte; /** - * $binary - * @var string - */ + * $binary + * @var string + */ protected $binary; /** - * $date - * @var \DateTime - */ + * $date + * @var \DateTime + */ protected $date; /** - * $date_time - * @var \DateTime - */ + * $date_time + * @var \DateTime + */ protected $date_time; /** - * $uuid - * @var string - */ - protected $uuid; - /** - * $password - * @var string - */ + * $password + * @var string + */ protected $password; /** @@ -234,7 +229,6 @@ class FormatTest implements ArrayAccess $this->binary = $data["binary"]; $this->date = $data["date"]; $this->date_time = $data["date_time"]; - $this->uuid = $data["uuid"]; $this->password = $data["password"]; } } @@ -246,7 +240,7 @@ class FormatTest implements ArrayAccess { return $this->integer; } - + /** * Sets integer * @param int $integer @@ -266,7 +260,7 @@ class FormatTest implements ArrayAccess { return $this->int32; } - + /** * Sets int32 * @param int $int32 @@ -286,7 +280,7 @@ class FormatTest implements ArrayAccess { return $this->int64; } - + /** * Sets int64 * @param int $int64 @@ -306,7 +300,7 @@ class FormatTest implements ArrayAccess { return $this->number; } - + /** * Sets number * @param float $number @@ -326,7 +320,7 @@ class FormatTest implements ArrayAccess { return $this->float; } - + /** * Sets float * @param float $float @@ -346,7 +340,7 @@ class FormatTest implements ArrayAccess { return $this->double; } - + /** * Sets double * @param double $double @@ -366,7 +360,7 @@ class FormatTest implements ArrayAccess { return $this->string; } - + /** * Sets string * @param string $string @@ -386,7 +380,7 @@ class FormatTest implements ArrayAccess { return $this->byte; } - + /** * Sets byte * @param string $byte @@ -406,7 +400,7 @@ class FormatTest implements ArrayAccess { return $this->binary; } - + /** * Sets binary * @param string $binary @@ -426,7 +420,7 @@ class FormatTest implements ArrayAccess { return $this->date; } - + /** * Sets date * @param \DateTime $date @@ -446,7 +440,7 @@ class FormatTest implements ArrayAccess { return $this->date_time; } - + /** * Sets date_time * @param \DateTime $date_time @@ -458,26 +452,6 @@ class FormatTest implements ArrayAccess $this->date_time = $date_time; return $this; } - /** - * Gets uuid - * @return string - */ - public function getUuid() - { - return $this->uuid; - } - - /** - * Sets uuid - * @param string $uuid - * @return $this - */ - public function setUuid($uuid) - { - - $this->uuid = $uuid; - return $this; - } /** * Gets password * @return string @@ -486,7 +460,7 @@ class FormatTest implements ArrayAccess { return $this->password; } - + /** * Sets password * @param string $password @@ -507,7 +481,7 @@ class FormatTest implements ArrayAccess { return isset($this->$offset); } - + /** * Gets offset. * @param integer $offset Offset @@ -517,7 +491,7 @@ class FormatTest implements ArrayAccess { return $this->$offset; } - + /** * Sets value based on offset. * @param integer $offset Offset @@ -528,7 +502,7 @@ class FormatTest implements ArrayAccess { $this->$offset = $value; } - + /** * Unsets offset. * @param integer $offset Offset @@ -538,7 +512,7 @@ class FormatTest implements ArrayAccess { unset($this->$offset); } - + /** * Gets the string presentation of the object * @return string 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 8ea916fcc1e0..fd305916a2d9 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 + * @description Model for testing model name starting with number * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 @@ -47,9 +47,15 @@ use \ArrayAccess; class Model200Response implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = '200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'name' => 'int' ); @@ -98,13 +104,11 @@ class Model200Response implements ArrayAccess - /** * $name * @var int */ protected $name; - /** * Constructor @@ -113,13 +117,13 @@ class Model200Response implements ArrayAccess public function __construct(array $data = null) { + if ($data != null) { $this->name = $data["name"]; } } - /** - * Gets name. + * Gets name * @return int */ public function getName() @@ -128,7 +132,7 @@ class Model200Response implements ArrayAccess } /** - * Sets name. + * Sets name * @param int $name * @return $this */ @@ -138,7 +142,6 @@ class Model200Response implements ArrayAccess $this->name = $name; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -181,17 +184,15 @@ class Model200Response implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 1453c1a947ae..a7e36a143654 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 + * @description Model for testing reserved words * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 @@ -47,9 +47,15 @@ use \ArrayAccess; class ModelReturn implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'Return'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'return' => 'int' ); @@ -98,13 +104,11 @@ class ModelReturn implements ArrayAccess - /** * $return * @var int */ protected $return; - /** * Constructor @@ -113,13 +117,13 @@ class ModelReturn implements ArrayAccess public function __construct(array $data = null) { + if ($data != null) { $this->return = $data["return"]; } } - /** - * Gets return. + * Gets return * @return int */ public function getReturn() @@ -128,7 +132,7 @@ class ModelReturn implements ArrayAccess } /** - * Sets return. + * Sets return * @param int $return * @return $this */ @@ -138,7 +142,6 @@ class ModelReturn implements ArrayAccess $this->return = $return; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -181,17 +184,15 @@ class ModelReturn implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 a9a5b42831b0..ff62e4f1c25e 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 + * @description Model for testing model name same as property name * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 @@ -47,12 +47,19 @@ use \ArrayAccess; class Name implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * 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' + 'snake_case' => 'int', + 'property' => 'string' ); static function swaggerTypes() { @@ -65,7 +72,8 @@ class Name implements ArrayAccess */ static $attributeMap = array( 'name' => 'name', - 'snake_case' => 'snake_case' + 'snake_case' => 'snake_case', + 'property' => 'property' ); static function attributeMap() { @@ -78,7 +86,8 @@ class Name implements ArrayAccess */ static $setters = array( 'name' => 'setName', - 'snake_case' => 'setSnakeCase' + 'snake_case' => 'setSnakeCase', + 'property' => 'setProperty' ); static function setters() { @@ -91,7 +100,8 @@ class Name implements ArrayAccess */ static $getters = array( 'name' => 'getName', - 'snake_case' => 'getSnakeCase' + 'snake_case' => 'getSnakeCase', + 'property' => 'getProperty' ); static function getters() { @@ -102,19 +112,21 @@ class Name implements ArrayAccess - /** * $name * @var int */ protected $name; - /** * $snake_case * @var int */ protected $snake_case; - + /** + * $property + * @var string + */ + protected $property; /** * Constructor @@ -123,14 +135,15 @@ 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. + * Gets name * @return int */ public function getName() @@ -139,7 +152,7 @@ class Name implements ArrayAccess } /** - * Sets name. + * Sets name * @param int $name * @return $this */ @@ -149,9 +162,8 @@ class Name implements ArrayAccess $this->name = $name; return $this; } - /** - * Gets snake_case. + * Gets snake_case * @return int */ public function getSnakeCase() @@ -160,7 +172,7 @@ class Name implements ArrayAccess } /** - * Sets snake_case. + * Sets snake_case * @param int $snake_case * @return $this */ @@ -170,7 +182,26 @@ 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 @@ -213,17 +244,15 @@ class Name implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 e2983766141c..270a53a41e74 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -47,9 +47,15 @@ use \ArrayAccess; class Order implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'Order'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'pet_id' => 'int', @@ -133,43 +139,36 @@ class Order implements ArrayAccess } - /** * $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 = STATUS_PLACED; - + protected $status; /** * $complete * @var bool */ - protected $complete; - + protected $complete = false; /** * Constructor @@ -178,6 +177,7 @@ class Order implements ArrayAccess public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->pet_id = $data["pet_id"]; @@ -187,9 +187,8 @@ class Order implements ArrayAccess $this->complete = $data["complete"]; } } - /** - * Gets id. + * Gets id * @return int */ public function getId() @@ -198,7 +197,7 @@ class Order implements ArrayAccess } /** - * Sets id. + * Sets id * @param int $id * @return $this */ @@ -208,9 +207,8 @@ class Order implements ArrayAccess $this->id = $id; return $this; } - /** - * Gets pet_id. + * Gets pet_id * @return int */ public function getPetId() @@ -219,7 +217,7 @@ class Order implements ArrayAccess } /** - * Sets pet_id. + * Sets pet_id * @param int $pet_id * @return $this */ @@ -229,9 +227,8 @@ class Order implements ArrayAccess $this->pet_id = $pet_id; return $this; } - /** - * Gets quantity. + * Gets quantity * @return int */ public function getQuantity() @@ -240,7 +237,7 @@ class Order implements ArrayAccess } /** - * Sets quantity. + * Sets quantity * @param int $quantity * @return $this */ @@ -250,9 +247,8 @@ class Order implements ArrayAccess $this->quantity = $quantity; return $this; } - /** - * Gets ship_date. + * Gets ship_date * @return \DateTime */ public function getShipDate() @@ -261,7 +257,7 @@ class Order implements ArrayAccess } /** - * Sets ship_date. + * Sets ship_date * @param \DateTime $ship_date * @return $this */ @@ -271,9 +267,8 @@ class Order implements ArrayAccess $this->ship_date = $ship_date; return $this; } - /** - * Gets status. + * Gets status * @return string */ public function getStatus() @@ -282,7 +277,7 @@ class Order implements ArrayAccess } /** - * Sets status. + * Sets status * @param string $status Order Status * @return $this */ @@ -295,9 +290,8 @@ class Order implements ArrayAccess $this->status = $status; return $this; } - /** - * Gets complete. + * Gets complete * @return bool */ public function getComplete() @@ -306,7 +300,7 @@ class Order implements ArrayAccess } /** - * Sets complete. + * Sets complete * @param bool $complete * @return $this */ @@ -316,7 +310,6 @@ class Order implements ArrayAccess $this->complete = $complete; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -359,17 +352,15 @@ class Order implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 3f717048b0ac..ce1d7a63944d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -47,9 +47,15 @@ use \ArrayAccess; class Pet implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'Pet'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'category' => '\Swagger\Client\Model\Category', @@ -133,43 +139,36 @@ class Pet implements ArrayAccess } - /** * $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 @@ -178,6 +177,7 @@ class Pet implements ArrayAccess public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->category = $data["category"]; @@ -187,9 +187,8 @@ class Pet implements ArrayAccess $this->status = $data["status"]; } } - /** - * Gets id. + * Gets id * @return int */ public function getId() @@ -198,7 +197,7 @@ class Pet implements ArrayAccess } /** - * Sets id. + * Sets id * @param int $id * @return $this */ @@ -208,9 +207,8 @@ class Pet implements ArrayAccess $this->id = $id; return $this; } - /** - * Gets category. + * Gets category * @return \Swagger\Client\Model\Category */ public function getCategory() @@ -219,7 +217,7 @@ class Pet implements ArrayAccess } /** - * Sets category. + * Sets category * @param \Swagger\Client\Model\Category $category * @return $this */ @@ -229,9 +227,8 @@ class Pet implements ArrayAccess $this->category = $category; return $this; } - /** - * Gets name. + * Gets name * @return string */ public function getName() @@ -240,7 +237,7 @@ class Pet implements ArrayAccess } /** - * Sets name. + * Sets name * @param string $name * @return $this */ @@ -250,9 +247,8 @@ class Pet implements ArrayAccess $this->name = $name; return $this; } - /** - * Gets photo_urls. + * Gets photo_urls * @return string[] */ public function getPhotoUrls() @@ -261,7 +257,7 @@ class Pet implements ArrayAccess } /** - * Sets photo_urls. + * Sets photo_urls * @param string[] $photo_urls * @return $this */ @@ -271,9 +267,8 @@ class Pet implements ArrayAccess $this->photo_urls = $photo_urls; return $this; } - /** - * Gets tags. + * Gets tags * @return \Swagger\Client\Model\Tag[] */ public function getTags() @@ -282,7 +277,7 @@ class Pet implements ArrayAccess } /** - * Sets tags. + * Sets tags * @param \Swagger\Client\Model\Tag[] $tags * @return $this */ @@ -292,9 +287,8 @@ class Pet implements ArrayAccess $this->tags = $tags; return $this; } - /** - * Gets status. + * Gets status * @return string */ public function getStatus() @@ -303,7 +297,7 @@ class Pet implements ArrayAccess } /** - * Sets status. + * Sets status * @param string $status pet status in the store * @return $this */ @@ -316,7 +310,6 @@ class Pet implements ArrayAccess $this->status = $status; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -359,17 +352,15 @@ class Pet implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 daaa6f92624d..e2cb5b6e90f8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -47,9 +47,15 @@ use \ArrayAccess; class SpecialModelName implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * 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[] + */ static $swaggerTypes = array( 'special_property_name' => 'int' ); @@ -98,13 +104,11 @@ class SpecialModelName implements ArrayAccess - /** * $special_property_name * @var int */ protected $special_property_name; - /** * Constructor @@ -113,13 +117,13 @@ 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. + * Gets special_property_name * @return int */ public function getSpecialPropertyName() @@ -128,7 +132,7 @@ class SpecialModelName implements ArrayAccess } /** - * Sets special_property_name. + * Sets special_property_name * @param int $special_property_name * @return $this */ @@ -138,7 +142,6 @@ class SpecialModelName implements ArrayAccess $this->special_property_name = $special_property_name; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -181,17 +184,15 @@ class SpecialModelName implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 d0b5da095cc9..159c531b8b26 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -47,9 +47,15 @@ use \ArrayAccess; class Tag implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'Tag'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'name' => 'string' @@ -102,19 +108,16 @@ class Tag implements ArrayAccess - /** * $id * @var int */ protected $id; - /** * $name * @var string */ protected $name; - /** * Constructor @@ -123,14 +126,14 @@ class Tag implements ArrayAccess public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->name = $data["name"]; } } - /** - * Gets id. + * Gets id * @return int */ public function getId() @@ -139,7 +142,7 @@ class Tag implements ArrayAccess } /** - * Sets id. + * Sets id * @param int $id * @return $this */ @@ -149,9 +152,8 @@ class Tag implements ArrayAccess $this->id = $id; return $this; } - /** - * Gets name. + * Gets name * @return string */ public function getName() @@ -160,7 +162,7 @@ class Tag implements ArrayAccess } /** - * Sets name. + * Sets name * @param string $name * @return $this */ @@ -170,7 +172,6 @@ class Tag implements ArrayAccess $this->name = $name; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -213,17 +214,15 @@ class Tag implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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 0d934a735136..2d6241032186 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -47,9 +47,15 @@ use \ArrayAccess; class User implements ArrayAccess { /** - * Array of property to type mappings. Used for (de)serialization - * @var string[] - */ + * The original name of the model. + * @var string + */ + static $swaggerModelName = 'User'; + + /** + * Array of property to type mappings. Used for (de)serialization + * @var string[] + */ static $swaggerTypes = array( 'id' => 'int', 'username' => 'string', @@ -126,55 +132,46 @@ class User implements ArrayAccess - /** * $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 @@ -183,6 +180,7 @@ class User implements ArrayAccess public function __construct(array $data = null) { + if ($data != null) { $this->id = $data["id"]; $this->username = $data["username"]; @@ -194,9 +192,8 @@ class User implements ArrayAccess $this->user_status = $data["user_status"]; } } - /** - * Gets id. + * Gets id * @return int */ public function getId() @@ -205,7 +202,7 @@ class User implements ArrayAccess } /** - * Sets id. + * Sets id * @param int $id * @return $this */ @@ -215,9 +212,8 @@ class User implements ArrayAccess $this->id = $id; return $this; } - /** - * Gets username. + * Gets username * @return string */ public function getUsername() @@ -226,7 +222,7 @@ class User implements ArrayAccess } /** - * Sets username. + * Sets username * @param string $username * @return $this */ @@ -236,9 +232,8 @@ class User implements ArrayAccess $this->username = $username; return $this; } - /** - * Gets first_name. + * Gets first_name * @return string */ public function getFirstName() @@ -247,7 +242,7 @@ class User implements ArrayAccess } /** - * Sets first_name. + * Sets first_name * @param string $first_name * @return $this */ @@ -257,9 +252,8 @@ class User implements ArrayAccess $this->first_name = $first_name; return $this; } - /** - * Gets last_name. + * Gets last_name * @return string */ public function getLastName() @@ -268,7 +262,7 @@ class User implements ArrayAccess } /** - * Sets last_name. + * Sets last_name * @param string $last_name * @return $this */ @@ -278,9 +272,8 @@ class User implements ArrayAccess $this->last_name = $last_name; return $this; } - /** - * Gets email. + * Gets email * @return string */ public function getEmail() @@ -289,7 +282,7 @@ class User implements ArrayAccess } /** - * Sets email. + * Sets email * @param string $email * @return $this */ @@ -299,9 +292,8 @@ class User implements ArrayAccess $this->email = $email; return $this; } - /** - * Gets password. + * Gets password * @return string */ public function getPassword() @@ -310,7 +302,7 @@ class User implements ArrayAccess } /** - * Sets password. + * Sets password * @param string $password * @return $this */ @@ -320,9 +312,8 @@ class User implements ArrayAccess $this->password = $password; return $this; } - /** - * Gets phone. + * Gets phone * @return string */ public function getPhone() @@ -331,7 +322,7 @@ class User implements ArrayAccess } /** - * Sets phone. + * Sets phone * @param string $phone * @return $this */ @@ -341,9 +332,8 @@ class User implements ArrayAccess $this->phone = $phone; return $this; } - /** - * Gets user_status. + * Gets user_status * @return int */ public function getUserStatus() @@ -352,7 +342,7 @@ class User implements ArrayAccess } /** - * Sets user_status. + * Sets user_status * @param int $user_status User Status * @return $this */ @@ -362,7 +352,6 @@ class User implements ArrayAccess $this->user_status = $user_status; return $this; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset @@ -405,17 +394,15 @@ class User implements ArrayAccess } /** - * Gets the string presentation of the object. + * Gets the string presentation of the object * @return string */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { + if (defined('JSON_PRETTY_PRINT')) { // use 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)); } } - -?> From 70b25a682d821e702cc797500906a27cbbf6702b Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 27 Apr 2016 23:28:15 +0800 Subject: [PATCH 076/170] fix java default and feign sample --- .../SwaggerClientTest.userprefs | 10 +- .../petstore/java/default/docs/FormatTest.md | 1 - .../petstore/java/default/docs/Order.md | 6 +- .../client/petstore/java/default/docs/Pet.md | 6 +- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 271 ++++-------------- .../java/io/swagger/client/api/StoreApi.java | 142 ++------- .../java/io/swagger/client/api/UserApi.java | 125 ++++---- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../io/swagger/client/auth/HttpBasicAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../java/io/swagger/client/model/Animal.java | 3 +- .../java/io/swagger/client/model/Cat.java | 5 +- .../io/swagger/client/model/Category.java | 5 +- .../java/io/swagger/client/model/Dog.java | 5 +- .../io/swagger/client/model/EnumTest.java | 7 +- .../io/swagger/client/model/FormatTest.java | 6 +- .../client/model/Model200Response.java | 6 +- .../client/model/ModelApiResponse.java | 6 +- .../io/swagger/client/model/ModelReturn.java | 6 +- .../java/io/swagger/client/model/Name.java | 42 +-- .../java/io/swagger/client/model/Order.java | 27 +- .../java/io/swagger/client/model/Pet.java | 13 +- .../client/model/SpecialModelName.java | 3 +- .../java/io/swagger/client/model/Tag.java | 5 +- .../java/io/swagger/client/model/User.java | 17 +- .../io/swagger/client/FormAwareEncoder.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 78 ++--- .../java/io/swagger/client/api/StoreApi.java | 40 +-- .../java/io/swagger/client/api/UserApi.java | 31 +- .../java/io/swagger/client/model/Animal.java | 3 +- .../java/io/swagger/client/model/Cat.java | 5 +- .../io/swagger/client/model/Category.java | 5 +- .../java/io/swagger/client/model/Dog.java | 5 +- .../io/swagger/client/model/EnumTest.java | 7 +- .../io/swagger/client/model/FormatTest.java | 24 +- .../client/model/Model200Response.java | 6 +- .../client/model/ModelApiResponse.java | 8 +- .../io/swagger/client/model/ModelReturn.java | 6 +- .../java/io/swagger/client/model/Name.java | 42 +-- .../java/io/swagger/client/model/Order.java | 27 +- .../java/io/swagger/client/model/Pet.java | 13 +- .../client/model/SpecialModelName.java | 3 +- .../java/io/swagger/client/model/Tag.java | 5 +- .../java/io/swagger/client/model/User.java | 17 +- 49 files changed, 370 insertions(+), 690 deletions(-) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index 3c3b0624157a..eb976117be8b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,12 +1,10 @@  - + - - - - - + + + diff --git a/samples/client/petstore/java/default/docs/FormatTest.md b/samples/client/petstore/java/default/docs/FormatTest.md index dc2b559dad28..5e54362e5353 100644 --- a/samples/client/petstore/java/default/docs/FormatTest.md +++ b/samples/client/petstore/java/default/docs/FormatTest.md @@ -15,7 +15,6 @@ Name | Type | Description | Notes **binary** | **byte[]** | | [optional] **date** | [**Date**](Date.md) | | **dateTime** | [**Date**](Date.md) | | [optional] -**uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/default/docs/Order.md b/samples/client/petstore/java/default/docs/Order.md index b1709c14eee0..29ca3ddbc6b2 100644 --- a/samples/client/petstore/java/default/docs/Order.md +++ b/samples/client/petstore/java/default/docs/Order.md @@ -16,9 +16,9 @@ Name | Type | Description | Notes ## Enum: StatusEnum Name | Value ---- | ----- -PLACED | placed -APPROVED | approved -DELIVERED | delivered +PLACED | "placed" +APPROVED | "approved" +DELIVERED | "delivered" diff --git a/samples/client/petstore/java/default/docs/Pet.md b/samples/client/petstore/java/default/docs/Pet.md index 20a1c298dd61..5b63109ef924 100644 --- a/samples/client/petstore/java/default/docs/Pet.md +++ b/samples/client/petstore/java/default/docs/Pet.md @@ -16,9 +16,9 @@ Name | Type | Description | Notes ## Enum: StatusEnum Name | Value ---- | ----- -AVAILABLE | available -PENDING | pending -SOLD | sold +AVAILABLE | "available" +PENDING | "pending" +SOLD | "sold" 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 d2bcf57f9970..27395e86ba98 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-02T22:36:41.205+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 0b7cad9f8a94..19b0ebeae4e7 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-02T22:36:41.205+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 a6144d708158..d8d32210b105 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-02T22:36:41.205+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 8da35dc644bf..1383dd0decb0 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-02T22:36:41.205+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 5c0338370a93..c4ff05ec24f8 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-02T22:36:41.205+08:00") + public class PetApi { private ApiClient apiClient; @@ -36,16 +36,20 @@ 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 (optional) + * @param body Pet object that needs to be added to the store (required) * @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"); @@ -54,14 +58,11 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -72,51 +73,9 @@ 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 * @@ -141,16 +100,13 @@ 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/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -161,21 +117,24 @@ 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 query (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @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"); @@ -184,16 +143,12 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "status", status)); - + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -204,22 +159,24 @@ 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 - * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @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"); @@ -228,16 +185,12 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); - + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -248,16 +201,13 @@ 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 pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Pet * @throws ApiException if fails to make API call */ @@ -278,14 +228,11 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -294,119 +241,25 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + 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 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 (optional) + * @param body Pet object that needs to be added to the store (required) * @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"); @@ -415,14 +268,11 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -433,11 +283,9 @@ 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 * @@ -446,7 +294,7 @@ public class PetApi { * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ - public void updatePetWithForm(String petId, String name, String status) throws ApiException { + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -463,18 +311,15 @@ 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/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -485,20 +330,19 @@ public class PetApi { 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 void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -515,18 +359,15 @@ public class PetApi { 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/xml" + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -537,9 +378,7 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - - } - + 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/StoreApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java index b7ad7afc2dc5..59a1a58266eb 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-02T22:36:41.205+08:00") + public class StoreApi { private ApiClient apiClient; @@ -34,7 +34,6 @@ 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 @@ -58,14 +57,11 @@ public class StoreApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -76,55 +72,9 @@ 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 @@ -142,14 +92,11 @@ public class StoreApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -160,61 +107,17 @@ 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(String orderId) throws ApiException { + public Order getOrderById(Long orderId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'orderId' is set @@ -231,14 +134,11 @@ public class StoreApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -247,24 +147,26 @@ public class StoreApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" }; + String[] localVarAuthNames = new String[] { }; - 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 (optional) + * @param body order placed for purchasing the pet (required) * @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"); @@ -273,14 +175,11 @@ public class StoreApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -289,12 +188,9 @@ public class StoreApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; + String[] localVarAuthNames = new String[] { }; - 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 d247fb435864..7ab75eabd344 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-02T22:36:41.205+08:00") + public class UserApi { private ApiClient apiClient; @@ -34,16 +34,20 @@ public class UserApi { this.apiClient = apiClient; } - /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @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"); @@ -52,14 +56,11 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -70,20 +71,23 @@ 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 (optional) + * @param body List of user object (required) * @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"); @@ -92,14 +96,11 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -110,20 +111,23 @@ 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 (optional) + * @param body List of user object (required) * @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"); @@ -132,14 +136,11 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -150,11 +151,9 @@ 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. @@ -178,14 +177,11 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -194,17 +190,15 @@ public class UserApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_http_basic" }; + String[] localVarAuthNames = new String[] { }; + - 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 */ @@ -225,14 +219,11 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -243,23 +234,30 @@ 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 (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @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"); @@ -268,18 +266,13 @@ 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/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -290,12 +283,9 @@ 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 * @@ -312,14 +302,11 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -330,16 +317,14 @@ 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 (optional) + * @param body Updated user object (required) * @throws ApiException if fails to make API call */ public void updateUser(String username, User body) throws ApiException { @@ -350,6 +335,11 @@ 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())); @@ -359,14 +349,11 @@ public class UserApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -377,9 +364,7 @@ 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 01322f38b251..6882dbc41c08 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-02T22:36:41.205+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 35bc9c1d9434..64f2c887377b 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-02T22:36:41.205+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 46da5bd364a6..76d2917f24ea 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-02T22:36:41.205+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/Animal.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java index dda573cf5d07..559e19848f96 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Animal */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") + public class Animal { private String className = null; @@ -31,7 +31,6 @@ public class Animal { this.className = className; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java index 7010d6130f76..305b4806f4af 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; /** * Cat */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") + public class Cat extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Cat extends Animal { this.className = className; } - + /** **/ public Cat declawed(Boolean declawed) { @@ -50,7 +50,6 @@ public class Cat extends Animal { this.declawed = declawed; } - @Override public boolean equals(java.lang.Object o) { 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 c44784cdb730..b97a241ff8c2 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; /** * Category */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+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,7 +49,6 @@ 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/Dog.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java index 1367e218733c..f72a7f046ab6 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; /** * Dog */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") + public class Dog extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Dog extends Animal { this.className = className; } - + /** **/ public Dog breed(String breed) { @@ -50,7 +50,6 @@ public class Dog extends Animal { this.breed = breed; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java index 3d9aac156f34..806628ebd569 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * EnumTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") + public class EnumTest { @@ -97,7 +97,7 @@ public class EnumTest { this.enumString = enumString; } - + /** **/ public EnumTest enumInteger(EnumIntegerEnum enumInteger) { @@ -114,7 +114,7 @@ public class EnumTest { this.enumInteger = enumInteger; } - + /** **/ public EnumTest enumNumber(EnumNumberEnum enumNumber) { @@ -131,7 +131,6 @@ public class EnumTest { this.enumNumber = enumNumber; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java index 6c3bcfbca9f8..f10a0749f5e9 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java @@ -8,9 +8,9 @@ import java.math.BigDecimal; import java.util.Date; - - - +/** + * FormatTest + */ public class FormatTest { 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 ec3ad40a40ec..e62ec1f32818 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,9 +7,10 @@ import io.swagger.annotations.ApiModelProperty; /** - * Model200Response + * Model for testing model name starting with number */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") +@ApiModel(description = "Model for testing model name starting with number") + public class Model200Response { private Integer name = null; @@ -31,7 +32,6 @@ 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/ModelApiResponse.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java index 62300f1a0ebc..719f9b676fd8 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -6,9 +6,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - +/** + * ModelApiResponse + */ public class ModelApiResponse { 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 1bf22a5873cb..fa6b2b8b90ce 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,9 +7,10 @@ import io.swagger.annotations.ApiModelProperty; /** - * ModelReturn + * Model for testing reserved words */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") +@ApiModel(description = "Model for testing reserved words") + public class ModelReturn { private Integer _return = null; @@ -31,7 +32,6 @@ 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 fee1c239f7cd..b9953ebac0a7 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,13 +7,15 @@ import io.swagger.annotations.ApiModelProperty; /** - * Name + * Model for testing model name same as property name */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") +@ApiModel(description = "Model for testing model name same as property name") + public class Name { private Integer name = null; private Integer snakeCase = null; + private String property = null; /** @@ -23,7 +25,7 @@ public class Name { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("name") public Integer getName() { return name; @@ -32,24 +34,30 @@ 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 void setSnakeCase(Integer snakeCase) { - this.snakeCase = snakeCase; + + + /** + **/ + public Name property(String property) { + this.property = property; + return this; + } + + @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) { @@ -61,12 +69,13 @@ public class Name { } Name name = (Name) o; return Objects.equals(this.name, name.name) && - Objects.equals(this.snakeCase, name.snakeCase); + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property); } @Override public int hashCode() { - return Objects.hash(name, snakeCase); + return Objects.hash(name, snakeCase, property); } @Override @@ -76,6 +85,7 @@ 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 6af4a4c55dc4..00372f26f932 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; /** * Order */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") + public class Order { private Long id = null; @@ -40,17 +40,27 @@ public class Order { } } - private StatusEnum status = StatusEnum.PLACED; - private Boolean complete = null; + private StatusEnum status = null; + private Boolean complete = false; + /** + **/ + 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) { @@ -67,7 +77,7 @@ public class Order { this.petId = petId; } - + /** **/ public Order quantity(Integer quantity) { @@ -84,7 +94,7 @@ public class Order { this.quantity = quantity; } - + /** **/ public Order shipDate(Date shipDate) { @@ -101,7 +111,7 @@ public class Order { this.shipDate = shipDate; } - + /** * Order Status **/ @@ -119,7 +129,7 @@ public class Order { this.status = status; } - + /** **/ public Order complete(Boolean complete) { @@ -136,7 +146,6 @@ 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 11eec4d83480..a3e34c8570f1 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; /** * Pet */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") + public class Pet { private Long id = null; @@ -63,7 +63,7 @@ public class Pet { this.id = id; } - + /** **/ public Pet category(Category category) { @@ -80,7 +80,7 @@ public class Pet { this.category = category; } - + /** **/ public Pet name(String name) { @@ -97,7 +97,7 @@ public class Pet { this.name = name; } - + /** **/ public Pet photoUrls(List photoUrls) { @@ -114,7 +114,7 @@ public class Pet { this.photoUrls = photoUrls; } - + /** **/ public Pet tags(List tags) { @@ -131,7 +131,7 @@ public class Pet { this.tags = tags; } - + /** * pet status in the store **/ @@ -149,7 +149,6 @@ 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 acb1c4e5e15b..1a38a0edea98 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; /** * SpecialModelName */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+08:00") + public class SpecialModelName { private Long specialPropertyName = null; @@ -31,7 +31,6 @@ 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 b0b42521af12..f76224dd4893 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; /** * Tag */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+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,7 +49,6 @@ 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 545b009bf72e..017a72b2ee56 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; /** * User */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T22:48:50.833+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,7 +158,6 @@ 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/FormAwareEncoder.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java index 5d5342515192..4d348dcd9cb8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java @@ -14,7 +14,7 @@ import feign.codec.EncodeException; import feign.codec.Encoder; import feign.RequestTemplate; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class FormAwareEncoder implements Encoder { public static final String UTF_8 = "utf-8"; private static final String LINE_FEED = "\r\n"; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java index 0a07276e65b1..3d1b4a72710e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/feign/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-23T12:48:24.088+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+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/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index c0bf61b63b69..e44f445d2916 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -3,8 +3,8 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; 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; @@ -12,14 +12,14 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public interface PetApi extends ApiClient.Api { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return void */ @RequestLine("POST /pet") @@ -28,20 +28,7 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) void addPet(Pet body); - - /** - * 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) - * @return void - */ - @RequestLine("POST /pet?testing_byte_array=true") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - void addPetUsingByteArray(byte[] body); - + /** * Deletes a pet * @@ -56,11 +43,11 @@ public interface PetApi extends ApiClient.Api { "apiKey: {apiKey}" }) void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); - + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return List */ @RequestLine("GET /pet/findByStatus?status={status}") @@ -69,11 +56,11 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) List findPetsByStatus(@Param("status") List status); - + /** * Finds Pets by tags - * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return List */ @RequestLine("GET /pet/findByTags?tags={tags}") @@ -82,11 +69,11 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) List findPetsByTags(@Param("tags") List tags); - + /** * 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) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Pet */ @RequestLine("GET /pet/{petId}") @@ -95,37 +82,11 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) Pet getPetById(@Param("petId") Long petId); - - /** - * 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 - */ - @RequestLine("GET /pet/{petId}?response=inline_arbitrary_object") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - InlineResponse200 getPetByIdInObject(@Param("petId") Long petId); - - /** - * 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[] - */ - @RequestLine("GET /pet/{petId}?testing_byte_array=true") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - byte[] petPetIdtestingByteArraytrueGet(@Param("petId") Long petId); - + /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return void */ @RequestLine("PUT /pet") @@ -134,7 +95,7 @@ public interface PetApi extends ApiClient.Api { "Accepts: application/json", }) void updatePet(Pet body); - + /** * Updates a pet in the store with form data * @@ -148,21 +109,20 @@ public interface PetApi extends ApiClient.Api { "Content-type: application/x-www-form-urlencoded", "Accepts: application/json", }) - void updatePetWithForm(@Param("petId") String petId, @Param("name") String name, @Param("status") String status); - + void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + /** * 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 void + * @return ModelApiResponse */ @RequestLine("POST /pet/{petId}/uploadImage") @Headers({ "Content-type: multipart/form-data", "Accepts: application/json", }) - void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); - + ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index a16bc537ce03..04993aa879ad 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public interface StoreApi extends ApiClient.Api { @@ -26,20 +26,7 @@ public interface StoreApi extends ApiClient.Api { "Accepts: application/json", }) void deleteOrder(@Param("orderId") String orderId); - - /** - * 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 - */ - @RequestLine("GET /store/findByStatus?status={status}") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - List findOrdersByStatus(@Param("status") String status); - + /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -51,22 +38,10 @@ public interface StoreApi extends ApiClient.Api { "Accepts: application/json", }) Map getInventory(); - - /** - * 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 - */ - @RequestLine("GET /store/inventory?response=arbitrary_object") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - Object getInventoryInObject(); - + /** * 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 */ @@ -75,12 +50,12 @@ public interface StoreApi extends ApiClient.Api { "Content-type: application/json", "Accepts: application/json", }) - Order getOrderById(@Param("orderId") String orderId); - + Order getOrderById(@Param("orderId") Long orderId); + /** * Place an order for a pet * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return Order */ @RequestLine("POST /store/order") @@ -89,5 +64,4 @@ public interface StoreApi extends ApiClient.Api { "Accepts: application/json", }) Order placeOrder(Order body); - } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index 3ae5900b51dc..13171d4bed47 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -10,14 +10,14 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public interface UserApi extends ApiClient.Api { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @return void */ @RequestLine("POST /user") @@ -26,11 +26,11 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void createUser(User body); - + /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return void */ @RequestLine("POST /user/createWithArray") @@ -39,11 +39,11 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void createUsersWithArrayInput(List body); - + /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return void */ @RequestLine("POST /user/createWithList") @@ -52,7 +52,7 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void createUsersWithListInput(List body); - + /** * Delete user * This can only be done by the logged in user. @@ -65,11 +65,11 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void deleteUser(@Param("username") String username); - + /** * 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 */ @RequestLine("GET /user/{username}") @@ -78,12 +78,12 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) User getUserByName(@Param("username") String username); - + /** * Logs user into the system * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return String */ @RequestLine("GET /user/login?username={username}&password={password}") @@ -92,7 +92,7 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) String loginUser(@Param("username") String username, @Param("password") String password); - + /** * Logs out current logged in user session * @@ -104,12 +104,12 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void logoutUser(); - + /** * 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 (optional) + * @param body Updated user object (required) * @return void */ @RequestLine("PUT /user/{username}") @@ -118,5 +118,4 @@ public interface UserApi extends ApiClient.Api { "Accepts: application/json", }) void updateUser(@Param("username") String username, User body); - } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java index eb4d93dcba00..d6249c18d7ed 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Animal */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class Animal { private String className = null; @@ -31,7 +31,6 @@ public class Animal { this.className = className; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java index e229b0c1b5bd..278889e60d46 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; /** * Cat */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class Cat extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Cat extends Animal { this.className = className; } - + /** **/ public Cat declawed(Boolean declawed) { @@ -50,7 +50,6 @@ public class Cat extends Animal { this.declawed = declawed; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index 0c808ad68608..f1df969c29c1 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Category */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+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,7 +49,6 @@ public class Category { this.name = name; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java index 9374d677f950..1a6374d54bfd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; /** * Dog */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class Dog extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Dog extends Animal { this.className = className; } - + /** **/ public Dog breed(String breed) { @@ -50,7 +50,6 @@ public class Dog extends Animal { this.breed = breed; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java index 6ed9e0f09f28..9148bd3d5d57 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * EnumTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class EnumTest { @@ -97,7 +97,7 @@ public class EnumTest { this.enumString = enumString; } - + /** **/ public EnumTest enumInteger(EnumIntegerEnum enumInteger) { @@ -114,7 +114,7 @@ public class EnumTest { this.enumInteger = enumInteger; } - + /** **/ public EnumTest enumNumber(EnumNumberEnum enumNumber) { @@ -131,7 +131,6 @@ public class EnumTest { this.enumNumber = enumNumber; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java index ae470044a23c..53aa13638a77 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java @@ -8,10 +8,10 @@ import java.math.BigDecimal; import java.util.Date; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * FormatTest + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class FormatTest { private Integer integer = null; @@ -29,6 +29,8 @@ public class FormatTest { /** + * minimum: 10.0 + * maximum: 100.0 **/ public FormatTest integer(Integer integer) { this.integer = integer; @@ -46,6 +48,8 @@ public class FormatTest { /** + * minimum: 20.0 + * maximum: 200.0 **/ public FormatTest int32(Integer int32) { this.int32 = int32; @@ -80,6 +84,8 @@ public class FormatTest { /** + * minimum: 32.1 + * maximum: 543.2 **/ public FormatTest number(BigDecimal number) { this.number = number; @@ -97,6 +103,8 @@ public class FormatTest { /** + * minimum: 54.3 + * maximum: 987.6 **/ public FormatTest _float(Float _float) { this._float = _float; @@ -114,6 +122,8 @@ public class FormatTest { /** + * minimum: 67.8 + * maximum: 123.4 **/ public FormatTest _double(Double _double) { this._double = _double; @@ -154,7 +164,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("byte") public byte[] getByte() { return _byte; @@ -188,7 +198,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("date") public Date getDate() { return date; @@ -222,7 +232,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("password") public String getPassword() { return password; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index 25318de289ad..4573c22c3da0 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -7,9 +7,10 @@ import io.swagger.annotations.ApiModelProperty; /** - * Model200Response + * Model for testing model name starting with number */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@ApiModel(description = "Model for testing model name starting with number") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class Model200Response { private Integer name = null; @@ -31,7 +32,6 @@ public class Model200Response { this.name = name; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java index a1ca4f7ef450..eca2b1fb3883 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00") +/** + * ModelApiResponse + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java index 969f0515ebdd..476bf4792882 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java @@ -7,9 +7,10 @@ import io.swagger.annotations.ApiModelProperty; /** - * ModelReturn + * Model for testing reserved words */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@ApiModel(description = "Model for testing reserved words") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class ModelReturn { private Integer _return = null; @@ -31,7 +32,6 @@ public class ModelReturn { this._return = _return; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java index d86bb6a5394c..19ababb8f1cc 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java @@ -7,13 +7,15 @@ import io.swagger.annotations.ApiModelProperty; /** - * Name + * Model for testing model name same as property name */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@ApiModel(description = "Model for testing model name same as property name") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class Name { private Integer name = null; private Integer snakeCase = null; + private String property = null; /** @@ -23,7 +25,7 @@ public class Name { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("name") public Integer getName() { return name; @@ -32,24 +34,30 @@ 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 void setSnakeCase(Integer snakeCase) { - this.snakeCase = snakeCase; + + + /** + **/ + public Name property(String property) { + this.property = property; + return this; + } + + @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) { @@ -61,12 +69,13 @@ public class Name { } Name name = (Name) o; return Objects.equals(this.name, name.name) && - Objects.equals(this.snakeCase, name.snakeCase); + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property); } @Override public int hashCode() { - return Objects.hash(name, snakeCase); + return Objects.hash(name, snakeCase, property); } @Override @@ -76,6 +85,7 @@ 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/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index 5fa2f4173c66..359d0105b804 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -11,7 +11,7 @@ import java.util.Date; /** * Order */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class Order { private Long id = null; @@ -40,17 +40,27 @@ public class Order { } } - private StatusEnum status = StatusEnum.PLACED; - private Boolean complete = null; + private StatusEnum status = null; + private Boolean complete = false; + /** + **/ + 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) { @@ -67,7 +77,7 @@ public class Order { this.petId = petId; } - + /** **/ public Order quantity(Integer quantity) { @@ -84,7 +94,7 @@ public class Order { this.quantity = quantity; } - + /** **/ public Order shipDate(Date shipDate) { @@ -101,7 +111,7 @@ public class Order { this.shipDate = shipDate; } - + /** * Order Status **/ @@ -119,7 +129,7 @@ public class Order { this.status = status; } - + /** **/ public Order complete(Boolean complete) { @@ -136,7 +146,6 @@ public class Order { this.complete = complete; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index 24e261c0a2ad..511100f868d4 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -14,7 +14,7 @@ import java.util.List; /** * Pet */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class Pet { private Long id = null; @@ -63,7 +63,7 @@ public class Pet { this.id = id; } - + /** **/ public Pet category(Category category) { @@ -80,7 +80,7 @@ public class Pet { this.category = category; } - + /** **/ public Pet name(String name) { @@ -97,7 +97,7 @@ public class Pet { this.name = name; } - + /** **/ public Pet photoUrls(List photoUrls) { @@ -114,7 +114,7 @@ public class Pet { this.photoUrls = photoUrls; } - + /** **/ public Pet tags(List tags) { @@ -131,7 +131,7 @@ public class Pet { this.tags = tags; } - + /** * pet status in the store **/ @@ -149,7 +149,6 @@ public class Pet { this.status = status; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java index 2306d2324689..37c5823ed2cc 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * SpecialModelName */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") public class SpecialModelName { private Long specialPropertyName = null; @@ -31,7 +31,6 @@ public class SpecialModelName { this.specialPropertyName = specialPropertyName; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index f9e7c8d8c765..ff51db61fefd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Tag */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+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,7 +49,6 @@ public class Tag { this.name = name; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index dab32a22f8d2..6a4414b5f82f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * User */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:03.099+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+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,7 +158,6 @@ public class User { this.userStatus = userStatus; } - @Override public boolean equals(java.lang.Object o) { From 3913388331082e9112b9d2b9f07e711116da2206 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 28 Apr 2016 15:57:49 +0800 Subject: [PATCH 077/170] fix java okhttp enum mismatche tab --- .../okhttp-gson/enum_outer_doc.mustache | 2 +- .../java/okhttp-gson/docs/FormatTest.md | 6 +- .../petstore/java/okhttp-gson/docs/Order.md | 6 +- .../petstore/java/okhttp-gson/docs/Pet.md | 6 +- .../petstore/java/okhttp-gson/git_push.sh | 6 +- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../java/io/swagger/client/model/Animal.java | 3 - .../java/io/swagger/client/model/Cat.java | 6 +- .../java/io/swagger/client/model/Dog.java | 6 +- .../io/swagger/client/model/EnumTest.java | 9 +- .../io/swagger/client/model/FormatTest.java | 23 ++- .../client/model/Model200Response.java | 6 +- .../client/model/ModelApiResponse.java | 7 +- .../io/swagger/client/model/ModelReturn.java | 6 +- .../java/io/swagger/client/model/Name.java | 31 ++-- .../java/io/swagger/client/model/Order.java | 27 ++-- .../java/io/swagger/client/StringUtil.java | 2 +- .../io/swagger/client/model/FormatTest.java | 16 +- .../java/io/swagger/client/model/Order.java | 12 +- .../java/io/swagger/client/model/Pet.java | 137 ++++++++---------- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/model/Order.java | 12 +- .../java/io/swagger/client/model/Pet.java | 12 +- 28 files changed, 175 insertions(+), 180 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache index a7e706eba4e2..b5370c1360b7 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache @@ -4,4 +4,4 @@ {{#allowableValues}}{{#enumVars}} * `{{name}}` (value: `{{value}}`) -{{#enumVars}}{{/allowableValues}} +{{/enumVars}}{{/allowableValues}} diff --git a/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md b/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md index 8e400e7bcd77..5e54362e5353 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md @@ -11,11 +11,11 @@ Name | Type | Description | Notes **_float** | **Float** | | [optional] **_double** | **Double** | | [optional] **string** | **String** | | [optional] -**_byte** | **byte[]** | | [optional] +**_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] -**date** | [**Date**](Date.md) | | [optional] +**date** | [**Date**](Date.md) | | **dateTime** | [**Date**](Date.md) | | [optional] -**password** | **String** | | [optional] +**password** | **String** | | diff --git a/samples/client/petstore/java/okhttp-gson/docs/Order.md b/samples/client/petstore/java/okhttp-gson/docs/Order.md index b1709c14eee0..29ca3ddbc6b2 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/Order.md +++ b/samples/client/petstore/java/okhttp-gson/docs/Order.md @@ -16,9 +16,9 @@ Name | Type | Description | Notes ## Enum: StatusEnum Name | Value ---- | ----- -PLACED | placed -APPROVED | approved -DELIVERED | delivered +PLACED | "placed" +APPROVED | "approved" +DELIVERED | "delivered" diff --git a/samples/client/petstore/java/okhttp-gson/docs/Pet.md b/samples/client/petstore/java/okhttp-gson/docs/Pet.md index 20a1c298dd61..5b63109ef924 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/Pet.md +++ b/samples/client/petstore/java/okhttp-gson/docs/Pet.md @@ -16,9 +16,9 @@ Name | Type | Description | Notes ## Enum: StatusEnum Name | Value ---- | ----- -AVAILABLE | available -PENDING | pending -SOLD | sold +AVAILABLE | "available" +PENDING | "pending" +SOLD | "sold" diff --git a/samples/client/petstore/java/okhttp-gson/git_push.sh b/samples/client/petstore/java/okhttp-gson/git_push.sh index 6ca091b49d95..1a36388db023 100644 --- a/samples/client/petstore/java/okhttp-gson/git_push.sh +++ b/samples/client/petstore/java/okhttp-gson/git_push.sh @@ -8,17 +8,17 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="" + git_user_id="YOUR_GIT_USR_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="" + git_repo_id="YOUR_GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi if [ "$release_note" = "" ]; then - release_note="" + release_note="Minor update" echo "[INFO] No command line input provided. Set \$release_note to $release_note" fi diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 91d660ba2ac5..6a437716d9c1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/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-23T12:54:48.271+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index cba4c9e4fdef..92cadce33c3e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/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-23T12:54:48.271+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index d7d9f17cf3cc..41324a8941d6 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/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-23T12:54:48.271+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index bcd8b8115c8c..0bc5d09320d6 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/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-23T12:54:48.271+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+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/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 81c31c9f07d4..df09446d3b7a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/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-23T12:54:48.271+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index b281311fa192..2d459e2da07c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/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-23T12:54:48.271+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:54:58.477+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java index 5425d324f504..328f71b7123e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java @@ -14,9 +14,7 @@ public class Animal { @SerializedName("className") private String className = null; - - /** **/ @ApiModelProperty(required = true, value = "") @@ -27,7 +25,6 @@ public class Animal { this.className = className; } - @Override public boolean equals(Object o) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java index 11806f89e9bd..9ca891410331 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java @@ -15,12 +15,10 @@ public class Cat extends Animal { @SerializedName("className") private String className = null; - + @SerializedName("declawed") private Boolean declawed = null; - - /** **/ @ApiModelProperty(required = true, value = "") @@ -31,7 +29,6 @@ public class Cat extends Animal { this.className = className; } - /** **/ @ApiModelProperty(value = "") @@ -42,7 +39,6 @@ public class Cat extends Animal { this.declawed = declawed; } - @Override public boolean equals(Object o) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java index 25eab6c979e3..2fa478001b17 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java @@ -15,12 +15,10 @@ public class Dog extends Animal { @SerializedName("className") private String className = null; - + @SerializedName("breed") private String breed = null; - - /** **/ @ApiModelProperty(required = true, value = "") @@ -31,7 +29,6 @@ public class Dog extends Animal { this.className = className; } - /** **/ @ApiModelProperty(value = "") @@ -42,7 +39,6 @@ public class Dog extends Animal { this.breed = breed; } - @Override public boolean equals(Object o) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java index 1c46e1fadf07..9b3103c16d7f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java @@ -37,7 +37,7 @@ public class EnumTest { @SerializedName("enum_string") private EnumStringEnum enumString = null; - + /** * Gets or Sets enumInteger @@ -63,7 +63,7 @@ public class EnumTest { @SerializedName("enum_integer") private EnumIntegerEnum enumInteger = null; - + /** * Gets or Sets enumNumber @@ -89,9 +89,7 @@ public class EnumTest { @SerializedName("enum_number") private EnumNumberEnum enumNumber = null; - - /** **/ @ApiModelProperty(value = "") @@ -102,7 +100,6 @@ public class EnumTest { this.enumString = enumString; } - /** **/ @ApiModelProperty(value = "") @@ -113,7 +110,6 @@ public class EnumTest { this.enumInteger = enumInteger; } - /** **/ @ApiModelProperty(value = "") @@ -124,7 +120,6 @@ public class EnumTest { this.enumNumber = enumNumber; } - @Override public boolean equals(Object o) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java index 1b9100afbb07..0fc4082d1196 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java @@ -9,9 +9,9 @@ import java.util.Date; import com.google.gson.annotations.SerializedName; - - - +/** + * FormatTest + */ public class FormatTest { @SerializedName("integer") @@ -51,6 +51,8 @@ public class FormatTest { private String password = null; /** + * minimum: 10.0 + * maximum: 100.0 **/ @ApiModelProperty(value = "") public Integer getInteger() { @@ -61,6 +63,8 @@ public class FormatTest { } /** + * minimum: 20.0 + * maximum: 200.0 **/ @ApiModelProperty(value = "") public Integer getInt32() { @@ -81,6 +85,8 @@ public class FormatTest { } /** + * minimum: 32.1 + * maximum: 543.2 **/ @ApiModelProperty(required = true, value = "") public BigDecimal getNumber() { @@ -91,6 +97,8 @@ public class FormatTest { } /** + * minimum: 54.3 + * maximum: 987.6 **/ @ApiModelProperty(value = "") public Float getFloat() { @@ -101,6 +109,8 @@ public class FormatTest { } /** + * minimum: 67.8 + * maximum: 123.4 **/ @ApiModelProperty(value = "") public Double getDouble() { @@ -122,7 +132,7 @@ public class FormatTest { /** **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public byte[] getByte() { return _byte; } @@ -142,7 +152,7 @@ public class FormatTest { /** **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public Date getDate() { return date; } @@ -162,7 +172,7 @@ public class FormatTest { /** **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getPassword() { return password; } @@ -231,3 +241,4 @@ public class FormatTest { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java index 87c625704131..0ca445cb5458 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java @@ -8,15 +8,14 @@ import com.google.gson.annotations.SerializedName; /** - * Model200Response + * Model for testing model name starting with number */ +@ApiModel(description = "Model for testing model name starting with number") public class Model200Response { @SerializedName("name") private Integer name = null; - - /** **/ @ApiModelProperty(value = "") @@ -27,7 +26,6 @@ public class Model200Response { this.name = name; } - @Override public boolean equals(Object o) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java index 20d2fc58dd3c..da52eda160d9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -7,9 +7,9 @@ import io.swagger.annotations.ApiModelProperty; import com.google.gson.annotations.SerializedName; - - - +/** + * ModelApiResponse + */ public class ModelApiResponse { @SerializedName("code") @@ -94,3 +94,4 @@ public class ModelApiResponse { return o.toString().replace("\n", "\n "); } } + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java index dadb010290ac..51aa1f4e055a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java @@ -8,15 +8,14 @@ import com.google.gson.annotations.SerializedName; /** - * ModelReturn + * Model for testing reserved words */ +@ApiModel(description = "Model for testing reserved words") public class ModelReturn { @SerializedName("return") private Integer _return = null; - - /** **/ @ApiModelProperty(value = "") @@ -27,7 +26,6 @@ public class ModelReturn { this._return = _return; } - @Override public boolean equals(Object o) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java index 5e23e13bd91d..b9cc8170969c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java @@ -8,21 +8,23 @@ import com.google.gson.annotations.SerializedName; /** - * Name + * Model for testing model name same as property name */ +@ApiModel(description = "Model for testing model name same as property name") public class Name { @SerializedName("name") private Integer name = null; - + @SerializedName("snake_case") private Integer snakeCase = null; - - + @SerializedName("property") + private String property = null; + /** **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public Integer getName() { return name; } @@ -30,18 +32,23 @@ public class Name { this.name = name; } - /** **/ @ApiModelProperty(value = "") public Integer getSnakeCase() { return snakeCase; } - public void setSnakeCase(Integer snakeCase) { - this.snakeCase = snakeCase; + + /** + **/ + @ApiModelProperty(value = "") + public String getProperty() { + return property; + } + public void setProperty(String property) { + this.property = property; } - @Override public boolean equals(Object o) { @@ -53,12 +60,13 @@ public class Name { } Name name = (Name) o; return Objects.equals(this.name, name.name) && - Objects.equals(this.snakeCase, name.snakeCase); + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property); } @Override public int hashCode() { - return Objects.hash(name, snakeCase); + return Objects.hash(name, snakeCase, property); } @Override @@ -68,6 +76,7 @@ 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/okhttp-gson/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java index 004432790745..e5c87a21e5ba 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java @@ -15,16 +15,16 @@ public class Order { @SerializedName("id") private Long id = null; - + @SerializedName("petId") private Long petId = null; - + @SerializedName("quantity") private Integer quantity = null; - + @SerializedName("shipDate") private Date shipDate = null; - + /** * Order Status @@ -52,21 +52,21 @@ public class Order { } @SerializedName("status") - private StatusEnum status = StatusEnum.PLACED; - - @SerializedName("complete") - private Boolean complete = null; - + private StatusEnum status = null; + + @SerializedName("complete") + private Boolean complete = false; - /** **/ @ApiModelProperty(value = "") public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } - /** **/ @ApiModelProperty(value = "") @@ -77,7 +77,6 @@ public class Order { this.petId = petId; } - /** **/ @ApiModelProperty(value = "") @@ -88,7 +87,6 @@ public class Order { this.quantity = quantity; } - /** **/ @ApiModelProperty(value = "") @@ -99,7 +97,6 @@ public class Order { this.shipDate = shipDate; } - /** * Order Status **/ @@ -111,7 +108,6 @@ public class Order { this.status = status; } - /** **/ @ApiModelProperty(value = "") @@ -122,7 +118,6 @@ public class Order { this.complete = complete; } - @Override public boolean equals(Object o) { diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java index 8adb42d4fb8c..8f94eebd211f 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit/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-23T12:55:47.640+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T15:51:06.629+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/retrofit/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java index 29d17bbdfe70..40d1ca0ecea9 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java @@ -51,6 +51,8 @@ public class FormatTest { private String password = null; /** + * minimum: 10.0 + * maximum: 100.0 **/ @ApiModelProperty(value = "") public Integer getInteger() { @@ -61,6 +63,8 @@ public class FormatTest { } /** + * minimum: 20.0 + * maximum: 200.0 **/ @ApiModelProperty(value = "") public Integer getInt32() { @@ -81,6 +85,8 @@ public class FormatTest { } /** + * minimum: 32.1 + * maximum: 543.2 **/ @ApiModelProperty(required = true, value = "") public BigDecimal getNumber() { @@ -91,6 +97,8 @@ public class FormatTest { } /** + * minimum: 54.3 + * maximum: 987.6 **/ @ApiModelProperty(value = "") public Float getFloat() { @@ -101,6 +109,8 @@ public class FormatTest { } /** + * minimum: 67.8 + * maximum: 123.4 **/ @ApiModelProperty(value = "") public Double getDouble() { @@ -122,7 +132,7 @@ public class FormatTest { /** **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public byte[] getByte() { return _byte; } @@ -142,7 +152,7 @@ public class FormatTest { /** **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public Date getDate() { return date; } @@ -162,7 +172,7 @@ public class FormatTest { /** **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public String getPassword() { return password; } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java index 196a57024040..b875279fa88d 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java @@ -27,14 +27,14 @@ public class Order { public enum StatusEnum { - @SerializedName("placed") - PLACED("placed"), + @SerializedName(""placed"") + PLACED(""placed""), - @SerializedName("approved") - APPROVED("approved"), + @SerializedName(""approved"") + APPROVED(""approved""), - @SerializedName("delivered") - DELIVERED("delivered"); + @SerializedName(""delivered"") + DELIVERED(""delivered""); private String value; diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java index 78cb97945058..9620e9086c54 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java @@ -3,6 +3,7 @@ package io.swagger.client.model; import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Category; import io.swagger.client.model.Tag; import java.util.ArrayList; import java.util.List; @@ -10,82 +11,55 @@ import java.util.List; import com.google.gson.annotations.SerializedName; -/** - * InlineResponse200 - */ -public class InlineResponse200 { - - @SerializedName("photoUrls") - private List photoUrls = new ArrayList(); - - @SerializedName("name") - private String name = null; + + + +public class Pet { @SerializedName("id") private Long id = null; - + @SerializedName("category") - private Object category = null; - + private Category category = null; + + @SerializedName("name") + private String name = null; + + @SerializedName("photoUrls") + private List photoUrls = new ArrayList(); + @SerializedName("tags") private List tags = new ArrayList(); - - /** - * pet status in the store - */ - public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), - @SerializedName("pending") - PENDING("pending"), +public enum StatusEnum { + @SerializedName(""available"") + AVAILABLE(""available""), - @SerializedName("sold") - SOLD("sold"); + @SerializedName(""pending"") + PENDING(""pending""), - private String value; + @SerializedName(""sold"") + SOLD(""sold""); - StatusEnum(String value) { - this.value = value; - } + private String value; - @Override - public String toString() { - return String.valueOf(value); - } + StatusEnum(String value) { + this.value = value; } + @Override + public String toString() { + return value; + } +} + @SerializedName("status") private StatusEnum status = null; - - /** **/ @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - @ApiModelProperty(required = true, value = "") public Long getId() { return id; } @@ -93,18 +67,36 @@ public class InlineResponse200 { this.id = id; } - /** **/ @ApiModelProperty(value = "") - public Object getCategory() { + public Category getCategory() { return category; } - public void setCategory(Object category) { + public void setCategory(Category category) { this.category = category; } - + /** + **/ + @ApiModelProperty(required = true, value = "") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + @ApiModelProperty(required = true, value = "") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + /** **/ @ApiModelProperty(value = "") @@ -115,7 +107,6 @@ public class InlineResponse200 { this.tags = tags; } - /** * pet status in the store **/ @@ -127,7 +118,6 @@ public class InlineResponse200 { this.status = status; } - @Override public boolean equals(Object o) { @@ -137,29 +127,29 @@ public class InlineResponse200 { if (o == null || getClass() != o.getClass()) { return false; } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.photoUrls, inlineResponse200.photoUrls) && - Objects.equals(this.name, inlineResponse200.name) && - Objects.equals(this.id, inlineResponse200.id) && - Objects.equals(this.category, inlineResponse200.category) && - Objects.equals(this.tags, inlineResponse200.tags) && - Objects.equals(this.status, inlineResponse200.status); + Pet pet = (Pet) o; + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override public int hashCode() { - return Objects.hash(photoUrls, name, id, category, tags, status); + return Objects.hash(id, category, name, photoUrls, tags, status); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); + sb.append("class Pet {\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); @@ -177,4 +167,3 @@ public class InlineResponse200 { return o.toString().replace("\n", "\n "); } } - diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java index f5e5cea41514..a677427c46c1 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2/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-27T10:03:24.454+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T00:22:56.942+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/retrofit2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java index 196a57024040..b875279fa88d 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java @@ -27,14 +27,14 @@ public class Order { public enum StatusEnum { - @SerializedName("placed") - PLACED("placed"), + @SerializedName(""placed"") + PLACED(""placed""), - @SerializedName("approved") - APPROVED("approved"), + @SerializedName(""approved"") + APPROVED(""approved""), - @SerializedName("delivered") - DELIVERED("delivered"); + @SerializedName(""delivered"") + DELIVERED(""delivered""); private String value; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Pet.java index bcee581aa978..9620e9086c54 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Pet.java @@ -33,14 +33,14 @@ public class Pet { public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), + @SerializedName(""available"") + AVAILABLE(""available""), - @SerializedName("pending") - PENDING("pending"), + @SerializedName(""pending"") + PENDING(""pending""), - @SerializedName("sold") - SOLD("sold"); + @SerializedName(""sold"") + SOLD(""sold""); private String value; From 63701659128e3f1ef6e241e2af7250ce75378a2b Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 28 Apr 2016 16:13:44 +0800 Subject: [PATCH 078/170] fix retrofit 1, 2 java sample --- .../libraries/okhttp-gson/modelEnum.mustache | 2 +- .../okhttp-gson/modelInnerEnum.mustache | 2 +- .../Java/libraries/okhttp-gson/pojo.mustache | 4 +-- .../Java/libraries/retrofit/model.mustache | 4 +-- .../Java/libraries/retrofit2/model.mustache | 4 +-- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/model/Order.java | 35 ++++++++++--------- .../java/io/swagger/client/model/Pet.java | 35 ++++++++++--------- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/model/Order.java | 35 ++++++++++--------- .../java/io/swagger/client/model/Pet.java | 35 ++++++++++--------- 17 files changed, 92 insertions(+), 80 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache index a24100f5cc03..f7af4c89f2f8 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache @@ -2,7 +2,7 @@ * {{^description}}Gets or Sets {{name}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { - {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}) + {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{{name}}}({{{value}}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache index a95fd93249d7..30ebf3febb61 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache @@ -2,7 +2,7 @@ * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { - {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}) + {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{{name}}}({{{value}}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache index 1c9e06fa556c..b20499078a21 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache @@ -5,9 +5,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}} -{{>libraries/okhttp-gson/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} +{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} -{{>libraries/okhttp-gson/modelInnerEnum}}{{/items}}{{/items.isEnum}} +{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}} @SerializedName("{{baseName}}") private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; {{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/model.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/model.mustache index 779a56fedb76..1de150a9237a 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/model.mustache @@ -17,9 +17,9 @@ import com.google.gson.annotations.SerializedName; public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}} -{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} +{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} -{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}} +{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}} @SerializedName("{{baseName}}") private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; {{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/model.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/model.mustache index 779a56fedb76..1de150a9237a 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/model.mustache @@ -17,9 +17,9 @@ import com.google.gson.annotations.SerializedName; public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}} -{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} +{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} -{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}} +{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}} @SerializedName("{{baseName}}") private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; {{/vars}} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 6a437716d9c1..7c440acc914d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/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-28T15:54:58.477+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index 92cadce33c3e..3bb31938c36f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/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-28T15:54:58.477+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index 41324a8941d6..ff86c29b167f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/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-28T15:54:58.477+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index 0bc5d09320d6..67f661726b18 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/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-28T15:54:58.477+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+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/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index df09446d3b7a..c4e0be3e7118 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/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-28T15:54:58.477+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index 2d459e2da07c..e05568f8f383 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/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-28T15:54:58.477+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:09:59.809+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java index 8f94eebd211f..fb5b299a7066 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit/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-28T15:51:06.629+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:10:49.444+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/retrofit/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java index b875279fa88d..2f774c13834e 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java @@ -26,28 +26,31 @@ public class Order { private Date shipDate = null; -public enum StatusEnum { - @SerializedName(""placed"") - PLACED(""placed""), + /** + * Order Status + */ + public enum StatusEnum { + @SerializedName("placed") + PLACED("placed"), - @SerializedName(""approved"") - APPROVED(""approved""), + @SerializedName("approved") + APPROVED("approved"), - @SerializedName(""delivered"") - DELIVERED(""delivered""); + @SerializedName("delivered") + DELIVERED("delivered"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") private StatusEnum status = null; diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java index 9620e9086c54..8efc46bc471d 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Pet.java @@ -32,28 +32,31 @@ public class Pet { private List tags = new ArrayList(); -public enum StatusEnum { - @SerializedName(""available"") - AVAILABLE(""available""), + /** + * pet status in the store + */ + public enum StatusEnum { + @SerializedName("available") + AVAILABLE("available"), - @SerializedName(""pending"") - PENDING(""pending""), + @SerializedName("pending") + PENDING("pending"), - @SerializedName(""sold"") - SOLD(""sold""); + @SerializedName("sold") + SOLD("sold"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") private StatusEnum status = null; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java index a677427c46c1..fe188deeaf5d 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2/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-28T00:22:56.942+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:12:35.075+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/retrofit2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java index b875279fa88d..2f774c13834e 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java @@ -26,28 +26,31 @@ public class Order { private Date shipDate = null; -public enum StatusEnum { - @SerializedName(""placed"") - PLACED(""placed""), + /** + * Order Status + */ + public enum StatusEnum { + @SerializedName("placed") + PLACED("placed"), - @SerializedName(""approved"") - APPROVED(""approved""), + @SerializedName("approved") + APPROVED("approved"), - @SerializedName(""delivered"") - DELIVERED(""delivered""); + @SerializedName("delivered") + DELIVERED("delivered"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") private StatusEnum status = null; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Pet.java index 9620e9086c54..8efc46bc471d 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Pet.java @@ -32,28 +32,31 @@ public class Pet { private List tags = new ArrayList(); -public enum StatusEnum { - @SerializedName(""available"") - AVAILABLE(""available""), + /** + * pet status in the store + */ + public enum StatusEnum { + @SerializedName("available") + AVAILABLE("available"), - @SerializedName(""pending"") - PENDING(""pending""), + @SerializedName("pending") + PENDING("pending"), - @SerializedName(""sold"") - SOLD(""sold""); + @SerializedName("sold") + SOLD("sold"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") private StatusEnum status = null; From fc982d12052b70acf008f3d59f8d699dca5f8cdf Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 28 Apr 2016 16:15:06 +0800 Subject: [PATCH 079/170] add new files for java petstore --- .../petstore/java/default/docs/EnumClass.md | 8 + .../petstore/java/default/docs/EnumTest.md | 36 +++ .../petstore/java/default/docs/FakeApi.md | 4 +- .../java/io/swagger/client/api/FakeApi.java | 3 +- .../java/io/swagger/client/api/FakeApi.java | 40 ++++ .../java/okhttp-gson/docs/EnumClass.md | 14 ++ .../java/okhttp-gson/docs/EnumTest.md | 36 +++ .../petstore/java/okhttp-gson/docs/FakeApi.md | 75 ++++++ .../java/io/swagger/client/api/FakeApi.java | 221 ++++++++++++++++++ .../java/io/swagger/client/api/FakeApi.java | 66 ++++++ .../io/swagger/client/model/EnumClass.java | 50 ++++ .../io/swagger/client/model/EnumTest.java | 165 +++++++++++++ .../io/swagger/client/model/EnumClass.java | 50 ++++ .../io/swagger/client/model/EnumTest.java | 165 +++++++++++++ 14 files changed, 929 insertions(+), 4 deletions(-) create mode 100644 samples/client/petstore/java/default/docs/EnumClass.md create mode 100644 samples/client/petstore/java/default/docs/EnumTest.md create mode 100644 samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp-gson/docs/EnumClass.md create mode 100644 samples/client/petstore/java/okhttp-gson/docs/EnumTest.md create mode 100644 samples/client/petstore/java/okhttp-gson/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumTest.java diff --git a/samples/client/petstore/java/default/docs/EnumClass.md b/samples/client/petstore/java/default/docs/EnumClass.md new file mode 100644 index 000000000000..de0bc8a95ac8 --- /dev/null +++ b/samples/client/petstore/java/default/docs/EnumClass.md @@ -0,0 +1,8 @@ + +# EnumClass + +## Enum + +* `{values=[_abc, -efg, (xyz)], enumVars=[{name=_ABC, value="_abc"}, {name=_EFG, value="-efg"}, {name=_XYZ_, value="(xyz)"}]}` + + diff --git a/samples/client/petstore/java/default/docs/EnumTest.md b/samples/client/petstore/java/default/docs/EnumTest.md new file mode 100644 index 000000000000..deb1951c5528 --- /dev/null +++ b/samples/client/petstore/java/default/docs/EnumTest.md @@ -0,0 +1,36 @@ + +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] +**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] + + + +## Enum: EnumStringEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" + + + +## Enum: EnumIntegerEnum +Name | Value +---- | ----- +NUMBER_1 | 1 +NUMBER_MINUS_1 | -1 + + + +## Enum: EnumNumberEnum +Name | Value +---- | ----- +NUMBER_1_DOT_1 | 1.1 +NUMBER_MINUS_1_DOT_2 | -1.2 + + + diff --git a/samples/client/petstore/java/default/docs/FakeApi.md b/samples/client/petstore/java/default/docs/FakeApi.md index c1fdd3103218..f642566c8e77 100644 --- a/samples/client/petstore/java/default/docs/FakeApi.md +++ b/samples/client/petstore/java/default/docs/FakeApi.md @@ -23,7 +23,7 @@ Fake endpoint for testing various parameters FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None +String number = "number_example"; // String | None Double _double = 3.4D; // Double | None String string = "string_example"; // String | None byte[] _byte = B; // byte[] | None @@ -47,7 +47,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | + **number** | **String**| None | **_double** | **Double**| None | **string** | **String**| None | **_byte** | **byte[]**| None | diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java index 59d58fc6c7d7..ddfaff67d0f5 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java @@ -8,7 +8,6 @@ import io.swagger.client.Configuration; import io.swagger.client.Pair; import java.util.Date; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; @@ -52,7 +51,7 @@ public class FakeApi { * @param password None (optional) * @throws ApiException if fails to make API call */ - public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + public void testEndpointParameters(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java new file mode 100644 index 000000000000..b92a064d3e5b --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -0,0 +1,40 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiClient; + +import java.util.Date; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import feign.*; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") +public interface FakeApi extends ApiClient.Api { + + + /** + * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @return void + */ + @RequestLine("POST /fake") + @Headers({ + "Content-type: application/x-www-form-urlencoded", + "Accepts: application/json", + }) + void testEndpointParameters(@Param("number") String number, @Param("_double") Double _double, @Param("string") String string, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("binary") byte[] binary, @Param("date") Date date, @Param("dateTime") Date dateTime, @Param("password") String password); +} diff --git a/samples/client/petstore/java/okhttp-gson/docs/EnumClass.md b/samples/client/petstore/java/okhttp-gson/docs/EnumClass.md new file mode 100644 index 000000000000..d03195a19a41 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/EnumClass.md @@ -0,0 +1,14 @@ + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/EnumTest.md b/samples/client/petstore/java/okhttp-gson/docs/EnumTest.md new file mode 100644 index 000000000000..deb1951c5528 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/EnumTest.md @@ -0,0 +1,36 @@ + +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] +**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] + + + +## Enum: EnumStringEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" + + + +## Enum: EnumIntegerEnum +Name | Value +---- | ----- +NUMBER_1 | 1 +NUMBER_MINUS_1 | -1 + + + +## Enum: EnumNumberEnum +Name | Value +---- | ----- +NUMBER_1_DOT_1 | 1.1 +NUMBER_MINUS_1_DOT_2 | -1.2 + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md new file mode 100644 index 000000000000..f642566c8e77 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md @@ -0,0 +1,75 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters + + + +# **testEndpointParameters** +> testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String number = "number_example"; // String | None +Double _double = 3.4D; // Double | None +String string = "string_example"; // String | None +byte[] _byte = B; // byte[] | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 789L; // Long | None +Float _float = 3.4F; // Float | None +byte[] binary = B; // byte[] | None +Date date = new Date(); // Date | None +Date dateTime = new Date(); // Date | None +String password = "password_example"; // String | None +try { + apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **String**| None | + **_double** | **Double**| None | + **string** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **binary** | **byte[]**| None | [optional] + **date** | **Date**| None | [optional] + **dateTime** | **Date**| None | [optional] + **password** | **String**| None | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java new file mode 100644 index 000000000000..dd6d8236607a --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -0,0 +1,221 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import com.squareup.okhttp.Call; +import com.squareup.okhttp.Interceptor; +import com.squareup.okhttp.Response; + +import java.io.IOException; + +import java.util.Date; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient apiClient; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /* Build call for testEndpointParameters */ + private Call testEndpointParametersCall(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter 'string' is set + if (string == null) { + throw new ApiException("Missing the required parameter 'string' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + } + + + // create path and map variables + String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + if (integer != null) + localVarFormParams.put("integer", integer); + if (int32 != null) + localVarFormParams.put("int32", int32); + if (int64 != null) + localVarFormParams.put("int64", int64); + if (number != null) + localVarFormParams.put("number", number); + if (_float != null) + localVarFormParams.put("float", _float); + if (_double != null) + localVarFormParams.put("double", _double); + if (string != null) + localVarFormParams.put("string", string); + if (_byte != null) + localVarFormParams.put("byte", _byte); + if (binary != null) + localVarFormParams.put("binary", binary); + if (date != null) + localVarFormParams.put("date", date); + if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); + if (password != null) + localVarFormParams.put("password", password); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void testEndpointParameters(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + testEndpointParametersWithHttpInfo(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + } + + /** + * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse testEndpointParametersWithHttpInfo(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, null, null); + return apiClient.execute(call); + } + + /** + * Fake endpoint for testing various parameters (asynchronously) + * Fake endpoint for testing various parameters + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call testEndpointParametersAsync(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java new file mode 100644 index 000000000000..03f5b9aff1b0 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java @@ -0,0 +1,66 @@ +package io.swagger.client.api; + +import io.swagger.client.CollectionFormats.*; + +import retrofit.Callback; +import retrofit.http.*; +import retrofit.mime.*; + +import java.util.Date; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public interface FakeApi { + /** + * Fake endpoint for testing various parameters + * Sync method + * Fake endpoint for testing various parameters + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @return Void + */ + + @FormUrlEncoded + @POST("/fake") + Void testEndpointParameters( + @Field("number") String number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password + ); + + /** + * Fake endpoint for testing various parameters + * Async method + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param cb callback method + * @return void + */ + + @FormUrlEncoded + @POST("/fake") + void testEndpointParameters( + @Field("number") String number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password, Callback cb + ); +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumClass.java new file mode 100644 index 000000000000..8f9357fbd323 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumClass.java @@ -0,0 +1,50 @@ +package io.swagger.client.model; + +import java.util.Objects; + +import com.google.gson.annotations.SerializedName; + + + + + +public class EnumClass { + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumClass enumClass = (EnumClass) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumClass {\n"); + + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumTest.java new file mode 100644 index 000000000000..8db392afccc9 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumTest.java @@ -0,0 +1,165 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class EnumTest { + + + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + @SerializedName("UPPER") + UPPER("UPPER"), + + @SerializedName("lower") + LOWER("lower"); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_string") + private EnumStringEnum enumString = null; + + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + @SerializedName("1") + NUMBER_1(1), + + @SerializedName("-1") + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_integer") + private EnumIntegerEnum enumInteger = null; + + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + @SerializedName("1.1") + NUMBER_1_DOT_1(1.1), + + @SerializedName("-1.2") + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_number") + private EnumNumberEnum enumNumber = null; + + /** + **/ + @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { + return enumString; + } + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + /** + **/ + @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + /** + **/ + @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(enumString, enumTest.enumString) && + Objects.equals(enumInteger, enumTest.enumInteger) && + Objects.equals(enumNumber, enumTest.enumNumber); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumClass.java new file mode 100644 index 000000000000..8f9357fbd323 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumClass.java @@ -0,0 +1,50 @@ +package io.swagger.client.model; + +import java.util.Objects; + +import com.google.gson.annotations.SerializedName; + + + + + +public class EnumClass { + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumClass enumClass = (EnumClass) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumClass {\n"); + + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumTest.java new file mode 100644 index 000000000000..8db392afccc9 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumTest.java @@ -0,0 +1,165 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class EnumTest { + + + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + @SerializedName("UPPER") + UPPER("UPPER"), + + @SerializedName("lower") + LOWER("lower"); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_string") + private EnumStringEnum enumString = null; + + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + @SerializedName("1") + NUMBER_1(1), + + @SerializedName("-1") + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_integer") + private EnumIntegerEnum enumInteger = null; + + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + @SerializedName("1.1") + NUMBER_1_DOT_1(1.1), + + @SerializedName("-1.2") + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_number") + private EnumNumberEnum enumNumber = null; + + /** + **/ + @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { + return enumString; + } + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + /** + **/ + @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + /** + **/ + @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(enumString, enumTest.enumString) && + Objects.equals(enumInteger, enumTest.enumInteger) && + Objects.equals(enumNumber, enumTest.enumNumber); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} From 8f2573f8a7eb01151503c29f1cea000df88a0291 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 28 Apr 2016 23:47:15 +0800 Subject: [PATCH 080/170] add new files for retrofit2rx --- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 3 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/model/EnumClass.java | 50 ++++++ .../io/swagger/client/model/EnumTest.java | 165 ++++++++++++++++++ .../io/swagger/client/model/FormatTest.java | 18 +- .../java/io/swagger/client/model/Order.java | 35 ++-- .../java/io/swagger/client/model/Pet.java | 35 ++-- 8 files changed, 274 insertions(+), 36 deletions(-) create mode 100644 samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumTest.java diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java index cee81411e96a..ed7083e0370b 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2rx/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-27T10:03:29.641+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T23:45:14.234+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/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java index beaa9833892a..768376eb8f92 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java @@ -9,6 +9,7 @@ import retrofit2.http.*; import okhttp3.RequestBody; import java.util.Date; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; @@ -37,7 +38,7 @@ public interface FakeApi { @FormUrlEncoded @POST("fake") Observable testEndpointParameters( - @Field("number") String number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password + @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password ); } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java index 4a2e64b726e3..304ea7a29a8b 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java @@ -9,8 +9,8 @@ import retrofit2.http.*; import okhttp3.RequestBody; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumClass.java new file mode 100644 index 000000000000..8f9357fbd323 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumClass.java @@ -0,0 +1,50 @@ +package io.swagger.client.model; + +import java.util.Objects; + +import com.google.gson.annotations.SerializedName; + + + + + +public class EnumClass { + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumClass enumClass = (EnumClass) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumClass {\n"); + + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumTest.java new file mode 100644 index 000000000000..8db392afccc9 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumTest.java @@ -0,0 +1,165 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class EnumTest { + + + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + @SerializedName("UPPER") + UPPER("UPPER"), + + @SerializedName("lower") + LOWER("lower"); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_string") + private EnumStringEnum enumString = null; + + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + @SerializedName("1") + NUMBER_1(1), + + @SerializedName("-1") + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_integer") + private EnumIntegerEnum enumInteger = null; + + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + @SerializedName("1.1") + NUMBER_1_DOT_1(1.1), + + @SerializedName("-1.2") + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } + + @SerializedName("enum_number") + private EnumNumberEnum enumNumber = null; + + /** + **/ + @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { + return enumString; + } + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + /** + **/ + @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + /** + **/ + @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(enumString, enumTest.enumString) && + Objects.equals(enumInteger, enumTest.enumInteger) && + Objects.equals(enumNumber, enumTest.enumNumber); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java index 40d1ca0ecea9..4106b15caaf8 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java @@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.Date; +import java.util.UUID; import com.google.gson.annotations.SerializedName; @@ -47,6 +48,9 @@ public class FormatTest { @SerializedName("dateTime") private Date dateTime = null; + @SerializedName("uuid") + private UUID uuid = null; + @SerializedName("password") private String password = null; @@ -170,6 +174,16 @@ public class FormatTest { this.dateTime = dateTime; } + /** + **/ + @ApiModelProperty(value = "") + public UUID getUuid() { + return uuid; + } + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + /** **/ @ApiModelProperty(required = true, value = "") @@ -201,12 +215,13 @@ public class FormatTest { Objects.equals(binary, formatTest.binary) && Objects.equals(date, formatTest.date) && Objects.equals(dateTime, formatTest.dateTime) && + Objects.equals(uuid, formatTest.uuid) && Objects.equals(password, formatTest.password); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, password); + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } @Override @@ -225,6 +240,7 @@ public class FormatTest { sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java index 196a57024040..2f774c13834e 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java @@ -26,28 +26,31 @@ public class Order { private Date shipDate = null; -public enum StatusEnum { - @SerializedName("placed") - PLACED("placed"), + /** + * Order Status + */ + public enum StatusEnum { + @SerializedName("placed") + PLACED("placed"), - @SerializedName("approved") - APPROVED("approved"), + @SerializedName("approved") + APPROVED("approved"), - @SerializedName("delivered") - DELIVERED("delivered"); + @SerializedName("delivered") + DELIVERED("delivered"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") private StatusEnum status = null; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Pet.java index bcee581aa978..8efc46bc471d 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Pet.java @@ -32,28 +32,31 @@ public class Pet { private List tags = new ArrayList(); -public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), + /** + * pet status in the store + */ + public enum StatusEnum { + @SerializedName("available") + AVAILABLE("available"), - @SerializedName("pending") - PENDING("pending"), + @SerializedName("pending") + PENDING("pending"), - @SerializedName("sold") - SOLD("sold"); + @SerializedName("sold") + SOLD("sold"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - @Override - public String toString() { - return value; - } -} - @SerializedName("status") private StatusEnum status = null; From 6e8a19bc5bbd52bfd75e18e7495f9a3731feaf73 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 29 Apr 2016 00:21:24 +0800 Subject: [PATCH 081/170] fix enum for jaxrs and resteasy --- .../JavaJaxRS/jersey1_18/enumClass.mustache | 21 ++- .../JavaJaxRS/resteasy/enumClass.mustache | 21 ++- .../gen/java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/gen/java/io/swagger/api/PetApi.java | 2 +- .../java/io/swagger/api/PetApiService.java | 2 +- .../src/gen/java/io/swagger/api/StoreApi.java | 2 +- .../java/io/swagger/api/StoreApiService.java | 2 +- .../gen/java/io/swagger/api/StringUtil.java | 2 +- .../src/gen/java/io/swagger/api/UserApi.java | 2 +- .../java/io/swagger/api/UserApiService.java | 2 +- .../gen/java/io/swagger/model/Category.java | 2 +- .../io/swagger/model/ModelApiResponse.java | 2 +- .../src/gen/java/io/swagger/model/Order.java | 13 +- .../src/gen/java/io/swagger/model/Pet.java | 13 +- .../src/gen/java/io/swagger/model/Tag.java | 2 +- .../src/gen/java/io/swagger/model/User.java | 2 +- .../src/gen/java/io/swagger/model/Order.java | 11 +- .../src/gen/java/io/swagger/model/Pet.java | 159 +++++++++--------- 21 files changed, 146 insertions(+), 122 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/enumClass.mustache index 6010e26704f5..a9f78081ce51 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/enumClass.mustache @@ -1,17 +1,24 @@ + /** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}}({{{value}}}){{^-last}}, - public enum {{{datatypeWithEnum}}} { - {{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}}, - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/-last}}{{#-last}}; + {{/-last}} + {{/enumVars}} + {{/allowableValues}} + private {{datatype}} value; - private String value; - - {{{datatypeWithEnum}}}(String value) { + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) { this.value = value; } @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache index 6010e26704f5..a9f78081ce51 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache @@ -1,17 +1,24 @@ + /** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}}({{{value}}}){{^-last}}, - public enum {{{datatypeWithEnum}}} { - {{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}}, - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/-last}}{{#-last}}; + {{/-last}} + {{/enumVars}} + {{/allowableValues}} + private {{datatype}} value; - private String value; - - {{{datatypeWithEnum}}}(String value) { + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) { this.value = value; } @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java index 24a379384009..269b2e95c5e9 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java index 48b4d658725a..a12422230ec1 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class ApiOriginFilter implements javax.servlet.Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java index b1b2df77e20e..43cc54796d54 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java index 77bd497a3794..a367cfec5148 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java index 11870e95f1ed..6e360c1e23f4 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java @@ -22,7 +22,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class PetApi { private final PetApiService delegate = PetApiServiceFactory.getPetApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java index def447f5695d..f1a3e2465c24 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java @@ -17,7 +17,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public abstract class PetApiService { public abstract Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java index dea36a072753..ed21293f4660 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java @@ -20,7 +20,7 @@ import javax.ws.rs.*; @Path("/store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class StoreApi { private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java index dc740cd491df..52ea6fba8170 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java @@ -15,7 +15,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public abstract class StoreApiService { public abstract Response deleteOrder(String orderId,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java index 0cfee024b002..2fce17c06ce8 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java index 02e6d6b24da7..55bd0c185d95 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java @@ -20,7 +20,7 @@ import javax.ws.rs.*; @Path("/user") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class UserApi { private final UserApiService delegate = UserApiServiceFactory.getUserApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java index e900b1460614..ea30abb522f8 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java @@ -15,7 +15,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public abstract class UserApiService { public abstract Response createUser(User body,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java index bfeecafe6893..165fce2a49db 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelApiResponse.java index a46b64b8bbd8..8c1bdbf106ef 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java index e8af2984ef91..f33876b9c65a 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java @@ -9,7 +9,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class Order { private Long id = null; @@ -17,12 +17,15 @@ public class Order { private Integer quantity = null; private Date shipDate = null; - + /** + * Order Status + */ public enum StatusEnum { PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"); + APPROVED("approved"), + + DELIVERED("delivered"); private String value; StatusEnum(String value) { @@ -32,7 +35,7 @@ public class Order { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java index 740ed352c9dd..a14c72699313 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java @@ -11,7 +11,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class Pet { private Long id = null; @@ -20,12 +20,15 @@ public class Pet { private List photoUrls = new ArrayList(); private List tags = new ArrayList(); - + /** + * pet status in the store + */ public enum StatusEnum { AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); + PENDING("pending"), + + SOLD("sold"); private String value; StatusEnum(String value) { @@ -35,7 +38,7 @@ public class Pet { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java index 0a7e01df75b9..74ec375d7e22 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java index 3c1448921932..f01215a829e6 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-22T19:32:21.945+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") public class User { private Long id = null; diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java index 825fa282b8b0..fd36213d1282 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java @@ -19,12 +19,15 @@ public class Order { private Integer quantity = null; private Date shipDate = null; - + /** + * Order Status + */ public enum StatusEnum { PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"); + APPROVED("approved"), + + DELIVERED("delivered"); private String value; StatusEnum(String value) { @@ -34,7 +37,7 @@ public class Order { @Override @JsonValue public String toString() { - return value; + return String.valueOf(value); } } diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java index 6a4ce4398843..69fe2ca44db7 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java @@ -1,25 +1,26 @@ -package io.swagger.client.model; +package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.swagger.client.model.Tag; +import io.swagger.model.Category; +import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; -/** - * InlineResponse200 - */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") -public class InlineResponse200 { + + + + +public class Pet { - private List photoUrls = new ArrayList(); - private String name = null; private Long id = null; - private Object category = null; + private Category category = null; + private String name = null; + private List photoUrls = new ArrayList(); private List tags = new ArrayList(); /** @@ -27,9 +28,10 @@ public class InlineResponse200 { */ public enum StatusEnum { AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); + PENDING("pending"), + + SOLD("sold"); private String value; StatusEnum(String value) { @@ -45,49 +47,15 @@ public class InlineResponse200 { private StatusEnum status = null; - /** **/ - public InlineResponse200 photoUrls(List photoUrls) { - this.photoUrls = photoUrls; - return this; - } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - /** - **/ - public InlineResponse200 name(String name) { - this.name = name; - return this; - } - - @ApiModelProperty(example = "doggie", value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - public InlineResponse200 id(Long id) { + public Pet id(Long id) { this.id = id; return this; } + - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(value = "") @JsonProperty("id") public Long getId() { return id; @@ -96,32 +64,66 @@ public class InlineResponse200 { this.id = id; } - /** **/ - public InlineResponse200 category(Object category) { + public Pet category(Category category) { this.category = category; return this; } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("category") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } + @ApiModelProperty(value = "") + @JsonProperty("category") + public Category getCategory() { + return category; + } + public void setCategory(Category category) { + this.category = category; + } + /** **/ - public InlineResponse200 tags(List tags) { + public Pet name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + /** + **/ + public Pet tags(List tags) { this.tags = tags; return this; } + - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") @JsonProperty("tags") public List getTags() { return tags; @@ -130,16 +132,16 @@ public class InlineResponse200 { this.tags = tags; } - /** * pet status in the store **/ - public InlineResponse200 status(StatusEnum status) { + public Pet status(StatusEnum status) { this.status = status; return this; } + - @ApiModelProperty(example = "null", value = "pet status in the store") + @ApiModelProperty(value = "pet status in the store") @JsonProperty("status") public StatusEnum getStatus() { return status; @@ -148,39 +150,38 @@ public class InlineResponse200 { this.status = status; } - @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.photoUrls, inlineResponse200.photoUrls) && - Objects.equals(this.name, inlineResponse200.name) && - Objects.equals(this.id, inlineResponse200.id) && - Objects.equals(this.category, inlineResponse200.category) && - Objects.equals(this.tags, inlineResponse200.tags) && - Objects.equals(this.status, inlineResponse200.status); + Pet pet = (Pet) o; + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override public int hashCode() { - return Objects.hash(photoUrls, name, id, category, tags, status); + return Objects.hash(id, category, name, photoUrls, tags, status); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); + sb.append("class Pet {\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); @@ -191,7 +192,7 @@ public class InlineResponse200 { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(java.lang.Object o) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } From d35e30d57897ed3c72c8583b09d68ccb0cdc1466 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 2 May 2016 23:26:47 +0800 Subject: [PATCH 082/170] better enum support for JS --- bin/javascript-petstore.sh | 2 +- .../languages/JavascriptClientCodegen.java | 48 +++++-- .../resources/Javascript/enumClass.mustache | 18 ++- samples/client/petstore/javascript/README.md | 39 ++++-- .../petstore/javascript/docs/ApiResponse.md | 10 ++ .../petstore/javascript/docs/EnumClass.md | 7 + .../petstore/javascript/docs/EnumTest.md | 10 ++ .../petstore/javascript/docs/FakeApi.md | 82 +++++++++++ .../petstore/javascript/docs/FormatTest.md | 8 +- .../client/petstore/javascript/docs/Name.md | 1 + .../client/petstore/javascript/docs/Order.md | 2 +- .../client/petstore/javascript/docs/PetApi.md | 86 ++++++------ .../petstore/javascript/docs/StoreApi.md | 23 ++-- .../petstore/javascript/docs/UserApi.md | 76 +++++------ .../client/petstore/javascript/package.json | 2 +- .../petstore/javascript/src/api/FakeApi.js | 121 ++++++++++++++++ .../petstore/javascript/src/api/PetApi.js | 93 +++++++------ .../petstore/javascript/src/api/StoreApi.js | 23 ++-- .../petstore/javascript/src/api/UserApi.js | 90 +++++++----- .../client/petstore/javascript/src/index.js | 68 ++++++++- .../petstore/javascript/src/model/Animal.js | 7 +- .../javascript/src/model/ApiResponse.js | 81 +++++++++++ .../petstore/javascript/src/model/Cat.js | 7 +- .../petstore/javascript/src/model/Dog.js | 7 +- .../javascript/src/model/EnumClass.js | 54 ++++++++ .../petstore/javascript/src/model/EnumTest.js | 129 ++++++++++++++++++ .../javascript/src/model/FormatTest.js | 38 ++++-- .../javascript/src/model/Model200Response.js | 3 +- .../javascript/src/model/ModelReturn.js | 3 +- .../petstore/javascript/src/model/Name.js | 14 +- .../petstore/javascript/src/model/Order.js | 21 ++- .../petstore/javascript/src/model/Pet.js | 18 ++- .../javascript/src/model/SpecialModelName.js | 3 +- .../javascript/test/api/PetApiTest.js | 2 +- 34 files changed, 933 insertions(+), 263 deletions(-) create mode 100644 samples/client/petstore/javascript/docs/ApiResponse.md create mode 100644 samples/client/petstore/javascript/docs/EnumClass.md create mode 100644 samples/client/petstore/javascript/docs/EnumTest.md create mode 100644 samples/client/petstore/javascript/docs/FakeApi.md create mode 100644 samples/client/petstore/javascript/src/api/FakeApi.js create mode 100644 samples/client/petstore/javascript/src/model/ApiResponse.js create mode 100644 samples/client/petstore/javascript/src/model/EnumClass.js create mode 100644 samples/client/petstore/javascript/src/model/EnumTest.js diff --git a/bin/javascript-petstore.sh b/bin/javascript-petstore.sh index 11fadd17d497..2eb26210e0ae 100755 --- a/bin/javascript-petstore.sh +++ b/bin/javascript-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l javascript -o samples/client/petstore/javascript" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l javascript -o samples/client/petstore/javascript" java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags 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 4ba6a2247819..feec76d8de2b 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 @@ -892,7 +892,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo } } enumVar.put("name", toEnumVarName(enumName, var.datatype)); - enumVar.put("value", value.toString()); + enumVar.put("value",toEnumValue(value.toString(), var.datatype)); enumVars.add(enumVar); } allowableValues.put("enumVars", enumVars); @@ -938,15 +938,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); } */ - @Override - public String toEnumVarName(String value, String datatype) { - String var = value.replaceAll("\\W+", "_").toUpperCase(); - if (var.matches("\\d.*")) { - return "_" + var; - } else { - return var; - } - } private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) { // This generator uses inline classes to define enums, which breaks when @@ -1005,4 +996,41 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo return packageName; } + @Override + public String toEnumName(CodegenProperty property) { + return sanitizeName(camelize(property.name)) + "Enum"; + } + + @Override + public String toEnumVarName(String value, String datatype) { + return value; + /* + // number + if ("Integer".equals(datatype) || "Number".equals(datatype)) { + String varName = "NUMBER_" + value; + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); + return varName; + } + + // string + String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase(); + if (var.matches("\\d.*")) { + return "_" + var; + } else { + return var; + } + */ + } + + @Override + public String toEnumValue(String value, String datatype) { + if ("Integer".equals(datatype) || "Number".equals(datatype)) { + return value; + } else { + return "\"" + escapeText(value) + "\""; + } + } + } diff --git a/modules/swagger-codegen/src/main/resources/Javascript/enumClass.mustache b/modules/swagger-codegen/src/main/resources/Javascript/enumClass.mustache index d245084042ae..fb1e228577c9 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/enumClass.mustache @@ -3,11 +3,17 @@ * @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%> * @readonly */{{/emitJSDoc}} - exports.{{datatypeWithEnum}} = { {{#allowableValues}}{{#enumVars}} -{{#emitJSDoc}} /** - * value: {{value}} + exports.{{datatypeWithEnum}} = { + {{#allowableValues}} + {{#enumVars}} +{{#emitJSDoc}} + /** + * value: {{{value}}} * @const */ -{{/emitJSDoc}} {{name}}: "{{value}}"{{^-last}}, - {{/-last}}{{/enumVars}}{{/allowableValues}} - }; \ No newline at end of file +{{/emitJSDoc}} + "{{name}}": {{{value}}}{{^-last}}, + {{/-last}} + {{/enumVars}} + {{/allowableValues}} + }; diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 2ddda0aa3515..9c0393eb5029 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -1,12 +1,12 @@ # swagger-petstore SwaggerPetstore - JavaScript client for swagger-petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This SDK 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-02T22:07:48.077+08:00 +- Build date: 2016-05-02T23:24:54.621+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -53,16 +53,25 @@ Please follow the [installation](#installation) instruction and execute the foll ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; +var api = new SwaggerPetstore.FakeApi() -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +var _number = 3.4; // {Number} None -var api = new SwaggerPetstore.PetApi() +var _double = 1.2; // {Number} None + +var _string = "_string_example"; // {String} None + +var _byte = "B"; // {String} None var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'integer': 56, // {Integer} None + 'int32': 56, // {Integer} None + 'int64': 789, // {Integer} None + '_float': 3.4, // {Number} None + 'binary': "B", // {String} None + '_date': new Date("2013-10-20"), // {Date} None + 'dateTime': new Date("2013-10-20T19:20:30+01:00"), // {Date} None + 'password': "password_example" // {String} None }; var callback = function(error, data, response) { @@ -72,7 +81,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.addPet(opts, callback); +api.testEndpointParameters(_number, _double, _string, _byte, opts, callback); ``` @@ -82,6 +91,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*SwaggerPetstore.FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters *SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *SwaggerPetstore.PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet *SwaggerPetstore.PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -106,9 +116,20 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [SwaggerPetstore.Animal](docs/Animal.md) + - [SwaggerPetstore.ApiResponse](docs/ApiResponse.md) + - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) + - [SwaggerPetstore.Dog](docs/Dog.md) + - [SwaggerPetstore.EnumClass](docs/EnumClass.md) + - [SwaggerPetstore.EnumTest](docs/EnumTest.md) + - [SwaggerPetstore.FormatTest](docs/FormatTest.md) + - [SwaggerPetstore.Model200Response](docs/Model200Response.md) + - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) + - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.Order](docs/Order.md) - [SwaggerPetstore.Pet](docs/Pet.md) + - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) - [SwaggerPetstore.Tag](docs/Tag.md) - [SwaggerPetstore.User](docs/User.md) diff --git a/samples/client/petstore/javascript/docs/ApiResponse.md b/samples/client/petstore/javascript/docs/ApiResponse.md new file mode 100644 index 000000000000..0ee678b84afa --- /dev/null +++ b/samples/client/petstore/javascript/docs/ApiResponse.md @@ -0,0 +1,10 @@ +# SwaggerPetstore.ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + diff --git a/samples/client/petstore/javascript/docs/EnumClass.md b/samples/client/petstore/javascript/docs/EnumClass.md new file mode 100644 index 000000000000..5159ccfb4540 --- /dev/null +++ b/samples/client/petstore/javascript/docs/EnumClass.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript/docs/EnumTest.md b/samples/client/petstore/javascript/docs/EnumTest.md new file mode 100644 index 000000000000..724eea8a25e9 --- /dev/null +++ b/samples/client/petstore/javascript/docs/EnumTest.md @@ -0,0 +1,10 @@ +# SwaggerPetstore.EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumInteger** | **Integer** | | [optional] +**enumNumber** | **Number** | | [optional] + + diff --git a/samples/client/petstore/javascript/docs/FakeApi.md b/samples/client/petstore/javascript/docs/FakeApi.md new file mode 100644 index 000000000000..121056d1c568 --- /dev/null +++ b/samples/client/petstore/javascript/docs/FakeApi.md @@ -0,0 +1,82 @@ +# SwaggerPetstore.FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters + + + +# **testEndpointParameters** +> testEndpointParameters(_number, _double, _string, _byte, opts) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var _number = 3.4; // Number | None + +var _double = 1.2; // Number | None + +var _string = "_string_example"; // String | None + +var _byte = "B"; // String | None + +var opts = { + 'integer': 56, // Integer | None + 'int32': 56, // Integer | None + 'int64': 789, // Integer | None + '_float': 3.4, // Number | None + 'binary': "B", // String | None + '_date': new Date("2013-10-20"), // Date | None + 'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None + 'password': "password_example" // String | None +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully.'); + } +}; +apiInstance.testEndpointParameters(_number, _double, _string, _byte, opts, callback); +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_number** | **Number**| None | + **_double** | **Number**| None | + **_string** | **String**| None | + **_byte** | **String**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Integer**| None | [optional] + **_float** | **Number**| None | [optional] + **binary** | **String**| None | [optional] + **_date** | **Date**| None | [optional] + **dateTime** | **Date**| None | [optional] + **password** | **String**| None | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/javascript/docs/FormatTest.md b/samples/client/petstore/javascript/docs/FormatTest.md index 57a4fb132d53..9600904ee6d4 100644 --- a/samples/client/petstore/javascript/docs/FormatTest.md +++ b/samples/client/petstore/javascript/docs/FormatTest.md @@ -10,9 +10,11 @@ Name | Type | Description | Notes **_float** | **Number** | | [optional] **_double** | **Number** | | [optional] **_string** | **String** | | [optional] -**_byte** | **String** | | [optional] +**_byte** | **String** | | **binary** | **String** | | [optional] -**_date** | **Date** | | [optional] -**dateTime** | **String** | | [optional] +**_date** | **Date** | | +**dateTime** | **Date** | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | diff --git a/samples/client/petstore/javascript/docs/Name.md b/samples/client/petstore/javascript/docs/Name.md index f0e693f2f564..3bdb76be0859 100644 --- a/samples/client/petstore/javascript/docs/Name.md +++ b/samples/client/petstore/javascript/docs/Name.md @@ -5,5 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | **snakeCase** | **Integer** | | [optional] +**property** | **String** | | [optional] diff --git a/samples/client/petstore/javascript/docs/Order.md b/samples/client/petstore/javascript/docs/Order.md index b34b67d3a56a..10503b582065 100644 --- a/samples/client/petstore/javascript/docs/Order.md +++ b/samples/client/petstore/javascript/docs/Order.md @@ -8,6 +8,6 @@ Name | Type | Description | Notes **quantity** | **Integer** | | [optional] **shipDate** | **Date** | | [optional] **status** | **String** | Order Status | [optional] -**complete** | **Boolean** | | [optional] +**complete** | **Boolean** | | [optional] [default to false] diff --git a/samples/client/petstore/javascript/docs/PetApi.md b/samples/client/petstore/javascript/docs/PetApi.md index 39b8726b0b63..8807e772687c 100644 --- a/samples/client/petstore/javascript/docs/PetApi.md +++ b/samples/client/petstore/javascript/docs/PetApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **addPet** -> addPet(opts) +> addPet(body) Add a new pet to the store @@ -33,9 +33,8 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var opts = { - 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store -}; +var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store + var callback = function(error, data, response) { if (error) { @@ -44,14 +43,14 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -apiInstance.addPet(opts, callback); +apiInstance.addPet(body, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -64,7 +63,7 @@ null (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **deletePet** @@ -119,15 +118,15 @@ null (empty response body) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **findPetsByStatus** -> [Pet] findPetsByStatus(opts) +> [Pet] findPetsByStatus(status) Finds Pets by status -Multiple status values can be provided with comma seperated strings +Multiple status values can be provided with comma separated strings ### Example ```javascript @@ -140,9 +139,8 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var opts = { - 'status': ["available"] // [String] | Status values that need to be considered for filter -}; +var status = ["status_example"]; // [String] | Status values that need to be considered for filter + var callback = function(error, data, response) { if (error) { @@ -151,14 +149,14 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -apiInstance.findPetsByStatus(opts, callback); +apiInstance.findPetsByStatus(status, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**[String]**](String.md)| Status values that need to be considered for filter | [optional] [default to available] + **status** | [**[String]**](String.md)| Status values that need to be considered for filter | ### Return type @@ -171,15 +169,15 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **findPetsByTags** -> [Pet] findPetsByTags(opts) +> [Pet] findPetsByTags(tags) Finds Pets by tags -Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example ```javascript @@ -192,9 +190,8 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var opts = { - 'tags': ["tags_example"] // [String] | Tags to filter by -}; +var tags = ["tags_example"]; // [String] | Tags to filter by + var callback = function(error, data, response) { if (error) { @@ -203,14 +200,14 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -apiInstance.findPetsByTags(opts, callback); +apiInstance.findPetsByTags(tags, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**[String]**](String.md)| Tags to filter by | [optional] + **tags** | [**[String]**](String.md)| Tags to filter by | ### Return type @@ -223,7 +220,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **getPetById** @@ -231,7 +228,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a single pet ### Example ```javascript @@ -244,13 +241,9 @@ api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.apiKeyPrefix = 'Token'; -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; - var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Integer | ID of pet that needs to be fetched +var petId = 789; // Integer | ID of pet to return var callback = function(error, data, response) { @@ -267,7 +260,7 @@ apiInstance.getPetById(petId, callback); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | + **petId** | **Integer**| ID of pet to return | ### Return type @@ -275,16 +268,16 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **updatePet** -> updatePet(opts) +> updatePet(body) Update an existing pet @@ -301,9 +294,8 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var opts = { - 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store -}; +var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store + var callback = function(error, data, response) { if (error) { @@ -312,14 +304,14 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -apiInstance.updatePet(opts, callback); +apiInstance.updatePet(body, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -332,7 +324,7 @@ null (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **updatePetWithForm** @@ -353,7 +345,7 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var petId = "petId_example"; // String | ID of pet that needs to be updated +var petId = 789; // Integer | ID of pet that needs to be updated var opts = { 'name': "name_example", // String | Updated name of the pet @@ -374,7 +366,7 @@ apiInstance.updatePetWithForm(petId, opts, callback); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **String**| ID of pet that needs to be updated | + **petId** | **Integer**| ID of pet that needs to be updated | **name** | **String**| Updated name of the pet | [optional] **status** | **String**| Updated status of the pet | [optional] @@ -389,11 +381,11 @@ null (empty response body) ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **uploadFile** -> uploadFile(petId, opts) +> ApiResponse uploadFile(petId, opts) uploads an image @@ -421,7 +413,7 @@ var callback = function(error, data, response) { if (error) { console.error(error); } else { - console.log('API called successfully.'); + console.log('API called successfully. Returned data: ' + data); } }; apiInstance.uploadFile(petId, opts, callback); @@ -437,7 +429,7 @@ Name | Type | Description | Notes ### Return type -null (empty response body) +[**ApiResponse**](ApiResponse.md) ### Authorization @@ -446,5 +438,5 @@ null (empty response body) ### HTTP request headers - **Content-Type**: multipart/form-data - - **Accept**: application/json, application/xml + - **Accept**: application/json diff --git a/samples/client/petstore/javascript/docs/StoreApi.md b/samples/client/petstore/javascript/docs/StoreApi.md index 563157be5b0d..39c66ed54301 100644 --- a/samples/client/petstore/javascript/docs/StoreApi.md +++ b/samples/client/petstore/javascript/docs/StoreApi.md @@ -54,7 +54,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **getInventory** @@ -101,7 +101,7 @@ This endpoint does not need any parameter. ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/json # **getOrderById** @@ -117,7 +117,7 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = "orderId_example"; // String | ID of pet that needs to be fetched +var orderId = 789; // Integer | ID of pet that needs to be fetched var callback = function(error, data, response) { @@ -134,7 +134,7 @@ apiInstance.getOrderById(orderId, callback); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of pet that needs to be fetched | + **orderId** | **Integer**| ID of pet that needs to be fetched | ### Return type @@ -147,11 +147,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **placeOrder** -> Order placeOrder(opts) +> Order placeOrder(body) Place an order for a pet @@ -163,9 +163,8 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.StoreApi(); -var opts = { - 'body': new SwaggerPetstore.Order() // Order | order placed for purchasing the pet -}; +var body = new SwaggerPetstore.Order(); // Order | order placed for purchasing the pet + var callback = function(error, data, response) { if (error) { @@ -174,14 +173,14 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -apiInstance.placeOrder(opts, callback); +apiInstance.placeOrder(body, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + **body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -194,5 +193,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/javascript/docs/UserApi.md b/samples/client/petstore/javascript/docs/UserApi.md index 5f9faae29b57..6646acc83eeb 100644 --- a/samples/client/petstore/javascript/docs/UserApi.md +++ b/samples/client/petstore/javascript/docs/UserApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **createUser** -> createUser(opts) +> createUser(body) Create user @@ -28,9 +28,8 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.UserApi(); -var opts = { - 'body': new SwaggerPetstore.User() // User | Created user object -}; +var body = new SwaggerPetstore.User(); // User | Created user object + var callback = function(error, data, response) { if (error) { @@ -39,14 +38,14 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -apiInstance.createUser(opts, callback); +apiInstance.createUser(body, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | ### Return type @@ -59,11 +58,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **createUsersWithArrayInput** -> createUsersWithArrayInput(opts) +> createUsersWithArrayInput(body) Creates list of users with given input array @@ -75,9 +74,8 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.UserApi(); -var opts = { - 'body': [new SwaggerPetstore.User()] // [User] | List of user object -}; +var body = [new SwaggerPetstore.User()]; // [User] | List of user object + var callback = function(error, data, response) { if (error) { @@ -86,14 +84,14 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -apiInstance.createUsersWithArrayInput(opts, callback); +apiInstance.createUsersWithArrayInput(body, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](User.md)| List of user object | [optional] + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -106,11 +104,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **createUsersWithListInput** -> createUsersWithListInput(opts) +> createUsersWithListInput(body) Creates list of users with given input array @@ -122,9 +120,8 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.UserApi(); -var opts = { - 'body': [new SwaggerPetstore.User()] // [User] | List of user object -}; +var body = [new SwaggerPetstore.User()]; // [User] | List of user object + var callback = function(error, data, response) { if (error) { @@ -133,14 +130,14 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -apiInstance.createUsersWithListInput(opts, callback); +apiInstance.createUsersWithListInput(body, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](User.md)| List of user object | [optional] + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -153,7 +150,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **deleteUser** @@ -199,7 +196,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **getUserByName** @@ -245,11 +242,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **loginUser** -> 'String' loginUser(opts) +> 'String' loginUser(username, password) Logs user into the system @@ -261,10 +258,10 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.UserApi(); -var opts = { - 'username': "username_example", // String | The user name for login - 'password': "password_example" // String | The password for login in clear text -}; +var username = "username_example"; // String | The user name for login + +var password = "password_example"; // String | The password for login in clear text + var callback = function(error, data, response) { if (error) { @@ -273,15 +270,15 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -apiInstance.loginUser(opts, callback); +apiInstance.loginUser(username, password, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [optional] - **password** | **String**| The password for login in clear text | [optional] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -294,7 +291,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **logoutUser** @@ -334,11 +331,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **updateUser** -> updateUser(username, opts) +> updateUser(username, body) Updated user @@ -352,9 +349,8 @@ var apiInstance = new SwaggerPetstore.UserApi(); var username = "username_example"; // String | name that need to be deleted -var opts = { - 'body': new SwaggerPetstore.User() // User | Updated user object -}; +var body = new SwaggerPetstore.User(); // User | Updated user object + var callback = function(error, data, response) { if (error) { @@ -363,7 +359,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -apiInstance.updateUser(username, opts, callback); +apiInstance.updateUser(username, body, callback); ``` ### Parameters @@ -371,7 +367,7 @@ apiInstance.updateUser(username, opts, callback); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | [optional] + **body** | [**User**](User.md)| Updated user object | ### Return type @@ -384,5 +380,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/javascript/package.json b/samples/client/petstore/javascript/package.json index 72a48ac71de6..8ff02a78ae3f 100644 --- a/samples/client/petstore/javascript/package.json +++ b/samples/client/petstore/javascript/package.json @@ -1,7 +1,7 @@ { "name": "swagger-petstore", "version": "1.0.0", - "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", + "description": "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.", "license": "Apache 2.0", "main": "src/index.js", "scripts": { diff --git a/samples/client/petstore/javascript/src/api/FakeApi.js b/samples/client/petstore/javascript/src/api/FakeApi.js new file mode 100644 index 000000000000..f75b8f558906 --- /dev/null +++ b/samples/client/petstore/javascript/src/api/FakeApi.js @@ -0,0 +1,121 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + /** + * Fake service. + * @module api/FakeApi + * @version 1.0.0 + */ + + /** + * Constructs a new FakeApi. + * @alias module:api/FakeApi + * @class + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. + */ + var exports = function(apiClient) { + this.apiClient = apiClient || ApiClient.instance; + + + /** + * Callback function to receive the result of the testEndpointParameters operation. + * @callback module:api/FakeApi~testEndpointParametersCallback + * @param {String} error Error message, if any. + * @param data This operation does not return a value. + * @param {String} response The complete HTTP response. + */ + + /** + * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters + * @param {Number} _number None + * @param {Number} _double None + * @param {String} _string None + * @param {String} _byte None + * @param {Object} opts Optional parameters + * @param {Integer} opts.integer None + * @param {Integer} opts.int32 None + * @param {Integer} opts.int64 None + * @param {Number} opts._float None + * @param {String} opts.binary None + * @param {Date} opts._date None + * @param {Date} opts.dateTime None + * @param {String} opts.password None + * @param {module:api/FakeApi~testEndpointParametersCallback} callback The callback function, accepting three arguments: error, data, response + */ + this.testEndpointParameters = function(_number, _double, _string, _byte, opts, callback) { + opts = opts || {}; + var postBody = null; + + // verify the required parameter '_number' is set + if (_number == undefined || _number == null) { + throw "Missing the required parameter '_number' when calling testEndpointParameters"; + } + + // verify the required parameter '_double' is set + if (_double == undefined || _double == null) { + throw "Missing the required parameter '_double' when calling testEndpointParameters"; + } + + // verify the required parameter '_string' is set + if (_string == undefined || _string == null) { + throw "Missing the required parameter '_string' when calling testEndpointParameters"; + } + + // verify the required parameter '_byte' is set + if (_byte == undefined || _byte == null) { + throw "Missing the required parameter '_byte' when calling testEndpointParameters"; + } + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + 'integer': opts['integer'], + 'int32': opts['int32'], + 'int64': opts['int64'], + 'number': _number, + 'float': opts['_float'], + 'double': _double, + 'string': _string, + 'byte': _byte, + 'binary': opts['binary'], + 'date': opts['_date'], + 'dateTime': opts['dateTime'], + 'password': opts['password'] + }; + + var authNames = []; + var contentTypes = []; + var accepts = ['application/xml', 'application/json']; + var returnType = null; + + return this.apiClient.callApi( + '/fake', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, callback + ); + } + }; + + return exports; +})); diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index da88c3f34f9e..6e7193bd53ed 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -1,18 +1,18 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Pet'], factory); + define(['ApiClient', 'model/Pet', 'model/ApiResponse'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/Pet')); + module.exports = factory(require('../ApiClient'), require('../model/Pet'), require('../model/ApiResponse')); } else { // Browser globals (root is window) if (!root.SwaggerPetstore) { root.SwaggerPetstore = {}; } - root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet); + root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet, root.SwaggerPetstore.ApiResponse); } -}(this, function(ApiClient, Pet) { +}(this, function(ApiClient, Pet, ApiResponse) { 'use strict'; /** @@ -43,13 +43,16 @@ /** * Add a new pet to the store * - * @param {Object} opts Optional parameters - * @param {module:model/Pet} opts.body Pet object that needs to be added to the store + * @param {module:model/Pet} body Pet object that needs to be added to the store * @param {module:api/PetApi~addPetCallback} callback The callback function, accepting three arguments: error, data, response */ - this.addPet = function(opts, callback) { - opts = opts || {}; - var postBody = opts['body']; + this.addPet = function(body, callback) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling addPet"; + } var pathParams = { @@ -63,7 +66,7 @@ var authNames = ['petstore_auth']; var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -112,7 +115,7 @@ var authNames = ['petstore_auth']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -132,21 +135,24 @@ /** * Finds Pets by status - * Multiple status values can be provided with comma seperated strings - * @param {Object} opts Optional parameters - * @param {Array.} opts.status Status values that need to be considered for filter (default to available) + * Multiple status values can be provided with comma separated strings + * @param {Array.} status Status values that need to be considered for filter * @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {Array.} */ - this.findPetsByStatus = function(opts, callback) { - opts = opts || {}; + this.findPetsByStatus = function(status, callback) { var postBody = null; + // verify the required parameter 'status' is set + if (status == undefined || status == null) { + throw "Missing the required parameter 'status' when calling findPetsByStatus"; + } + var pathParams = { }; var queryParams = { - 'status': this.apiClient.buildCollectionParam(opts['status'], 'multi') + 'status': this.apiClient.buildCollectionParam(status, 'csv') }; var headerParams = { }; @@ -155,7 +161,7 @@ var authNames = ['petstore_auth']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = [Pet]; return this.apiClient.callApi( @@ -175,21 +181,24 @@ /** * Finds Pets by tags - * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param {Object} opts Optional parameters - * @param {Array.} opts.tags Tags to filter by + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param {Array.} tags Tags to filter by * @param {module:api/PetApi~findPetsByTagsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {Array.} */ - this.findPetsByTags = function(opts, callback) { - opts = opts || {}; + this.findPetsByTags = function(tags, callback) { var postBody = null; + // verify the required parameter 'tags' is set + if (tags == undefined || tags == null) { + throw "Missing the required parameter 'tags' when calling findPetsByTags"; + } + var pathParams = { }; var queryParams = { - 'tags': this.apiClient.buildCollectionParam(opts['tags'], 'multi') + 'tags': this.apiClient.buildCollectionParam(tags, 'csv') }; var headerParams = { }; @@ -198,7 +207,7 @@ var authNames = ['petstore_auth']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = [Pet]; return this.apiClient.callApi( @@ -218,8 +227,8 @@ /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param {Integer} petId ID of pet that needs to be fetched + * Returns a single pet + * @param {Integer} petId ID of pet to return * @param {module:api/PetApi~getPetByIdCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {module:model/Pet} */ @@ -242,9 +251,9 @@ var formParams = { }; - var authNames = ['api_key', 'petstore_auth']; + var authNames = ['api_key']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = Pet; return this.apiClient.callApi( @@ -265,13 +274,16 @@ /** * Update an existing pet * - * @param {Object} opts Optional parameters - * @param {module:model/Pet} opts.body Pet object that needs to be added to the store + * @param {module:model/Pet} body Pet object that needs to be added to the store * @param {module:api/PetApi~updatePetCallback} callback The callback function, accepting three arguments: error, data, response */ - this.updatePet = function(opts, callback) { - opts = opts || {}; - var postBody = opts['body']; + this.updatePet = function(body, callback) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling updatePet"; + } var pathParams = { @@ -285,7 +297,7 @@ var authNames = ['petstore_auth']; var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -306,7 +318,7 @@ /** * Updates a pet in the store with form data * - * @param {String} petId ID of pet that needs to be updated + * @param {Integer} petId ID of pet that needs to be updated * @param {Object} opts Optional parameters * @param {String} opts.name Updated name of the pet * @param {String} opts.status Updated status of the pet @@ -336,7 +348,7 @@ var authNames = ['petstore_auth']; var contentTypes = ['application/x-www-form-urlencoded']; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -350,7 +362,7 @@ * Callback function to receive the result of the uploadFile operation. * @callback module:api/PetApi~uploadFileCallback * @param {String} error Error message, if any. - * @param data This operation does not return a value. + * @param {module:model/ApiResponse} data The data returned by the service call. * @param {String} response The complete HTTP response. */ @@ -362,6 +374,7 @@ * @param {String} opts.additionalMetadata Additional data to pass to server * @param {File} opts.file file to upload * @param {module:api/PetApi~uploadFileCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {module:model/ApiResponse} */ this.uploadFile = function(petId, opts, callback) { opts = opts || {}; @@ -387,8 +400,8 @@ var authNames = ['petstore_auth']; var contentTypes = ['multipart/form-data']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; + var accepts = ['application/json']; + var returnType = ApiResponse; return this.apiClient.callApi( '/pet/{petId}/uploadImage', 'POST', diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index 56c05b82aa49..8b9aa077de73 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -67,7 +67,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -106,7 +106,7 @@ var authNames = ['api_key']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/json']; var returnType = {'String': 'Integer'}; return this.apiClient.callApi( @@ -127,7 +127,7 @@ /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param {String} orderId ID of pet that needs to be fetched + * @param {Integer} orderId ID of pet that needs to be fetched * @param {module:api/StoreApi~getOrderByIdCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {module:model/Order} */ @@ -152,7 +152,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = Order; return this.apiClient.callApi( @@ -173,14 +173,17 @@ /** * Place an order for a pet * - * @param {Object} opts Optional parameters - * @param {module:model/Order} opts.body order placed for purchasing the pet + * @param {module:model/Order} body order placed for purchasing the pet * @param {module:api/StoreApi~placeOrderCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {module:model/Order} */ - this.placeOrder = function(opts, callback) { - opts = opts || {}; - var postBody = opts['body']; + this.placeOrder = function(body, callback) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling placeOrder"; + } var pathParams = { @@ -194,7 +197,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = Order; return this.apiClient.callApi( diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index 00c717cc3def..4bc7218fdcea 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -43,13 +43,16 @@ /** * Create user * This can only be done by the logged in user. - * @param {Object} opts Optional parameters - * @param {module:model/User} opts.body Created user object + * @param {module:model/User} body Created user object * @param {module:api/UserApi~createUserCallback} callback The callback function, accepting three arguments: error, data, response */ - this.createUser = function(opts, callback) { - opts = opts || {}; - var postBody = opts['body']; + this.createUser = function(body, callback) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling createUser"; + } var pathParams = { @@ -63,7 +66,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -84,13 +87,16 @@ /** * Creates list of users with given input array * - * @param {Object} opts Optional parameters - * @param {Array.} opts.body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response */ - this.createUsersWithArrayInput = function(opts, callback) { - opts = opts || {}; - var postBody = opts['body']; + this.createUsersWithArrayInput = function(body, callback) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling createUsersWithArrayInput"; + } var pathParams = { @@ -104,7 +110,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -125,13 +131,16 @@ /** * Creates list of users with given input array * - * @param {Object} opts Optional parameters - * @param {Array.} opts.body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response */ - this.createUsersWithListInput = function(opts, callback) { - opts = opts || {}; - var postBody = opts['body']; + this.createUsersWithListInput = function(body, callback) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling createUsersWithListInput"; + } var pathParams = { @@ -145,7 +154,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -190,7 +199,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -236,7 +245,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = User; return this.apiClient.callApi( @@ -257,22 +266,30 @@ /** * Logs user into the system * - * @param {Object} opts Optional parameters - * @param {String} opts.username The user name for login - * @param {String} opts.password The password for login in clear text + * @param {String} username The user name for login + * @param {String} password The password for login in clear text * @param {module:api/UserApi~loginUserCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {'String'} */ - this.loginUser = function(opts, callback) { - opts = opts || {}; + this.loginUser = function(username, password, callback) { var postBody = null; + // verify the required parameter 'username' is set + if (username == undefined || username == null) { + throw "Missing the required parameter 'username' when calling loginUser"; + } + + // verify the required parameter 'password' is set + if (password == undefined || password == null) { + throw "Missing the required parameter 'password' when calling loginUser"; + } + var pathParams = { }; var queryParams = { - 'username': opts['username'], - 'password': opts['password'] + 'username': username, + 'password': password }; var headerParams = { }; @@ -281,7 +298,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = 'String'; return this.apiClient.callApi( @@ -319,7 +336,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -341,19 +358,22 @@ * Updated user * This can only be done by the logged in user. * @param {String} username name that need to be deleted - * @param {Object} opts Optional parameters - * @param {module:model/User} opts.body Updated user object + * @param {module:model/User} body Updated user object * @param {module:api/UserApi~updateUserCallback} callback The callback function, accepting three arguments: error, data, response */ - this.updateUser = function(username, opts, callback) { - opts = opts || {}; - var postBody = opts['body']; + this.updateUser = function(username, body, callback) { + var postBody = body; // verify the required parameter 'username' is set if (username == undefined || username == null) { throw "Missing the required parameter 'username' when calling updateUser"; } + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling updateUser"; + } + var pathParams = { 'username': username @@ -367,7 +387,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index b0d17b3ef3a7..2c3fb27ef652 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,16 +1,16 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Category', 'model/Order', 'model/Pet', 'model/Tag', 'model/User', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); + define(['ApiClient', 'model/Animal', 'model/ApiResponse', 'model/Cat', 'model/Category', 'model/Dog', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/Order', 'model/Pet', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/ApiResponse'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Category, Order, Pet, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Animal, ApiResponse, Cat, Category, Dog, EnumClass, EnumTest, FormatTest, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) { 'use strict'; /** - * This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters.
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose..
* The index module provides access to constructors for all the classes which comprise the public API. *

* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: @@ -46,11 +46,61 @@ * @property {module:ApiClient} */ ApiClient: ApiClient, + /** + * The Animal model constructor. + * @property {module:model/Animal} + */ + Animal: Animal, + /** + * The ApiResponse model constructor. + * @property {module:model/ApiResponse} + */ + ApiResponse: ApiResponse, + /** + * The Cat model constructor. + * @property {module:model/Cat} + */ + Cat: Cat, /** * The Category model constructor. * @property {module:model/Category} */ Category: Category, + /** + * The Dog model constructor. + * @property {module:model/Dog} + */ + Dog: Dog, + /** + * The EnumClass model constructor. + * @property {module:model/EnumClass} + */ + EnumClass: EnumClass, + /** + * The EnumTest model constructor. + * @property {module:model/EnumTest} + */ + EnumTest: EnumTest, + /** + * The FormatTest model constructor. + * @property {module:model/FormatTest} + */ + FormatTest: FormatTest, + /** + * The Model200Response model constructor. + * @property {module:model/Model200Response} + */ + Model200Response: Model200Response, + /** + * The ModelReturn model constructor. + * @property {module:model/ModelReturn} + */ + ModelReturn: ModelReturn, + /** + * The Name model constructor. + * @property {module:model/Name} + */ + Name: Name, /** * The Order model constructor. * @property {module:model/Order} @@ -61,6 +111,11 @@ * @property {module:model/Pet} */ Pet: Pet, + /** + * The SpecialModelName model constructor. + * @property {module:model/SpecialModelName} + */ + SpecialModelName: SpecialModelName, /** * The Tag model constructor. * @property {module:model/Tag} @@ -71,6 +126,11 @@ * @property {module:model/User} */ User: User, + /** + * The FakeApi service constructor. + * @property {module:api/FakeApi} + */ + FakeApi: FakeApi, /** * The PetApi service constructor. * @property {module:api/PetApi} diff --git a/samples/client/petstore/javascript/src/model/Animal.js b/samples/client/petstore/javascript/src/model/Animal.js index 674471a30ee4..591b25307582 100644 --- a/samples/client/petstore/javascript/src/model/Animal.js +++ b/samples/client/petstore/javascript/src/model/Animal.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); @@ -28,8 +28,9 @@ * @param className */ var exports = function(className) { + var _this = this; - this['className'] = className; + _this['className'] = className; }; /** @@ -40,7 +41,7 @@ * @return {module:model/Animal} The populated Animal instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('className')) { diff --git a/samples/client/petstore/javascript/src/model/ApiResponse.js b/samples/client/petstore/javascript/src/model/ApiResponse.js new file mode 100644 index 000000000000..6d03d2767dbd --- /dev/null +++ b/samples/client/petstore/javascript/src/model/ApiResponse.js @@ -0,0 +1,81 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.ApiResponse = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + /** + * The ApiResponse model module. + * @module model/ApiResponse + * @version 1.0.0 + */ + + /** + * Constructs a new ApiResponse. + * @alias module:model/ApiResponse + * @class + */ + var exports = function() { + var _this = this; + + + + + }; + + /** + * Constructs a ApiResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ApiResponse} obj Optional instance to populate. + * @return {module:model/ApiResponse} The populated ApiResponse instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + if (data.hasOwnProperty('code')) { + obj['code'] = ApiClient.convertToType(data['code'], 'Integer'); + } + if (data.hasOwnProperty('type')) { + obj['type'] = ApiClient.convertToType(data['type'], 'String'); + } + if (data.hasOwnProperty('message')) { + obj['message'] = ApiClient.convertToType(data['message'], 'String'); + } + } + return obj; + } + + + /** + * @member {Integer} code + */ + exports.prototype['code'] = undefined; + + /** + * @member {String} type + */ + exports.prototype['type'] = undefined; + + /** + * @member {String} message + */ + exports.prototype['message'] = undefined; + + + + + return exports; +})); diff --git a/samples/client/petstore/javascript/src/model/Cat.js b/samples/client/petstore/javascript/src/model/Cat.js index c878af6edecf..9a19820832af 100644 --- a/samples/client/petstore/javascript/src/model/Cat.js +++ b/samples/client/petstore/javascript/src/model/Cat.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', './Animal'], factory); + define(['ApiClient', 'model/Animal'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./Animal')); @@ -29,7 +29,8 @@ * @param className */ var exports = function(className) { - Animal.call(this, className); + var _this = this; + Animal.call(_this, className); }; @@ -41,7 +42,7 @@ * @return {module:model/Cat} The populated Cat instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); Animal.constructFromObject(data, obj); if (data.hasOwnProperty('declawed')) { diff --git a/samples/client/petstore/javascript/src/model/Dog.js b/samples/client/petstore/javascript/src/model/Dog.js index e5e55581a70d..2ec22654277b 100644 --- a/samples/client/petstore/javascript/src/model/Dog.js +++ b/samples/client/petstore/javascript/src/model/Dog.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', './Animal'], factory); + define(['ApiClient', 'model/Animal'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./Animal')); @@ -29,7 +29,8 @@ * @param className */ var exports = function(className) { - Animal.call(this, className); + var _this = this; + Animal.call(_this, className); }; @@ -41,7 +42,7 @@ * @return {module:model/Dog} The populated Dog instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); Animal.constructFromObject(data, obj); if (data.hasOwnProperty('breed')) { diff --git a/samples/client/petstore/javascript/src/model/EnumClass.js b/samples/client/petstore/javascript/src/model/EnumClass.js new file mode 100644 index 000000000000..2b26b447e8ec --- /dev/null +++ b/samples/client/petstore/javascript/src/model/EnumClass.js @@ -0,0 +1,54 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.EnumClass = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + /** + * The EnumClass model module. + * @module model/EnumClass + * @version 1.0.0 + */ + + /** + * Constructs a new EnumClass. + * @alias module:model/EnumClass + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a EnumClass from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/EnumClass} obj Optional instance to populate. + * @return {module:model/EnumClass} The populated EnumClass instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + } + return obj; + } + + + + + + return exports; +})); diff --git a/samples/client/petstore/javascript/src/model/EnumTest.js b/samples/client/petstore/javascript/src/model/EnumTest.js new file mode 100644 index 000000000000..d4f6923dae2b --- /dev/null +++ b/samples/client/petstore/javascript/src/model/EnumTest.js @@ -0,0 +1,129 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.EnumTest = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + /** + * The EnumTest model module. + * @module model/EnumTest + * @version 1.0.0 + */ + + /** + * Constructs a new EnumTest. + * @alias module:model/EnumTest + * @class + */ + var exports = function() { + var _this = this; + + + + + }; + + /** + * Constructs a EnumTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/EnumTest} obj Optional instance to populate. + * @return {module:model/EnumTest} The populated EnumTest instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + if (data.hasOwnProperty('enum_string')) { + obj['enum_string'] = ApiClient.convertToType(data['enum_string'], 'String'); + } + if (data.hasOwnProperty('enum_integer')) { + obj['enum_integer'] = ApiClient.convertToType(data['enum_integer'], 'Integer'); + } + if (data.hasOwnProperty('enum_number')) { + obj['enum_number'] = ApiClient.convertToType(data['enum_number'], 'Number'); + } + } + return obj; + } + + + /** + * @member {module:model/EnumTest.EnumStringEnum} enum_string + */ + exports.prototype['enum_string'] = undefined; + + /** + * @member {module:model/EnumTest.EnumIntegerEnum} enum_integer + */ + exports.prototype['enum_integer'] = undefined; + + /** + * @member {module:model/EnumTest.EnumNumberEnum} enum_number + */ + exports.prototype['enum_number'] = undefined; + + + /** + * Allowed values for the enum_string property. + * @enum {String} + * @readonly + */ + exports.EnumStringEnum = { + /** + * value: "UPPER" + * @const + */ + "UPPER": "UPPER", + /** + * value: "lower" + * @const + */ + "lower": "lower" }; + /** + * Allowed values for the enum_integer property. + * @enum {Integer} + * @readonly + */ + exports.EnumIntegerEnum = { + /** + * value: 1 + * @const + */ + "1": 1, + /** + * value: -1 + * @const + */ + "-1": -1 }; + /** + * Allowed values for the enum_number property. + * @enum {Number} + * @readonly + */ + exports.EnumNumberEnum = { + /** + * value: 1.1 + * @const + */ + "1.1": 1.1, + /** + * value: -1.2 + * @const + */ + "-1.2": -1.2 }; + + + return exports; +})); diff --git a/samples/client/petstore/javascript/src/model/FormatTest.js b/samples/client/petstore/javascript/src/model/FormatTest.js index 46a9bc854fc6..8f3a531bad50 100644 --- a/samples/client/petstore/javascript/src/model/FormatTest.js +++ b/samples/client/petstore/javascript/src/model/FormatTest.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); @@ -26,20 +26,26 @@ * @alias module:model/FormatTest * @class * @param _number + * @param _byte + * @param _date + * @param password */ - var exports = function(_number) { + var exports = function(_number, _byte, _date, password) { + var _this = this; - this['number'] = _number; - - + _this['number'] = _number; + _this['byte'] = _byte; + + _this['date'] = _date; + _this['password'] = password; }; /** @@ -50,7 +56,7 @@ * @return {module:model/FormatTest} The populated FormatTest instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('integer')) { @@ -84,7 +90,13 @@ obj['date'] = ApiClient.convertToType(data['date'], 'Date'); } if (data.hasOwnProperty('dateTime')) { - obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'String'); + obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); + } + if (data.hasOwnProperty('uuid')) { + obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); + } + if (data.hasOwnProperty('password')) { + obj['password'] = ApiClient.convertToType(data['password'], 'String'); } } return obj; @@ -142,10 +154,20 @@ exports.prototype['date'] = undefined; /** - * @member {String} dateTime + * @member {Date} dateTime */ exports.prototype['dateTime'] = undefined; + /** + * @member {String} uuid + */ + exports.prototype['uuid'] = undefined; + + /** + * @member {String} password + */ + exports.prototype['password'] = undefined; + diff --git a/samples/client/petstore/javascript/src/model/Model200Response.js b/samples/client/petstore/javascript/src/model/Model200Response.js index 8381185d9d08..908e264fe227 100644 --- a/samples/client/petstore/javascript/src/model/Model200Response.js +++ b/samples/client/petstore/javascript/src/model/Model200Response.js @@ -28,6 +28,7 @@ * @class */ var exports = function() { + var _this = this; }; @@ -40,7 +41,7 @@ * @return {module:model/Model200Response} The populated Model200Response instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('name')) { diff --git a/samples/client/petstore/javascript/src/model/ModelReturn.js b/samples/client/petstore/javascript/src/model/ModelReturn.js index 9549db64d465..156ee977eeef 100644 --- a/samples/client/petstore/javascript/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript/src/model/ModelReturn.js @@ -28,6 +28,7 @@ * @class */ var exports = function() { + var _this = this; }; @@ -40,7 +41,7 @@ * @return {module:model/ModelReturn} The populated ModelReturn instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('return')) { diff --git a/samples/client/petstore/javascript/src/model/Name.js b/samples/client/petstore/javascript/src/model/Name.js index 08a5a34c29a6..63616e26d299 100644 --- a/samples/client/petstore/javascript/src/model/Name.js +++ b/samples/client/petstore/javascript/src/model/Name.js @@ -29,8 +29,10 @@ * @param name */ var exports = function(name) { + var _this = this; + + _this['name'] = name; - this['name'] = name; }; @@ -42,7 +44,7 @@ * @return {module:model/Name} The populated Name instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('name')) { @@ -51,6 +53,9 @@ if (data.hasOwnProperty('snake_case')) { obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Integer'); } + if (data.hasOwnProperty('property')) { + obj['property'] = ApiClient.convertToType(data['property'], 'String'); + } } return obj; } @@ -66,6 +71,11 @@ */ exports.prototype['snake_case'] = undefined; + /** + * @member {String} property + */ + exports.prototype['property'] = undefined; + diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index 664908b77a9a..f5c2ee1f4e01 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -99,8 +99,9 @@ /** * @member {Boolean} complete + * @default false */ - exports.prototype['complete'] = undefined; + exports.prototype['complete'] = false; /** @@ -108,25 +109,23 @@ * @enum {String} * @readonly */ - exports.StatusEnum = { + exports.StatusEnum = { /** - * value: placed + * value: "placed" * @const */ - PLACED: "placed", - + "placed": "placed", /** - * value: approved + * value: "approved" * @const */ - APPROVED: "approved", - + "approved": "approved", /** - * value: delivered + * value: "delivered" * @const */ - DELIVERED: "delivered" - }; + "delivered": "delivered" }; + return exports; })); diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index ae907d35ca2f..c4f68d17eca5 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -110,25 +110,23 @@ * @enum {String} * @readonly */ - exports.StatusEnum = { + exports.StatusEnum = { /** - * value: available + * value: "available" * @const */ - AVAILABLE: "available", - + "available": "available", /** - * value: pending + * value: "pending" * @const */ - PENDING: "pending", - + "pending": "pending", /** - * value: sold + * value: "sold" * @const */ - SOLD: "sold" - }; + "sold": "sold" }; + return exports; })); diff --git a/samples/client/petstore/javascript/src/model/SpecialModelName.js b/samples/client/petstore/javascript/src/model/SpecialModelName.js index 8694196cdd96..3f0ef79cebf9 100644 --- a/samples/client/petstore/javascript/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript/src/model/SpecialModelName.js @@ -27,6 +27,7 @@ * @class */ var exports = function() { + var _this = this; }; @@ -39,7 +40,7 @@ * @return {module:model/SpecialModelName} The populated SpecialModelName instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('$special[property.name]')) { diff --git a/samples/client/petstore/javascript/test/api/PetApiTest.js b/samples/client/petstore/javascript/test/api/PetApiTest.js index 700b30ac5059..213660d8058d 100644 --- a/samples/client/petstore/javascript/test/api/PetApiTest.js +++ b/samples/client/petstore/javascript/test/api/PetApiTest.js @@ -55,7 +55,7 @@ describe('PetApi', function() { it('should create and get pet', function(done) { var pet = createRandomPet(); - api.addPet({body: pet}, function(error) { + api.addPet(pet, function(error) { if (error) throw error; api.getPetById(pet.id, function(error, fetched, response) { From acb34e3db0fa4d1b43b137249cbaa7280c1218a6 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 11:06:38 +0800 Subject: [PATCH 083/170] better JS enum class support --- .../main/resources/Javascript/model.mustache | 91 +------------------ samples/client/petstore/javascript/README.md | 2 +- .../petstore/javascript/src/model/Animal.js | 6 +- .../javascript/src/model/ApiResponse.js | 8 +- .../petstore/javascript/src/model/Cat.js | 6 +- .../petstore/javascript/src/model/Category.js | 7 +- .../petstore/javascript/src/model/Dog.js | 6 +- .../javascript/src/model/EnumClass.js | 52 +++++------ .../petstore/javascript/src/model/EnumTest.js | 8 +- .../javascript/src/model/FormatTest.js | 18 +--- .../javascript/src/model/Model200Response.js | 6 +- .../javascript/src/model/ModelReturn.js | 6 +- .../petstore/javascript/src/model/Name.js | 8 +- .../petstore/javascript/src/model/Order.js | 11 +-- .../petstore/javascript/src/model/Pet.js | 11 +-- .../javascript/src/model/SpecialModelName.js | 6 +- .../petstore/javascript/src/model/Tag.js | 7 +- .../petstore/javascript/src/model/User.js | 13 +-- 18 files changed, 100 insertions(+), 172 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache index 11b9ec74e0bb..db480f05b1d1 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache @@ -15,91 +15,6 @@ }(this, function(ApiClient{{#imports}}, {{import}}{{/imports}}) { 'use strict'; -{{#models}}{{#model}}{{#emitJSDoc}} /** - * The {{classname}} model module. - * @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} - * @version {{projectVersion}} - */ - - /** - * Constructs a new {{classname}}.{{#description}} - * {{description}}{{/description}} - * @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} - * @class{{#useInheritance}}{{#parent}} - * @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}} - * @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}} - * @param {{.}}{{/vendorExtensions.x-all-required}} - */ -{{/emitJSDoc}} var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) { - var _this = this; -{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array(); - Object.setPrototypeOf(_this, exports); -{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}} -{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}}); -{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}} -{{/vars}}{{#parent}}{{^parentModel}} return _this; -{{/parentModel}}{{/parent}} }; - -{{#emitJSDoc}} /** - * Constructs a {{classname}} from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> obj Optional instance to populate. - * @return {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> The populated {{classname}} instance. - */ -{{/emitJSDoc}} exports.constructFromObject = function(data, obj) { - if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} { - obj = obj || new exports(); -{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, {{vendorExtensions.x-itemType}}); -{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}} -{{#interfaces}} {{.}}.constructFromObject(data, obj); -{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) { - obj['{{baseName}}']{{{defaultValueWithParam}}} - } -{{/vars}} } - return obj; - } -{{#useInheritance}}{{#parentModel}} - exports.prototype = Object.create({{classname}}.prototype); - exports.prototype.constructor = exports; -{{/parentModel}}{{/useInheritance}} -{{#vars}}{{#emitJSDoc}} - /**{{#description}} - * {{{description}}}{{/description}} - * @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}} - * @default {{{defaultValue}}}{{/defaultValue}} - */ -{{/emitJSDoc}} exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}}; -{{/vars}}{{#useInheritance}}{{#interfaceModels}} - // Implement {{classname}} interface:{{#allVars}}{{#emitJSDoc}} - /**{{#description}} - * {{{description}}}{{/description}} - * @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}} - * @default {{{defaultValue}}}{{/defaultValue}} - */ -{{/emitJSDoc}} exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}}; -{{/allVars}}{{/interfaceModels}}{{/useInheritance}} -{{#emitModelMethods}}{{#vars}}{{#emitJSDoc}} /**{{#description}} - * Returns {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} - * @return {{{vendorExtensions.x-jsdoc-type}}} - */ -{{/emitJSDoc}} exports.prototype.{{getter}} = function() { - return this['{{baseName}}']; - } - -{{#emitJSDoc}} /**{{#description}} - * Sets {{{description}}}{{/description}} - * @param {{{vendorExtensions.x-jsdoc-type}}} {{name}}{{#description}} {{{description}}}{{/description}} - */ -{{/emitJSDoc}} exports.prototype.{{setter}} = function({{name}}) { - this['{{baseName}}'] = {{name}}; - } - -{{/vars}}{{/emitModelMethods}} -{{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} -{{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}} - - return exports; -{{/model}}{{/models}}})); +{{#models}}{{#model}} +{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 9c0393eb5029..651e1e6047fd 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-02T23:24:54.621+08:00 +- Build date: 2016-05-03T11:05:41.851+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation diff --git a/samples/client/petstore/javascript/src/model/Animal.js b/samples/client/petstore/javascript/src/model/Animal.js index 591b25307582..e42874c669b8 100644 --- a/samples/client/petstore/javascript/src/model/Animal.js +++ b/samples/client/petstore/javascript/src/model/Animal.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Animal model module. * @module model/Animal @@ -51,7 +54,6 @@ return obj; } - /** * @member {String} className */ @@ -62,3 +64,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/ApiResponse.js b/samples/client/petstore/javascript/src/model/ApiResponse.js index 6d03d2767dbd..6d4c970264b0 100644 --- a/samples/client/petstore/javascript/src/model/ApiResponse.js +++ b/samples/client/petstore/javascript/src/model/ApiResponse.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The ApiResponse model module. * @module model/ApiResponse @@ -58,17 +61,14 @@ return obj; } - /** * @member {Integer} code */ exports.prototype['code'] = undefined; - /** * @member {String} type */ exports.prototype['type'] = undefined; - /** * @member {String} message */ @@ -79,3 +79,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/Cat.js b/samples/client/petstore/javascript/src/model/Cat.js index 9a19820832af..a6b25bc6d584 100644 --- a/samples/client/petstore/javascript/src/model/Cat.js +++ b/samples/client/petstore/javascript/src/model/Cat.js @@ -15,6 +15,9 @@ }(this, function(ApiClient, Animal) { 'use strict'; + + + /** * The Cat model module. * @module model/Cat @@ -55,7 +58,6 @@ exports.prototype = Object.create(Animal.prototype); exports.prototype.constructor = exports; - /** * @member {Boolean} declawed */ @@ -66,3 +68,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/Category.js b/samples/client/petstore/javascript/src/model/Category.js index 9956525e037c..9e2e19ac5bba 100644 --- a/samples/client/petstore/javascript/src/model/Category.js +++ b/samples/client/petstore/javascript/src/model/Category.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Category model module. * @module model/Category @@ -54,12 +57,10 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {String} name */ @@ -70,3 +71,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/Dog.js b/samples/client/petstore/javascript/src/model/Dog.js index 2ec22654277b..ee17ae3467f2 100644 --- a/samples/client/petstore/javascript/src/model/Dog.js +++ b/samples/client/petstore/javascript/src/model/Dog.js @@ -15,6 +15,9 @@ }(this, function(ApiClient, Animal) { 'use strict'; + + + /** * The Dog model module. * @module model/Dog @@ -55,7 +58,6 @@ exports.prototype = Object.create(Animal.prototype); exports.prototype.constructor = exports; - /** * @member {String} breed */ @@ -66,3 +68,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/EnumClass.js b/samples/client/petstore/javascript/src/model/EnumClass.js index 2b26b447e8ec..2ff3398113a1 100644 --- a/samples/client/petstore/javascript/src/model/EnumClass.js +++ b/samples/client/petstore/javascript/src/model/EnumClass.js @@ -15,40 +15,30 @@ }(this, function(ApiClient) { 'use strict'; - /** - * The EnumClass model module. - * @module model/EnumClass - * @version 1.0.0 - */ /** - * Constructs a new EnumClass. - * @alias module:model/EnumClass - * @class + * Enum class EnumClass. + * @enum {} + * @readonly */ - var exports = function() { - var _this = this; - - }; - - /** - * Constructs a EnumClass from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/EnumClass} obj Optional instance to populate. - * @return {module:model/EnumClass} The populated EnumClass instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - } - return obj; - } - - - - + exports.EnumClass = { + /** + * value: _abc + * @const + */ + "_abc": "_abc", + /** + * value: -efg + * @const + */ + "-efg": "-efg", + /** + * value: (xyz) + * @const + */ + "(xyz)": "(xyz)" }; return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/EnumTest.js b/samples/client/petstore/javascript/src/model/EnumTest.js index d4f6923dae2b..6f8f0de38365 100644 --- a/samples/client/petstore/javascript/src/model/EnumTest.js +++ b/samples/client/petstore/javascript/src/model/EnumTest.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The EnumTest model module. * @module model/EnumTest @@ -58,17 +61,14 @@ return obj; } - /** * @member {module:model/EnumTest.EnumStringEnum} enum_string */ exports.prototype['enum_string'] = undefined; - /** * @member {module:model/EnumTest.EnumIntegerEnum} enum_integer */ exports.prototype['enum_integer'] = undefined; - /** * @member {module:model/EnumTest.EnumNumberEnum} enum_number */ @@ -127,3 +127,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/FormatTest.js b/samples/client/petstore/javascript/src/model/FormatTest.js index 8f3a531bad50..ed9e0cfcaf89 100644 --- a/samples/client/petstore/javascript/src/model/FormatTest.js +++ b/samples/client/petstore/javascript/src/model/FormatTest.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The FormatTest model module. * @module model/FormatTest @@ -102,67 +105,54 @@ return obj; } - /** * @member {Integer} integer */ exports.prototype['integer'] = undefined; - /** * @member {Integer} int32 */ exports.prototype['int32'] = undefined; - /** * @member {Integer} int64 */ exports.prototype['int64'] = undefined; - /** * @member {Number} number */ exports.prototype['number'] = undefined; - /** * @member {Number} float */ exports.prototype['float'] = undefined; - /** * @member {Number} double */ exports.prototype['double'] = undefined; - /** * @member {String} string */ exports.prototype['string'] = undefined; - /** * @member {String} byte */ exports.prototype['byte'] = undefined; - /** * @member {String} binary */ exports.prototype['binary'] = undefined; - /** * @member {Date} date */ exports.prototype['date'] = undefined; - /** * @member {Date} dateTime */ exports.prototype['dateTime'] = undefined; - /** * @member {String} uuid */ exports.prototype['uuid'] = undefined; - /** * @member {String} password */ @@ -173,3 +163,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/Model200Response.js b/samples/client/petstore/javascript/src/model/Model200Response.js index 908e264fe227..1d83d420287f 100644 --- a/samples/client/petstore/javascript/src/model/Model200Response.js +++ b/samples/client/petstore/javascript/src/model/Model200Response.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Model200Response model module. * @module model/Model200Response @@ -51,7 +54,6 @@ return obj; } - /** * @member {Integer} name */ @@ -62,3 +64,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/ModelReturn.js b/samples/client/petstore/javascript/src/model/ModelReturn.js index 156ee977eeef..d0236e77b174 100644 --- a/samples/client/petstore/javascript/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript/src/model/ModelReturn.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The ModelReturn model module. * @module model/ModelReturn @@ -51,7 +54,6 @@ return obj; } - /** * @member {Integer} return */ @@ -62,3 +64,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/Name.js b/samples/client/petstore/javascript/src/model/Name.js index 63616e26d299..93d1d55deb27 100644 --- a/samples/client/petstore/javascript/src/model/Name.js +++ b/samples/client/petstore/javascript/src/model/Name.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Name model module. * @module model/Name @@ -60,17 +63,14 @@ return obj; } - /** * @member {Integer} name */ exports.prototype['name'] = undefined; - /** * @member {Integer} snake_case */ exports.prototype['snake_case'] = undefined; - /** * @member {String} property */ @@ -81,3 +81,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index f5c2ee1f4e01..57f77d84ccd0 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Order model module. * @module model/Order @@ -70,33 +73,27 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {Integer} petId */ exports.prototype['petId'] = undefined; - /** * @member {Integer} quantity */ exports.prototype['quantity'] = undefined; - /** * @member {Date} shipDate */ exports.prototype['shipDate'] = undefined; - /** * Order Status * @member {module:model/Order.StatusEnum} status */ exports.prototype['status'] = undefined; - /** * @member {Boolean} complete * @default false @@ -129,3 +126,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index c4f68d17eca5..fe14361dbf2e 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -15,6 +15,9 @@ }(this, function(ApiClient, Category, Tag) { 'use strict'; + + + /** * The Pet model module. * @module model/Pet @@ -72,32 +75,26 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {module:model/Category} category */ exports.prototype['category'] = undefined; - /** * @member {String} name */ exports.prototype['name'] = undefined; - /** * @member {Array.} photoUrls */ exports.prototype['photoUrls'] = undefined; - /** * @member {Array.} tags */ exports.prototype['tags'] = undefined; - /** * pet status in the store * @member {module:model/Pet.StatusEnum} status @@ -130,3 +127,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/SpecialModelName.js b/samples/client/petstore/javascript/src/model/SpecialModelName.js index 3f0ef79cebf9..d5a0e992a73e 100644 --- a/samples/client/petstore/javascript/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript/src/model/SpecialModelName.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The SpecialModelName model module. * @module model/SpecialModelName @@ -50,7 +53,6 @@ return obj; } - /** * @member {Integer} $special[property.name] */ @@ -61,3 +63,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/Tag.js b/samples/client/petstore/javascript/src/model/Tag.js index d9ab35fb8b53..443d312b76ab 100644 --- a/samples/client/petstore/javascript/src/model/Tag.js +++ b/samples/client/petstore/javascript/src/model/Tag.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Tag model module. * @module model/Tag @@ -54,12 +57,10 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {String} name */ @@ -70,3 +71,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript/src/model/User.js b/samples/client/petstore/javascript/src/model/User.js index 3bc6aaab630e..2360c7c6314b 100644 --- a/samples/client/petstore/javascript/src/model/User.js +++ b/samples/client/petstore/javascript/src/model/User.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The User model module. * @module model/User @@ -78,42 +81,34 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {String} username */ exports.prototype['username'] = undefined; - /** * @member {String} firstName */ exports.prototype['firstName'] = undefined; - /** * @member {String} lastName */ exports.prototype['lastName'] = undefined; - /** * @member {String} email */ exports.prototype['email'] = undefined; - /** * @member {String} password */ exports.prototype['password'] = undefined; - /** * @member {String} phone */ exports.prototype['phone'] = undefined; - /** * User Status * @member {Integer} userStatus @@ -125,3 +120,5 @@ return exports; })); + + From 5c97717fc818950aa956afb2538266dbf9404793 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 14:08:02 +0800 Subject: [PATCH 084/170] temporary remove ts resource folder --- .../TypeScript-Angular/api.d.mustache | 13 - .../resources/TypeScript-Angular/api.mustache | 98 ------- .../TypeScript-Angular/git_push.sh.mustache | 52 ---- .../TypeScript-Angular/model.mustache | 39 --- .../resources/TypeScript-node/api.mustache | 264 ------------------ .../TypeScript-node/git_push.sh.mustache | 52 ---- .../typescript-node/package.mustache | 22 -- .../typescript-node/tsconfig.mustache | 18 -- .../typescript-node/typings.mustache | 10 - 9 files changed, 568 deletions(-) delete mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.d.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache delete mode 100755 modules/swagger-codegen/src/main/resources/TypeScript-Angular/git_push.sh.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Angular/model.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache delete mode 100755 modules/swagger-codegen/src/main/resources/TypeScript-node/git_push.sh.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/typescript-node/package.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.d.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.d.mustache deleted file mode 100644 index a8bf1c582670..000000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.d.mustache +++ /dev/null @@ -1,13 +0,0 @@ -{{#models}} -{{#model}} -/// -{{/model}} -{{/models}} - -{{#apiInfo}} -{{#apis}} -{{#operations}} -/// -{{/operations}} -{{/apis}} -{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache deleted file mode 100644 index 427479cf6756..000000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache +++ /dev/null @@ -1,98 +0,0 @@ -/// - -/* tslint:disable:no-unused-variable member-ordering */ - -{{#operations}} -namespace {{package}} { - 'use strict'; - -{{#description}} - /** - * {{&description}} - */ -{{/description}} - export class {{classname}} { - protected basePath = '{{basePath}}'; - public defaultHeaders : any = {}; - - static $inject: string[] = ['$http', '$httpParamSerializer']; - - constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) { - if (basePath) { - this.basePath = basePath; - } - } - - private extendObj(objA: T1, objB: T2) { - for(let key in objB){ - if(objB.hasOwnProperty(key)){ - objA[key] = objB[key]; - } - } - return objA; - } - -{{#operation}} - /** - * {{summary}} - * {{notes}} - {{#allParams}}* @param {{paramName}} {{description}} - {{/allParams}}*/ - public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> { - const localVarPath = this.basePath + '{{path}}'{{#pathParams}} - .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); -{{#hasFormParams}} - let formParams: any = {}; - -{{/hasFormParams}} -{{#allParams}} -{{#required}} - // verify required parameter '{{paramName}}' is set - if (!{{paramName}}) { - throw new Error('Missing required parameter {{paramName}} when calling {{nickname}}'); - } -{{/required}} -{{/allParams}} -{{#queryParams}} - if ({{paramName}} !== undefined) { - queryParameters['{{baseName}}'] = {{paramName}}; - } - -{{/queryParams}} -{{#headerParams}} - headerParams['{{baseName}}'] = {{paramName}}; - -{{/headerParams}} -{{#hasFormParams}} - headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; - -{{/hasFormParams}} -{{#formParams}} - formParams['{{baseName}}'] = {{paramName}}; - -{{/formParams}} - let httpRequestParams: any = { - method: '{{httpMethod}}', - url: localVarPath, - json: {{#hasFormParams}}false{{/hasFormParams}}{{^hasFormParams}}true{{/hasFormParams}}, - {{#bodyParam}}data: {{paramName}}, - {{/bodyParam}} - {{#hasFormParams}}data: this.$httpParamSerializer(formParams), - {{/hasFormParams}} - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } -{{/operation}} - } -} -{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/git_push.sh.mustache deleted file mode 100755 index e153ce23ecf4..000000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/git_push.sh.mustache +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="{{{gitUserId}}}" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="{{{gitRepoId}}}" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="{{{releaseNote}}}" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/model.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/model.mustache deleted file mode 100644 index b7d929621578..000000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/model.mustache +++ /dev/null @@ -1,39 +0,0 @@ -/// - -namespace {{package}} { - 'use strict'; - -{{#models}} -{{#model}} -{{#description}} - /** - * {{{description}}} - */ -{{/description}} - export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ -{{#vars}} - -{{#description}} - /** - * {{{description}}} - */ -{{/description}} - "{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; -{{/vars}} - } - -{{#hasEnums}} - export namespace {{classname}} { -{{#vars}} -{{#isEnum}} - - export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} - {{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} - } -{{/isEnum}} -{{/vars}} - } -{{/hasEnums}} -{{/model}} -{{/models}} -} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache deleted file mode 100644 index 25e152a9e344..000000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ /dev/null @@ -1,264 +0,0 @@ -import request = require('request'); -import promise = require('bluebird'); -import http = require('http'); - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - -/* tslint:disable:no-unused-variable */ - -{{#models}} -{{#model}} -{{#description}} -/** -* {{{description}}} -*/ -{{/description}} -export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ -{{#vars}} -{{#description}} - /** - * {{{description}}} - */ -{{/description}} - "{{name}}": {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; -{{/vars}} -} - -{{#hasEnums}} -export namespace {{classname}} { -{{#vars}} -{{#isEnum}} - export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} - {{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} - } -{{/isEnum}} -{{/vars}} -} -{{/hasEnums}} -{{/model}} -{{/models}} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: request.Options): void; -} - -export class HttpBasicAuth implements Authentication { - public username: string; - public password: string; - applyToRequest(requestOptions: request.Options): void { - requestOptions.auth = { - username: this.username, password: this.password - } - } -} - -export class ApiKeyAuth implements Authentication { - public apiKey: string; - - constructor(private location: string, private paramName: string) { - } - - applyToRequest(requestOptions: request.Options): void { - if (this.location == "query") { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location == "header") { - requestOptions.headers[this.paramName] = this.apiKey; - } - } -} - -export class OAuth implements Authentication { - public accessToken: string; - - applyToRequest(requestOptions: request.Options): void { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } -} - -export class VoidAuth implements Authentication { - public username: string; - public password: string; - applyToRequest(requestOptions: request.Options): void { - // Do nothing - } -} - -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#description}} -/** -* {{&description}} -*/ -{{/description}} -export enum {{classname}}ApiKeys { -{{#authMethods}} -{{#isApiKey}} - {{name}}, -{{/isApiKey}} -{{/authMethods}} -} - -export class {{classname}} { - protected basePath = '{{basePath}}'; - protected defaultHeaders : any = {}; - - protected authentications = { - 'default': new VoidAuth(), -{{#authMethods}} -{{#isBasic}} - '{{name}}': new HttpBasicAuth(), -{{/isBasic}} -{{#isApiKey}} - '{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{^isKeyInHeader}}'query'{{/isKeyInHeader}}, '{{keyParamName}}'), -{{/isApiKey}} -{{#isOAuth}} - '{{name}}': new OAuth(), -{{/isOAuth}} -{{/authMethods}} - } - - constructor(basePath?: string); -{{#authMethods}} -{{#isBasic}} - constructor(username: string, password: string, basePath?: string); -{{/isBasic}} -{{/authMethods}} - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { -{{#authMethods}} -{{#isBasic}} - this.username = basePathOrUsername; - this.password = password -{{/isBasic}} -{{/authMethods}} - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - public setApiKey(key: {{classname}}ApiKeys, value: string) { - this.authentications[{{classname}}ApiKeys[key]].apiKey = value; - } -{{#authMethods}} -{{#isBasic}} - - set username(username: string) { - this.authentications.{{name}}.username = username; - } - - set password(password: string) { - this.authentications.{{name}}.password = password; - } -{{/isBasic}} -{{#isOAuth}} - - set accessToken(token: string) { - this.authentications.{{name}}.accessToken = token; - } -{{/isOAuth}} -{{/authMethods}} - private extendObj(objA: T1, objB: T2) { - for(let key in objB){ - if(objB.hasOwnProperty(key)){ - objA[key] = objB[key]; - } - } - return objA; - } -{{#operation}} - /** - * {{summary}} - * {{notes}} - {{#allParams}}* @param {{paramName}} {{description}} - {{/allParams}}*/ - public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { - const localVarPath = this.basePath + '{{path}}'{{#pathParams}} - .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - -{{#allParams}}{{#required}} - // verify required parameter '{{paramName}}' is not null or undefined - if ({{paramName}} === null || {{paramName}} === undefined) { - throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); - } -{{/required}}{{/allParams}} -{{#queryParams}} - if ({{paramName}} !== undefined) { - queryParameters['{{baseName}}'] = {{paramName}}; - } - -{{/queryParams}} -{{#headerParams}} - headerParams['{{baseName}}'] = {{paramName}}; - -{{/headerParams}} - let useFormData = false; - -{{#formParams}} - if ({{paramName}} !== undefined) { - formParams['{{baseName}}'] = {{paramName}}; - } -{{#isFile}} - useFormData = true; -{{/isFile}} - -{{/formParams}} - let localVarDeferred = promise.defer<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>(); - - let requestOptions: request.Options = { - method: '{{httpMethod}}', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - json: true, -{{#bodyParam}} - body: {{paramName}}, -{{/bodyParam}} - } - -{{#authMethods}} - this.authentications.{{name}}.applyToRequest(requestOptions); - -{{/authMethods}} - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - - request(requestOptions, (error, response, body) => { - if (error) { - localVarDeferred.reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - localVarDeferred.resolve({ response: response, body: body }); - } else { - localVarDeferred.reject({ response: response, body: body }); - } - } - }); - - return localVarDeferred.promise; - } -{{/operation}} -} -{{/operations}} -{{/apis}} -{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/git_push.sh.mustache deleted file mode 100755 index e153ce23ecf4..000000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/git_push.sh.mustache +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="{{{gitUserId}}}" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="{{{gitRepoId}}}" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="{{{releaseNote}}}" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache deleted file mode 100644 index 967145002087..000000000000 --- a/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "{{npmName}}", - "version": "{{npmVersion}}", - "description": "NodeJS client for {{npmName}}", - "main": "api.js", - "scripts": { - "build": "typings install && tsc" - }, - "author": "Swagger Codegen Contributors", - "license": "MIT", - "dependencies": { - "bluebird": "^3.3.5", - "request": "^2.72.0" - }, - "devDependencies": { - "typescript": "^1.8.10", - "typings": "^0.8.1" - }{{#npmRepository}}, - "publishConfig":{ - "registry":"{{npmRepository}}" - }{{/npmRepository}} -} diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache deleted file mode 100644 index 2dd166566e97..000000000000 --- a/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "target": "ES5", - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "noLib": false, - "declaration": true - }, - "files": [ - "api.ts", - "typings/main.d.ts" - ] -} - diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache deleted file mode 100644 index 76c4cc8e6af3..000000000000 --- a/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ambientDependencies": { - "bluebird": "registry:dt/bluebird#2.0.0+20160319051630", - "core-js": "registry:dt/core-js#0.0.0+20160317120654", - "node": "registry:dt/node#4.0.0+20160423143914" - }, - "dependencies": { - "request": "registry:npm/request#2.69.0+20160304121250" - } -} \ No newline at end of file From 0bce28cff226b50bbbea02d627f076b39ea0386d Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 14:09:08 +0800 Subject: [PATCH 085/170] add back ts resource folder with new folder name --- .../typescript-angular/api.d.mustache | 13 + .../resources/typescript-angular/api.mustache | 98 +++++++ .../typescript-angular/git_push.sh.mustache | 52 ++++ .../typescript-angular/model.mustache | 39 +++ .../resources/typescript-node/api.mustache | 264 ++++++++++++++++++ .../typescript-node/git_push.sh.mustache | 52 ++++ .../typescript-node/package.mustache | 22 ++ .../typescript-node/tsconfig.mustache | 18 ++ .../typescript-node/typings.mustache | 10 + 9 files changed, 568 insertions(+) create mode 100644 modules/swagger-codegen/src/main/resources/typescript-angular/api.d.mustache create mode 100644 modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache create mode 100755 modules/swagger-codegen/src/main/resources/typescript-angular/git_push.sh.mustache create mode 100644 modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache create mode 100644 modules/swagger-codegen/src/main/resources/typescript-node/api.mustache create mode 100755 modules/swagger-codegen/src/main/resources/typescript-node/git_push.sh.mustache create mode 100644 modules/swagger-codegen/src/main/resources/typescript-node/package.mustache create mode 100644 modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache create mode 100644 modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.d.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.d.mustache new file mode 100644 index 000000000000..a8bf1c582670 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/api.d.mustache @@ -0,0 +1,13 @@ +{{#models}} +{{#model}} +/// +{{/model}} +{{/models}} + +{{#apiInfo}} +{{#apis}} +{{#operations}} +/// +{{/operations}} +{{/apis}} +{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache new file mode 100644 index 000000000000..427479cf6756 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache @@ -0,0 +1,98 @@ +/// + +/* tslint:disable:no-unused-variable member-ordering */ + +{{#operations}} +namespace {{package}} { + 'use strict'; + +{{#description}} + /** + * {{&description}} + */ +{{/description}} + export class {{classname}} { + protected basePath = '{{basePath}}'; + public defaultHeaders : any = {}; + + static $inject: string[] = ['$http', '$httpParamSerializer']; + + constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } + +{{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}}* @param {{paramName}} {{description}} + {{/allParams}}*/ + public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> { + const localVarPath = this.basePath + '{{path}}'{{#pathParams}} + .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; + + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); +{{#hasFormParams}} + let formParams: any = {}; + +{{/hasFormParams}} +{{#allParams}} +{{#required}} + // verify required parameter '{{paramName}}' is set + if (!{{paramName}}) { + throw new Error('Missing required parameter {{paramName}} when calling {{nickname}}'); + } +{{/required}} +{{/allParams}} +{{#queryParams}} + if ({{paramName}} !== undefined) { + queryParameters['{{baseName}}'] = {{paramName}}; + } + +{{/queryParams}} +{{#headerParams}} + headerParams['{{baseName}}'] = {{paramName}}; + +{{/headerParams}} +{{#hasFormParams}} + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + +{{/hasFormParams}} +{{#formParams}} + formParams['{{baseName}}'] = {{paramName}}; + +{{/formParams}} + let httpRequestParams: any = { + method: '{{httpMethod}}', + url: localVarPath, + json: {{#hasFormParams}}false{{/hasFormParams}}{{^hasFormParams}}true{{/hasFormParams}}, + {{#bodyParam}}data: {{paramName}}, + {{/bodyParam}} + {{#hasFormParams}}data: this.$httpParamSerializer(formParams), + {{/hasFormParams}} + params: queryParameters, + headers: headerParams + }; + + if (extraHttpRequestParams) { + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); + } + + return this.$http(httpRequestParams); + } +{{/operation}} + } +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/git_push.sh.mustache new file mode 100755 index 000000000000..e153ce23ecf4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/git_push.sh.mustache @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache new file mode 100644 index 000000000000..b7d929621578 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache @@ -0,0 +1,39 @@ +/// + +namespace {{package}} { + 'use strict'; + +{{#models}} +{{#model}} +{{#description}} + /** + * {{{description}}} + */ +{{/description}} + export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#vars}} + +{{#description}} + /** + * {{{description}}} + */ +{{/description}} + "{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; +{{/vars}} + } + +{{#hasEnums}} + export namespace {{classname}} { +{{#vars}} +{{#isEnum}} + + export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} + {{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} + } +{{/isEnum}} +{{/vars}} + } +{{/hasEnums}} +{{/model}} +{{/models}} +} diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/api.mustache new file mode 100644 index 000000000000..25e152a9e344 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-node/api.mustache @@ -0,0 +1,264 @@ +import request = require('request'); +import promise = require('bluebird'); +import http = require('http'); + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +/* tslint:disable:no-unused-variable */ + +{{#models}} +{{#model}} +{{#description}} +/** +* {{{description}}} +*/ +{{/description}} +export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#vars}} +{{#description}} + /** + * {{{description}}} + */ +{{/description}} + "{{name}}": {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; +{{/vars}} +} + +{{#hasEnums}} +export namespace {{classname}} { +{{#vars}} +{{#isEnum}} + export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} + {{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} + } +{{/isEnum}} +{{/vars}} +} +{{/hasEnums}} +{{/model}} +{{/models}} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: request.Options): void; +} + +export class HttpBasicAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: request.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: request.Options): void { + if (this.location == "query") { + (requestOptions.qs)[this.paramName] = this.apiKey; + } else if (this.location == "header") { + requestOptions.headers[this.paramName] = this.apiKey; + } + } +} + +export class OAuth implements Authentication { + public accessToken: string; + + applyToRequest(requestOptions: request.Options): void { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } +} + +export class VoidAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: request.Options): void { + // Do nothing + } +} + +{{#apiInfo}} +{{#apis}} +{{#operations}} +{{#description}} +/** +* {{&description}} +*/ +{{/description}} +export enum {{classname}}ApiKeys { +{{#authMethods}} +{{#isApiKey}} + {{name}}, +{{/isApiKey}} +{{/authMethods}} +} + +export class {{classname}} { + protected basePath = '{{basePath}}'; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), +{{#authMethods}} +{{#isBasic}} + '{{name}}': new HttpBasicAuth(), +{{/isBasic}} +{{#isApiKey}} + '{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{^isKeyInHeader}}'query'{{/isKeyInHeader}}, '{{keyParamName}}'), +{{/isApiKey}} +{{#isOAuth}} + '{{name}}': new OAuth(), +{{/isOAuth}} +{{/authMethods}} + } + + constructor(basePath?: string); +{{#authMethods}} +{{#isBasic}} + constructor(username: string, password: string, basePath?: string); +{{/isBasic}} +{{/authMethods}} + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { +{{#authMethods}} +{{#isBasic}} + this.username = basePathOrUsername; + this.password = password +{{/isBasic}} +{{/authMethods}} + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: {{classname}}ApiKeys, value: string) { + this.authentications[{{classname}}ApiKeys[key]].apiKey = value; + } +{{#authMethods}} +{{#isBasic}} + + set username(username: string) { + this.authentications.{{name}}.username = username; + } + + set password(password: string) { + this.authentications.{{name}}.password = password; + } +{{/isBasic}} +{{#isOAuth}} + + set accessToken(token: string) { + this.authentications.{{name}}.accessToken = token; + } +{{/isOAuth}} +{{/authMethods}} + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } +{{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}}* @param {{paramName}} {{description}} + {{/allParams}}*/ + public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { + const localVarPath = this.basePath + '{{path}}'{{#pathParams}} + .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + +{{#allParams}}{{#required}} + // verify required parameter '{{paramName}}' is not null or undefined + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); + } +{{/required}}{{/allParams}} +{{#queryParams}} + if ({{paramName}} !== undefined) { + queryParameters['{{baseName}}'] = {{paramName}}; + } + +{{/queryParams}} +{{#headerParams}} + headerParams['{{baseName}}'] = {{paramName}}; + +{{/headerParams}} + let useFormData = false; + +{{#formParams}} + if ({{paramName}} !== undefined) { + formParams['{{baseName}}'] = {{paramName}}; + } +{{#isFile}} + useFormData = true; +{{/isFile}} + +{{/formParams}} + let localVarDeferred = promise.defer<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>(); + + let requestOptions: request.Options = { + method: '{{httpMethod}}', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, +{{#bodyParam}} + body: {{paramName}}, +{{/bodyParam}} + } + +{{#authMethods}} + this.authentications.{{name}}.applyToRequest(requestOptions); + +{{/authMethods}} + this.authentications.default.applyToRequest(requestOptions); + + if (Object.keys(formParams).length) { + if (useFormData) { + (requestOptions).formData = formParams; + } else { + requestOptions.form = formParams; + } + } + + request(requestOptions, (error, response, body) => { + if (error) { + localVarDeferred.reject(error); + } else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + + return localVarDeferred.promise; + } +{{/operation}} +} +{{/operations}} +{{/apis}} +{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/git_push.sh.mustache new file mode 100755 index 000000000000..e153ce23ecf4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-node/git_push.sh.mustache @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache new file mode 100644 index 000000000000..967145002087 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache @@ -0,0 +1,22 @@ +{ + "name": "{{npmName}}", + "version": "{{npmVersion}}", + "description": "NodeJS client for {{npmName}}", + "main": "api.js", + "scripts": { + "build": "typings install && tsc" + }, + "author": "Swagger Codegen Contributors", + "license": "MIT", + "dependencies": { + "bluebird": "^3.3.5", + "request": "^2.72.0" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + }{{#npmRepository}}, + "publishConfig":{ + "registry":"{{npmRepository}}" + }{{/npmRepository}} +} diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache new file mode 100644 index 000000000000..2dd166566e97 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": false, + "suppressImplicitAnyIndexErrors": true, + "target": "ES5", + "moduleResolution": "node", + "removeComments": true, + "sourceMap": true, + "noLib": false, + "declaration": true + }, + "files": [ + "api.ts", + "typings/main.d.ts" + ] +} + diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache new file mode 100644 index 000000000000..76c4cc8e6af3 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache @@ -0,0 +1,10 @@ +{ + "ambientDependencies": { + "bluebird": "registry:dt/bluebird#2.0.0+20160319051630", + "core-js": "registry:dt/core-js#0.0.0+20160317120654", + "node": "registry:dt/node#4.0.0+20160423143914" + }, + "dependencies": { + "request": "registry:npm/request#2.69.0+20160304121250" + } +} \ No newline at end of file From 1d6ec92141b1154baa0247210164b59e89713362 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 14:11:49 +0800 Subject: [PATCH 086/170] add sh for groovy petstore --- bin/groovy-petstore.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 bin/groovy-petstore.sh diff --git a/bin/groovy-petstore.sh b/bin/groovy-petstore.sh new file mode 100755 index 000000000000..6afb14a7f099 --- /dev/null +++ b/bin/groovy-petstore.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l groovy -o samples/client/petstore/groovy -DhideGenerationTimestamp=true" +java $JAVA_OPTS -jar $executable $ags From ea8516d74722dd518477b5441ee3536c764dc58b Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Tue, 3 May 2016 08:39:39 +0200 Subject: [PATCH 087/170] Readding client.ts --- .../petstore/typescript-node/npm/client.ts | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 samples/client/petstore/typescript-node/npm/client.ts diff --git a/samples/client/petstore/typescript-node/npm/client.ts b/samples/client/petstore/typescript-node/npm/client.ts new file mode 100644 index 000000000000..51a7f687e09f --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/client.ts @@ -0,0 +1,59 @@ +import api = require('./api'); +import fs = require('fs'); + +var petApi = new api.PetApi(); +petApi.setApiKey(api.PetApiApiKeys.api_key, 'special-key'); +petApi.setApiKey(api.PetApiApiKeys.test_api_key_header, 'query-key'); + +var tag1 = new api.Tag(); +tag1.id = 18291; +tag1.name = 'TS tag 1'; + +var pet = new api.Pet(); +pet.name = 'TypeScriptDoggie'; +pet.id = 18291; +pet.photoUrls = ["http://url1", "http://url2"]; +pet.tags = [tag1]; + +var petId: any; + +var exitCode = 0; + +// Test various API calls to the petstore +petApi.addPet(pet) + .then((res) => { + var newPet = res.body; + petId = newPet.id; + console.log(`Created pet with ID ${petId}`); + newPet.status = api.Pet.StatusEnum.available; + return petApi.updatePet(newPet); + }) + .then((res) => { + console.log('Updated pet using POST body'); + return petApi.updatePetWithForm(petId, undefined, "pending"); + }) + .then((res) => { + console.log('Updated pet using POST form'); + return petApi.uploadFile(petId, undefined, fs.createReadStream('sample.png')); + }) + .then((res) => { + console.log('Uploaded image'); + return petApi.getPetById(petId); + }) + .then((res) => { + console.log('Got pet by ID: ' + JSON.stringify(res.body)); + if (res.body.status != api.Pet.StatusEnum.pending) { + throw new Error("Unexpected pet status"); + } + }) + .catch((err: any) => { + console.error(err); + exitCode = 1; + }) + .finally(() => { + return petApi.deletePet(petId); + }) + .then((res) => { + console.log('Deleted pet'); + process.exit(exitCode); + }); From 6b0b343b92ea52d4d349db75b5a0605e0ca7d267 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 16:42:02 +0800 Subject: [PATCH 088/170] add option to support ES6 --- .gitignore | 3 + .../io/swagger/codegen/CodegenConstants.java | 4 +- .../AbstractTypeScriptClientCodegen.java | 17 +- .../resources/typescript-node/api.mustache | 26 +- .../typescript-node/tsconfig.mustache | 2 +- ...peScriptAngular2ClientOptionsProvider.java | 2 + ...ypeScriptAngularClientOptionsProvider.java | 2 + .../TypeScriptNodeClientOptionsProvider.java | 2 + .../TypeScriptAngularClientOptionsTest.java | 2 + .../TypeScriptAngular2ClientOptionsTest.java | 2 + .../TypeScriptNodeClientOptionsTest.java | 2 + .../petstore/typescript-node/default/api.js | 1188 +++++++++++++++++ .../petstore/typescript-node/default/api.ts | 170 +-- .../petstore/typescript-node/npm/api.d.ts | 204 +++ .../petstore/typescript-node/npm/api.js | 1070 +++++++++++++++ .../petstore/typescript-node/npm/api.js.map | 1 + .../petstore/typescript-node/npm/api.ts | 170 +-- .../petstore/typescript-node/npm/package.json | 2 +- 18 files changed, 2634 insertions(+), 235 deletions(-) create mode 100644 samples/client/petstore/typescript-node/default/api.js create mode 100644 samples/client/petstore/typescript-node/npm/api.d.ts create mode 100644 samples/client/petstore/typescript-node/npm/api.js create mode 100644 samples/client/petstore/typescript-node/npm/api.js.map diff --git a/.gitignore b/.gitignore index 0dc527992362..25bb6c205cba 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,6 @@ samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt samples/client/petstore/python/.coverage samples/client/petstore/python/.projectile samples/client/petstore/python/.venv/ + +# ts +samples/client/petstore/typescript-node/npm/node_modules diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java index 1d97fe829b83..b4b414bb00de 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java @@ -89,7 +89,7 @@ public class CodegenConstants { public static final String MODEL_NAME_SUFFIX_DESC = "Suffix that will be appended to all model names. Default is the empty string."; public static final String OPTIONAL_EMIT_DEFAULT_VALUES = "optionalEmitDefaultValues"; - public static final String OPTIONAL_EMIT_DEFAULT_VALUES_DESC = "Set DataMember's EmitDefaultValue, default false."; + public static final String OPTIONAL_EMIT_DEFAULT_VALUES_DESC = "Set DataMember's EmitDefaultValue."; public static final String GIT_USER_ID = "gitUserId"; public static final String GIT_USER_ID_DESC = "Git user ID, e.g. swagger-api."; @@ -103,4 +103,6 @@ public class CodegenConstants { public static final String HTTP_USER_AGENT = "httpUserAgent"; public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'Swagger-Codegen/{packageVersion}}/{language}'"; + public static final String SUPPORTS_ES6 = "supportsES6"; + public static final String SUPPORTS_ES6_DESC = "Generate code that conforms to ES6."; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index a5e62fc30535..76ad5fce131a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -11,6 +11,7 @@ import org.apache.commons.lang.StringUtils; public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig { protected String modelPropertyNaming= "camelCase"; + protected Boolean supportsES6 = true; public AbstractTypeScriptClientCodegen() { super(); @@ -63,16 +64,22 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp typeMapping.put("UUID", "string"); cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase")); - + cliOptions.add(new CliOption(CodegenConstants.SUPPORTS_ES6, CodegenConstants.SUPPORTS_ES6_DESC).defaultValue("false")); } @Override public void processOpts() { super.processOpts(); + if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) { setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING)); } + + if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ES6)) { + setSupportsES6(Boolean.valueOf((String)additionalProperties.get(CodegenConstants.SUPPORTS_ES6))); + additionalProperties.put("supportsES6", getSupportsES6()); + } } @@ -231,4 +238,12 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp } } + + public void setSupportsES6(Boolean value) { + supportsES6 = value; + } + + public Boolean getSupportsES6() { + return supportsES6; + } } diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/api.mustache index a85c170082e8..81163d686aaf 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-node/api.mustache @@ -1,5 +1,8 @@ import request = require('request'); import http = require('http'); +{{^supportsES6}} +import promise = require('bluebird'); +{{/supportsES6}} let defaultBasePath = '{{basePath}}'; @@ -183,7 +186,7 @@ export class {{classname}} { * {{notes}} {{#allParams}}* @param {{paramName}} {{description}} {{/allParams}}*/ - public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { + public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { const localVarPath = this.basePath + '{{path}}'{{#pathParams}} .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; let queryParameters: any = {}; @@ -217,6 +220,9 @@ export class {{classname}} { {{/isFile}} {{/formParams}} + {{^supportsES6}} + let localVarDeferred = promise.defer<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>(); + {{/supportsES6}} let requestOptions: request.Options = { method: '{{httpMethod}}', qs: queryParameters, @@ -241,7 +247,21 @@ export class {{classname}} { requestOptions.form = formParams; } } - + {{^supportsES6}} + request(requestOptions, (error, response, body) => { + if (error) { + localVarDeferred.reject(error); + } else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + {{/supportsES6}} + {{#supportsES6}} return new Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => { request(requestOptions, (error, response, body) => { if (error) { @@ -255,7 +275,7 @@ export class {{classname}} { } }); }); - + {{/supportsES6}} } {{/operation}} } diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache index 2dd166566e97..1a3bd00183a3 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache @@ -3,7 +3,7 @@ "module": "commonjs", "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, - "target": "ES5", + "target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}", "moduleResolution": "node", "removeComments": true, "sourceMap": true, diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java index f0bca356d6f5..8b8077edfeed 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java @@ -8,6 +8,7 @@ import io.swagger.codegen.CodegenConstants; import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider { + public static final String SUPPORTS_ES6_VALUE = "false"; public static final String SORT_PARAMS_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; private static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; @@ -26,6 +27,7 @@ public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) + .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME) .put(TypeScriptAngular2ClientCodegen.NPM_VERSION, NMP_VERSION) .put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularClientOptionsProvider.java index 3899ed26b29f..4fe0820d34ee 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngularClientOptionsProvider.java @@ -7,6 +7,7 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; public class TypeScriptAngularClientOptionsProvider implements OptionsProvider { + public static final String SUPPORTS_ES6_VALUE = "false"; public static final String SORT_PARAMS_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; @@ -20,6 +21,7 @@ public class TypeScriptAngularClientOptionsProvider implements OptionsProvider { public Map createOptions() { ImmutableMap.Builder builder = new ImmutableMap.Builder(); return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) .build(); diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptNodeClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptNodeClientOptionsProvider.java index bfbd3528e87a..61868ef6faf7 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptNodeClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptNodeClientOptionsProvider.java @@ -9,6 +9,7 @@ import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; public class TypeScriptNodeClientOptionsProvider implements OptionsProvider { + public static final String SUPPORTS_ES6_VALUE = "false"; public static final String SORT_PARAMS_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; @@ -26,6 +27,7 @@ public class TypeScriptNodeClientOptionsProvider implements OptionsProvider { public Map createOptions() { ImmutableMap.Builder builder = new ImmutableMap.Builder(); return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) .put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME) diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptangular/TypeScriptAngularClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptangular/TypeScriptAngularClientOptionsTest.java index 17d9c1ed2050..70cfb3d250d8 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptangular/TypeScriptAngularClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptangular/TypeScriptAngularClientOptionsTest.java @@ -30,6 +30,8 @@ public class TypeScriptAngularClientOptionsTest extends AbstractOptionsTest { times = 1; clientCodegen.setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); times = 1; + clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE)); + times = 1; }}; } } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptangular2/TypeScriptAngular2ClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptangular2/TypeScriptAngular2ClientOptionsTest.java index 4c56a7dfab2b..74e575c44960 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptangular2/TypeScriptAngular2ClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptangular2/TypeScriptAngular2ClientOptionsTest.java @@ -30,6 +30,8 @@ public class TypeScriptAngular2ClientOptionsTest extends AbstractOptionsTest { times = 1; clientCodegen.setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); times = 1; + clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE)); + times = 1; }}; } } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptnode/TypeScriptNodeClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptnode/TypeScriptNodeClientOptionsTest.java index 67b55de138a1..72b55b0b39d6 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptnode/TypeScriptNodeClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptnode/TypeScriptNodeClientOptionsTest.java @@ -30,6 +30,8 @@ public class TypeScriptNodeClientOptionsTest extends AbstractOptionsTest { times = 1; clientCodegen.setModelPropertyNaming(TypeScriptNodeClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); times = 1; + clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SUPPORTS_ES6_VALUE)); + times = 1; }}; } } diff --git a/samples/client/petstore/typescript-node/default/api.js b/samples/client/petstore/typescript-node/default/api.js new file mode 100644 index 000000000000..9a6c0a28ec72 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/api.js @@ -0,0 +1,1188 @@ +var request = require('request'); +var promise = require('bluebird'); +var defaultBasePath = 'http://petstore.swagger.io/v2'; +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== +/* tslint:disable:no-unused-variable */ +var Category = (function () { + function Category() { + } + return Category; +})(); +exports.Category = Category; +var Order = (function () { + function Order() { + } + return Order; +})(); +exports.Order = Order; +var Order; +(function (Order) { + (function (StatusEnum) { + StatusEnum[StatusEnum["StatusEnum_placed"] = 'placed'] = "StatusEnum_placed"; + StatusEnum[StatusEnum["StatusEnum_approved"] = 'approved'] = "StatusEnum_approved"; + StatusEnum[StatusEnum["StatusEnum_delivered"] = 'delivered'] = "StatusEnum_delivered"; + })(Order.StatusEnum || (Order.StatusEnum = {})); + var StatusEnum = Order.StatusEnum; +})(Order = exports.Order || (exports.Order = {})); +var Pet = (function () { + function Pet() { + } + return Pet; +})(); +exports.Pet = Pet; +var Pet; +(function (Pet) { + (function (StatusEnum) { + StatusEnum[StatusEnum["StatusEnum_available"] = 'available'] = "StatusEnum_available"; + StatusEnum[StatusEnum["StatusEnum_pending"] = 'pending'] = "StatusEnum_pending"; + StatusEnum[StatusEnum["StatusEnum_sold"] = 'sold'] = "StatusEnum_sold"; + })(Pet.StatusEnum || (Pet.StatusEnum = {})); + var StatusEnum = Pet.StatusEnum; +})(Pet = exports.Pet || (exports.Pet = {})); +var Tag = (function () { + function Tag() { + } + return Tag; +})(); +exports.Tag = Tag; +var User = (function () { + function User() { + } + return User; +})(); +exports.User = User; +var HttpBasicAuth = (function () { + function HttpBasicAuth() { + } + HttpBasicAuth.prototype.applyToRequest = function (requestOptions) { + requestOptions.auth = { + username: this.username, password: this.password + }; + }; + return HttpBasicAuth; +})(); +exports.HttpBasicAuth = HttpBasicAuth; +var ApiKeyAuth = (function () { + function ApiKeyAuth(location, paramName) { + this.location = location; + this.paramName = paramName; + } + ApiKeyAuth.prototype.applyToRequest = function (requestOptions) { + if (this.location == "query") { + requestOptions.qs[this.paramName] = this.apiKey; + } + else if (this.location == "header") { + requestOptions.headers[this.paramName] = this.apiKey; + } + }; + return ApiKeyAuth; +})(); +exports.ApiKeyAuth = ApiKeyAuth; +var OAuth = (function () { + function OAuth() { + } + OAuth.prototype.applyToRequest = function (requestOptions) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + }; + return OAuth; +})(); +exports.OAuth = OAuth; +var VoidAuth = (function () { + function VoidAuth() { + } + VoidAuth.prototype.applyToRequest = function (requestOptions) { + // Do nothing + }; + return VoidAuth; +})(); +exports.VoidAuth = VoidAuth; +(function (PetApiApiKeys) { + PetApiApiKeys[PetApiApiKeys["api_key"] = 0] = "api_key"; +})(exports.PetApiApiKeys || (exports.PetApiApiKeys = {})); +var PetApiApiKeys = exports.PetApiApiKeys; +var PetApi = (function () { + function PetApi(basePathOrUsername, password, basePath) { + this.basePath = defaultBasePath; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + }; + if (password) { + if (basePath) { + this.basePath = basePath; + } + } + else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername; + } + } + } + PetApi.prototype.setApiKey = function (key, value) { + this.authentications[PetApiApiKeys[key]].apiKey = value; + }; + Object.defineProperty(PetApi.prototype, "accessToken", { + set: function (token) { + this.authentications.petstore_auth.accessToken = token; + }, + enumerable: true, + configurable: true + }); + PetApi.prototype.extendObj = function (objA, objB) { + for (var key in objB) { + if (objB.hasOwnProperty(key)) { + objA[key] = objB[key]; + } + } + return objA; + }; + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + */ + PetApi.prototype.addPet = function (body) { + var localVarPath = this.basePath + '/pet'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + */ + PetApi.prototype.deletePet = function (petId, apiKey) { + var localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling deletePet.'); + } + headerParams['api_key'] = apiKey; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'DELETE', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Finds Pets by status + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter + */ + PetApi.prototype.findPetsByStatus = function (status) { + var localVarPath = this.basePath + '/pet/findByStatus'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (status !== undefined) { + queryParameters['status'] = status; + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Finds Pets by tags + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + */ + PetApi.prototype.findPetsByTags = function (tags) { + var localVarPath = this.basePath + '/pet/findByTags'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (tags !== undefined) { + queryParameters['tags'] = tags; + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * 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 + */ + PetApi.prototype.getPetById = function (petId) { + var localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling getPetById.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + */ + PetApi.prototype.updatePet = function (body) { + var localVarPath = this.basePath + '/pet'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'PUT', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + PetApi.prototype.updatePetWithForm = function (petId, name, status) { + var localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + var useFormData = false; + if (name !== undefined) { + formParams['name'] = name; + } + if (status !== undefined) { + formParams['status'] = status; + } + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + PetApi.prototype.uploadFile = function (petId, additionalMetadata, file) { + var localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(petId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); + } + var useFormData = false; + if (additionalMetadata !== undefined) { + formParams['additionalMetadata'] = additionalMetadata; + } + if (file !== undefined) { + formParams['file'] = file; + } + useFormData = true; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + return PetApi; +})(); +exports.PetApi = PetApi; +(function (StoreApiApiKeys) { + StoreApiApiKeys[StoreApiApiKeys["api_key"] = 0] = "api_key"; +})(exports.StoreApiApiKeys || (exports.StoreApiApiKeys = {})); +var StoreApiApiKeys = exports.StoreApiApiKeys; +var StoreApi = (function () { + function StoreApi(basePathOrUsername, password, basePath) { + this.basePath = defaultBasePath; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + }; + if (password) { + if (basePath) { + this.basePath = basePath; + } + } + else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername; + } + } + } + StoreApi.prototype.setApiKey = function (key, value) { + this.authentications[StoreApiApiKeys[key]].apiKey = value; + }; + Object.defineProperty(StoreApi.prototype, "accessToken", { + set: function (token) { + this.authentications.petstore_auth.accessToken = token; + }, + enumerable: true, + configurable: true + }); + StoreApi.prototype.extendObj = function (objA, objB) { + for (var key in objB) { + if (objB.hasOwnProperty(key)) { + objA[key] = objB[key]; + } + } + return objA; + }; + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + */ + StoreApi.prototype.deleteOrder = function (orderId) { + var localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'DELETE', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + StoreApi.prototype.getInventory = function () { + var localVarPath = this.basePath + '/store/inventory'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Find purchase order by ID + * 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 + */ + StoreApi.prototype.getOrderById = function (orderId) { + var localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + */ + StoreApi.prototype.placeOrder = function (body) { + var localVarPath = this.basePath + '/store/order'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + return StoreApi; +})(); +exports.StoreApi = StoreApi; +(function (UserApiApiKeys) { + UserApiApiKeys[UserApiApiKeys["api_key"] = 0] = "api_key"; +})(exports.UserApiApiKeys || (exports.UserApiApiKeys = {})); +var UserApiApiKeys = exports.UserApiApiKeys; +var UserApi = (function () { + function UserApi(basePathOrUsername, password, basePath) { + this.basePath = defaultBasePath; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + }; + if (password) { + if (basePath) { + this.basePath = basePath; + } + } + else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername; + } + } + } + UserApi.prototype.setApiKey = function (key, value) { + this.authentications[UserApiApiKeys[key]].apiKey = value; + }; + Object.defineProperty(UserApi.prototype, "accessToken", { + set: function (token) { + this.authentications.petstore_auth.accessToken = token; + }, + enumerable: true, + configurable: true + }); + UserApi.prototype.extendObj = function (objA, objB) { + for (var key in objB) { + if (objB.hasOwnProperty(key)) { + objA[key] = objB[key]; + } + } + return objA; + }; + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + */ + UserApi.prototype.createUser = function (body) { + var localVarPath = this.basePath + '/user'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + UserApi.prototype.createUsersWithArrayInput = function (body) { + var localVarPath = this.basePath + '/user/createWithArray'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + UserApi.prototype.createUsersWithListInput = function (body) { + var localVarPath = this.basePath + '/user/createWithList'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + */ + UserApi.prototype.deleteUser = function (username) { + var localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling deleteUser.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'DELETE', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + UserApi.prototype.getUserByName = function (username) { + var localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getUserByName.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + */ + UserApi.prototype.loginUser = function (username, password) { + var localVarPath = this.basePath + '/user/login'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (username !== undefined) { + queryParameters['username'] = username; + } + if (password !== undefined) { + queryParameters['password'] = password; + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Logs out current logged in user session + * + */ + UserApi.prototype.logoutUser = function () { + var localVarPath = this.basePath + '/user/logout'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param body Updated user object + */ + UserApi.prototype.updateUser = function (username, body) { + var localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling updateUser.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'PUT', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + return UserApi; +})(); +exports.UserApi = UserApi; diff --git a/samples/client/petstore/typescript-node/default/api.ts b/samples/client/petstore/typescript-node/default/api.ts index c2bd53e8ca29..568335b5769a 100644 --- a/samples/client/petstore/typescript-node/default/api.ts +++ b/samples/client/petstore/typescript-node/default/api.ts @@ -1,6 +1,8 @@ import request = require('request'); -import promise = require('bluebird'); import http = require('http'); +import promise = require('bluebird'); + +let defaultBasePath = 'http://petstore.swagger.io/v2'; // =============================================== // This file is autogenerated - Please do not edit @@ -9,65 +11,65 @@ import http = require('http'); /* tslint:disable:no-unused-variable */ export class Category { - "id": number; - "name": string; + 'id': number; + 'name': string; } export class Order { - "id": number; - "petId": number; - "quantity": number; - "shipDate": Date; + 'id': number; + 'petId': number; + 'quantity': number; + 'shipDate': Date; /** * Order Status */ - "status": Order.StatusEnum; - "complete": boolean; + 'status': Order.StatusEnum; + 'complete': boolean; } export namespace Order { export enum StatusEnum { - placed = 'placed', - approved = 'approved', - delivered = 'delivered' + StatusEnum_placed = 'placed', + StatusEnum_approved = 'approved', + StatusEnum_delivered = 'delivered' } } export class Pet { - "id": number; - "category": Category; - "name": string; - "photoUrls": Array; - "tags": Array; + 'id': number; + 'category': Category; + 'name': string; + 'photoUrls': Array; + 'tags': Array; /** * pet status in the store */ - "status": Pet.StatusEnum; + 'status': Pet.StatusEnum; } export namespace Pet { export enum StatusEnum { - available = 'available', - pending = 'pending', - sold = 'sold' + StatusEnum_available = 'available', + StatusEnum_pending = 'pending', + StatusEnum_sold = 'sold' } } export class Tag { - "id": number; - "name": string; + 'id': number; + 'name': string; } export class User { - "id": number; - "username": string; - "firstName": string; - "lastName": string; - "email": string; - "password": string; - "phone": string; + 'id': number; + 'username': string; + 'firstName': string; + 'lastName': string; + 'email': string; + 'password': string; + 'phone': string; /** * User Status */ - "userStatus": number; + 'userStatus': number; } @@ -124,7 +126,7 @@ export enum PetApiApiKeys { } export class PetApi { - protected basePath = 'http://petstore.swagger.io/v2'; + protected basePath = defaultBasePath; protected defaultHeaders : any = {}; protected authentications = { @@ -176,7 +178,6 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -184,7 +185,7 @@ export class PetApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -197,7 +198,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -209,7 +209,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -236,14 +235,13 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'DELETE', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -256,7 +254,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -268,7 +265,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -290,14 +286,13 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Array; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -310,7 +305,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -322,7 +316,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -344,14 +337,13 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Array; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -364,7 +356,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -376,7 +367,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -400,14 +390,13 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Pet; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.api_key.applyToRequest(requestOptions); @@ -422,7 +411,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -434,7 +422,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -452,7 +439,6 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'PUT', qs: queryParameters, @@ -460,7 +446,7 @@ export class PetApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -473,7 +459,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -485,7 +470,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -519,14 +503,13 @@ export class PetApi { } let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -539,7 +522,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -551,7 +533,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -586,14 +567,13 @@ export class PetApi { useFormData = true; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -606,7 +586,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -618,7 +597,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } } @@ -627,7 +605,7 @@ export enum StoreApiApiKeys { } export class StoreApi { - protected basePath = 'http://petstore.swagger.io/v2'; + protected basePath = defaultBasePath; protected defaultHeaders : any = {}; protected authentications = { @@ -685,14 +663,13 @@ export class StoreApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'DELETE', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -703,7 +680,6 @@ export class StoreApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -715,7 +691,6 @@ export class StoreApi { } } }); - return localVarDeferred.promise; } /** @@ -732,14 +707,13 @@ export class StoreApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: { [key: string]: number; }; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.api_key.applyToRequest(requestOptions); @@ -752,7 +726,6 @@ export class StoreApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -764,7 +737,6 @@ export class StoreApi { } } }); - return localVarDeferred.promise; } /** @@ -788,14 +760,13 @@ export class StoreApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -806,7 +777,6 @@ export class StoreApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -818,7 +788,6 @@ export class StoreApi { } } }); - return localVarDeferred.promise; } /** @@ -836,7 +805,6 @@ export class StoreApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -844,7 +812,7 @@ export class StoreApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -855,7 +823,6 @@ export class StoreApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -867,7 +834,6 @@ export class StoreApi { } } }); - return localVarDeferred.promise; } } @@ -876,7 +842,7 @@ export enum UserApiApiKeys { } export class UserApi { - protected basePath = 'http://petstore.swagger.io/v2'; + protected basePath = defaultBasePath; protected defaultHeaders : any = {}; protected authentications = { @@ -928,7 +894,6 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -936,7 +901,7 @@ export class UserApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -947,7 +912,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -959,7 +923,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -977,7 +940,6 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -985,7 +947,7 @@ export class UserApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -996,7 +958,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1008,7 +969,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1026,7 +986,6 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -1034,7 +993,7 @@ export class UserApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1045,7 +1004,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1057,7 +1015,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1081,14 +1038,13 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'DELETE', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1099,7 +1055,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1111,7 +1066,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1135,14 +1089,13 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: User; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1153,7 +1106,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1165,7 +1117,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1192,14 +1143,13 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: string; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1210,7 +1160,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1222,7 +1171,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1239,14 +1187,13 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1257,7 +1204,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1269,7 +1215,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1294,7 +1239,6 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'PUT', qs: queryParameters, @@ -1302,7 +1246,7 @@ export class UserApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1313,7 +1257,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1325,7 +1268,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } } diff --git a/samples/client/petstore/typescript-node/npm/api.d.ts b/samples/client/petstore/typescript-node/npm/api.d.ts new file mode 100644 index 000000000000..7a1a1ff81994 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/api.d.ts @@ -0,0 +1,204 @@ +import request = require('request'); +import http = require('http'); +export declare class Category { + 'id': number; + 'name': string; +} +export declare class Order { + 'id': number; + 'petId': number; + 'quantity': number; + 'shipDate': Date; + 'status': Order.StatusEnum; + 'complete': boolean; +} +export declare namespace Order { + enum StatusEnum { + StatusEnum_placed, + StatusEnum_approved, + StatusEnum_delivered, + } +} +export declare class Pet { + 'id': number; + 'category': Category; + 'name': string; + 'photoUrls': Array; + 'tags': Array; + 'status': Pet.StatusEnum; +} +export declare namespace Pet { + enum StatusEnum { + StatusEnum_available, + StatusEnum_pending, + StatusEnum_sold, + } +} +export declare class Tag { + 'id': number; + 'name': string; +} +export declare class User { + 'id': number; + 'username': string; + 'firstName': string; + 'lastName': string; + 'email': string; + 'password': string; + 'phone': string; + 'userStatus': number; +} +export interface Authentication { + applyToRequest(requestOptions: request.Options): void; +} +export declare class HttpBasicAuth implements Authentication { + username: string; + password: string; + applyToRequest(requestOptions: request.Options): void; +} +export declare class ApiKeyAuth implements Authentication { + private location; + private paramName; + apiKey: string; + constructor(location: string, paramName: string); + applyToRequest(requestOptions: request.Options): void; +} +export declare class OAuth implements Authentication { + accessToken: string; + applyToRequest(requestOptions: request.Options): void; +} +export declare class VoidAuth implements Authentication { + username: string; + password: string; + applyToRequest(requestOptions: request.Options): void; +} +export declare enum PetApiApiKeys { + api_key = 0, +} +export declare class PetApi { + protected basePath: string; + protected defaultHeaders: any; + protected authentications: { + 'default': Authentication; + 'api_key': ApiKeyAuth; + 'petstore_auth': OAuth; + }; + constructor(basePath?: string); + setApiKey(key: PetApiApiKeys, value: string): void; + accessToken: string; + private extendObj(objA, objB); + addPet(body?: Pet): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + deletePet(petId: number, apiKey?: string): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + findPetsByStatus(status?: Array): Promise<{ + response: http.ClientResponse; + body: Array; + }>; + findPetsByTags(tags?: Array): Promise<{ + response: http.ClientResponse; + body: Array; + }>; + getPetById(petId: number): Promise<{ + response: http.ClientResponse; + body: Pet; + }>; + updatePet(body?: Pet): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + updatePetWithForm(petId: string, name?: string, status?: string): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + uploadFile(petId: number, additionalMetadata?: string, file?: any): Promise<{ + response: http.ClientResponse; + body?: any; + }>; +} +export declare enum StoreApiApiKeys { + api_key = 0, +} +export declare class StoreApi { + protected basePath: string; + protected defaultHeaders: any; + protected authentications: { + 'default': Authentication; + 'api_key': ApiKeyAuth; + 'petstore_auth': OAuth; + }; + constructor(basePath?: string); + setApiKey(key: StoreApiApiKeys, value: string): void; + accessToken: string; + private extendObj(objA, objB); + deleteOrder(orderId: string): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + getInventory(): Promise<{ + response: http.ClientResponse; + body: { + [key: string]: number; + }; + }>; + getOrderById(orderId: string): Promise<{ + response: http.ClientResponse; + body: Order; + }>; + placeOrder(body?: Order): Promise<{ + response: http.ClientResponse; + body: Order; + }>; +} +export declare enum UserApiApiKeys { + api_key = 0, +} +export declare class UserApi { + protected basePath: string; + protected defaultHeaders: any; + protected authentications: { + 'default': Authentication; + 'api_key': ApiKeyAuth; + 'petstore_auth': OAuth; + }; + constructor(basePath?: string); + setApiKey(key: UserApiApiKeys, value: string): void; + accessToken: string; + private extendObj(objA, objB); + createUser(body?: User): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + createUsersWithArrayInput(body?: Array): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + createUsersWithListInput(body?: Array): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + deleteUser(username: string): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + getUserByName(username: string): Promise<{ + response: http.ClientResponse; + body: User; + }>; + loginUser(username?: string, password?: string): Promise<{ + response: http.ClientResponse; + body: string; + }>; + logoutUser(): Promise<{ + response: http.ClientResponse; + body?: any; + }>; + updateUser(username: string, body?: User): Promise<{ + response: http.ClientResponse; + body?: any; + }>; +} diff --git a/samples/client/petstore/typescript-node/npm/api.js b/samples/client/petstore/typescript-node/npm/api.js new file mode 100644 index 000000000000..b8426c2b644c --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/api.js @@ -0,0 +1,1070 @@ +var request = require('request'); +var promise = require('bluebird'); +var defaultBasePath = 'http://petstore.swagger.io/v2'; +var Category = (function () { + function Category() { + } + return Category; +})(); +exports.Category = Category; +var Order = (function () { + function Order() { + } + return Order; +})(); +exports.Order = Order; +var Order; +(function (Order) { + (function (StatusEnum) { + StatusEnum[StatusEnum["StatusEnum_placed"] = 'placed'] = "StatusEnum_placed"; + StatusEnum[StatusEnum["StatusEnum_approved"] = 'approved'] = "StatusEnum_approved"; + StatusEnum[StatusEnum["StatusEnum_delivered"] = 'delivered'] = "StatusEnum_delivered"; + })(Order.StatusEnum || (Order.StatusEnum = {})); + var StatusEnum = Order.StatusEnum; +})(Order = exports.Order || (exports.Order = {})); +var Pet = (function () { + function Pet() { + } + return Pet; +})(); +exports.Pet = Pet; +var Pet; +(function (Pet) { + (function (StatusEnum) { + StatusEnum[StatusEnum["StatusEnum_available"] = 'available'] = "StatusEnum_available"; + StatusEnum[StatusEnum["StatusEnum_pending"] = 'pending'] = "StatusEnum_pending"; + StatusEnum[StatusEnum["StatusEnum_sold"] = 'sold'] = "StatusEnum_sold"; + })(Pet.StatusEnum || (Pet.StatusEnum = {})); + var StatusEnum = Pet.StatusEnum; +})(Pet = exports.Pet || (exports.Pet = {})); +var Tag = (function () { + function Tag() { + } + return Tag; +})(); +exports.Tag = Tag; +var User = (function () { + function User() { + } + return User; +})(); +exports.User = User; +var HttpBasicAuth = (function () { + function HttpBasicAuth() { + } + HttpBasicAuth.prototype.applyToRequest = function (requestOptions) { + requestOptions.auth = { + username: this.username, password: this.password + }; + }; + return HttpBasicAuth; +})(); +exports.HttpBasicAuth = HttpBasicAuth; +var ApiKeyAuth = (function () { + function ApiKeyAuth(location, paramName) { + this.location = location; + this.paramName = paramName; + } + ApiKeyAuth.prototype.applyToRequest = function (requestOptions) { + if (this.location == "query") { + requestOptions.qs[this.paramName] = this.apiKey; + } + else if (this.location == "header") { + requestOptions.headers[this.paramName] = this.apiKey; + } + }; + return ApiKeyAuth; +})(); +exports.ApiKeyAuth = ApiKeyAuth; +var OAuth = (function () { + function OAuth() { + } + OAuth.prototype.applyToRequest = function (requestOptions) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + }; + return OAuth; +})(); +exports.OAuth = OAuth; +var VoidAuth = (function () { + function VoidAuth() { + } + VoidAuth.prototype.applyToRequest = function (requestOptions) { + }; + return VoidAuth; +})(); +exports.VoidAuth = VoidAuth; +(function (PetApiApiKeys) { + PetApiApiKeys[PetApiApiKeys["api_key"] = 0] = "api_key"; +})(exports.PetApiApiKeys || (exports.PetApiApiKeys = {})); +var PetApiApiKeys = exports.PetApiApiKeys; +var PetApi = (function () { + function PetApi(basePathOrUsername, password, basePath) { + this.basePath = defaultBasePath; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + }; + if (password) { + if (basePath) { + this.basePath = basePath; + } + } + else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername; + } + } + } + PetApi.prototype.setApiKey = function (key, value) { + this.authentications[PetApiApiKeys[key]].apiKey = value; + }; + Object.defineProperty(PetApi.prototype, "accessToken", { + set: function (token) { + this.authentications.petstore_auth.accessToken = token; + }, + enumerable: true, + configurable: true + }); + PetApi.prototype.extendObj = function (objA, objB) { + for (var key in objB) { + if (objB.hasOwnProperty(key)) { + objA[key] = objB[key]; + } + } + return objA; + }; + PetApi.prototype.addPet = function (body) { + var localVarPath = this.basePath + '/pet'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + PetApi.prototype.deletePet = function (petId, apiKey) { + var localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling deletePet.'); + } + headerParams['api_key'] = apiKey; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'DELETE', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + PetApi.prototype.findPetsByStatus = function (status) { + var localVarPath = this.basePath + '/pet/findByStatus'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (status !== undefined) { + queryParameters['status'] = status; + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + PetApi.prototype.findPetsByTags = function (tags) { + var localVarPath = this.basePath + '/pet/findByTags'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (tags !== undefined) { + queryParameters['tags'] = tags; + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + PetApi.prototype.getPetById = function (petId) { + var localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling getPetById.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + PetApi.prototype.updatePet = function (body) { + var localVarPath = this.basePath + '/pet'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'PUT', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + PetApi.prototype.updatePetWithForm = function (petId, name, status) { + var localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + var useFormData = false; + if (name !== undefined) { + formParams['name'] = name; + } + if (status !== undefined) { + formParams['status'] = status; + } + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + PetApi.prototype.uploadFile = function (petId, additionalMetadata, file) { + var localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(petId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); + } + var useFormData = false; + if (additionalMetadata !== undefined) { + formParams['additionalMetadata'] = additionalMetadata; + } + if (file !== undefined) { + formParams['file'] = file; + } + useFormData = true; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + return PetApi; +})(); +exports.PetApi = PetApi; +(function (StoreApiApiKeys) { + StoreApiApiKeys[StoreApiApiKeys["api_key"] = 0] = "api_key"; +})(exports.StoreApiApiKeys || (exports.StoreApiApiKeys = {})); +var StoreApiApiKeys = exports.StoreApiApiKeys; +var StoreApi = (function () { + function StoreApi(basePathOrUsername, password, basePath) { + this.basePath = defaultBasePath; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + }; + if (password) { + if (basePath) { + this.basePath = basePath; + } + } + else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername; + } + } + } + StoreApi.prototype.setApiKey = function (key, value) { + this.authentications[StoreApiApiKeys[key]].apiKey = value; + }; + Object.defineProperty(StoreApi.prototype, "accessToken", { + set: function (token) { + this.authentications.petstore_auth.accessToken = token; + }, + enumerable: true, + configurable: true + }); + StoreApi.prototype.extendObj = function (objA, objB) { + for (var key in objB) { + if (objB.hasOwnProperty(key)) { + objA[key] = objB[key]; + } + } + return objA; + }; + StoreApi.prototype.deleteOrder = function (orderId) { + var localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'DELETE', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + StoreApi.prototype.getInventory = function () { + var localVarPath = this.basePath + '/store/inventory'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + StoreApi.prototype.getOrderById = function (orderId) { + var localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + StoreApi.prototype.placeOrder = function (body) { + var localVarPath = this.basePath + '/store/order'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + return StoreApi; +})(); +exports.StoreApi = StoreApi; +(function (UserApiApiKeys) { + UserApiApiKeys[UserApiApiKeys["api_key"] = 0] = "api_key"; +})(exports.UserApiApiKeys || (exports.UserApiApiKeys = {})); +var UserApiApiKeys = exports.UserApiApiKeys; +var UserApi = (function () { + function UserApi(basePathOrUsername, password, basePath) { + this.basePath = defaultBasePath; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + }; + if (password) { + if (basePath) { + this.basePath = basePath; + } + } + else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername; + } + } + } + UserApi.prototype.setApiKey = function (key, value) { + this.authentications[UserApiApiKeys[key]].apiKey = value; + }; + Object.defineProperty(UserApi.prototype, "accessToken", { + set: function (token) { + this.authentications.petstore_auth.accessToken = token; + }, + enumerable: true, + configurable: true + }); + UserApi.prototype.extendObj = function (objA, objB) { + for (var key in objB) { + if (objB.hasOwnProperty(key)) { + objA[key] = objB[key]; + } + } + return objA; + }; + UserApi.prototype.createUser = function (body) { + var localVarPath = this.basePath + '/user'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + UserApi.prototype.createUsersWithArrayInput = function (body) { + var localVarPath = this.basePath + '/user/createWithArray'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + UserApi.prototype.createUsersWithListInput = function (body) { + var localVarPath = this.basePath + '/user/createWithList'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'POST', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + UserApi.prototype.deleteUser = function (username) { + var localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling deleteUser.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'DELETE', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + UserApi.prototype.getUserByName = function (username) { + var localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getUserByName.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + UserApi.prototype.loginUser = function (username, password) { + var localVarPath = this.basePath + '/user/login'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (username !== undefined) { + queryParameters['username'] = username; + } + if (password !== undefined) { + queryParameters['password'] = password; + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + UserApi.prototype.logoutUser = function () { + var localVarPath = this.basePath + '/user/logout'; + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'GET', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + UserApi.prototype.updateUser = function (username, body) { + var localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + var queryParameters = {}; + var headerParams = this.extendObj({}, this.defaultHeaders); + var formParams = {}; + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling updateUser.'); + } + var useFormData = false; + var localVarDeferred = promise.defer(); + var requestOptions = { + method: 'PUT', + qs: queryParameters, + headers: headerParams, + uri: localVarPath, + json: true, + body: body, + }; + this.authentications.default.applyToRequest(requestOptions); + if (Object.keys(formParams).length) { + if (useFormData) { + requestOptions.formData = formParams; + } + else { + requestOptions.form = formParams; + } + } + request(requestOptions, function (error, response, body) { + if (error) { + localVarDeferred.reject(error); + } + else { + if (response.statusCode >= 200 && response.statusCode <= 299) { + localVarDeferred.resolve({ response: response, body: body }); + } + else { + localVarDeferred.reject({ response: response, body: body }); + } + } + }); + return localVarDeferred.promise; + }; + return UserApi; +})(); +exports.UserApi = UserApi; +//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/api.js.map b/samples/client/petstore/typescript-node/npm/api.js.map new file mode 100644 index 000000000000..850f54714895 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/api.js.map @@ -0,0 +1 @@ +{"version":3,"file":"api.js","sourceRoot":"","sources":["api.ts"],"names":["Category","Category.constructor","Order","Order.constructor","Order.StatusEnum","Pet","Pet.constructor","Pet.StatusEnum","Tag","Tag.constructor","User","User.constructor","HttpBasicAuth","HttpBasicAuth.constructor","HttpBasicAuth.applyToRequest","ApiKeyAuth","ApiKeyAuth.constructor","ApiKeyAuth.applyToRequest","OAuth","OAuth.constructor","OAuth.applyToRequest","VoidAuth","VoidAuth.constructor","VoidAuth.applyToRequest","PetApiApiKeys","PetApi","PetApi.constructor","PetApi.setApiKey","PetApi.accessToken","PetApi.extendObj","PetApi.addPet","PetApi.deletePet","PetApi.findPetsByStatus","PetApi.findPetsByTags","PetApi.getPetById","PetApi.updatePet","PetApi.updatePetWithForm","PetApi.uploadFile","StoreApiApiKeys","StoreApi","StoreApi.constructor","StoreApi.setApiKey","StoreApi.accessToken","StoreApi.extendObj","StoreApi.deleteOrder","StoreApi.getInventory","StoreApi.getOrderById","StoreApi.placeOrder","UserApiApiKeys","UserApi","UserApi.constructor","UserApi.setApiKey","UserApi.accessToken","UserApi.extendObj","UserApi.createUser","UserApi.createUsersWithArrayInput","UserApi.createUsersWithListInput","UserApi.deleteUser","UserApi.getUserByName","UserApi.loginUser","UserApi.logoutUser","UserApi.updateUser"],"mappings":"AAAA,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AAEpC,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAErC,IAAI,eAAe,GAAG,+BAA+B,CAAC;AAQtD;IAAAA;IAGAC,CAACA;IAADD,eAACA;AAADA,CAACA,AAHD,IAGC;AAHY,gBAAQ,WAGpB,CAAA;AAED;IAAAE;IAUAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAVD,IAUC;AAVY,aAAK,QAUjB,CAAA;AAED,IAAiB,KAAK,CAMrB;AAND,WAAiB,KAAK,EAAC,CAAC;IACpBA,WAAYA,UAAUA;QAClBE,6CAA0BA,QAAQA,uBAAAA,CAAAA;QAClCA,+CAA4BA,UAAUA,yBAAAA,CAAAA;QACtCA,gDAA6BA,WAAWA,0BAAAA,CAAAA;IAC5CA,CAACA,EAJWF,gBAAUA,KAAVA,gBAAUA,QAIrBA;IAJDA,IAAYA,UAAUA,GAAVA,gBAIXA,CAAAA;AACLA,CAACA,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,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AAGA,UAAUA,CAACA;YAChDA,CAACA;YAACA,IAAIA,CAACA,CAACA;gBACJA,cAAcA,CAACA,IAAIA,GAAGA,UAAUA,CAACA;YACrCA,CAACA;QACLA,CAACA;QACDA,OAAOA,CAACA,cAAcA,EAAEA,UAACA,KAAKA,EAAEA,QAAQA,EAAEA,IAAIA;YAC1CA,EAAEA,CAACA,CAACA,KAAKA,CAACA,CAACA,CAACA;gBACRA,gBAAgBA,CAACA,MAAMA,CAACA,KAAKA,CAACA,CAACA;YACnCA,CAACA;YAACA,IAAIA,CAACA,CAACA;gBACJA,EAAEA,CAACA,CAACA,QAAQA,CAACA,UAAUA,IAAIA,GAAGA,IAAIA,QAAQA,CAACA,UAAUA,IAAIA,GAAGA,CAACA,CAACA,CAACA;oBAC3DA,gBAAgBA,CAACA,OAAOA,CAACA,EAAEA,QAAQA,EAAEA,QAAQA,EAAEA,IAAIA,EAAEA,IAAIA,EAAEA,CAACA,CAACA;gBACjEA,CAACA;gBAACA,IAAIA,CAACA,CAACA;oBACJA,gBAAgBA,CAACA,MAAMA,CAACA,EAAEA,QAAQA,EAAEA,QAAQA,EAAEA,IAAIA,EAAEA,IAAIA,EAAEA,CAACA,CAACA;gBAChEA,CAACA;YACLA,CAACA;QACLA,CAACA,CAACA,CAACA;QACHA,MAAMA,CAACA,gBAAgBA,CAACA,OAAOA,CAACA;IACpCA,CAACA;IACLZ,cAACA;AAADA,CAACA,AA7aD,IA6aC;AA7aY,eAAO,UA6anB,CAAA"} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/api.ts b/samples/client/petstore/typescript-node/npm/api.ts index c2bd53e8ca29..568335b5769a 100644 --- a/samples/client/petstore/typescript-node/npm/api.ts +++ b/samples/client/petstore/typescript-node/npm/api.ts @@ -1,6 +1,8 @@ import request = require('request'); -import promise = require('bluebird'); import http = require('http'); +import promise = require('bluebird'); + +let defaultBasePath = 'http://petstore.swagger.io/v2'; // =============================================== // This file is autogenerated - Please do not edit @@ -9,65 +11,65 @@ import http = require('http'); /* tslint:disable:no-unused-variable */ export class Category { - "id": number; - "name": string; + 'id': number; + 'name': string; } export class Order { - "id": number; - "petId": number; - "quantity": number; - "shipDate": Date; + 'id': number; + 'petId': number; + 'quantity': number; + 'shipDate': Date; /** * Order Status */ - "status": Order.StatusEnum; - "complete": boolean; + 'status': Order.StatusEnum; + 'complete': boolean; } export namespace Order { export enum StatusEnum { - placed = 'placed', - approved = 'approved', - delivered = 'delivered' + StatusEnum_placed = 'placed', + StatusEnum_approved = 'approved', + StatusEnum_delivered = 'delivered' } } export class Pet { - "id": number; - "category": Category; - "name": string; - "photoUrls": Array; - "tags": Array; + 'id': number; + 'category': Category; + 'name': string; + 'photoUrls': Array; + 'tags': Array; /** * pet status in the store */ - "status": Pet.StatusEnum; + 'status': Pet.StatusEnum; } export namespace Pet { export enum StatusEnum { - available = 'available', - pending = 'pending', - sold = 'sold' + StatusEnum_available = 'available', + StatusEnum_pending = 'pending', + StatusEnum_sold = 'sold' } } export class Tag { - "id": number; - "name": string; + 'id': number; + 'name': string; } export class User { - "id": number; - "username": string; - "firstName": string; - "lastName": string; - "email": string; - "password": string; - "phone": string; + 'id': number; + 'username': string; + 'firstName': string; + 'lastName': string; + 'email': string; + 'password': string; + 'phone': string; /** * User Status */ - "userStatus": number; + 'userStatus': number; } @@ -124,7 +126,7 @@ export enum PetApiApiKeys { } export class PetApi { - protected basePath = 'http://petstore.swagger.io/v2'; + protected basePath = defaultBasePath; protected defaultHeaders : any = {}; protected authentications = { @@ -176,7 +178,6 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -184,7 +185,7 @@ export class PetApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -197,7 +198,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -209,7 +209,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -236,14 +235,13 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'DELETE', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -256,7 +254,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -268,7 +265,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -290,14 +286,13 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Array; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -310,7 +305,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -322,7 +316,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -344,14 +337,13 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Array; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -364,7 +356,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -376,7 +367,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -400,14 +390,13 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Pet; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.api_key.applyToRequest(requestOptions); @@ -422,7 +411,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -434,7 +422,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -452,7 +439,6 @@ export class PetApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'PUT', qs: queryParameters, @@ -460,7 +446,7 @@ export class PetApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -473,7 +459,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -485,7 +470,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -519,14 +503,13 @@ export class PetApi { } let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -539,7 +522,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -551,7 +533,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } /** @@ -586,14 +567,13 @@ export class PetApi { useFormData = true; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.petstore_auth.applyToRequest(requestOptions); @@ -606,7 +586,6 @@ export class PetApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -618,7 +597,6 @@ export class PetApi { } } }); - return localVarDeferred.promise; } } @@ -627,7 +605,7 @@ export enum StoreApiApiKeys { } export class StoreApi { - protected basePath = 'http://petstore.swagger.io/v2'; + protected basePath = defaultBasePath; protected defaultHeaders : any = {}; protected authentications = { @@ -685,14 +663,13 @@ export class StoreApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'DELETE', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -703,7 +680,6 @@ export class StoreApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -715,7 +691,6 @@ export class StoreApi { } } }); - return localVarDeferred.promise; } /** @@ -732,14 +707,13 @@ export class StoreApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: { [key: string]: number; }; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.api_key.applyToRequest(requestOptions); @@ -752,7 +726,6 @@ export class StoreApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -764,7 +737,6 @@ export class StoreApi { } } }); - return localVarDeferred.promise; } /** @@ -788,14 +760,13 @@ export class StoreApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -806,7 +777,6 @@ export class StoreApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -818,7 +788,6 @@ export class StoreApi { } } }); - return localVarDeferred.promise; } /** @@ -836,7 +805,6 @@ export class StoreApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -844,7 +812,7 @@ export class StoreApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -855,7 +823,6 @@ export class StoreApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -867,7 +834,6 @@ export class StoreApi { } } }); - return localVarDeferred.promise; } } @@ -876,7 +842,7 @@ export enum UserApiApiKeys { } export class UserApi { - protected basePath = 'http://petstore.swagger.io/v2'; + protected basePath = defaultBasePath; protected defaultHeaders : any = {}; protected authentications = { @@ -928,7 +894,6 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -936,7 +901,7 @@ export class UserApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -947,7 +912,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -959,7 +923,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -977,7 +940,6 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -985,7 +947,7 @@ export class UserApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -996,7 +958,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1008,7 +969,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1026,7 +986,6 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'POST', qs: queryParameters, @@ -1034,7 +993,7 @@ export class UserApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1045,7 +1004,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1057,7 +1015,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1081,14 +1038,13 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'DELETE', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1099,7 +1055,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1111,7 +1066,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1135,14 +1089,13 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: User; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1153,7 +1106,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1165,7 +1117,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1192,14 +1143,13 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: string; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1210,7 +1160,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1222,7 +1171,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1239,14 +1187,13 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1257,7 +1204,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1269,7 +1215,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } /** @@ -1294,7 +1239,6 @@ export class UserApi { let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - let requestOptions: request.Options = { method: 'PUT', qs: queryParameters, @@ -1302,7 +1246,7 @@ export class UserApi { uri: localVarPath, json: true, body: body, - } + }; this.authentications.default.applyToRequest(requestOptions); @@ -1313,7 +1257,6 @@ export class UserApi { requestOptions.form = formParams; } } - request(requestOptions, (error, response, body) => { if (error) { localVarDeferred.reject(error); @@ -1325,7 +1268,6 @@ export class UserApi { } } }); - return localVarDeferred.promise; } } diff --git a/samples/client/petstore/typescript-node/npm/package.json b/samples/client/petstore/typescript-node/npm/package.json index 5654c9ed4a31..440f9d15e0ae 100644 --- a/samples/client/petstore/typescript-node/npm/package.json +++ b/samples/client/petstore/typescript-node/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201605022215", + "version": "0.0.1-SNAPSHOT.201605031634", "description": "NodeJS client for @swagger/angular2-typescript-petstore", "main": "api.js", "scripts": { From 982a035cc1228d477e8583d9cf070698818082a1 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 18:12:35 +0800 Subject: [PATCH 089/170] add better enum support to swift --- .../codegen/languages/SwiftCodegen.java | 61 +- .../src/test/resources/2_0/petstore.json | 467 +---------- .../Classes/Swaggers/Models.swift | 4 +- .../Classes/Swaggers/Models/Category.swift | 1 - .../Classes/Swaggers/Models/Order.swift | 6 +- .../Classes/Swaggers/Models/Pet.swift | 5 +- .../Classes/Swaggers/Models/Tag.swift | 1 - .../Classes/Swaggers/Models/User.swift | 1 - .../Pods/Pods.xcodeproj/project.pbxproj | 748 +++++++++--------- samples/client/petstore/swift/git_push.sh | 4 +- 10 files changed, 440 insertions(+), 858 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java index 93d7e3c2f64e..7b6bf8fbdc37 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java @@ -335,8 +335,10 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig { swiftEnums.add(map); } codegenProperty.allowableValues.put("values", swiftEnums); - codegenProperty.datatypeWithEnum = - StringUtils.left(codegenProperty.datatypeWithEnum, codegenProperty.datatypeWithEnum.length() - "Enum".length()); + codegenProperty.datatypeWithEnum = toEnumName(codegenProperty); + //codegenProperty.datatypeWithEnum = + // StringUtils.left(codegenProperty.datatypeWithEnum, codegenProperty.datatypeWithEnum.length() - "Enum".length()); + // Ensure that the enum type doesn't match a reserved word or // the variable name doesn't match the generated enum type or the // Swift compiler will generate an error @@ -483,4 +485,59 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig { public void setResponseAs(String[] responseAs) { this.responseAs = responseAs; } + + @Override + public String toEnumValue(String value, String datatype) { + if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) { + return value; + } else { + return "\'" + escapeText(value) + "\'"; + } + } + + @Override + public String toEnumDefaultValue(String value, String datatype) { + return datatype + "_" + value; + } + + @Override + public String toEnumVarName(String name, String datatype) { + // number + if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) { + String varName = new String(name); + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); + return varName; + } + + // string + String enumName = sanitizeName(underscore(name).toUpperCase()); + enumName = enumName.replaceFirst("^_", ""); + enumName = enumName.replaceFirst("_$", ""); + + if (enumName.matches("\\d.*")) { // starts with number + return "_" + enumName; + } else { + return enumName; + } + } + + @Override + public String toEnumName(CodegenProperty property) { + String enumName = underscore(toModelName(property.name)).toUpperCase(); + + if (enumName.matches("\\d.*")) { // starts with number + return "_" + enumName; + } else { + return enumName; + } + } + + @Override + public Map postProcessModels(Map objs) { + // process enum in models + return postProcessModelsEnum(objs); + } + } 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 19d0e72419df..24fcf4bf768c 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -1,12 +1,13 @@ + { "swagger": "2.0", "info": { "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://swagger.io/terms/", + "termsOfService": "http://helloreverb.com/terms/", "contact": { - "email": "apiteam@swagger.io" + "email": "apiteam@wordnik.com" }, "license": { "name": "Apache 2.0", @@ -19,49 +20,6 @@ "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": [ @@ -156,7 +114,7 @@ "pet" ], "summary": "Finds Pets by status", - "description": "Multiple status values can be provided with comma separated strings", + "description": "Multiple status values can be provided with comma seperated strings", "operationId": "findPetsByStatus", "produces": [ "application/json", @@ -166,23 +124,14 @@ { "name": "status", "in": "query", - "description": "Status values that need to be considered for query", + "description": "Status values that need to be considered for filter", "required": false, "type": "array", "items": { "type": "string", - "enum": [ - "available", - "pending", - "sold" - ] + "enum": ["available", "pending", "sold"] }, "collectionFormat": "multi", - "enum": [ - "available", - "pending", - "sold" - ], "default": "available" } ], @@ -194,6 +143,15 @@ "items": { "$ref": "#/definitions/Pet" } + }, + "examples": { + "application/json": { + "name": "Puma", + "type": "Dog", + "color": "Black", + "gender": "Female", + "breed": "Mixed" + } } }, "400": { @@ -259,150 +217,6 @@ ] } }, - "/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": [ @@ -630,33 +444,6 @@ ] } }, - "/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": [ @@ -690,62 +477,7 @@ "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}": { @@ -782,15 +514,7 @@ "400": { "description": "Invalid ID supplied" } - }, - "security": [ - { - "test_api_key_header": [] - }, - { - "test_api_key_query": [] - } - ] + } }, "delete": { "tags": [ @@ -1007,18 +731,6 @@ "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": { @@ -1091,12 +803,7 @@ "400": { "description": "Invalid username supplied" } - }, - "security": [ - { - "test_http_basic": [] - } - ] + } } } }, @@ -1114,29 +821,6 @@ "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": { @@ -1257,8 +941,7 @@ "properties": { "id": { "type": "integer", - "format": "int64", - "readOnly": true + "format": "int64" }, "petId": { "type": "integer", @@ -1274,7 +957,6 @@ }, "status": { "type": "string", - "default": "placed", "description": "Order Status", "enum": [ "placed", @@ -1289,117 +971,6 @@ "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" - } - } - }, - "EnumClass" : { - "type": "string", - "default": "-efg", - "enum": ["_abc", "-efg", "(xyz)"] - }, - "Enum_Test" : { - "type" : "object", - "properties" : { - "enum_string" : { - "type" : "string", - "enum" : ["UPPER", "lower"] - }, - "enum_integer" : { - "type" : "integer", - "format" : "int32", - "enum" : [1, -1] - }, - "enum_number" : { - "type" : "number", - "format" : "double", - "enum" : [1.1, -1.2] - } - } } } } diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift index f9e2f72b9082..0aa3b3e381c9 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift @@ -156,7 +156,7 @@ class Decoders { instance.petId = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["petId"]) instance.quantity = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["quantity"]) instance.shipDate = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["shipDate"]) - instance.status = Order.Status(rawValue: (sourceDictionary["status"] as? String) ?? "") + instance.status = Order.ST(rawValue: (sourceDictionary["status"] as? String) ?? "") instance.complete = Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["complete"]) return instance } @@ -175,7 +175,7 @@ class Decoders { instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) instance.photoUrls = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["photoUrls"]) instance.tags = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["tags"]) - instance.status = Pet.Status(rawValue: (sourceDictionary["status"] as? String) ?? "") + instance.status = Pet.ST(rawValue: (sourceDictionary["status"] as? String) ?? "") return instance } diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Category.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Category.swift index 19f31d266efd..89ce2ccb616e 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Category.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Category.swift @@ -18,7 +18,6 @@ public class Category: JSONEncodable { func encodeToJSON() -> AnyObject { var nillableDictionary = [String:AnyObject?]() nillableDictionary["id"] = self.id?.encodeToJSON() - nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["name"] = self.name let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Order.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Order.swift index 4374d95ed470..e40861432665 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Order.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Order.swift @@ -9,7 +9,7 @@ import Foundation public class Order: JSONEncodable { - public enum Status: String { + public enum ST: String { case Placed = "placed" case Approved = "approved" case Delivered = "delivered" @@ -19,7 +19,7 @@ public class Order: JSONEncodable { public var quantity: Int32? public var shipDate: NSDate? /** Order Status */ - public var status: Status? + public var status: ST? public var complete: Bool? public init() {} @@ -28,8 +28,6 @@ public class Order: JSONEncodable { func encodeToJSON() -> AnyObject { var nillableDictionary = [String:AnyObject?]() nillableDictionary["id"] = self.id?.encodeToJSON() - nillableDictionary["id"] = self.id?.encodeToJSON() - nillableDictionary["petId"] = self.petId?.encodeToJSON() nillableDictionary["petId"] = self.petId?.encodeToJSON() nillableDictionary["quantity"] = self.quantity?.encodeToJSON() nillableDictionary["shipDate"] = self.shipDate?.encodeToJSON() diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Pet.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Pet.swift index 8a467a5bf0b5..ee9aa295a53d 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Pet.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Pet.swift @@ -9,7 +9,7 @@ import Foundation public class Pet: JSONEncodable { - public enum Status: String { + public enum ST: String { case Available = "available" case Pending = "pending" case Sold = "sold" @@ -20,7 +20,7 @@ public class Pet: JSONEncodable { public var photoUrls: [String]? public var tags: [Tag]? /** pet status in the store */ - public var status: Status? + public var status: ST? public init() {} @@ -28,7 +28,6 @@ public class Pet: JSONEncodable { func encodeToJSON() -> AnyObject { var nillableDictionary = [String:AnyObject?]() nillableDictionary["id"] = self.id?.encodeToJSON() - nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["category"] = self.category?.encodeToJSON() nillableDictionary["name"] = self.name nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Tag.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Tag.swift index a3916f59b137..774f91557e66 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Tag.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Tag.swift @@ -18,7 +18,6 @@ public class Tag: JSONEncodable { func encodeToJSON() -> AnyObject { var nillableDictionary = [String:AnyObject?]() nillableDictionary["id"] = self.id?.encodeToJSON() - nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["name"] = self.name let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/User.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/User.swift index 26e9c619927b..67b72a619221 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/User.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/User.swift @@ -25,7 +25,6 @@ public class User: JSONEncodable { func encodeToJSON() -> AnyObject { var nillableDictionary = [String:AnyObject?]() nillableDictionary["id"] = self.id?.encodeToJSON() - nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["username"] = self.username nillableDictionary["firstName"] = self.firstName nillableDictionary["lastName"] = self.lastName diff --git a/samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/project.pbxproj b/samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/project.pbxproj index fe35821d6e0c..da35c633e44c 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/project.pbxproj @@ -7,113 +7,103 @@ objects = { /* Begin PBXBuildFile section */ + 01BD61BBC475EB3369237B84FE24D3EE /* UIViewController+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BA017E288BB42E06EBEE9C6E6993EAF /* UIViewController+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0268F9278E32ACC1F996F4E2E45622B5 /* UIActionSheet+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 6846D22C9F0CCBC48DF833E309A8E84F /* UIActionSheet+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; 03F494989CC1A8857B68A317D5D6860F /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DF5FC3AF99846209C5FCE55A2E12D9A /* Response.swift */; }; 0681ADC8BAE2C3185F13487BAAB4D9DD /* Upload.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCE38472832BBCC541E646DA6C18EF9C /* Upload.swift */; }; - 0B0F79070CD75DE3CF053E58B491A3AC /* UserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD05F019D163F2D5FE7C8E64C1D2E299 /* UserAPI.swift */; }; + 06F7C0C55DF4C09C015159F6B0802EB1 /* join.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84319E048FE6DD89B905FA3A81005C5F /* join.swift */; }; 0B34EB4425C08BB021C2D09F75C9C146 /* OMGHTTPURLRQ.h in Headers */ = {isa = PBXBuildFile; fileRef = 450166FEA2155A5821D97744A0127DF8 /* OMGHTTPURLRQ.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0BB1E79782E3BE258C30A65A20C85FC1 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC4BF94DC4B3D8B88FC160B00931B0EC /* QuartzCore.framework */; }; - 10E93502CF9CED0B6341DB95B658F2F9 /* Model200Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C24509ECAD94A91B30D87D8B2DEEB9B /* Model200Response.swift */; }; - 14FD108A5B931460A799BDCB874A99C3 /* SpecialModelName.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED58811444E6D32A1F7B372F034DB7A /* SpecialModelName.swift */; }; - 1A4D55F76DCB3489302BC425F4DB1C04 /* when.m in Sources */ = {isa = PBXBuildFile; fileRef = 143BC30E5DDAF52A3D9578F507EC6A41 /* when.m */; }; - 1DB7E23C2A2A8D4B5CE046135E4540C6 /* PromiseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BFFA6FD621E9ED341AA89AEAC1604D7 /* PromiseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2308448E8874D3DAA33A1AEFEFCFBA2D /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BAE461B3A62164A09480E8967D29E64 /* Extensions.swift */; }; + 0BDA43D8F48C8B0D504C440046FAF681 /* Umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A8906F6D6920DF197965D1740A7E283 /* Umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0D240D796AAD10F0119A1D7AC2570AAA /* NSObject+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6EB54C331FED437583A5F01EB2757D1 /* NSObject+Promise.swift */; }; + 11C221075C5B20BDEEB3DDF8EAC99E63 /* NSNotificationCenter+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 4798BAC01B0E3F07E3BBBB07BA57F2D7 /* NSNotificationCenter+AnyPromise.m */; }; + 11EA8D6B0352FD31F520F983CFB9D993 /* UIAlertView+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = F075F63EFE77F7B59FF77CBA95B9AADF /* UIAlertView+AnyPromise.m */; }; + 12348513CB81BD05B497C210905CDF65 /* UIAlertView+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 92D340D66F03F31237B70F23FE9B00D0 /* UIAlertView+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 124EFF5E3C46EC88F47C52479FA6ACAF /* CALayer+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A22F2595054D39018E03961CA7283A /* CALayer+AnyPromise.m */; }; + 1287903F965945AEB5EFC4EE768C7B38 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC4BF94DC4B3D8B88FC160B00931B0EC /* QuartzCore.framework */; }; + 15ECEBA1EFBD023AEA47F36524270D2C /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F0266C5AE0B23A436291F6647902086 /* Models.swift */; }; + 18FAC6B4FD3B44CB353C7A6027286100 /* NSURLConnection+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = BAE48ACA10E8895BB8BF5CE8C0846B4B /* NSURLConnection+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1AC7E88F0EC64D1D4E83CE7767BFD2B7 /* afterlife.swift in Sources */ = {isa = PBXBuildFile; fileRef = C476B916B763E55E4161F0B30760C4E8 /* afterlife.swift */; }; + 1CDA074C6DC95876D85E13ECF882B93A /* Pet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284B3DE9B793FCC633E971DB1798AFAF /* Pet.swift */; }; + 1E1010EA437F154A554D04F7F3A894EC /* Promise+Properties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0DBDE561A6C2E7AC7A24160F8A5F28 /* Promise+Properties.swift */; }; + 25FBB92AFB8F5A777CE8E40EC3B9DACA /* PetstoreClient-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 46A8E0328DC896E0893B565FE8742167 /* PetstoreClient-dummy.m */; }; + 2B38BB4603B4286FF8D7A780372E947F /* PetAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 261F03A3C73374FD19333EEA59CCD59F /* PetAPI.swift */; }; 2C5450AC69398958CF6F7539EF7D99E5 /* Alamofire-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 30CE7341A995EF6812D71771E74CF7F7 /* Alamofire-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2DF2D3E610EB6F19375570C0EBA9E77F /* after.m in Sources */ = {isa = PBXBuildFile; fileRef = B868468092D7B2489B889A50981C9247 /* after.m */; }; - 30F9F020F5B35577080063E71CDAB08C /* OMGHTTPURLRQ.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3530BF15E14D1F6D7134EE67377D5C8C /* OMGHTTPURLRQ.framework */; }; - 33326318BF830A838DA62D54ADAA5ECA /* Cat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D172F6D749B7735D04B495330AB7FE3 /* Cat.swift */; }; + 2D9379807BA243E1CE457D1BE963DA09 /* UserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 552D15E0340BF58CC1922B82E864AEC9 /* UserAPI.swift */; }; 35F6B35131F89EA23246C6508199FB05 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB15A61DB7ABCB74565286162157C5A0 /* Foundation.framework */; }; - 38FE2977C973FA258977E86E1E964E02 /* AnyPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5973BC143AE488C12FFB1E83E71F0C45 /* AnyPromise.swift */; }; - 39E7AFE23097B4BC393D43A44093FB63 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB15A61DB7ABCB74565286162157C5A0 /* Foundation.framework */; }; + 3860D960E37C1257BDA54626CA592E86 /* AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F19945EE403F7B29D8B1939EA6D579A /* AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 387C7387FDC662D23D743879B6143D59 /* UIActionSheet+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD570E28B63274E742E7D1FBBD55BB41 /* UIActionSheet+Promise.swift */; }; 3A8D316D4266A3309D0A98ED74F8A13A /* OMGUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 87BC7910B8D7D31310A07C32438A8C67 /* OMGUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 41C531C4CEDCAE196A6F92FEAE66CCF3 /* StoreAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7FF1C1E487B6795C5F6734CCA49DF3 /* StoreAPI.swift */; }; - 445F515F4FAB3537878E1377562BBBA7 /* NSNotificationCenter+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 4798BAC01B0E3F07E3BBBB07BA57F2D7 /* NSNotificationCenter+AnyPromise.m */; }; - 4827FED90242878355B47A6D34BAABCA /* APIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 323E5DCC342B03D7AE59F37523D2626A /* APIs.swift */; }; + 443361437B359830308B93A7B98BE039 /* StoreAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E5E3CD673B025FD8AC260E67AB47E /* StoreAPI.swift */; }; + 46F838880F41F56ABD91796FC956B4BF /* APIHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2BAD338E56EF3CAA6E54490FE0C5DF9 /* APIHelper.swift */; }; 48CB8E7E16443CA771E4DCFB3E0709A2 /* OMGHTTPURLRQ.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D579267FC1F163C8F04B444DAEFED0D /* OMGHTTPURLRQ.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 4C22563311AC2B52651A6525A979E076 /* UIView+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F0F4EDC2236E1C270DC2014181D6506 /* UIView+AnyPromise.m */; }; 4DE5FCC41D100B113B6645EA64410F16 /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FBD351D007CF4095C98C9DFD9D83D61 /* ParameterEncoding.swift */; }; - 4E07AC40078EBB1C88ED8700859F5A1B /* APIHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E506C8F40F5AD602D83B383EAA7C0CD /* APIHelper.swift */; }; + 516D41E4D035A817CC5116C11302E408 /* AlamofireImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92734297B64DFE0EB0EDE1EA821163DB /* AlamofireImplementations.swift */; }; 5192A7466019F9B3D7F1E987124E96BC /* OMGHTTPURLRQ-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F7EBDD2EEED520E06ACB3538B3832049 /* OMGHTTPURLRQ-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 523C1819FC864864A9715CF713DD12E9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB15A61DB7ABCB74565286162157C5A0 /* Foundation.framework */; }; 5480169E42C456C49BE59E273D7E0115 /* OMGFormURLEncode.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ADA0B6B6B00CB0E818AA8CBC311677 /* OMGFormURLEncode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5E46AC6FA35723E095C2EB6ED23C0510 /* PromiseKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9042667D08D783E45394FE8B97EE6468 /* PromiseKit-dummy.m */; }; - 5EECE3F98893B2D4E03DC027C57C21F3 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A60B64E388679F589CB959AA5FC4787 /* Models.swift */; }; - 5FDCAFE73B791C4A4B863C9D65F6CF7B /* UIAlertView+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA854180C132DB5511D64C82535C5FDE /* UIAlertView+Promise.swift */; }; - 623677B20997F5EC0F6CA695CADD410B /* ObjectReturn.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3CC2D1A2A451C0A3C4DBD6D7E117C01 /* ObjectReturn.swift */; }; - 63AF5DF795F5D610768B4AF53C7E9976 /* UIActionSheet+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 6846D22C9F0CCBC48DF833E309A8E84F /* UIActionSheet+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 655C3826275A76D04835F2336AC87A91 /* UIAlertView+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = F075F63EFE77F7B59FF77CBA95B9AADF /* UIAlertView+AnyPromise.m */; }; - 660435DF96CE68B3A3E078030C5F54FA /* UIView+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3CDA0958D6247505ECD9098D662EA74 /* UIView+Promise.swift */; }; - 66B8591A8CCC9760D933506B71A13962 /* UIViewController+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BA017E288BB42E06EBEE9C6E6993EAF /* UIViewController+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5D7EAE5725A7E750B51FD27AECB5F0FD /* join.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AD59903FAA8315AD0036AC459FFB97F /* join.m */; }; + 5EE5E1CA27F3CB04A5DCF5BB90B76000 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5412898DEB10F1983487A10453C6B9CB /* Extensions.swift */; }; + 5FFED823C0BDD412FA41B01EA47394D1 /* hang.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B6A98D6DAF474045210F5A74FF1C3C /* hang.m */; }; + 60EBBACB76CD5879FB7B9B3E0AA5E2C1 /* UIViewController+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = AA24C5EC82CF437D8D1FFFAB68975408 /* UIViewController+AnyPromise.m */; }; + 656BED6137A9FFA3B2DF03861F525022 /* PetstoreClient-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F681D2C508D1BA8F62893120D9343A4 /* PetstoreClient-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6A128FE350973D8A693E3F063C5E4A49 /* dispatch_promise.m in Sources */ = {isa = PBXBuildFile; fileRef = A92242715FB4C0608F8DCEBF8F3791E2 /* dispatch_promise.m */; }; + 6B0A17CD24331793D2504E0FBBAF5EB2 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 211F73A46D90346F7FC6D0D29640EE4F /* Tag.swift */; }; 6CB84A616D7B4D189A4E94BD37621575 /* OMGUserAgent.m in Sources */ = {isa = PBXBuildFile; fileRef = E11BFB27B43B742CB5D6086C4233A909 /* OMGUserAgent.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; 6D264CCBD7DAC0A530076FB1A847EEC7 /* Pods-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 894E5DA93A9F359521A89826BE6DA777 /* Pods-dummy.m */; }; 6F63943B0E954F701F32BC7A1F4C2FEC /* OMGFormURLEncode.m in Sources */ = {isa = PBXBuildFile; fileRef = 25614E715DDC170DAFB0DF50C5503E33 /* OMGFormURLEncode.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - 7120EA2BF0D3942FF9CE0EDABBF86BA1 /* NSURLConnection+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 412985229DA7A4DF9E129B7E8F0C09BB /* NSURLConnection+Promise.swift */; }; - 72B2C8A6E81C1E99E6093BE3BDBDE554 /* join.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84319E048FE6DD89B905FA3A81005C5F /* join.swift */; }; - 752EACD07B4F948C1F24E0583C5DA165 /* NSNotificationCenter+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 3616971BAEF40302B7F2F8B1007C0B2B /* NSNotificationCenter+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7BCBC4FD2E385CAFC5F3949FFFFE2095 /* NSError+Cancellation.h in Headers */ = {isa = PBXBuildFile; fileRef = 045C1F608ADE57757E6732D721779F22 /* NSError+Cancellation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7C87E63D6733AC0FE083373A5FAF86CB /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71B762588C78E0A95319F5BB534965BE /* Category.swift */; }; - 7CE6DE14AB43CB51B4D5C5BA4293C47B /* join.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AD59903FAA8315AD0036AC459FFB97F /* join.m */; }; - 7D38A3624822DA504D0FBD9F4EA485BA /* UIViewController+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D459D0AB2361B48F81C4D14C6D0DAA /* UIViewController+Promise.swift */; }; - 7DAC8F56FC00F6400AC3BF3AF79ACAFD /* ModelReturn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17CBD3DEAD30C207791B4B1A5AD66991 /* ModelReturn.swift */; }; + 73FA79FDB37E5C458B996012BFB0CF04 /* PMKAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C731FBFCC690050C6C08E5AC9D9DC724 /* PMKAlertController.swift */; }; + 7D7A40DBAC93241786E8C553921E8C86 /* OMGHTTPURLRQ.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3530BF15E14D1F6D7134EE67377D5C8C /* OMGHTTPURLRQ.framework */; }; 80F496237530D382A045A29654D8C11C /* ServerTrustPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 400A6910E83F606BCD67DC11FA706697 /* ServerTrustPolicy.swift */; }; - 81970BD13A497C0962CBEA922C1DAB3E /* race.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980FD13F87B44BFD90F8AC129BEB2E61 /* race.swift */; }; + 81A2DB65C0742D785DE7C2609CC14140 /* NSURLSession+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535DF88FC12304114DEF55E4003421B2 /* NSURLSession+Promise.swift */; }; 82971968CBDAB224212EEB4607C9FB8D /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53F8B2513042BD6DB957E8063EF895BD /* Result.swift */; }; - 82BEAE7085889DB1A860FE690273EA7E /* PMKAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C731FBFCC690050C6C08E5AC9D9DC724 /* PMKAlertController.swift */; }; 8399DBEE3E2D98EB1F466132E476F4D9 /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F14E17B4D6BDF8BD3E384BE6528F744 /* MultipartFormData.swift */; }; - 8809E3D6CC478B4AC9FA6C2389A5447F /* NSObject+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6EB54C331FED437583A5F01EB2757D1 /* NSObject+Promise.swift */; }; - 8955A9B8A34594437C8D27C4C55BFC9E /* FormatTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B41BBA87E8FD7BD3513CD49733EB30 /* FormatTest.swift */; }; - 895CB65D12461DA4EA243ACE8346D21F /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = D513E5F3C28C7B452E79AE279B71813D /* User.swift */; }; - 8C749DAB8EA0585A7A5769F38CB33CBC /* NSURLConnection+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = A7F0DAACAC89A93B940BBE54E6A87E9F /* NSURLConnection+AnyPromise.m */; }; - 92EEF6DC60C3CA25AA3997D2652A28F9 /* PetstoreClient-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 46A8E0328DC896E0893B565FE8742167 /* PetstoreClient-dummy.m */; }; + 857E5961D9F6E23BD86DEB613A1499C7 /* NSError+Cancellation.h in Headers */ = {isa = PBXBuildFile; fileRef = 045C1F608ADE57757E6732D721779F22 /* NSError+Cancellation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 88B3F911629C08DEEB226F3B294AAB36 /* NSNotificationCenter+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93FB4BB16CFB41DCA35A8CFAD7A7FEF /* NSNotificationCenter+Promise.swift */; }; + 8C4A96A3E69C772990E3E922D0FD1BC4 /* UIView+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDD82DB3E6D43BA9769FCA9B744CB5E /* UIView+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 8D3A68D3CBD8A1D89099F704A04A04FC /* PromiseKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9042667D08D783E45394FE8B97EE6468 /* PromiseKit-dummy.m */; }; + 8E3861989641484EE3095722EC08B5A9 /* NSURLConnection+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = A7F0DAACAC89A93B940BBE54E6A87E9F /* NSURLConnection+AnyPromise.m */; }; + 909B0A29022956D90C32C4AA319F75D1 /* AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B7E90A568681E000EF3CB0917584F3C /* AnyPromise.m */; }; 96D99D0C2472535A169DED65CB231CD7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB15A61DB7ABCB74565286162157C5A0 /* Foundation.framework */; }; - 97BDDBBB6BA36B90E98FCD53B9AE171A /* UIAlertView+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 92D340D66F03F31237B70F23FE9B00D0 /* UIAlertView+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 994580EAAB3547FFCA0E969378A7AC2E /* Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D23C407A7CDBFD244D6115899F9D45D /* Promise.swift */; }; - 995CE773471ADA3D5FEB52DF624174C6 /* CALayer+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 27E0FE41D771BE8BE3F0D4F1DAD0B179 /* CALayer+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9D7DE077DBB18ADD8C4272A59BEB323A /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1D1571AB15108DF6F9C4FE2064E3C43 /* Alamofire.framework */; }; - 9E7DA5C2386E5EA1D57B8C9A38D0A509 /* dispatch_promise.m in Sources */ = {isa = PBXBuildFile; fileRef = A92242715FB4C0608F8DCEBF8F3791E2 /* dispatch_promise.m */; }; + 97D71F12142A541BEEF425805D51379E /* race.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980FD13F87B44BFD90F8AC129BEB2E61 /* race.swift */; }; + 9CFBA896DF45B68C788F80013AC3FDBB /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1D1571AB15108DF6F9C4FE2064E3C43 /* Alamofire.framework */; }; A2C172FE407C0BC3478ADCA91A6C9CEC /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D51C929AC51E34493AA757180C09C3B /* Manager.swift */; }; A3505FA2FB3067D53847AD288AC04F03 /* Download.swift in Sources */ = {isa = PBXBuildFile; fileRef = A04177B09D9596450D827FE49A36C4C4 /* Download.swift */; }; - A5EBC0528F4371B43BFA5A2293089BB5 /* dispatch_promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392FA21A33296B88F790D62A4FAA4E4E /* dispatch_promise.swift */; }; - AA38773839F0E81980834A7A374BA9DC /* InlineResponse200.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176079DAA9CD16ADABA2C18C289C529D /* InlineResponse200.swift */; }; - AC6DCF4BF95F44A46CF6BC9230AD6604 /* UIActionSheet+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD570E28B63274E742E7D1FBBD55BB41 /* UIActionSheet+Promise.swift */; }; - B0AB13A8C68D6972CEDF64FB39D38CB4 /* after.swift in Sources */ = {isa = PBXBuildFile; fileRef = 275DA9A664C70DD40A4059090D1A00D4 /* after.swift */; }; + ADEEE5F368B5D707D03E78FD75C59048 /* Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D23C407A7CDBFD244D6115899F9D45D /* Promise.swift */; }; B0FB4B01682814B9E3D32F9DC4A5E762 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B476A57549D7994745E17A6DE5BE745 /* Alamofire.swift */; }; - B26D78FFEBAA030D8E8D44B67888C4C2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB15A61DB7ABCB74565286162157C5A0 /* Foundation.framework */; }; - B2C0216914777E4B58E1827D854886C2 /* URLDataPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7CE161ED0CF68954A63F30528ACAD9B /* URLDataPromise.swift */; }; B6D2DC3E3DA44CD382B9B425F40E11C1 /* Alamofire-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 139346EB669CBE2DE8FE506E14A2BA9C /* Alamofire-dummy.m */; }; - B9096C0EE89EC783BDDC77E1F07314E4 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = C716D7A2A32272C40DFA0AAC76DC0E1E /* Tag.swift */; }; - BC9F5678D442E5AA1B14083554B7B1C8 /* CALayer+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A22F2595054D39018E03961CA7283A /* CALayer+AnyPromise.m */; }; - BCCC0421EE641F782CA295FBD240E2E1 /* NSURLSession+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535DF88FC12304114DEF55E4003421B2 /* NSURLSession+Promise.swift */; }; - BEE4B5067218AB107DDECC8B09569EFC /* AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B7E90A568681E000EF3CB0917584F3C /* AnyPromise.m */; }; - C5EEED0AFF5E2C5AAE2A646689B73DA3 /* UIViewController+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = AA24C5EC82CF437D8D1FFFAB68975408 /* UIViewController+AnyPromise.m */; }; C75519F0450166A6F28126ECC7664E9C /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA1AD92813B887E2D017D051B8C0E3D2 /* Validation.swift */; }; - CA0AABE1706F8B94DC37330AB2BC062C /* Umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A8906F6D6920DF197965D1740A7E283 /* Umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CB4E6EA27EA59B8851C744CA7D98A2BA /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A112EF8BB3933C1C1E42F11B3DD3B02A /* PromiseKit.framework */; }; - CE7DAD64CE27C4B98432BDB1CB0E21C7 /* Dog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AEDC82569B65EDA2A3D12E1F9B8A2D8 /* Dog.swift */; }; - D1E26E1C25F870E9A0AEC9240E589D75 /* Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = C295084120B300E8BDB7B91981B104FC /* Name.swift */; }; + C86881D2285095255829A578F0A85300 /* after.m in Sources */ = {isa = PBXBuildFile; fileRef = B868468092D7B2489B889A50981C9247 /* after.m */; }; + C86CE0A47FAD4C9B2929A335D62A179E /* UIViewController+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D459D0AB2361B48F81C4D14C6D0DAA /* UIViewController+Promise.swift */; }; + CAF12A3EDA2376FFEAD4A12E413C1AAD /* UIActionSheet+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 9774D31336C85248A115B569E7D95283 /* UIActionSheet+AnyPromise.m */; }; + CB2A58CBAB5A2E63D0CB70F2697CAE87 /* when.m in Sources */ = {isa = PBXBuildFile; fileRef = 143BC30E5DDAF52A3D9578F507EC6A41 /* when.m */; }; + CD97970D21D3CB8C459FAFEF11EE60F3 /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4DF0604EDC1460935E6E445A47023A4 /* Category.swift */; }; + CE225CF07E6E385F014883D607AFA44D /* URLDataPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7CE161ED0CF68954A63F30528ACAD9B /* URLDataPromise.swift */; }; + CE89E5C528D52BBCBCD23309603BA6D1 /* CALayer+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 27E0FE41D771BE8BE3F0D4F1DAD0B179 /* CALayer+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D1735D6C4D574339EB49024228448459 /* UIView+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3CDA0958D6247505ECD9098D662EA74 /* UIView+Promise.swift */; }; D1E8B31EFCBDE00F108E739AD69425C0 /* Pods-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BCC458FDD5F692BBB2BFC64BB5701FC /* Pods-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; D21B7325B3642887BFBE977E021F2D26 /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD558DDCDDA1B46951548B02C34277EF /* ResponseSerialization.swift */; }; - D258F1E893340393ADABCB02B9FBA206 /* AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F19945EE403F7B29D8B1939EA6D579A /* AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D2C7190FC2A0F2868EB7C89F5CFA526B /* State.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DC63EB77B3791891517B98CAA115DE8 /* State.swift */; }; D358A828E68E152D06FC8E35533BF00B /* OMGHTTPURLRQ-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F36B65CF990C57DC527824ED0BA1915 /* OMGHTTPURLRQ-dummy.m */; }; - D39F4FBEE42A57E59471B2A0997FE4CF /* hang.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B6A98D6DAF474045210F5A74FF1C3C /* hang.m */; }; - D57DA5AC37CE3CEA92958C9528F80FD9 /* UIActionSheet+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 9774D31336C85248A115B569E7D95283 /* UIActionSheet+AnyPromise.m */; }; + D546A4DBA3F7750F45A6F63B994C081C /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B248364ABF60ACD7DB31A17DCFDFD0C /* User.swift */; }; D75CA395D510E08C404E55F5BDAE55CE /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A9CB35983E4859DFFBAD8840196A094 /* Error.swift */; }; - D839A38DEEDDB887F186714D75E73431 /* Promise+Properties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0DBDE561A6C2E7AC7A24160F8A5F28 /* Promise+Properties.swift */; }; - DC710F75309F7DFEA3C5AB01E9288681 /* AlamofireImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAA644003A8DF304D35F77FE04B8AB17 /* AlamofireImplementations.swift */; }; - DCFE64070EE0BB77557935AD2A4ABF62 /* when.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16730DAF3E51C161D8247E473F069E71 /* when.swift */; }; + D93596046CD3B301F4EC99A7A118C82C /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558DFECE2C740177CA6357DA71A1DFBB /* Error.swift */; }; + DBD1F4247E1C591AE4EE5531599AB170 /* NSNotificationCenter+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 3616971BAEF40302B7F2F8B1007C0B2B /* NSNotificationCenter+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; DD8D067A7F742F39B87FA04CE12DD118 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB15A61DB7ABCB74565286162157C5A0 /* Foundation.framework */; }; - E1EB5507436EFBD58AF7B9FF051A5AC4 /* afterlife.swift in Sources */ = {isa = PBXBuildFile; fileRef = C476B916B763E55E4161F0B30760C4E8 /* afterlife.swift */; }; - E3AB1EE3B8DECE5D55D9EB64B0D05E93 /* Pet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29C027BA870C5E7975BF50087CAE384 /* Pet.swift */; }; - E62ABEDB4D7B179589B75C8423C5BF9B /* NSURLConnection+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = BAE48ACA10E8895BB8BF5CE8C0846B4B /* NSURLConnection+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E74976C9C4A5EF60B0A9CA1285693DDF /* UIView+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDD82DB3E6D43BA9769FCA9B744CB5E /* UIView+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EB0C1A986BDF161D01919BCCCAE40D7E /* Animal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076251AD10B5F4E8880F4C350E1D9D5A /* Animal.swift */; }; - F0E47CCDA10383F8489C3839FD0DF755 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A1DC80A0773C5A569348DC442EAFD1D /* UIKit.framework */; }; - F1E37BB11F68A6A76DF44B230F965E05 /* PetstoreClient-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F681D2C508D1BA8F62893120D9343A4 /* PetstoreClient-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F3D3D4088EDA3359CC0E5EBA9B683959 /* PetAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2773E2F96E394825BE86FA45E48132 /* PetAPI.swift */; }; - F4448E76D51EBACC2B20CDFE3D2D90D7 /* Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91579AC4E335E76904DB4DB54228CC42 /* Order.swift */; }; - F4C2BD51185019A010DA83458B007F81 /* NSNotificationCenter+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93FB4BB16CFB41DCA35A8CFAD7A7FEF /* NSNotificationCenter+Promise.swift */; }; - F4E24EB57CB59F112060100A4B9E5D10 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558DFECE2C740177CA6357DA71A1DFBB /* Error.swift */; }; + E2B0094FAAEA55C55AD141136F650E35 /* Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A545673F09F49CDD60A13B4B0AF1020 /* Order.swift */; }; + EA35E77B4F31DC3E1D224458E0BC959D /* APIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8072E1108951F272C003553FC8926C7 /* APIs.swift */; }; + EA67B414E392EFD2B14742F55A595596 /* after.swift in Sources */ = {isa = PBXBuildFile; fileRef = 275DA9A664C70DD40A4059090D1A00D4 /* after.swift */; }; + EA691570F0F8066651EE2A7066426384 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A1DC80A0773C5A569348DC442EAFD1D /* UIKit.framework */; }; + EB3C88CDAF122BA763FEF85758370C7C /* UIAlertView+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA854180C132DB5511D64C82535C5FDE /* UIAlertView+Promise.swift */; }; + EB9A1F33DB49ADA09F6E7F19A2C30357 /* NSURLConnection+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 412985229DA7A4DF9E129B7E8F0C09BB /* NSURLConnection+Promise.swift */; }; + ED30A8B82BA1D53CBC370B1DC18DA1EB /* when.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16730DAF3E51C161D8247E473F069E71 /* when.swift */; }; + EEF6E654182421FEBC0CC202E72F71A8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB15A61DB7ABCB74565286162157C5A0 /* Foundation.framework */; }; + F4582E8DC1C9F362ADA4BAE9CEF8B681 /* dispatch_promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392FA21A33296B88F790D62A4FAA4E4E /* dispatch_promise.swift */; }; + F700EAA9F9F6C1F99C83B45D05C5AD14 /* PromiseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BFFA6FD621E9ED341AA89AEAC1604D7 /* PromiseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F7161E50F083B2267363F243C4E4B78F /* AnyPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5973BC143AE488C12FFB1E83E71F0C45 /* AnyPromise.swift */; }; + F898D4270885EF1114608E76B0C09E21 /* State.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DC63EB77B3791891517B98CAA115DE8 /* State.swift */; }; + FB0B33F03AC2BC8A7FC7FD912C12CC22 /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A112EF8BB3933C1C1E42F11B3DD3B02A /* PromiseKit.framework */; }; FC14480CECE872865A9C6E584F886DA3 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 133C5287CFDCB3B67578A7B1221E132C /* Request.swift */; }; FEF0D7653948988B804226129471C1EC /* Stream.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A8F373B23E0F7FB68B0BA71D92D1C60 /* Stream.swift */; }; - FF5CD62C722D6A68AD65462B56D7CB72 /* UIView+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F0F4EDC2236E1C270DC2014181D6506 /* UIView+AnyPromise.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -121,17 +111,10 @@ isa = PBXContainerItemProxy; containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; proxyType = 1; - remoteGlobalIDString = 57958C5706F810052A634C1714567A9F; + remoteGlobalIDString = 2FD913B4E24277823983BABFDB071664; remoteInfo = PetstoreClient; }; - 23252B1F29F10BD972ECD7BA34F20EA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 190ACD3A51BC90B85EADB13E9CDD207B; - remoteInfo = OMGHTTPURLRQ; - }; - 56AF0748FFC13AD34ECC967C04930EF8 /* PBXContainerItemProxy */ = { + 4BED27A854EA6600536518D29BBB3670 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; proxyType = 1; @@ -145,6 +128,13 @@ remoteGlobalIDString = 432ECC54282C84882B482CCB4CF227FC; remoteInfo = Alamofire; }; + 8059767A82D94C9F7F7C16D030819C4E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 190ACD3A51BC90B85EADB13E9CDD207B; + remoteInfo = OMGHTTPURLRQ; + }; 9AD20158D23CE70A2A91E5B7859090C3 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; @@ -156,14 +146,14 @@ isa = PBXContainerItemProxy; containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; proxyType = 1; - remoteGlobalIDString = D9A01D449983C8E3EF61C0CA4A7D8F59; + remoteGlobalIDString = 25EDA9CFC641C69402B3857A2C4A39F0; remoteInfo = PromiseKit; }; - EEB067570D28F14A138B737F596BCB1A /* PBXContainerItemProxy */ = { + ECAC5E4454026C822004659466983ADD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; proxyType = 1; - remoteGlobalIDString = D9A01D449983C8E3EF61C0CA4A7D8F59; + remoteGlobalIDString = 25EDA9CFC641C69402B3857A2C4A39F0; remoteInfo = PromiseKit; }; /* End PBXContainerItemProxy section */ @@ -171,10 +161,9 @@ /* Begin PBXFileReference section */ 045C1F608ADE57757E6732D721779F22 /* NSError+Cancellation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSError+Cancellation.h"; path = "Sources/NSError+Cancellation.h"; sourceTree = ""; }; 04A22F2595054D39018E03961CA7283A /* CALayer+AnyPromise.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "CALayer+AnyPromise.m"; path = "Categories/QuartzCore/CALayer+AnyPromise.m"; sourceTree = ""; }; - 076251AD10B5F4E8880F4C350E1D9D5A /* Animal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Animal.swift; sourceTree = ""; }; + 0A545673F09F49CDD60A13B4B0AF1020 /* Order.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Order.swift; sourceTree = ""; }; 0A8906F6D6920DF197965D1740A7E283 /* Umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Umbrella.h; path = Sources/Umbrella.h; sourceTree = ""; }; 0BA017E288BB42E06EBEE9C6E6993EAF /* UIViewController+AnyPromise.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIViewController+AnyPromise.h"; path = "Categories/UIKit/UIViewController+AnyPromise.h"; sourceTree = ""; }; - 0C24509ECAD94A91B30D87D8B2DEEB9B /* Model200Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Model200Response.swift; sourceTree = ""; }; 0F36B65CF990C57DC527824ED0BA1915 /* OMGHTTPURLRQ-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "OMGHTTPURLRQ-dummy.m"; sourceTree = ""; }; 122D5005A81832479161CD1D223C573A /* PromiseKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PromiseKit-prefix.pch"; sourceTree = ""; }; 133C5287CFDCB3B67578A7B1221E132C /* Request.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Request.swift; path = Source/Request.swift; sourceTree = ""; }; @@ -183,23 +172,21 @@ 143BC30E5DDAF52A3D9578F507EC6A41 /* when.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = when.m; path = Sources/when.m; sourceTree = ""; }; 16730DAF3E51C161D8247E473F069E71 /* when.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = when.swift; path = Sources/when.swift; sourceTree = ""; }; 16D7C901D915C251DEBA27AC1EF57E34 /* OMGHTTPURLRQ.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = OMGHTTPURLRQ.xcconfig; sourceTree = ""; }; - 176079DAA9CD16ADABA2C18C289C529D /* InlineResponse200.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = InlineResponse200.swift; sourceTree = ""; }; - 17CBD3DEAD30C207791B4B1A5AD66991 /* ModelReturn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ModelReturn.swift; sourceTree = ""; }; + 1A3E5E3CD673B025FD8AC260E67AB47E /* StoreAPI.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = StoreAPI.swift; sourceTree = ""; }; 1B7E90A568681E000EF3CB0917584F3C /* AnyPromise.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AnyPromise.m; path = Sources/AnyPromise.m; sourceTree = ""; }; - 1C7FF1C1E487B6795C5F6734CCA49DF3 /* StoreAPI.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = StoreAPI.swift; sourceTree = ""; }; 1F19945EE403F7B29D8B1939EA6D579A /* AnyPromise.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AnyPromise.h; path = Sources/AnyPromise.h; sourceTree = ""; }; 1FBD351D007CF4095C98C9DFD9D83D61 /* ParameterEncoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoding.swift; path = Source/ParameterEncoding.swift; sourceTree = ""; }; + 211F73A46D90346F7FC6D0D29640EE4F /* Tag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = ""; }; 24C79ED4B5226F263307B22E96E88F9F /* OMGHTTPURLRQ.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = OMGHTTPURLRQ.modulemap; sourceTree = ""; }; 25614E715DDC170DAFB0DF50C5503E33 /* OMGFormURLEncode.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = OMGFormURLEncode.m; path = Sources/OMGFormURLEncode.m; sourceTree = ""; }; + 261F03A3C73374FD19333EEA59CCD59F /* PetAPI.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PetAPI.swift; sourceTree = ""; }; 275DA9A664C70DD40A4059090D1A00D4 /* after.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = after.swift; path = Sources/after.swift; sourceTree = ""; }; 27E0FE41D771BE8BE3F0D4F1DAD0B179 /* CALayer+AnyPromise.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "CALayer+AnyPromise.h"; path = "Categories/QuartzCore/CALayer+AnyPromise.h"; sourceTree = ""; }; - 2BAE461B3A62164A09480E8967D29E64 /* Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + 284B3DE9B793FCC633E971DB1798AFAF /* Pet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Pet.swift; sourceTree = ""; }; 2BCC458FDD5F692BBB2BFC64BB5701FC /* Pods-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-umbrella.h"; sourceTree = ""; }; 2D51C929AC51E34493AA757180C09C3B /* Manager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Manager.swift; path = Source/Manager.swift; sourceTree = ""; }; - 2E506C8F40F5AD602D83B383EAA7C0CD /* APIHelper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = APIHelper.swift; sourceTree = ""; }; 2F0F4EDC2236E1C270DC2014181D6506 /* UIView+AnyPromise.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIView+AnyPromise.m"; path = "Categories/UIKit/UIView+AnyPromise.m"; sourceTree = ""; }; 30CE7341A995EF6812D71771E74CF7F7 /* Alamofire-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-umbrella.h"; sourceTree = ""; }; - 323E5DCC342B03D7AE59F37523D2626A /* APIs.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = APIs.swift; sourceTree = ""; }; 3530BF15E14D1F6D7134EE67377D5C8C /* OMGHTTPURLRQ.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OMGHTTPURLRQ.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3616971BAEF40302B7F2F8B1007C0B2B /* NSNotificationCenter+AnyPromise.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSNotificationCenter+AnyPromise.h"; path = "Categories/Foundation/NSNotificationCenter+AnyPromise.h"; sourceTree = ""; }; 392FA21A33296B88F790D62A4FAA4E4E /* dispatch_promise.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = dispatch_promise.swift; path = Sources/dispatch_promise.swift; sourceTree = ""; }; @@ -215,17 +202,17 @@ 51ADA0B6B6B00CB0E818AA8CBC311677 /* OMGFormURLEncode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = OMGFormURLEncode.h; path = Sources/OMGFormURLEncode.h; sourceTree = ""; }; 535DF88FC12304114DEF55E4003421B2 /* NSURLSession+Promise.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSURLSession+Promise.swift"; path = "Categories/Foundation/NSURLSession+Promise.swift"; sourceTree = ""; }; 53F8B2513042BD6DB957E8063EF895BD /* Result.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Source/Result.swift; sourceTree = ""; }; + 5412898DEB10F1983487A10453C6B9CB /* Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + 552D15E0340BF58CC1922B82E864AEC9 /* UserAPI.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = UserAPI.swift; sourceTree = ""; }; 558DFECE2C740177CA6357DA71A1DFBB /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = Sources/Error.swift; sourceTree = ""; }; 5973BC143AE488C12FFB1E83E71F0C45 /* AnyPromise.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyPromise.swift; path = Sources/AnyPromise.swift; sourceTree = ""; }; 5A1DC80A0773C5A569348DC442EAFD1D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + 5B248364ABF60ACD7DB31A17DCFDFD0C /* User.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; 5CA1C154DFC54DFFB12A754B9A0BBDFC /* OMGHTTPURLRQ.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OMGHTTPURLRQ.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 5DF5FC3AF99846209C5FCE55A2E12D9A /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Source/Response.swift; sourceTree = ""; }; 5F14E17B4D6BDF8BD3E384BE6528F744 /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Source/MultipartFormData.swift; sourceTree = ""; }; 6846D22C9F0CCBC48DF833E309A8E84F /* UIActionSheet+AnyPromise.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIActionSheet+AnyPromise.h"; path = "Categories/UIKit/UIActionSheet+AnyPromise.h"; sourceTree = ""; }; - 6A60B64E388679F589CB959AA5FC4787 /* Models.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; }; 6AD59903FAA8315AD0036AC459FFB97F /* join.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = join.m; path = Sources/join.m; sourceTree = ""; }; - 6AEDC82569B65EDA2A3D12E1F9B8A2D8 /* Dog.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Dog.swift; sourceTree = ""; }; - 71B762588C78E0A95319F5BB534965BE /* Category.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = ""; }; 792D14AC86CD98AA9C31373287E0F353 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 79A9DEDC89FE8336BF5FEDAAF75BF7FC /* Pods.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Pods.modulemap; sourceTree = ""; }; 7E0DBDE561A6C2E7AC7A24160F8A5F28 /* Promise+Properties.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Promise+Properties.swift"; path = "Sources/Promise+Properties.swift"; sourceTree = ""; }; @@ -238,27 +225,22 @@ 8A9CB35983E4859DFFBAD8840196A094 /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = Source/Error.swift; sourceTree = ""; }; 8B476A57549D7994745E17A6DE5BE745 /* Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alamofire.swift; path = Source/Alamofire.swift; sourceTree = ""; }; 8DC63EB77B3791891517B98CAA115DE8 /* State.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = State.swift; path = Sources/State.swift; sourceTree = ""; }; + 8F0266C5AE0B23A436291F6647902086 /* Models.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; }; 9042667D08D783E45394FE8B97EE6468 /* PromiseKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "PromiseKit-dummy.m"; sourceTree = ""; }; - 91579AC4E335E76904DB4DB54228CC42 /* Order.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Order.swift; sourceTree = ""; }; + 92734297B64DFE0EB0EDE1EA821163DB /* AlamofireImplementations.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AlamofireImplementations.swift; sourceTree = ""; }; 92D340D66F03F31237B70F23FE9B00D0 /* UIAlertView+AnyPromise.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIAlertView+AnyPromise.h"; path = "Categories/UIKit/UIAlertView+AnyPromise.h"; sourceTree = ""; }; - 93B41BBA87E8FD7BD3513CD49733EB30 /* FormatTest.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = FormatTest.swift; sourceTree = ""; }; 9774D31336C85248A115B569E7D95283 /* UIActionSheet+AnyPromise.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIActionSheet+AnyPromise.m"; path = "Categories/UIKit/UIActionSheet+AnyPromise.m"; sourceTree = ""; }; 977577C045EDA9D9D1F46E2598D19FC7 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.debug.xcconfig; sourceTree = ""; }; 980FD13F87B44BFD90F8AC129BEB2E61 /* race.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = race.swift; path = Sources/race.swift; sourceTree = ""; }; - 9D172F6D749B7735D04B495330AB7FE3 /* Cat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Cat.swift; sourceTree = ""; }; 9D579267FC1F163C8F04B444DAEFED0D /* OMGHTTPURLRQ.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = OMGHTTPURLRQ.m; path = Sources/OMGHTTPURLRQ.m; sourceTree = ""; }; - 9F2773E2F96E394825BE86FA45E48132 /* PetAPI.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PetAPI.swift; sourceTree = ""; }; 9F681D2C508D1BA8F62893120D9343A4 /* PetstoreClient-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PetstoreClient-umbrella.h"; sourceTree = ""; }; A04177B09D9596450D827FE49A36C4C4 /* Download.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Download.swift; path = Source/Download.swift; sourceTree = ""; }; A112EF8BB3933C1C1E42F11B3DD3B02A /* PromiseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PromiseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A1D1571AB15108DF6F9C4FE2064E3C43 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A29C027BA870C5E7975BF50087CAE384 /* Pet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Pet.swift; sourceTree = ""; }; - A3CC2D1A2A451C0A3C4DBD6D7E117C01 /* ObjectReturn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ObjectReturn.swift; sourceTree = ""; }; A7F0DAACAC89A93B940BBE54E6A87E9F /* NSURLConnection+AnyPromise.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSURLConnection+AnyPromise.m"; path = "Categories/Foundation/NSURLConnection+AnyPromise.m"; sourceTree = ""; }; A92242715FB4C0608F8DCEBF8F3791E2 /* dispatch_promise.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = dispatch_promise.m; path = Sources/dispatch_promise.m; sourceTree = ""; }; AA24C5EC82CF437D8D1FFFAB68975408 /* UIViewController+AnyPromise.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+AnyPromise.m"; path = "Categories/UIKit/UIViewController+AnyPromise.m"; sourceTree = ""; }; AB4DA378490493502B34B20D4B12325B /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AD05F019D163F2D5FE7C8E64C1D2E299 /* UserAPI.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = UserAPI.swift; sourceTree = ""; }; B3A144887C8B13FD888B76AB096B0CA1 /* PetstoreClient-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PetstoreClient-prefix.pch"; sourceTree = ""; }; B868468092D7B2489B889A50981C9247 /* after.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = after.m; path = Sources/after.m; sourceTree = ""; }; B93FB4BB16CFB41DCA35A8CFAD7A7FEF /* NSNotificationCenter+Promise.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSNotificationCenter+Promise.swift"; path = "Categories/Foundation/NSNotificationCenter+Promise.swift"; sourceTree = ""; }; @@ -266,26 +248,24 @@ BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; BAE48ACA10E8895BB8BF5CE8C0846B4B /* NSURLConnection+AnyPromise.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSURLConnection+AnyPromise.h"; path = "Categories/Foundation/NSURLConnection+AnyPromise.h"; sourceTree = ""; }; BCDD82DB3E6D43BA9769FCA9B744CB5E /* UIView+AnyPromise.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIView+AnyPromise.h"; path = "Categories/UIKit/UIView+AnyPromise.h"; sourceTree = ""; }; - C295084120B300E8BDB7B91981B104FC /* Name.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Name.swift; sourceTree = ""; }; C476B916B763E55E4161F0B30760C4E8 /* afterlife.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = afterlife.swift; path = Categories/Foundation/afterlife.swift; sourceTree = ""; }; - C716D7A2A32272C40DFA0AAC76DC0E1E /* Tag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = ""; }; C731FBFCC690050C6C08E5AC9D9DC724 /* PMKAlertController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PMKAlertController.swift; path = Categories/UIKit/PMKAlertController.swift; sourceTree = ""; }; CA1AD92813B887E2D017D051B8C0E3D2 /* Validation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Source/Validation.swift; sourceTree = ""; }; CA854180C132DB5511D64C82535C5FDE /* UIAlertView+Promise.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIAlertView+Promise.swift"; path = "Categories/UIKit/UIAlertView+Promise.swift"; sourceTree = ""; }; - CAA644003A8DF304D35F77FE04B8AB17 /* AlamofireImplementations.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AlamofireImplementations.swift; sourceTree = ""; }; CBC0F7C552B739C909B650A0F42F7F38 /* Pods-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-resources.sh"; sourceTree = ""; }; CC49FF2A84C0E0E9349747D94036B728 /* PromiseKit.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PromiseKit.xcconfig; sourceTree = ""; }; CCE38472832BBCC541E646DA6C18EF9C /* Upload.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Upload.swift; path = Source/Upload.swift; sourceTree = ""; }; CDC4DD7DB9F4C34A288BECA73BC13B57 /* PromiseKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = PromiseKit.modulemap; sourceTree = ""; }; D0405803033A2A777B8E4DFA0C1800ED /* Pods-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-acknowledgements.markdown"; sourceTree = ""; }; + D2BAD338E56EF3CAA6E54490FE0C5DF9 /* APIHelper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = APIHelper.swift; sourceTree = ""; }; D4248CF20178C57CEFEFAAF453C0DC75 /* PromiseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PromiseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D513E5F3C28C7B452E79AE279B71813D /* User.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; + D4DF0604EDC1460935E6E445A47023A4 /* Category.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = ""; }; D6D459D0AB2361B48F81C4D14C6D0DAA /* UIViewController+Promise.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIViewController+Promise.swift"; path = "Categories/UIKit/UIViewController+Promise.swift"; sourceTree = ""; }; D6EB54C331FED437583A5F01EB2757D1 /* NSObject+Promise.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSObject+Promise.swift"; path = "Categories/Foundation/NSObject+Promise.swift"; sourceTree = ""; }; + D8072E1108951F272C003553FC8926C7 /* APIs.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = APIs.swift; sourceTree = ""; }; D931A99C6B5A8E0F69C818C6ECC3C44F /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA312349A49333542E6F4B36B329960E /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.release.xcconfig; sourceTree = ""; }; DADAB10704E49D6B9E18F59F995BB88F /* PetstoreClient.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PetstoreClient.xcconfig; sourceTree = ""; }; - DED58811444E6D32A1F7B372F034DB7A /* SpecialModelName.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SpecialModelName.swift; sourceTree = ""; }; E11BFB27B43B742CB5D6086C4233A909 /* OMGUserAgent.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = OMGUserAgent.m; path = Sources/OMGUserAgent.m; sourceTree = ""; }; E160B50E4D11692AA38E74C897D69C61 /* PetstoreClient.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PetstoreClient.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E3CDA0958D6247505ECD9098D662EA74 /* UIView+Promise.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Promise.swift"; path = "Categories/UIKit/UIView+Promise.swift"; sourceTree = ""; }; @@ -305,16 +285,6 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 783E7A91F3C3404EDF234C828FCA6543 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9D7DE077DBB18ADD8C4272A59BEB323A /* Alamofire.framework in Frameworks */, - B26D78FFEBAA030D8E8D44B67888C4C2 /* Foundation.framework in Frameworks */, - CB4E6EA27EA59B8851C744CA7D98A2BA /* PromiseKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 9792A6BDBB07FB15453527B4370E3086 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -331,14 +301,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - DBF65F787DDFE72646CDC44CF9E22784 /* Frameworks */ = { + B9EC7146E2607203CE4A5678AE249144 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 39E7AFE23097B4BC393D43A44093FB63 /* Foundation.framework in Frameworks */, - 30F9F020F5B35577080063E71CDAB08C /* OMGHTTPURLRQ.framework in Frameworks */, - 0BB1E79782E3BE258C30A65A20C85FC1 /* QuartzCore.framework in Frameworks */, - F0E47CCDA10383F8489C3839FD0DF755 /* UIKit.framework in Frameworks */, + EEF6E654182421FEBC0CC202E72F71A8 /* Foundation.framework in Frameworks */, + 7D7A40DBAC93241786E8C553921E8C86 /* OMGHTTPURLRQ.framework in Frameworks */, + 1287903F965945AEB5EFC4EE768C7B38 /* QuartzCore.framework in Frameworks */, + EA691570F0F8066651EE2A7066426384 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -350,6 +320,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FC8C7ACC9E4D7F04E9223A734BF57FFB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9CFBA896DF45B68C788F80013AC3FDBB /* Alamofire.framework in Frameworks */, + 523C1819FC864864A9715CF713DD12E9 /* Foundation.framework in Frameworks */, + FB0B33F03AC2BC8A7FC7FD912C12CC22 /* PromiseKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -362,24 +342,14 @@ name = UserAgent; sourceTree = ""; }; - 18E0A354B63748476BE2595538327E6C /* Models */ = { + 1322FED69118C64DAD026CAF7F4C38C6 /* Models */ = { isa = PBXGroup; children = ( - 076251AD10B5F4E8880F4C350E1D9D5A /* Animal.swift */, - 9D172F6D749B7735D04B495330AB7FE3 /* Cat.swift */, - 71B762588C78E0A95319F5BB534965BE /* Category.swift */, - 6AEDC82569B65EDA2A3D12E1F9B8A2D8 /* Dog.swift */, - 93B41BBA87E8FD7BD3513CD49733EB30 /* FormatTest.swift */, - 176079DAA9CD16ADABA2C18C289C529D /* InlineResponse200.swift */, - 0C24509ECAD94A91B30D87D8B2DEEB9B /* Model200Response.swift */, - 17CBD3DEAD30C207791B4B1A5AD66991 /* ModelReturn.swift */, - C295084120B300E8BDB7B91981B104FC /* Name.swift */, - A3CC2D1A2A451C0A3C4DBD6D7E117C01 /* ObjectReturn.swift */, - 91579AC4E335E76904DB4DB54228CC42 /* Order.swift */, - A29C027BA870C5E7975BF50087CAE384 /* Pet.swift */, - DED58811444E6D32A1F7B372F034DB7A /* SpecialModelName.swift */, - C716D7A2A32272C40DFA0AAC76DC0E1E /* Tag.swift */, - D513E5F3C28C7B452E79AE279B71813D /* User.swift */, + D4DF0604EDC1460935E6E445A47023A4 /* Category.swift */, + 0A545673F09F49CDD60A13B4B0AF1020 /* Order.swift */, + 284B3DE9B793FCC633E971DB1798AFAF /* Pet.swift */, + 211F73A46D90346F7FC6D0D29640EE4F /* Tag.swift */, + 5B248364ABF60ACD7DB31A17DCFDFD0C /* User.swift */, ); path = Models; sourceTree = ""; @@ -576,7 +546,7 @@ AD94092456F8ABCB18F74CAC75AD85DE /* Classes */ = { isa = PBXGroup; children = ( - DFFDD7A6740B9120EF97F5F72A59157D /* Swaggers */, + F64549CFCC17C7AC6479508BE180B18D /* Swaggers */, ); path = Classes; sourceTree = ""; @@ -617,16 +587,6 @@ name = CorePromise; sourceTree = ""; }; - CA9F1413BA9B41923CFFA1AAB2765441 /* APIs */ = { - isa = PBXGroup; - children = ( - 9F2773E2F96E394825BE86FA45E48132 /* PetAPI.swift */, - 1C7FF1C1E487B6795C5F6734CCA49DF3 /* StoreAPI.swift */, - AD05F019D163F2D5FE7C8E64C1D2E299 /* UserAPI.swift */, - ); - path = APIs; - sourceTree = ""; - }; CF22FA3EE19C3EC42FEBA1247EB70D85 /* Pods */ = { isa = PBXGroup; children = ( @@ -661,20 +621,6 @@ path = PromiseKit; sourceTree = ""; }; - DFFDD7A6740B9120EF97F5F72A59157D /* Swaggers */ = { - isa = PBXGroup; - children = ( - CAA644003A8DF304D35F77FE04B8AB17 /* AlamofireImplementations.swift */, - 2E506C8F40F5AD602D83B383EAA7C0CD /* APIHelper.swift */, - 323E5DCC342B03D7AE59F37523D2626A /* APIs.swift */, - 2BAE461B3A62164A09480E8967D29E64 /* Extensions.swift */, - 6A60B64E388679F589CB959AA5FC4787 /* Models.swift */, - CA9F1413BA9B41923CFFA1AAB2765441 /* APIs */, - 18E0A354B63748476BE2595538327E6C /* Models */, - ); - path = Swaggers; - sourceTree = ""; - }; E73D9BF152C59F341559DE62A3143721 /* PetstoreClient */ = { isa = PBXGroup; children = ( @@ -714,9 +660,59 @@ path = ../..; sourceTree = ""; }; + F64549CFCC17C7AC6479508BE180B18D /* Swaggers */ = { + isa = PBXGroup; + children = ( + 92734297B64DFE0EB0EDE1EA821163DB /* AlamofireImplementations.swift */, + D2BAD338E56EF3CAA6E54490FE0C5DF9 /* APIHelper.swift */, + D8072E1108951F272C003553FC8926C7 /* APIs.swift */, + 5412898DEB10F1983487A10453C6B9CB /* Extensions.swift */, + 8F0266C5AE0B23A436291F6647902086 /* Models.swift */, + F92EFB558CBA923AB1CFA22F708E315A /* APIs */, + 1322FED69118C64DAD026CAF7F4C38C6 /* Models */, + ); + path = Swaggers; + sourceTree = ""; + }; + F92EFB558CBA923AB1CFA22F708E315A /* APIs */ = { + isa = PBXGroup; + children = ( + 261F03A3C73374FD19333EEA59CCD59F /* PetAPI.swift */, + 1A3E5E3CD673B025FD8AC260E67AB47E /* StoreAPI.swift */, + 552D15E0340BF58CC1922B82E864AEC9 /* UserAPI.swift */, + ); + path = APIs; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 09D29D14882ADDDA216809ED16917D07 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3860D960E37C1257BDA54626CA592E86 /* AnyPromise.h in Headers */, + CE89E5C528D52BBCBCD23309603BA6D1 /* CALayer+AnyPromise.h in Headers */, + 857E5961D9F6E23BD86DEB613A1499C7 /* NSError+Cancellation.h in Headers */, + DBD1F4247E1C591AE4EE5531599AB170 /* NSNotificationCenter+AnyPromise.h in Headers */, + 18FAC6B4FD3B44CB353C7A6027286100 /* NSURLConnection+AnyPromise.h in Headers */, + F700EAA9F9F6C1F99C83B45D05C5AD14 /* PromiseKit.h in Headers */, + 0268F9278E32ACC1F996F4E2E45622B5 /* UIActionSheet+AnyPromise.h in Headers */, + 12348513CB81BD05B497C210905CDF65 /* UIAlertView+AnyPromise.h in Headers */, + 8C4A96A3E69C772990E3E922D0FD1BC4 /* UIView+AnyPromise.h in Headers */, + 01BD61BBC475EB3369237B84FE24D3EE /* UIViewController+AnyPromise.h in Headers */, + 0BDA43D8F48C8B0D504C440046FAF681 /* Umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2835BFBD2FEFE3E2844CFC1B10201EA4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 656BED6137A9FFA3B2DF03861F525022 /* PetstoreClient-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5F7B61281F714E2A64A51E80A2C9C062 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -725,14 +721,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 661BAF8916A434EEB8B0CDCC39DF19C2 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - F1E37BB11F68A6A76DF44B230F965E05 /* PetstoreClient-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 7E1332ABD911123D7A873D6D87E2F182 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -752,24 +740,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CC349308BCECD7B68C93EB3091B72E61 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D258F1E893340393ADABCB02B9FBA206 /* AnyPromise.h in Headers */, - 995CE773471ADA3D5FEB52DF624174C6 /* CALayer+AnyPromise.h in Headers */, - 7BCBC4FD2E385CAFC5F3949FFFFE2095 /* NSError+Cancellation.h in Headers */, - 752EACD07B4F948C1F24E0583C5DA165 /* NSNotificationCenter+AnyPromise.h in Headers */, - E62ABEDB4D7B179589B75C8423C5BF9B /* NSURLConnection+AnyPromise.h in Headers */, - 1DB7E23C2A2A8D4B5CE046135E4540C6 /* PromiseKit.h in Headers */, - 63AF5DF795F5D610768B4AF53C7E9976 /* UIActionSheet+AnyPromise.h in Headers */, - 97BDDBBB6BA36B90E98FCD53B9AE171A /* UIAlertView+AnyPromise.h in Headers */, - E74976C9C4A5EF60B0A9CA1285693DDF /* UIView+AnyPromise.h in Headers */, - 66B8591A8CCC9760D933506B71A13962 /* UIViewController+AnyPromise.h in Headers */, - CA0AABE1706F8B94DC37330AB2BC062C /* Umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -790,6 +760,43 @@ productReference = 5CA1C154DFC54DFFB12A754B9A0BBDFC /* OMGHTTPURLRQ.framework */; productType = "com.apple.product-type.framework"; }; + 25EDA9CFC641C69402B3857A2C4A39F0 /* PromiseKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 03DDC7D7BA248863E8493F462ABAD118 /* Build configuration list for PBXNativeTarget "PromiseKit" */; + buildPhases = ( + 1541E3035B9D2A7EED16C98953A8CEB6 /* Sources */, + B9EC7146E2607203CE4A5678AE249144 /* Frameworks */, + 09D29D14882ADDDA216809ED16917D07 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + C893B48B47F4A7541102DAAFECFC50F2 /* PBXTargetDependency */, + ); + name = PromiseKit; + productName = PromiseKit; + productReference = D4248CF20178C57CEFEFAAF453C0DC75 /* PromiseKit.framework */; + productType = "com.apple.product-type.framework"; + }; + 2FD913B4E24277823983BABFDB071664 /* PetstoreClient */ = { + isa = PBXNativeTarget; + buildConfigurationList = B5E28E2093F917340AF5AAA0FCE5E37D /* Build configuration list for PBXNativeTarget "PetstoreClient" */; + buildPhases = ( + 0DDA01F58E1381BEA0D7FB759B75A456 /* Sources */, + FC8C7ACC9E4D7F04E9223A734BF57FFB /* Frameworks */, + 2835BFBD2FEFE3E2844CFC1B10201EA4 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + FC9E3FF49D9B636B2925749B2D51A5D3 /* PBXTargetDependency */, + FAC5685F6C40E5D74404831646CBC453 /* PBXTargetDependency */, + ); + name = PetstoreClient; + productName = PetstoreClient; + productReference = E160B50E4D11692AA38E74C897D69C61 /* PetstoreClient.framework */; + productType = "com.apple.product-type.framework"; + }; 432ECC54282C84882B482CCB4CF227FC /* Alamofire */ = { isa = PBXNativeTarget; buildConfigurationList = 8B2B2DA2F7F80D41B1FDB5FACFA4B3DE /* Build configuration list for PBXNativeTarget "Alamofire" */; @@ -807,25 +814,6 @@ productReference = EBC4140FCBB5B4D3A955B1608C165C04 /* Alamofire.framework */; productType = "com.apple.product-type.framework"; }; - 57958C5706F810052A634C1714567A9F /* PetstoreClient */ = { - isa = PBXNativeTarget; - buildConfigurationList = C36F9DFB9BBE472AD46194868C8F885B /* Build configuration list for PBXNativeTarget "PetstoreClient" */; - buildPhases = ( - 85A7E0C7933D1BC0EB062F281D1F19AD /* Sources */, - 783E7A91F3C3404EDF234C828FCA6543 /* Frameworks */, - 661BAF8916A434EEB8B0CDCC39DF19C2 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - F6093ED00F5D11A44F55549F1A4C778F /* PBXTargetDependency */, - 38BE3993D1A8CA768731BA0465C21F17 /* PBXTargetDependency */, - ); - name = PetstoreClient; - productName = PetstoreClient; - productReference = E160B50E4D11692AA38E74C897D69C61 /* PetstoreClient.framework */; - productType = "com.apple.product-type.framework"; - }; 7A5DBD588D2CC1C0CB1C42D4ED613FE4 /* Pods */ = { isa = PBXNativeTarget; buildConfigurationList = 8CB3C5DF3F4B6413A6F2D003B58CCF32 /* Build configuration list for PBXNativeTarget "Pods" */; @@ -847,24 +835,6 @@ productReference = D931A99C6B5A8E0F69C818C6ECC3C44F /* Pods.framework */; productType = "com.apple.product-type.framework"; }; - D9A01D449983C8E3EF61C0CA4A7D8F59 /* PromiseKit */ = { - isa = PBXNativeTarget; - buildConfigurationList = FCAE2E57B1A9453B9D35EF9071C4C581 /* Build configuration list for PBXNativeTarget "PromiseKit" */; - buildPhases = ( - E0A9A1079F8923D78CC7F6D7F87CD779 /* Sources */, - DBF65F787DDFE72646CDC44CF9E22784 /* Frameworks */, - CC349308BCECD7B68C93EB3091B72E61 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - A48A5E27A5C878B373F0FE7365829141 /* PBXTargetDependency */, - ); - name = PromiseKit; - productName = PromiseKit; - productReference = D4248CF20178C57CEFEFAAF453C0DC75 /* PromiseKit.framework */; - productType = "com.apple.product-type.framework"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -888,14 +858,77 @@ targets = ( 432ECC54282C84882B482CCB4CF227FC /* Alamofire */, 190ACD3A51BC90B85EADB13E9CDD207B /* OMGHTTPURLRQ */, - 57958C5706F810052A634C1714567A9F /* PetstoreClient */, + 2FD913B4E24277823983BABFDB071664 /* PetstoreClient */, 7A5DBD588D2CC1C0CB1C42D4ED613FE4 /* Pods */, - D9A01D449983C8E3EF61C0CA4A7D8F59 /* PromiseKit */, + 25EDA9CFC641C69402B3857A2C4A39F0 /* PromiseKit */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ + 0DDA01F58E1381BEA0D7FB759B75A456 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 516D41E4D035A817CC5116C11302E408 /* AlamofireImplementations.swift in Sources */, + 46F838880F41F56ABD91796FC956B4BF /* APIHelper.swift in Sources */, + EA35E77B4F31DC3E1D224458E0BC959D /* APIs.swift in Sources */, + CD97970D21D3CB8C459FAFEF11EE60F3 /* Category.swift in Sources */, + 5EE5E1CA27F3CB04A5DCF5BB90B76000 /* Extensions.swift in Sources */, + 15ECEBA1EFBD023AEA47F36524270D2C /* Models.swift in Sources */, + E2B0094FAAEA55C55AD141136F650E35 /* Order.swift in Sources */, + 1CDA074C6DC95876D85E13ECF882B93A /* Pet.swift in Sources */, + 2B38BB4603B4286FF8D7A780372E947F /* PetAPI.swift in Sources */, + 25FBB92AFB8F5A777CE8E40EC3B9DACA /* PetstoreClient-dummy.m in Sources */, + 443361437B359830308B93A7B98BE039 /* StoreAPI.swift in Sources */, + 6B0A17CD24331793D2504E0FBBAF5EB2 /* Tag.swift in Sources */, + D546A4DBA3F7750F45A6F63B994C081C /* User.swift in Sources */, + 2D9379807BA243E1CE457D1BE963DA09 /* UserAPI.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1541E3035B9D2A7EED16C98953A8CEB6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C86881D2285095255829A578F0A85300 /* after.m in Sources */, + EA67B414E392EFD2B14742F55A595596 /* after.swift in Sources */, + 1AC7E88F0EC64D1D4E83CE7767BFD2B7 /* afterlife.swift in Sources */, + 909B0A29022956D90C32C4AA319F75D1 /* AnyPromise.m in Sources */, + F7161E50F083B2267363F243C4E4B78F /* AnyPromise.swift in Sources */, + 124EFF5E3C46EC88F47C52479FA6ACAF /* CALayer+AnyPromise.m in Sources */, + 6A128FE350973D8A693E3F063C5E4A49 /* dispatch_promise.m in Sources */, + F4582E8DC1C9F362ADA4BAE9CEF8B681 /* dispatch_promise.swift in Sources */, + D93596046CD3B301F4EC99A7A118C82C /* Error.swift in Sources */, + 5FFED823C0BDD412FA41B01EA47394D1 /* hang.m in Sources */, + 5D7EAE5725A7E750B51FD27AECB5F0FD /* join.m in Sources */, + 06F7C0C55DF4C09C015159F6B0802EB1 /* join.swift in Sources */, + 11C221075C5B20BDEEB3DDF8EAC99E63 /* NSNotificationCenter+AnyPromise.m in Sources */, + 88B3F911629C08DEEB226F3B294AAB36 /* NSNotificationCenter+Promise.swift in Sources */, + 0D240D796AAD10F0119A1D7AC2570AAA /* NSObject+Promise.swift in Sources */, + 8E3861989641484EE3095722EC08B5A9 /* NSURLConnection+AnyPromise.m in Sources */, + EB9A1F33DB49ADA09F6E7F19A2C30357 /* NSURLConnection+Promise.swift in Sources */, + 81A2DB65C0742D785DE7C2609CC14140 /* NSURLSession+Promise.swift in Sources */, + 73FA79FDB37E5C458B996012BFB0CF04 /* PMKAlertController.swift in Sources */, + 1E1010EA437F154A554D04F7F3A894EC /* Promise+Properties.swift in Sources */, + ADEEE5F368B5D707D03E78FD75C59048 /* Promise.swift in Sources */, + 8D3A68D3CBD8A1D89099F704A04A04FC /* PromiseKit-dummy.m in Sources */, + 97D71F12142A541BEEF425805D51379E /* race.swift in Sources */, + F898D4270885EF1114608E76B0C09E21 /* State.swift in Sources */, + CAF12A3EDA2376FFEAD4A12E413C1AAD /* UIActionSheet+AnyPromise.m in Sources */, + 387C7387FDC662D23D743879B6143D59 /* UIActionSheet+Promise.swift in Sources */, + 11EA8D6B0352FD31F520F983CFB9D993 /* UIAlertView+AnyPromise.m in Sources */, + EB3C88CDAF122BA763FEF85758370C7C /* UIAlertView+Promise.swift in Sources */, + 4C22563311AC2B52651A6525A979E076 /* UIView+AnyPromise.m in Sources */, + D1735D6C4D574339EB49024228448459 /* UIView+Promise.swift in Sources */, + 60EBBACB76CD5879FB7B9B3E0AA5E2C1 /* UIViewController+AnyPromise.m in Sources */, + C86CE0A47FAD4C9B2929A335D62A179E /* UIViewController+Promise.swift in Sources */, + CE225CF07E6E385F014883D607AFA44D /* URLDataPromise.swift in Sources */, + CB2A58CBAB5A2E63D0CB70F2697CAE87 /* when.m in Sources */, + ED30A8B82BA1D53CBC370B1DC18DA1EB /* when.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 44321F32F148EB47FF23494889576DF5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -907,37 +940,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 85A7E0C7933D1BC0EB062F281D1F19AD /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DC710F75309F7DFEA3C5AB01E9288681 /* AlamofireImplementations.swift in Sources */, - EB0C1A986BDF161D01919BCCCAE40D7E /* Animal.swift in Sources */, - 4E07AC40078EBB1C88ED8700859F5A1B /* APIHelper.swift in Sources */, - 4827FED90242878355B47A6D34BAABCA /* APIs.swift in Sources */, - 33326318BF830A838DA62D54ADAA5ECA /* Cat.swift in Sources */, - 7C87E63D6733AC0FE083373A5FAF86CB /* Category.swift in Sources */, - CE7DAD64CE27C4B98432BDB1CB0E21C7 /* Dog.swift in Sources */, - 2308448E8874D3DAA33A1AEFEFCFBA2D /* Extensions.swift in Sources */, - 8955A9B8A34594437C8D27C4C55BFC9E /* FormatTest.swift in Sources */, - AA38773839F0E81980834A7A374BA9DC /* InlineResponse200.swift in Sources */, - 10E93502CF9CED0B6341DB95B658F2F9 /* Model200Response.swift in Sources */, - 7DAC8F56FC00F6400AC3BF3AF79ACAFD /* ModelReturn.swift in Sources */, - 5EECE3F98893B2D4E03DC027C57C21F3 /* Models.swift in Sources */, - D1E26E1C25F870E9A0AEC9240E589D75 /* Name.swift in Sources */, - 623677B20997F5EC0F6CA695CADD410B /* ObjectReturn.swift in Sources */, - F4448E76D51EBACC2B20CDFE3D2D90D7 /* Order.swift in Sources */, - E3AB1EE3B8DECE5D55D9EB64B0D05E93 /* Pet.swift in Sources */, - F3D3D4088EDA3359CC0E5EBA9B683959 /* PetAPI.swift in Sources */, - 92EEF6DC60C3CA25AA3997D2652A28F9 /* PetstoreClient-dummy.m in Sources */, - 14FD108A5B931460A799BDCB874A99C3 /* SpecialModelName.swift in Sources */, - 41C531C4CEDCAE196A6F92FEAE66CCF3 /* StoreAPI.swift in Sources */, - B9096C0EE89EC783BDDC77E1F07314E4 /* Tag.swift in Sources */, - 895CB65D12461DA4EA243ACE8346D21F /* User.swift in Sources */, - 0B0F79070CD75DE3CF053E58B491A3AC /* UserAPI.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 91F4D6732A1613C9660866E34445A67B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -946,48 +948,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - E0A9A1079F8923D78CC7F6D7F87CD779 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2DF2D3E610EB6F19375570C0EBA9E77F /* after.m in Sources */, - B0AB13A8C68D6972CEDF64FB39D38CB4 /* after.swift in Sources */, - E1EB5507436EFBD58AF7B9FF051A5AC4 /* afterlife.swift in Sources */, - BEE4B5067218AB107DDECC8B09569EFC /* AnyPromise.m in Sources */, - 38FE2977C973FA258977E86E1E964E02 /* AnyPromise.swift in Sources */, - BC9F5678D442E5AA1B14083554B7B1C8 /* CALayer+AnyPromise.m in Sources */, - 9E7DA5C2386E5EA1D57B8C9A38D0A509 /* dispatch_promise.m in Sources */, - A5EBC0528F4371B43BFA5A2293089BB5 /* dispatch_promise.swift in Sources */, - F4E24EB57CB59F112060100A4B9E5D10 /* Error.swift in Sources */, - D39F4FBEE42A57E59471B2A0997FE4CF /* hang.m in Sources */, - 7CE6DE14AB43CB51B4D5C5BA4293C47B /* join.m in Sources */, - 72B2C8A6E81C1E99E6093BE3BDBDE554 /* join.swift in Sources */, - 445F515F4FAB3537878E1377562BBBA7 /* NSNotificationCenter+AnyPromise.m in Sources */, - F4C2BD51185019A010DA83458B007F81 /* NSNotificationCenter+Promise.swift in Sources */, - 8809E3D6CC478B4AC9FA6C2389A5447F /* NSObject+Promise.swift in Sources */, - 8C749DAB8EA0585A7A5769F38CB33CBC /* NSURLConnection+AnyPromise.m in Sources */, - 7120EA2BF0D3942FF9CE0EDABBF86BA1 /* NSURLConnection+Promise.swift in Sources */, - BCCC0421EE641F782CA295FBD240E2E1 /* NSURLSession+Promise.swift in Sources */, - 82BEAE7085889DB1A860FE690273EA7E /* PMKAlertController.swift in Sources */, - D839A38DEEDDB887F186714D75E73431 /* Promise+Properties.swift in Sources */, - 994580EAAB3547FFCA0E969378A7AC2E /* Promise.swift in Sources */, - 5E46AC6FA35723E095C2EB6ED23C0510 /* PromiseKit-dummy.m in Sources */, - 81970BD13A497C0962CBEA922C1DAB3E /* race.swift in Sources */, - D2C7190FC2A0F2868EB7C89F5CFA526B /* State.swift in Sources */, - D57DA5AC37CE3CEA92958C9528F80FD9 /* UIActionSheet+AnyPromise.m in Sources */, - AC6DCF4BF95F44A46CF6BC9230AD6604 /* UIActionSheet+Promise.swift in Sources */, - 655C3826275A76D04835F2336AC87A91 /* UIAlertView+AnyPromise.m in Sources */, - 5FDCAFE73B791C4A4B863C9D65F6CF7B /* UIAlertView+Promise.swift in Sources */, - FF5CD62C722D6A68AD65462B56D7CB72 /* UIView+AnyPromise.m in Sources */, - 660435DF96CE68B3A3E078030C5F54FA /* UIView+Promise.swift in Sources */, - C5EEED0AFF5E2C5AAE2A646689B73DA3 /* UIViewController+AnyPromise.m in Sources */, - 7D38A3624822DA504D0FBD9F4EA485BA /* UIViewController+Promise.swift in Sources */, - B2C0216914777E4B58E1827D854886C2 /* URLDataPromise.swift in Sources */, - 1A4D55F76DCB3489302BC425F4DB1C04 /* when.m in Sources */, - DCFE64070EE0BB77557935AD2A4ABF62 /* when.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; EF659EFF40D426A3A32A82CDB98CC6EE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1016,19 +976,13 @@ 2673248EF608AB8375FABCFDA8141072 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = PetstoreClient; - target = 57958C5706F810052A634C1714567A9F /* PetstoreClient */; + target = 2FD913B4E24277823983BABFDB071664 /* PetstoreClient */; targetProxy = 014385BD85FA83B60A03ADE9E8844F33 /* PBXContainerItemProxy */; }; - 38BE3993D1A8CA768731BA0465C21F17 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PromiseKit; - target = D9A01D449983C8E3EF61C0CA4A7D8F59 /* PromiseKit */; - targetProxy = EEB067570D28F14A138B737F596BCB1A /* PBXContainerItemProxy */; - }; 5433AD51A3DC696530C96B8A7D78ED7D /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = PromiseKit; - target = D9A01D449983C8E3EF61C0CA4A7D8F59 /* PromiseKit */; + target = 25EDA9CFC641C69402B3857A2C4A39F0 /* PromiseKit */; targetProxy = B5FB8931CDF8801206EDD2FEF94793BF /* PBXContainerItemProxy */; }; 64142DAEC5D96F7E876BBE00917C0E9D /* PBXTargetDependency */ = { @@ -1037,17 +991,11 @@ target = 432ECC54282C84882B482CCB4CF227FC /* Alamofire */; targetProxy = 769630CDAAA8C24AA5B4C81A85C45AC8 /* PBXContainerItemProxy */; }; - A48A5E27A5C878B373F0FE7365829141 /* PBXTargetDependency */ = { + C893B48B47F4A7541102DAAFECFC50F2 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = OMGHTTPURLRQ; target = 190ACD3A51BC90B85EADB13E9CDD207B /* OMGHTTPURLRQ */; - targetProxy = 23252B1F29F10BD972ECD7BA34F20EA8 /* PBXContainerItemProxy */; - }; - F6093ED00F5D11A44F55549F1A4C778F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Alamofire; - target = 432ECC54282C84882B482CCB4CF227FC /* Alamofire */; - targetProxy = 56AF0748FFC13AD34ECC967C04930EF8 /* PBXContainerItemProxy */; + targetProxy = 8059767A82D94C9F7F7C16D030819C4E /* PBXContainerItemProxy */; }; F74DEE1C89F05CC835997330B0E3B7C1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -1055,6 +1003,18 @@ target = 190ACD3A51BC90B85EADB13E9CDD207B /* OMGHTTPURLRQ */; targetProxy = 9AD20158D23CE70A2A91E5B7859090C3 /* PBXContainerItemProxy */; }; + FAC5685F6C40E5D74404831646CBC453 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = PromiseKit; + target = 25EDA9CFC641C69402B3857A2C4A39F0 /* PromiseKit */; + targetProxy = ECAC5E4454026C822004659466983ADD /* PBXContainerItemProxy */; + }; + FC9E3FF49D9B636B2925749B2D51A5D3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Alamofire; + target = 432ECC54282C84882B482CCB4CF227FC /* Alamofire */; + targetProxy = 4BED27A854EA6600536518D29BBB3670 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -1085,6 +1045,33 @@ }; name = Release; }; + 10966F49AC953FB6BFDCBF072AF5B251 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = DADAB10704E49D6B9E18F59F995BB88F /* PetstoreClient.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/PetstoreClient/PetstoreClient-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/PetstoreClient/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/PetstoreClient/PetstoreClient.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = PetstoreClient; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; 1361791756A3908370041AE99E5CF772 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 977577C045EDA9D9D1F46E2598D19FC7 /* Pods.debug.xcconfig */; @@ -1171,34 +1158,7 @@ }; name = Release; }; - 6FD241CD58AB51A79661DD6FAEA92DBD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DADAB10704E49D6B9E18F59F995BB88F /* PetstoreClient.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_PREFIX_HEADER = "Target Support Files/PetstoreClient/PetstoreClient-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/PetstoreClient/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/PetstoreClient/PetstoreClient.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = PetstoreClient; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 80A78EC79E146B38BA17527C9588FE35 /* Release */ = { + 7B7ACBE5930AD378A2346DC89BAD1027 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = CC49FF2A84C0E0E9349747D94036B728 /* PromiseKit.xcconfig */; buildSettings = { @@ -1215,15 +1175,16 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = "Target Support Files/PromiseKit/PromiseKit.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; + MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_NAME = PromiseKit; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; + name = Debug; }; 819D3D3D508154D9CFF3CE30C13E000E /* Debug */ = { isa = XCBuildConfiguration; @@ -1291,35 +1252,7 @@ }; name = Debug; }; - AE41315F8FBD1AB94C4250498DEAAFE5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = CC49FF2A84C0E0E9349747D94036B728 /* PromiseKit.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_PREFIX_HEADER = "Target Support Files/PromiseKit/PromiseKit-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/PromiseKit/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/PromiseKit/PromiseKit.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = PromiseKit; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - BA9437D357EA08C2BE7C3B5F7555E7E7 /* Debug */ = { + 94652EA7B5323CE393BCE396E7262170 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = DADAB10704E49D6B9E18F59F995BB88F /* PetstoreClient.xcconfig */; buildSettings = { @@ -1347,6 +1280,33 @@ }; name = Debug; }; + ADB2280332CE02FCD777CC987CD4E28A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CC49FF2A84C0E0E9349747D94036B728 /* PromiseKit.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/PromiseKit/PromiseKit-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/PromiseKit/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/PromiseKit/PromiseKit.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = PromiseKit; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; C5A18280E9321A9268D1C80B7DA43967 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1414,6 +1374,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 03DDC7D7BA248863E8493F462ABAD118 /* Build configuration list for PBXNativeTarget "PromiseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7B7ACBE5930AD378A2346DC89BAD1027 /* Debug */, + ADB2280332CE02FCD777CC987CD4E28A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1450,20 +1419,11 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - C36F9DFB9BBE472AD46194868C8F885B /* Build configuration list for PBXNativeTarget "PetstoreClient" */ = { + B5E28E2093F917340AF5AAA0FCE5E37D /* Build configuration list for PBXNativeTarget "PetstoreClient" */ = { isa = XCConfigurationList; buildConfigurations = ( - BA9437D357EA08C2BE7C3B5F7555E7E7 /* Debug */, - 6FD241CD58AB51A79661DD6FAEA92DBD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - FCAE2E57B1A9453B9D35EF9071C4C581 /* Build configuration list for PBXNativeTarget "PromiseKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AE41315F8FBD1AB94C4250498DEAAFE5 /* Debug */, - 80A78EC79E146B38BA17527C9588FE35 /* Release */, + 94652EA7B5323CE393BCE396E7262170 /* Debug */, + 10966F49AC953FB6BFDCBF072AF5B251 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/samples/client/petstore/swift/git_push.sh b/samples/client/petstore/swift/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/swift/git_push.sh +++ b/samples/client/petstore/swift/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi From 3346c84a1fa9ed44516e7d8f0b7ade16eaf283aa Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 18:23:08 +0800 Subject: [PATCH 090/170] better enum support for typescript --- .../AbstractTypeScriptClientCodegen.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index a5e62fc30535..b5ac095e573d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -231,4 +231,59 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp } } + + @Override + public String toEnumValue(String value, String datatype) { + if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) { + return value; + } else { + return "\'" + escapeText(value) + "\'"; + } + } + + @Override + public String toEnumDefaultValue(String value, String datatype) { + return datatype + "_" + value; + } + + @Override + public String toEnumVarName(String name, String datatype) { + // number + if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) { + String varName = new String(name); + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); + return varName; + } + + // string + String enumName = sanitizeName(underscore(name).toUpperCase()); + enumName = enumName.replaceFirst("^_", ""); + enumName = enumName.replaceFirst("_$", ""); + + if (enumName.matches("\\d.*")) { // starts with number + return "_" + enumName; + } else { + return enumName; + } + } + + @Override + public String toEnumName(CodegenProperty property) { + String enumName = toModelName(property.name) + "Enum"; + + if (enumName.matches("\\d.*")) { // starts with number + return "_" + enumName; + } else { + return enumName; + } + } + + @Override + public Map postProcessModels(Map objs) { + // process enum in models + return postProcessModelsEnum(objs); + } + } From bfdd49a2b2855c0f554f77f85d520df5121d5363 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 18:24:00 +0800 Subject: [PATCH 091/170] add new JS enum mustache template --- .../partial_model_enum_class.mustache | 24 ++++ .../Javascript/partial_model_generic.mustache | 103 ++++++++++++++++++ .../partial_model_inner_enum.mustache | 21 ++++ 3 files changed, 148 insertions(+) create mode 100644 modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache create mode 100644 modules/swagger-codegen/src/main/resources/Javascript/partial_model_generic.mustache create mode 100644 modules/swagger-codegen/src/main/resources/Javascript/partial_model_inner_enum.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache new file mode 100644 index 000000000000..c7d18d358414 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache @@ -0,0 +1,24 @@ +{{#emitJSDoc}} + /** + * Enum class {{classname}}. + * @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%> + * @readonly + */ +{{/emitJSDoc}} + exports.{{classname}} = { + {{#allowableValues}} + {{#values}} +{{#emitJSDoc}} + /** + * value: {{{.}}} + * @const + */ +{{/emitJSDoc}} + "{{{.}}}": "{{{.}}}"{{^-last}}, + {{/-last}} + {{/values}} + {{/allowableValues}} + }; + + return exports; +})); diff --git a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_generic.mustache b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_generic.mustache new file mode 100644 index 000000000000..d8a9d250a4a2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_generic.mustache @@ -0,0 +1,103 @@ + +{{#models}}{{#model}} +{{#emitJSDoc}} + /** + * The {{classname}} model module. + * @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} + * @version {{projectVersion}} + */ + + /** + * Constructs a new {{classname}}.{{#description}} + * {{description}}{{/description}} + * @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}} + * @class{{#useInheritance}}{{#parent}} + * @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}} + * @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}} + * @param {{.}}{{/vendorExtensions.x-all-required}} + */ +{{/emitJSDoc}} + var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) { + var _this = this; +{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array(); + Object.setPrototypeOf(_this, exports); +{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}} +{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}}); +{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}} +{{/vars}}{{#parent}}{{^parentModel}} return _this; +{{/parentModel}}{{/parent}} }; + +{{#emitJSDoc}} + /** + * Constructs a {{classname}} from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> obj Optional instance to populate. + * @return {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> The populated {{classname}} instance. + */ +{{/emitJSDoc}} + exports.constructFromObject = function(data, obj) { + if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} { + obj = obj || new exports(); +{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, {{vendorExtensions.x-itemType}}); +{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}} +{{#interfaces}} {{.}}.constructFromObject(data, obj); +{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) { + obj['{{baseName}}']{{{defaultValueWithParam}}} + } +{{/vars}} } + return obj; + } +{{#useInheritance}}{{#parentModel}} + exports.prototype = Object.create({{classname}}.prototype); + exports.prototype.constructor = exports; +{{/parentModel}}{{/useInheritance}} +{{#vars}} +{{#emitJSDoc}} + /**{{#description}} + * {{{description}}}{{/description}} + * @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}} + * @default {{{defaultValue}}}{{/defaultValue}} + */ +{{/emitJSDoc}} + exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}}; +{{/vars}}{{#useInheritance}}{{#interfaceModels}} + // Implement {{classname}} interface:{{#allVars}} +{{#emitJSDoc}} + /**{{#description}} + * {{{description}}}{{/description}} + * @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}} + * @default {{{defaultValue}}}{{/defaultValue}} + */ +{{/emitJSDoc}} +exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}}; +{{/allVars}}{{/interfaceModels}}{{/useInheritance}} +{{#emitModelMethods}}{{#vars}} +{{#emitJSDoc}} + /**{{#description}} + * Returns {{{description}}}{{/description}}{{#minimum}} + * minimum: {{minimum}}{{/minimum}}{{#maximum}} + * maximum: {{maximum}}{{/maximum}} + * @return {{{vendorExtensions.x-jsdoc-type}}} + */ +{{/emitJSDoc}} + exports.prototype.{{getter}} = function() { + return this['{{baseName}}']; + } + +{{#emitJSDoc}} + /**{{#description}} + * Sets {{{description}}}{{/description}} + * @param {{{vendorExtensions.x-jsdoc-type}}} {{name}}{{#description}} {{{description}}}{{/description}} + */ +{{/emitJSDoc}} + exports.prototype.{{setter}} = function({{name}}) { + this['{{baseName}}'] = {{name}}; + } + +{{/vars}}{{/emitModelMethods}} +{{#vars}}{{#isEnum}}{{>partial_model_inner_enum}}{{/isEnum}}{{#items.isEnum}}{{#items}} +{{>partial_model_inner_enum}}{{/items}}*/{{/items.isEnum}}{{/vars}} + + return exports; +{{/model}}{{/models}}})); diff --git a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_inner_enum.mustache b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_inner_enum.mustache new file mode 100644 index 000000000000..a8b981316d1c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_inner_enum.mustache @@ -0,0 +1,21 @@ +{{#emitJSDoc}} + /** + * Allowed values for the {{baseName}} property. + * @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%> + * @readonly + */ +{{/emitJSDoc}} + exports.{{datatypeWithEnum}} = { + {{#allowableValues}} + {{#enumVars}} +{{#emitJSDoc}} + /** + * value: {{{value}}} + * @const + */ +{{/emitJSDoc}} + "{{name}}": {{{value}}}{{^-last}}, + {{/-last}} + {{/enumVars}} + {{/allowableValues}} + }; From 2c41451b67f8eb864fa43a4ff92e30c1c7c46244 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 3 May 2016 18:24:25 +0800 Subject: [PATCH 092/170] add new java file for enum mustache template --- .../libraries/common/modelInnerEnum.mustache | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/common/modelInnerEnum.mustache diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/common/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/common/modelInnerEnum.mustache new file mode 100644 index 000000000000..30ebf3febb61 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/common/modelInnerEnum.mustache @@ -0,0 +1,20 @@ + /** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{{name}}}({{{value}}}){{^-last}}, + + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{datatype}} value; + + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + } From 9604257649375abdc60673d584883389db1502ec Mon Sep 17 00:00:00 2001 From: diyfr Date: Tue, 3 May 2016 13:45:31 +0200 Subject: [PATCH 093/170] #2742 Issue multiple methods if use multi tags --- .../languages/SpringMVCServerCodegen.java | 50 ++++++++++++++++++- .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 2 +- .../main/java/io/swagger/api/StoreApi.java | 2 +- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../swagger/configuration/SwaggerConfig.java | 2 +- .../configuration/SwaggerUiConfiguration.java | 2 +- .../swagger/configuration/WebApplication.java | 2 +- .../configuration/WebMvcConfiguration.java | 2 +- .../main/java/io/swagger/model/Category.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 2 +- .../main/java/io/swagger/api/StoreApi.java | 2 +- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../swagger/configuration/SwaggerConfig.java | 2 +- .../configuration/SwaggerUiConfiguration.java | 2 +- .../swagger/configuration/WebApplication.java | 2 +- .../configuration/WebMvcConfiguration.java | 2 +- .../main/java/io/swagger/model/Category.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 33 files changed, 80 insertions(+), 34 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java index 41d17a3e8071..8bd7e3c1f8e7 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java @@ -2,11 +2,12 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; import io.swagger.models.Operation; - +import io.swagger.models.Path; +import io.swagger.models.Swagger; import java.io.File; import java.util.*; -public class SpringMVCServerCodegen extends JavaClientCodegen { +public class SpringMVCServerCodegen extends JavaClientCodegen implements CodegenConfig{ public static final String CONFIG_PACKAGE = "configPackage"; protected String title = "Petstore Server"; protected String configPackage = ""; @@ -120,6 +121,51 @@ public class SpringMVCServerCodegen extends JavaClientCodegen { opList.add(co); co.baseName = basePath; } + + @Override + public void preprocessSwagger(Swagger swagger) { + System.out.println("preprocessSwagger"); + if ("/".equals(swagger.getBasePath())) { + swagger.setBasePath(""); + } + + String host = swagger.getHost(); + String port = "8080"; + if (host != null) { + String[] parts = host.split(":"); + if (parts.length > 1) { + port = parts[1]; + } + } + + this.additionalProperties.put("serverPort", port); + if (swagger != null && swagger.getPaths() != null) { + for (String pathname : swagger.getPaths().keySet()) { + Path path = swagger.getPath(pathname); + if (path.getOperations() != null) { + for (Operation operation : path.getOperations()) { + if (operation.getTags() != null) { + List> tags = new ArrayList>(); + for (String tag : operation.getTags()) { + Map value = new HashMap(); + value.put("tag", tag); + value.put("hasMore", "true"); + tags.add(value); + } + if (tags.size() > 0) { + tags.get(tags.size() - 1).remove("hasMore"); + } + if (operation.getTags().size() > 0) { + String tag = operation.getTags().get(0); + operation.setTags(Arrays.asList(tag)); + } + operation.setVendorExtension("x-tags", tags); + } + } + } + } + } + } @Override public Map postProcessOperations(Map objs) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java index 7fa9d6b24cca..608a7957017e 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java index 12e868926e9b..0a2894d0be4f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java index a9baf798c662..9bc56631d292 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java index af4fba572837..72ca217e7c08 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index bc264595a443..c3d4887b35f9 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java index 5b4e2ae6aefd..4eb6c73849a8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index 5ef98712f286..b24082923dc3 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -34,7 +34,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java index 87096d412607..5004845542f5 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index f2cb3004e64c..6b3b305942f5 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java index 48bad4bb263b..7e437ae6b148 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index 64f96fe37f32..40f8a10a4381 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index 850c801606e4..18f08f895e14 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index 72ed79b768bb..738a9e81f960 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index aca7ff86695e..26e4d3c529e1 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -14,7 +14,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index d688eb2ee021..2f39f45a1f8e 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index 9a4778315690..eee7800acbf8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:30.859+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:42:56.594+02:00") public class User { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java index 25f2efe14cd6..b83f1890525b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java index ccc0cbbb7aae..9b91bee0559b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java index 2b007cb749a2..1e34ed21964c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java index 9ec36e8ab356..8adb7dfcdecf 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index f50ce573df59..b4520b2b5786 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index 254d8822b5c8..48085e9dda1f 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index a87eed542e2f..235ccbfb0afb 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -31,7 +31,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java index e55006ed86e3..7d5f58101ac4 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index bd977dde85d5..ebae7c559ae3 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java index dd1da23da947..c672d78518c5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index e4f224f59473..047f95c58f90 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index bae60f19a802..be118387fb56 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index 9787055aa3a6..b0cc5d7b558d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index 3948dba37dac..aabd1a9be1be 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index 5547993d18a4..df87b351c309 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 448ba1dceecd..8458048efc24 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-28T15:08:37.024+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-05-03T13:43:02.966+02:00") public class User { private Long id = null; From 0ce6fd7b3626f7359aed33b4f735c9e34304a05c Mon Sep 17 00:00:00 2001 From: kolyjjj Date: Tue, 3 May 2016 22:18:43 +0800 Subject: [PATCH 094/170] [koly] update swagger tools to 0.10.1 --- .../swagger-codegen/src/main/resources/nodejs/package.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/nodejs/package.mustache b/modules/swagger-codegen/src/main/resources/nodejs/package.mustache index 86aa21af6356..2d2b917c4b25 100644 --- a/modules/swagger-codegen/src/main/resources/nodejs/package.mustache +++ b/modules/swagger-codegen/src/main/resources/nodejs/package.mustache @@ -11,6 +11,6 @@ "dependencies": { "connect": "^3.2.0", "js-yaml": "^3.3.0", - "swagger-tools": "0.9.*" + "swagger-tools": "0.10.1" } } From a5b08a8ce7894a26d45727e8a99647e98ca59be2 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Tue, 3 May 2016 10:16:47 -0700 Subject: [PATCH 095/170] fixed merge conflict --- .../src/main/resources/go/api.mustache | 8 +-- .../client/petstore/go/go-petstore/README.md | 2 +- .../client/petstore/go/go-petstore/pet_api.go | 64 +++++++++--------- .../petstore/go/go-petstore/store_api.go | 30 ++++----- .../petstore/go/go-petstore/user_api.go | 66 +++++++++---------- 5 files changed, 85 insertions(+), 85 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 6ca3a39324f4..cd32f831d716 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -37,7 +37,7 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}} { {{#allParams}} * @param {{paramName}} {{description}} {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ -func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}APIResponse, error) { +func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}*{{{returnType}}}, {{/returnType}}*APIResponse, error) { var httpMethod = "{{httpMethod}}" // create path and map variables @@ -46,7 +46,7 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{ {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if &{{paramName}} == nil { - return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + return {{#returnType}}new({{{returnType}}}), {{/returnType}}nil, errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") }{{/required}}{{/allParams}} headerParams := make(map[string]string) @@ -113,10 +113,10 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{ {{#returnType}} var successPayload = new({{returnType}}){{/returnType}} httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err + return {{#returnType}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err } {{#returnType}} err = json.Unmarshal(httpResponse.Body(), &successPayload){{/returnType}} - return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err + return {{#returnType}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err } {{/operation}}{{/operations}} diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index 9130ec599b62..9f725fb007b9 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-02T15:51:26.331+01:00 +- Build date: 2016-05-03T10:14:09.589-07:00 - Build package: class io.swagger.codegen.languages.GoClientCodegen ## Installation diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index 0e252159fd02..c5eb1f7ef3e4 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -36,7 +36,7 @@ func NewPetApiWithBasePath(basePath string) *PetApi { * @param body Pet object that needs to be added to the store * @return void */ -func (a PetApi) AddPet(body Pet) (APIResponse, error) { +func (a PetApi) AddPet(body Pet) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -44,7 +44,7 @@ func (a PetApi) AddPet(body Pet) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->AddPet") + return nil, errors.New("Missing required parameter 'body' when calling PetApi->AddPet") } headerParams := make(map[string]string) @@ -89,10 +89,10 @@ func (a PetApi) AddPet(body Pet) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -103,7 +103,7 @@ func (a PetApi) AddPet(body Pet) (APIResponse, error) { * @param apiKey * @return void */ -func (a PetApi) DeletePet(petId int64, apiKey string) (APIResponse, error) { +func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -112,7 +112,7 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (APIResponse, error) { // verify the required parameter 'petId' is set if &petId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") + return nil, errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") } headerParams := make(map[string]string) @@ -158,10 +158,10 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -171,7 +171,7 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (APIResponse, error) { * @param status Status values that need to be considered for filter * @return []Pet */ -func (a PetApi) FindPetsByStatus(status []string) ([]Pet, APIResponse, error) { +func (a PetApi) FindPetsByStatus(status []string) (*[]Pet, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -179,7 +179,7 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, APIResponse, error) { // verify the required parameter 'status' is set if &status == nil { - return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") + return new([]Pet), nil, errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") } headerParams := make(map[string]string) @@ -224,10 +224,10 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, APIResponse, error) { var successPayload = new([]Pet) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -237,7 +237,7 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, APIResponse, error) { * @param tags Tags to filter by * @return []Pet */ -func (a PetApi) FindPetsByTags(tags []string) ([]Pet, APIResponse, error) { +func (a PetApi) FindPetsByTags(tags []string) (*[]Pet, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -245,7 +245,7 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, APIResponse, error) { // verify the required parameter 'tags' is set if &tags == nil { - return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") + return new([]Pet), nil, errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") } headerParams := make(map[string]string) @@ -290,10 +290,10 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, APIResponse, error) { var successPayload = new([]Pet) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -303,7 +303,7 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, APIResponse, error) { * @param petId ID of pet to return * @return Pet */ -func (a PetApi) GetPetById(petId int64) (Pet, APIResponse, error) { +func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -312,7 +312,7 @@ func (a PetApi) GetPetById(petId int64) (Pet, APIResponse, error) { // verify the required parameter 'petId' is set if &petId == nil { - return *new(Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") + return new(Pet), nil, errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") } headerParams := make(map[string]string) @@ -353,10 +353,10 @@ func (a PetApi) GetPetById(petId int64) (Pet, APIResponse, error) { var successPayload = new(Pet) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -366,7 +366,7 @@ func (a PetApi) GetPetById(petId int64) (Pet, APIResponse, error) { * @param body Pet object that needs to be added to the store * @return void */ -func (a PetApi) UpdatePet(body Pet) (APIResponse, error) { +func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) { var httpMethod = "Put" // create path and map variables @@ -374,7 +374,7 @@ func (a PetApi) UpdatePet(body Pet) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") + return nil, errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") } headerParams := make(map[string]string) @@ -419,10 +419,10 @@ func (a PetApi) UpdatePet(body Pet) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -434,7 +434,7 @@ func (a PetApi) UpdatePet(body Pet) (APIResponse, error) { * @param status Updated status of the pet * @return void */ -func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (APIResponse, error) { +func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -443,7 +443,7 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (APIR // verify the required parameter 'petId' is set if &petId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") + return nil, errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") } headerParams := make(map[string]string) @@ -488,10 +488,10 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (APIR httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -503,7 +503,7 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (APIR * @param file file to upload * @return ModelApiResponse */ -func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (ModelApiResponse, APIResponse, error) { +func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (*ModelApiResponse, *APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -512,7 +512,7 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File // verify the required parameter 'petId' is set if &petId == nil { - return *new(ModelApiResponse), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") + return new(ModelApiResponse), nil, errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") } headerParams := make(map[string]string) @@ -559,9 +559,9 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File var successPayload = new(ModelApiResponse) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index d28483051141..53aafd569aa8 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -34,7 +34,7 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi { * @param orderId ID of the order that needs to be deleted * @return void */ -func (a StoreApi) DeleteOrder(orderId string) (APIResponse, error) { +func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -43,7 +43,7 @@ func (a StoreApi) DeleteOrder(orderId string) (APIResponse, error) { // verify the required parameter 'orderId' is set if &orderId == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") + return nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") } headerParams := make(map[string]string) @@ -80,10 +80,10 @@ func (a StoreApi) DeleteOrder(orderId string) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -92,7 +92,7 @@ func (a StoreApi) DeleteOrder(orderId string) (APIResponse, error) { * * @return map[string]int32 */ -func (a StoreApi) GetInventory() (map[string]int32, APIResponse, error) { +func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -136,10 +136,10 @@ func (a StoreApi) GetInventory() (map[string]int32, APIResponse, error) { var successPayload = new(map[string]int32) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -149,7 +149,7 @@ func (a StoreApi) GetInventory() (map[string]int32, APIResponse, error) { * @param orderId ID of pet that needs to be fetched * @return Order */ -func (a StoreApi) GetOrderById(orderId int64) (Order, APIResponse, error) { +func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -158,7 +158,7 @@ func (a StoreApi) GetOrderById(orderId int64) (Order, APIResponse, error) { // verify the required parameter 'orderId' is set if &orderId == nil { - return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") + return new(Order), nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") } headerParams := make(map[string]string) @@ -195,10 +195,10 @@ func (a StoreApi) GetOrderById(orderId int64) (Order, APIResponse, error) { var successPayload = new(Order) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -208,7 +208,7 @@ func (a StoreApi) GetOrderById(orderId int64) (Order, APIResponse, error) { * @param body order placed for purchasing the pet * @return Order */ -func (a StoreApi) PlaceOrder(body Order) (Order, APIResponse, error) { +func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -216,7 +216,7 @@ func (a StoreApi) PlaceOrder(body Order) (Order, APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") + return new(Order), nil, errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") } headerParams := make(map[string]string) @@ -256,9 +256,9 @@ func (a StoreApi) PlaceOrder(body Order) (Order, APIResponse, error) { var successPayload = new(Order) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index ce23df39d690..e096fd506ec0 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -34,7 +34,7 @@ func NewUserApiWithBasePath(basePath string) *UserApi { * @param body Created user object * @return void */ -func (a UserApi) CreateUser(body User) (APIResponse, error) { +func (a UserApi) CreateUser(body User) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -42,7 +42,7 @@ func (a UserApi) CreateUser(body User) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") + return nil, errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") } headerParams := make(map[string]string) @@ -82,10 +82,10 @@ func (a UserApi) CreateUser(body User) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -95,7 +95,7 @@ func (a UserApi) CreateUser(body User) (APIResponse, error) { * @param body List of user object * @return void */ -func (a UserApi) CreateUsersWithArrayInput(body []User) (APIResponse, error) { +func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -103,7 +103,7 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") + return nil, errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") } headerParams := make(map[string]string) @@ -143,10 +143,10 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -156,7 +156,7 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (APIResponse, error) { * @param body List of user object * @return void */ -func (a UserApi) CreateUsersWithListInput(body []User) (APIResponse, error) { +func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -164,7 +164,7 @@ func (a UserApi) CreateUsersWithListInput(body []User) (APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") + return nil, errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") } headerParams := make(map[string]string) @@ -204,10 +204,10 @@ func (a UserApi) CreateUsersWithListInput(body []User) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -217,7 +217,7 @@ func (a UserApi) CreateUsersWithListInput(body []User) (APIResponse, error) { * @param username The name that needs to be deleted * @return void */ -func (a UserApi) DeleteUser(username string) (APIResponse, error) { +func (a UserApi) DeleteUser(username string) (*APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -226,7 +226,7 @@ func (a UserApi) DeleteUser(username string) (APIResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") + return nil, errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") } headerParams := make(map[string]string) @@ -263,10 +263,10 @@ func (a UserApi) DeleteUser(username string) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -276,7 +276,7 @@ func (a UserApi) DeleteUser(username string) (APIResponse, error) { * @param username The name that needs to be fetched. Use user1 for testing. * @return User */ -func (a UserApi) GetUserByName(username string) (User, APIResponse, error) { +func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -285,7 +285,7 @@ func (a UserApi) GetUserByName(username string) (User, APIResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *new(User), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") + return new(User), nil, errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") } headerParams := make(map[string]string) @@ -322,10 +322,10 @@ func (a UserApi) GetUserByName(username string) (User, APIResponse, error) { var successPayload = new(User) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -336,7 +336,7 @@ func (a UserApi) GetUserByName(username string) (User, APIResponse, error) { * @param password The password for login in clear text * @return string */ -func (a UserApi) LoginUser(username string, password string) (string, APIResponse, error) { +func (a UserApi) LoginUser(username string, password string) (*string, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -344,11 +344,11 @@ func (a UserApi) LoginUser(username string, password string) (string, APIRespons // verify the required parameter 'username' is set if &username == nil { - return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") + return new(string), nil, errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") } // verify the required parameter 'password' is set if &password == nil { - return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") + return new(string), nil, errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") } headerParams := make(map[string]string) @@ -391,10 +391,10 @@ func (a UserApi) LoginUser(username string, password string) (string, APIRespons var successPayload = new(string) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -403,7 +403,7 @@ func (a UserApi) LoginUser(username string, password string) (string, APIRespons * * @return void */ -func (a UserApi) LogoutUser() (APIResponse, error) { +func (a UserApi) LogoutUser() (*APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -444,10 +444,10 @@ func (a UserApi) LogoutUser() (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } /** @@ -458,7 +458,7 @@ func (a UserApi) LogoutUser() (APIResponse, error) { * @param body Updated user object * @return void */ -func (a UserApi) UpdateUser(username string, body User) (APIResponse, error) { +func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) { var httpMethod = "Put" // create path and map variables @@ -467,11 +467,11 @@ func (a UserApi) UpdateUser(username string, body User) (APIResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") + return nil, errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") } // verify the required parameter 'body' is set if &body == nil { - return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") + return nil, errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") } headerParams := make(map[string]string) @@ -511,9 +511,9 @@ func (a UserApi) UpdateUser(username string, body User) (APIResponse, error) { httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } - return *NewAPIResponse(httpResponse.RawResponse), err + return NewAPIResponse(httpResponse.RawResponse), err } From 035ee18ba4bed8cef113711eabb00c13c7d615fd Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Tue, 3 May 2016 10:27:27 -0700 Subject: [PATCH 096/170] fixed testing issue --- samples/client/petstore/go/pet_api_test.go | 39 +++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/samples/client/petstore/go/pet_api_test.go b/samples/client/petstore/go/pet_api_test.go index 8b996dea85fc..be240b5268e3 100644 --- a/samples/client/petstore/go/pet_api_test.go +++ b/samples/client/petstore/go/pet_api_test.go @@ -18,8 +18,8 @@ func TestAddPet(t *testing.T) { t.Errorf("Error while adding pet") t.Log(err) } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) + if *apiResponse.Response.StatusCode != 200 { + t.Log(*apiResponse.Response) } } @@ -32,8 +32,8 @@ func TestFindPetsByStatusWithMissingParam(t *testing.T) { t.Errorf("Error while testing TestFindPetsByStatusWithMissingParam") t.Log(err) } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse) + if *apiResponse.Response.StatusCode != 200 { + t.Log(*apiResponse) } } @@ -52,8 +52,8 @@ func TestGetPetById(t *testing.T) { //t.Log(resp) } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) + if *apiResponse.Response.StatusCode != 200 { + t.Log(*apiResponse.Response) } } @@ -67,8 +67,8 @@ func TestGetPetByIdWithInvalidID(t *testing.T) { } else { t.Log(resp) } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) + if *apiResponse.Response.StatusCode != 200 { + t.Log(*apiResponse.Response) } } @@ -79,29 +79,29 @@ func TestUpdatePetWithForm(t *testing.T) { if err != nil { t.Errorf("Error while updating pet by id") t.Log(err) - t.Log(apiResponse) + t.Log(*apiResponse) } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) + if *apiResponse.Response.StatusCode != 200 { + t.Log(*apiResponse.Response) } } func TestFindPetsByStatus(t *testing.T) { s := sw.NewPetApi() - resp, apiResponse, err := s.FindPetsByStatus([]string {"pending"}) + resp, apiResponse, err := s.FindPetsByStatus([]string {"available"}) if err != nil { t.Errorf("Error while getting pet by id") t.Log(err) - t.Log(apiResponse) + t.Log(*apiResponse) } else { - t.Log(apiResponse) + t.Log(*apiResponse) if len(*resp) == 0 { t.Errorf("Error no pets returned") } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) - } + if *apiResponse.Response.StatusCode != 200 { + t.Log(*apiResponse.Response) + } } } @@ -115,7 +115,8 @@ func TestUploadFile(t *testing.T) { t.Errorf("Error while uploading file") t.Log(err) } - if apiResponse.Response.StatusCode != 200 { + + if *apiResponse.Response.StatusCode != 200 { t.Log(apiResponse.Response) } } @@ -128,7 +129,7 @@ func TestDeletePet(t *testing.T) { t.Errorf("Error while deleting pet by id") t.Log(err) } - if apiResponse.Response.StatusCode != 200 { + if *apiResponse.Response.StatusCode != 200 { t.Log(apiResponse.Response) } } From 9fb85ae8fea527c4268d52afc5ca9009d4afc08e Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Tue, 3 May 2016 20:36:24 +0200 Subject: [PATCH 097/170] removing comment --- .../codegen/languages/TypeScriptNodeClientCodegen.java | 1 - samples/client/petstore/typescript-node/npm/api.ts | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptNodeClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptNodeClientCodegen.java index 3950c1a7ff32..d4207f09cc83 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptNodeClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptNodeClientCodegen.java @@ -41,7 +41,6 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen super.processOpts(); supportingFiles.add(new SupportingFile("api.mustache", null, "api.ts")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - //supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); LOGGER.warn("check additionals: " + additionalProperties.get(NPM_NAME)); if(additionalProperties.containsKey(NPM_NAME)) { diff --git a/samples/client/petstore/typescript-node/npm/api.ts b/samples/client/petstore/typescript-node/npm/api.ts index c2bd53e8ca29..3e25b5e718c0 100644 --- a/samples/client/petstore/typescript-node/npm/api.ts +++ b/samples/client/petstore/typescript-node/npm/api.ts @@ -129,8 +129,8 @@ export class PetApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } constructor(basePath?: string); @@ -409,10 +409,10 @@ export class PetApi { json: true, } - this.authentications.api_key.applyToRequest(requestOptions); - this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { @@ -632,8 +632,8 @@ export class StoreApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } constructor(basePath?: string); @@ -881,8 +881,8 @@ export class UserApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } constructor(basePath?: string); From 60ee308da59ce61bdc4a47860c2e3751982ba194 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Tue, 3 May 2016 11:55:51 -0700 Subject: [PATCH 098/170] added assert to check response status match the query --- samples/client/petstore/go/pet_api_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/samples/client/petstore/go/pet_api_test.go b/samples/client/petstore/go/pet_api_test.go index 5b18e3a76754..73c0da6cd062 100644 --- a/samples/client/petstore/go/pet_api_test.go +++ b/samples/client/petstore/go/pet_api_test.go @@ -88,20 +88,25 @@ func TestUpdatePetWithForm(t *testing.T) { func TestFindPetsByStatus(t *testing.T) { s := sw.NewPetApi() - resp, apiResponse, err := s.FindPetsByStatus([]string {"pending"}) + resp, apiResponse, err := s.FindPetsByStatus([]string {"available"}) if err != nil { t.Errorf("Error while getting pet by id") t.Log(err) t.Log(apiResponse) } else { - t.Log(apiResponse) + if len(resp) == 0 { t.Errorf("Error no pets returned") + } else { + assert := assert.New(t) + for i := 0; i < len(resp); i++ { + assert.Equal(resp[i].Status, "available", "Pet status should be `available`") + } } - if apiResponse.Response.StatusCode != 200 { - t.Log(apiResponse.Response) - } + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) + } } } @@ -131,4 +136,4 @@ func TestDeletePet(t *testing.T) { if apiResponse.Response.StatusCode != 200 { t.Log(apiResponse.Response) } -} +} \ No newline at end of file From c8f2715edcfa668adabfb7dbc28cc7dfaf0aa61e Mon Sep 17 00:00:00 2001 From: abcsun Date: Wed, 4 May 2016 14:52:12 +0800 Subject: [PATCH 099/170] fix the minLength validation --- modules/swagger-codegen/src/main/resources/php/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index c0401940b484..0fc827faa909 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -131,7 +131,7 @@ use \{{invokerPackage}}\ObjectSerializer; } {{/maxLength}} {{#minLength}} - if (strlen(${{paramName}}) > {{minLength}}) { + if (strlen(${{paramName}}) < {{minLength}}) { throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); } {{/minLength}} From f4ef2b0325de715f9cb8d1cec6755e8166955e94 Mon Sep 17 00:00:00 2001 From: abcsun Date: Wed, 4 May 2016 16:56:56 +0800 Subject: [PATCH 100/170] add valid function and validation to each setter --- .../src/main/resources/php/model.mustache | 80 ++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 6f292e854afe..f230286a1207 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -127,10 +127,60 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA {{/discriminator}} if ($data != null) { - {{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}} - {{/hasMore}}{{/vars}} + {{#vars}} + if (isset($data["{{name}}"])) { + $this->{{name}} = $data["{{name}}"]; + }{{#hasMore}}{{/hasMore}} + {{/vars}} } } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + {{#vars}} + {{#required}} + if ($this->{{name}} === null) { + return false; + } + {{/required}} + {{#hasValidation}} + {{#maxLength}} + if (strlen($this->{{name}}) > {{maxLength}}) { + return false; + } + {{/maxLength}} + {{#minLength}} + if (strlen($this->{{name}}) < {{minLength}}) { + return false; + } + {{/minLength}} + {{#maximum}} + if ($this->{{name}} > {{maximum}}) { + return false; + } + {{/maximum}} + {{#minimum}} + if ($this->{{name}} < {{minimum}}) { + return false; + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", $this->{{name}})) { + return false; + } + {{/pattern}} + {{/hasValidation}} + {{/vars}} + return true; + } + + {{#vars}} /** * Gets {{name}} @@ -152,6 +202,32 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA if (!in_array(${{{name}}}, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}"); }{{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if (strlen(${{name}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + }{{/maxLength}} + {{#minLength}} + if (strlen(${{name}}) < {{minLength}}) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if (${{name}} > {{maximum}}) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if (${{name}} < {{minimum}}) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", ${{name}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); + } + {{/pattern}} + {{/hasValidation}} $this->{{name}} = ${{name}}; return $this; } From 98a2a22abf6d3a460087099b87a2bcffe700d445 Mon Sep 17 00:00:00 2001 From: kolyjjj Date: Wed, 4 May 2016 17:56:02 +0800 Subject: [PATCH 101/170] [koly] generate nodejs codes --- .../server/petstore/nodejs/api/swagger.yaml | 8 +-- .../petstore/nodejs/controllers/PetService.js | 60 +++++++++---------- .../nodejs/controllers/StoreService.js | 16 ++--- .../nodejs/controllers/UserService.js | 14 ++--- samples/server/petstore/nodejs/package.json | 2 +- 5 files changed, 50 insertions(+), 50 deletions(-) diff --git a/samples/server/petstore/nodejs/api/swagger.yaml b/samples/server/petstore/nodejs/api/swagger.yaml index 1aad0a1d4f44..f6987daa9156 100644 --- a/samples/server/petstore/nodejs/api/swagger.yaml +++ b/samples/server/petstore/nodejs/api/swagger.yaml @@ -587,10 +587,6 @@ paths: description: "User not found" x-swagger-router-controller: "User" securityDefinitions: - api_key: - type: "apiKey" - name: "api_key" - in: "header" petstore_auth: type: "oauth2" authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" @@ -598,6 +594,10 @@ securityDefinitions: scopes: write:pets: "modify pets in your account" read:pets: "read your pets" + api_key: + type: "apiKey" + name: "api_key" + in: "header" definitions: Order: type: "object" diff --git a/samples/server/petstore/nodejs/controllers/PetService.js b/samples/server/petstore/nodejs/controllers/PetService.js index 95f42f6a0381..2c464714aa71 100644 --- a/samples/server/petstore/nodejs/controllers/PetService.js +++ b/samples/server/petstore/nodejs/controllers/PetService.js @@ -13,7 +13,7 @@ exports.deletePet = function(args, res, next) { /** * parameters expected in the args: * petId (Long) - * apiKey (String) + * api_key (String) **/ // no response value expected for this operation res.end(); @@ -26,18 +26,18 @@ exports.findPetsByStatus = function(args, res, next) { **/ var examples = {}; examples['application/json'] = [ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" } ]; if(Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); @@ -56,18 +56,18 @@ exports.findPetsByTags = function(args, res, next) { **/ var examples = {}; examples['application/json'] = [ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" } ]; if(Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); @@ -86,18 +86,18 @@ exports.getPetById = function(args, res, next) { **/ var examples = {}; examples['application/json'] = { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" }; if(Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); @@ -138,9 +138,9 @@ exports.uploadFile = function(args, res, next) { **/ var examples = {}; examples['application/json'] = { - "message" : "aeiou", "code" : 123, - "type" : "aeiou" + "type" : "aeiou", + "message" : "aeiou" }; if(Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); diff --git a/samples/server/petstore/nodejs/controllers/StoreService.js b/samples/server/petstore/nodejs/controllers/StoreService.js index 01759173bd4a..d20619ceb9b0 100644 --- a/samples/server/petstore/nodejs/controllers/StoreService.js +++ b/samples/server/petstore/nodejs/controllers/StoreService.js @@ -34,12 +34,12 @@ exports.getOrderById = function(args, res, next) { **/ var examples = {}; examples['application/json'] = { - "id" : 123456789, "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" }; if(Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); @@ -58,12 +58,12 @@ exports.placeOrder = function(args, res, next) { **/ var examples = {}; examples['application/json'] = { - "id" : 123456789, "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" }; if(Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); diff --git a/samples/server/petstore/nodejs/controllers/UserService.js b/samples/server/petstore/nodejs/controllers/UserService.js index 69fc1a813911..3a62feeaf3fa 100644 --- a/samples/server/petstore/nodejs/controllers/UserService.js +++ b/samples/server/petstore/nodejs/controllers/UserService.js @@ -43,14 +43,14 @@ exports.getUserByName = function(args, res, next) { **/ var examples = {}; examples['application/json'] = { - "id" : 123456789, - "lastName" : "aeiou", - "phone" : "aeiou", - "username" : "aeiou", - "email" : "aeiou", - "userStatus" : 123, "firstName" : "aeiou", - "password" : "aeiou" + "lastName" : "aeiou", + "password" : "aeiou", + "userStatus" : 123, + "phone" : "aeiou", + "id" : 123456789, + "email" : "aeiou", + "username" : "aeiou" }; if(Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); diff --git a/samples/server/petstore/nodejs/package.json b/samples/server/petstore/nodejs/package.json index 293316dac0e4..c5884b196b9d 100644 --- a/samples/server/petstore/nodejs/package.json +++ b/samples/server/petstore/nodejs/package.json @@ -11,6 +11,6 @@ "dependencies": { "connect": "^3.2.0", "js-yaml": "^3.3.0", - "swagger-tools": "0.9.*" + "swagger-tools": "0.10.1" } } From ec5d300bab7d977fec497768d371973337ff87b2 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 4 May 2016 18:26:13 +0800 Subject: [PATCH 102/170] added Pepipost --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d43198847dc..c1617b9b79e7 100644 --- a/README.md +++ b/README.md @@ -779,9 +779,11 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [nViso](http://www.nviso.ch/) - [Okiok](https://www.okiok.com) - [OSDN](https://osdn.jp) +- [Pepipost](https://www.pepipost.com) - [Pixoneye](http://www.pixoneye.com/) - [PostAffiliatePro](https://www.postaffiliatepro.com/) - [Reload! A/S](https://reload.dk/) +- [REstore](https://www.restore.eu) - [Royal Bank of Canada (RBC)](http://www.rbc.com/canada.html) - [SmartRecruiters](https://www.smartrecruiters.com/) - [StyleRecipe](http://stylerecipe.co.jp) @@ -790,7 +792,6 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [uShip](https://www.uship.com/) - [Zalando](https://tech.zalando.com) - [ZEEF.com](https://zeef.com/) -- [REstore](https://www.restore.eu) License ------- From e868690c035714f21449fdcd8e7bfa3d97de6b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=9C=9F=E4=BF=8A?= Date: Wed, 4 May 2016 19:51:53 +0800 Subject: [PATCH 103/170] add pom.xml based on build.gradle for android api client( using the volley HTTP library ); --- .../client/petstore/android/volley/pom.xml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 samples/client/petstore/android/volley/pom.xml diff --git a/samples/client/petstore/android/volley/pom.xml b/samples/client/petstore/android/volley/pom.xml new file mode 100644 index 000000000000..2a3b8ef2f967 --- /dev/null +++ b/samples/client/petstore/android/volley/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + io.swagger + volley + 1.0.0 + + + io.swagger + swagger-annotations + 1.5.0 + compile + + + org.apache.httpcomponents + httpcore + 4.4.4 + compile + + + org.apache.httpcomponents + httpmime + 4.5.2 + compile + + + com.google.code.gson + gson + 2.3.1 + compile + + + com.mcxiaoke.volley + library + 1.0.19 + aar + compile + + + From 8209653fb07166d9de2afdfe65b953f34a1d9a1f Mon Sep 17 00:00:00 2001 From: diyfr Date: Wed, 4 May 2016 16:38:36 +0200 Subject: [PATCH 104/170] Add SpringBoot server generator --- bin/springboot-petstore-server2.sh | 31 ++ bin/windows/springboot-petstore-server.bat | 10 + .../languages/SpringBootServerCodegen.java | 281 ++++++++++++++++++ .../resources/JavaSpringBoot/README.mustache | 18 ++ .../resources/JavaSpringBoot/api.mustache | 56 ++++ .../JavaSpringBoot/apiException.mustache | 10 + .../JavaSpringBoot/apiOriginFilter.mustache | 27 ++ .../apiResponseMessage.mustache | 69 +++++ .../JavaSpringBoot/application.properties | 2 + .../JavaSpringBoot/bodyParams.mustache | 1 + .../JavaSpringBoot/formParams.mustache | 2 + .../generatedAnnotation.mustache | 1 + .../JavaSpringBoot/headerParams.mustache | 1 + .../JavaSpringBoot/homeController.mustache | 16 + .../resources/JavaSpringBoot/model.mustache | 77 +++++ .../JavaSpringBoot/notFoundException.mustache | 10 + .../JavaSpringBoot/pathParams.mustache | 1 + .../resources/JavaSpringBoot/pom.mustache | 54 ++++ .../JavaSpringBoot/project/build.properties | 1 + .../JavaSpringBoot/project/plugins.sbt | 9 + .../JavaSpringBoot/queryParams.mustache | 1 + .../JavaSpringBoot/returnTypes.mustache | 1 + .../swagger2SpringBoot.mustache | 36 +++ .../swaggerDocumentationConfig.mustache | 40 +++ .../services/io.swagger.codegen.CodegenConfig | 1 + .../SpringBootServerOptionsProvider.java | 32 ++ .../SpringBootServerOptionsTest.java | 60 ++++ samples/server/petstore/springboot/README.md | 18 ++ samples/server/petstore/springboot/pom.xml | 54 ++++ .../java/io/swagger/Swagger2SpringBoot.java | 36 +++ .../java/io/swagger/api/ApiException.java | 10 + .../java/io/swagger/api/ApiOriginFilter.java | 27 ++ .../io/swagger/api/ApiResponseMessage.java | 69 +++++ .../io/swagger/api/NotFoundException.java | 10 + .../src/main/java/io/swagger/api/PetApi.java | 237 +++++++++++++++ .../main/java/io/swagger/api/StoreApi.java | 102 +++++++ .../src/main/java/io/swagger/api/UserApi.java | 177 +++++++++++ .../swagger/configuration/HomeController.java | 16 + .../SwaggerDocumentationConfig.java | 40 +++ .../main/java/io/swagger/model/Category.java | 71 +++++ .../src/main/java/io/swagger/model/Order.java | 134 +++++++++ .../src/main/java/io/swagger/model/Pet.java | 137 +++++++++ .../src/main/java/io/swagger/model/Tag.java | 71 +++++ .../src/main/java/io/swagger/model/User.java | 156 ++++++++++ .../src/main/resources/application.properties | 2 + 45 files changed, 2215 insertions(+) create mode 100644 bin/springboot-petstore-server2.sh create mode 100644 bin/windows/springboot-petstore-server.bat create mode 100644 modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiException.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiOriginFilter.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/application.properties create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/bodyParams.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/homeController.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/notFoundException.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/pathParams.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/build.properties create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/plugins.sbt create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/returnTypes.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/swagger2SpringBoot.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache create mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java create mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java create mode 100644 samples/server/petstore/springboot/README.md create mode 100644 samples/server/petstore/springboot/pom.xml create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/Swagger2SpringBoot.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/configuration/HomeController.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java create mode 100644 samples/server/petstore/springboot/src/main/resources/application.properties diff --git a/bin/springboot-petstore-server2.sh b/bin/springboot-petstore-server2.sh new file mode 100644 index 000000000000..83d810ba5954 --- /dev/null +++ b/bin/springboot-petstore-server2.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/server/petstore/springboot" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/springboot-petstore-server.bat b/bin/windows/springboot-petstore-server.bat new file mode 100644 index 000000000000..18077852db34 --- /dev/null +++ b/bin/windows/springboot-petstore-server.bat @@ -0,0 +1,10 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate -t modules\swagger-codegen\src\main\resources\JavaSpringBoot -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l springboot -o samples\server\petstore\springboot + +java %JAVA_OPTS% -jar %executable% %ags% \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java new file mode 100644 index 000000000000..070f5de6d03e --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java @@ -0,0 +1,281 @@ +package io.swagger.codegen.languages; + +import io.swagger.codegen.*; +import io.swagger.models.Operation; +import io.swagger.models.Path; +import io.swagger.models.Swagger; +import java.io.File; +import java.util.*; + +public class SpringBootServerCodegen extends JavaClientCodegen implements CodegenConfig{ + public static final String CONFIG_PACKAGE = "configPackage"; + public static final String BASE_PACKAGE = "basePackage"; + protected String title = "Petstore Server"; + protected String configPackage = ""; + protected String basePackage = ""; + protected String templateFileName = "api.mustache"; + + public SpringBootServerCodegen() { + super(); + outputFolder = "generated-code/javaSpringBoot"; + modelTemplateFiles.put("model.mustache", ".java"); + apiTemplateFiles.put(templateFileName, ".java"); + embeddedTemplateDir = templateDir = "JavaSpringBoot"; + apiPackage = "io.swagger.api"; + modelPackage = "io.swagger.model"; + configPackage = "io.swagger.configuration"; + invokerPackage = "io.swagger.api"; + basePackage = "io.swagger"; + artifactId = "swagger-springboot-server"; + + additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); + additionalProperties.put(CodegenConstants.GROUP_ID, groupId); + additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); + additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); + additionalProperties.put("title", title); + additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); + additionalProperties.put(CONFIG_PACKAGE, configPackage); + additionalProperties.put(BASE_PACKAGE, basePackage); + + cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")); + cliOptions.add(new CliOption(BASE_PACKAGE, "base package for generated code")); + + supportedLibraries.clear(); + supportedLibraries.put(DEFAULT_LIBRARY, "Default Spring Boot server stub."); + supportedLibraries.put("j8-async", "Use async servlet feature and Java 8's default interface. Generating interface with service " + + "declaration is useful when using Maven plugin. Just provide a implementation with @Controller to instantiate service."); + } + + @Override + public CodegenType getTag() { + return CodegenType.SERVER; + } + + @Override + public String getName() { + return "springboot"; + } + + @Override + public String getHelp() { + return "Generates a Java SpringBoot Server application using the SpringFox integration."; + } + + @Override + public void processOpts() { + super.processOpts(); + + // clear model and api doc template as this codegen + // does not support auto-generated markdown doc at the moment + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); + + if (additionalProperties.containsKey(CONFIG_PACKAGE)) { + this.setConfigPackage((String) additionalProperties.get(CONFIG_PACKAGE)); + } + + if (additionalProperties.containsKey(BASE_PACKAGE)) { + this.setBasePackage((String) additionalProperties.get(BASE_PACKAGE)); + } + + supportingFiles.clear(); + supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("apiException.mustache", + (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiException.java")); + supportingFiles.add(new SupportingFile("apiOriginFilter.mustache", + (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiOriginFilter.java")); + supportingFiles.add(new SupportingFile("apiResponseMessage.mustache", + (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiResponseMessage.java")); + supportingFiles.add(new SupportingFile("notFoundException.mustache", + (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java")); + + supportingFiles.add(new SupportingFile("swaggerDocumentationConfig.mustache", + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerDocumentationConfig.java")); + supportingFiles.add(new SupportingFile("homeController.mustache", + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "HomeController.java")); + + supportingFiles.add(new SupportingFile("swagger2SpringBoot.mustache", + (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "Swagger2SpringBoot.java")); + + + supportingFiles.add(new SupportingFile("application.properties", + ("src.main.resources").replace(".", java.io.File.separator), "application.properties")); + + } + + @Override + public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { + String basePath = resourcePath; + if (basePath.startsWith("/")) { + basePath = basePath.substring(1); + } + int pos = basePath.indexOf("/"); + if (pos > 0) { + basePath = basePath.substring(0, pos); + } + + if (basePath == "") { + basePath = "default"; + } else { + if (co.path.startsWith("/" + basePath)) { + co.path = co.path.substring(("/" + basePath).length()); + } + co.subresourceOperation = !co.path.isEmpty(); + } + List opList = operations.get(basePath); + if (opList == null) { + opList = new ArrayList(); + operations.put(basePath, opList); + } + opList.add(co); + co.baseName = basePath; + } + + @Override + public void preprocessSwagger(Swagger swagger) { + System.out.println("preprocessSwagger"); + if ("/".equals(swagger.getBasePath())) { + swagger.setBasePath(""); + } + + String host = swagger.getHost(); + String port = "8080"; + if (host != null) { + String[] parts = host.split(":"); + if (parts.length > 1) { + port = parts[1]; + } + } + + this.additionalProperties.put("serverPort", port); + if (swagger != null && swagger.getPaths() != null) { + for (String pathname : swagger.getPaths().keySet()) { + Path path = swagger.getPath(pathname); + if (path.getOperations() != null) { + for (Operation operation : path.getOperations()) { + if (operation.getTags() != null) { + List> tags = new ArrayList>(); + for (String tag : operation.getTags()) { + Map value = new HashMap(); + value.put("tag", tag); + value.put("hasMore", "true"); + tags.add(value); + } + if (tags.size() > 0) { + tags.get(tags.size() - 1).remove("hasMore"); + } + if (operation.getTags().size() > 0) { + String tag = operation.getTags().get(0); + operation.setTags(Arrays.asList(tag)); + } + operation.setVendorExtension("x-tags", tags); + } + } + } + } + } + } + + @Override + public Map postProcessOperations(Map objs) { + Map operations = (Map) objs.get("operations"); + if (operations != null) { + List ops = (List) operations.get("operation"); + for (CodegenOperation operation : ops) { + List responses = operation.responses; + if (responses != null) { + for (CodegenResponse resp : responses) { + if ("0".equals(resp.code)) { + resp.code = "200"; + } + } + } + + if (operation.returnType == null) { + operation.returnType = "Void"; + } else if (operation.returnType.startsWith("List")) { + String rt = operation.returnType; + int end = rt.lastIndexOf(">"); + if (end > 0) { + operation.returnType = rt.substring("List<".length(), end).trim(); + operation.returnContainer = "List"; + } + } else if (operation.returnType.startsWith("Map")) { + String rt = operation.returnType; + int end = rt.lastIndexOf(">"); + if (end > 0) { + operation.returnType = rt.substring("Map<".length(), end).split(",")[1].trim(); + operation.returnContainer = "Map"; + } + } else if (operation.returnType.startsWith("Set")) { + String rt = operation.returnType; + int end = rt.lastIndexOf(">"); + if (end > 0) { + operation.returnType = rt.substring("Set<".length(), end).trim(); + operation.returnContainer = "Set"; + } + } + } + } + if("j8-async".equals(getLibrary())) { + apiTemplateFiles.remove(this.templateFileName); + this.templateFileName = "api-j8-async.mustache"; + apiTemplateFiles.put(this.templateFileName, ".java"); + + int originalPomFileIdx = -1; + for (int i = 0; i < supportingFiles.size(); i++) { + if ("pom.xml".equals(supportingFiles.get(i).destinationFilename)) { + originalPomFileIdx = i; + break; + } + } + if (originalPomFileIdx > -1) { + supportingFiles.remove(originalPomFileIdx); + } + supportingFiles.add(new SupportingFile("pom-j8-async.mustache", "", "pom.xml")); + } + + return objs; + } + + @Override + public String toApiName(String name) { + if (name.length() == 0) { + return "DefaultApi"; + } + name = sanitizeName(name); + return camelize(name) + "Api"; + } + + public void setConfigPackage(String configPackage) { + this.configPackage = configPackage; + } + + public void setBasePackage(String configPackage) { + this.basePackage = configPackage; + } + + @Override + public Map postProcessModels(Map objs) { + // remove the import of "Object" to avoid compilation error + List> imports = (List>) objs.get("imports"); + Iterator> iterator = imports.iterator(); + while (iterator.hasNext()) { + String _import = iterator.next().get("import"); + if (_import.endsWith(".Object")) iterator.remove(); + } + 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) { + // handle default value for enum, e.g. available => StatusEnum.available + if (var.isEnum && var.defaultValue != null && !"null".equals(var.defaultValue)) { + var.defaultValue = var.datatypeWithEnum + "." + var.defaultValue; + } + } + } + return objs; + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache new file mode 100644 index 000000000000..8f9855eedf93 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache @@ -0,0 +1,18 @@ +# Swagger generated server + +Spring Boot Server + + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. +This is an example of building a swagger-enabled server in Java using the SpringBoot framework. + +The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as an simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/ + +Change default port value in application.properties \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache new file mode 100644 index 000000000000..126fbf61a2c4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache @@ -0,0 +1,56 @@ +package {{apiPackage}}; + +import {{modelPackage}}.*; + +{{#imports}}import {{import}}; +{{/imports}} + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import static org.springframework.http.MediaType.*; + +@Controller +@RequestMapping(value = "/{{{baseName}}}", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/{{{baseName}}}", description = "the {{{baseName}}} API") +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + {{#operation}} + + @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { + {{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { + {{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, + {{/hasMore}}{{/scopes}} + }{{/isOAuth}}){{#hasMore}}, + {{/hasMore}}{{/authMethods}} + }{{/hasAuthMethods}}) + @ApiResponses(value = { {{#responses}} + @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) + @RequestMapping(value = "{{{path}}}", + {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} + {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} + method = RequestMethod.{{httpMethod}}) + public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, + {{/hasMore}}{{/allParams}}) + throws NotFoundException { + // do some magic! + return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); + } + + {{/operation}} +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiException.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiException.mustache new file mode 100644 index 000000000000..11b4036b8326 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiException.mustache @@ -0,0 +1,10 @@ +package {{apiPackage}}; + +{{>generatedAnnotation}} +public class ApiException extends Exception{ + private int code; + public ApiException (int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiOriginFilter.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiOriginFilter.mustache new file mode 100644 index 000000000000..5db3301b3d93 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiOriginFilter.mustache @@ -0,0 +1,27 @@ +package {{apiPackage}}; + +import java.io.IOException; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; + +{{>generatedAnnotation}} +public class ApiOriginFilter implements javax.servlet.Filter { + @Override + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + @Override + public void destroy() { + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache new file mode 100644 index 000000000000..2b9a2b1f8c5b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache @@ -0,0 +1,69 @@ +package {{apiPackage}}; + +import javax.xml.bind.annotation.XmlTransient; + +@javax.xml.bind.annotation.XmlRootElement +{{>generatedAnnotation}} +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/application.properties b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/application.properties new file mode 100644 index 000000000000..858a5f007b5f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/application.properties @@ -0,0 +1,2 @@ +springfox.documentation.swagger.v2.path=/api-docs +#server.port=8090 \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/bodyParams.mustache new file mode 100644 index 000000000000..f1137ba70736 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/bodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestBody {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache new file mode 100644 index 000000000000..65e84817a23a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache @@ -0,0 +1,2 @@ +{{#isFormParam}}{{#notFile}} +@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@ApiParam(value = "file detail") @RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache new file mode 100644 index 000000000000..49110fc1ad93 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache @@ -0,0 +1 @@ +@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache new file mode 100644 index 000000000000..297d5131d929 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/homeController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/homeController.mustache new file mode 100644 index 000000000000..a3528010fb16 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/homeController.mustache @@ -0,0 +1,16 @@ +package {{configPackage}}; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Home redirection to swagger api documentation + */ +@Controller +public class HomeController { + @RequestMapping(value = "/") + public String index() { + System.out.println("swagger-ui.html"); + return "redirect:swagger-ui.html"; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache new file mode 100644 index 000000000000..b39a599ae714 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache @@ -0,0 +1,77 @@ +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; +{{#models}} + +{{#model}}{{#description}} +/** + * {{description}} + **/{{/description}} +@ApiModel(description = "{{{description}}}") +{{>generatedAnnotation}} +public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { + {{#vars}}{{#isEnum}} + public enum {{datatypeWithEnum}} { + {{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}} + }; + {{/isEnum}}{{#items}}{{#isEnum}} + public enum {{datatypeWithEnum}} { + {{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}} + }; + {{/isEnum}}{{/items}} + private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} + + {{#vars}} + /**{{#description}} + * {{{description}}}{{/description}}{{#minimum}} + * minimum: {{minimum}}{{/minimum}}{{#maximum}} + * maximum: {{maximum}}{{/maximum}} + **/ + @ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") + @JsonProperty("{{baseName}}") + public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + } + public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + } + + {{/vars}} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + {{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}} + return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} && + {{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}} + return true;{{/hasVars}} + } + + @Override + public int hashCode() { + return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}}sb.append(" " + super.toString()).append("\n");{{/parent}} + {{#vars}}sb.append(" {{name}}: ").append({{name}}).append("\n"); + {{/vars}}sb.append("}\n"); + return sb.toString(); + } +} +{{/model}} +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/notFoundException.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/notFoundException.mustache new file mode 100644 index 000000000000..1bd5e207d7be --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/notFoundException.mustache @@ -0,0 +1,10 @@ +package {{apiPackage}}; + +{{>generatedAnnotation}} +public class NotFoundException extends ApiException { + private int code; + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pathParams.mustache new file mode 100644 index 000000000000..4a6f7dfc9224 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}} {{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @PathVariable("{{paramName}}") {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache new file mode 100644 index 000000000000..f6cc38793e7c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache @@ -0,0 +1,54 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{artifactVersion}} + + 2.4.0 + + + org.springframework.boot + spring-boot-starter-parent + 1.3.3.RELEASE + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/build.properties b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/build.properties new file mode 100644 index 000000000000..a8c2f849be3c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/build.properties @@ -0,0 +1 @@ +sbt.version=0.12.0 diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/plugins.sbt b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/plugins.sbt new file mode 100644 index 000000000000..713b7f3e9935 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/plugins.sbt @@ -0,0 +1,9 @@ +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.4") + +libraryDependencies <+= sbtVersion(v => v match { + case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8" + case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10" + case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11" + case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1" + case x if (x.startsWith("0.12")) => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1" +}) \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache new file mode 100644 index 000000000000..3bb2afcb6cd4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value = "{{paramName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isQueryParam}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/returnTypes.mustache new file mode 100644 index 000000000000..c8f7a56938aa --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/returnTypes.mustache @@ -0,0 +1 @@ +{{#returnContainer}}{{#isMapContainer}}Map{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swagger2SpringBoot.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swagger2SpringBoot.mustache new file mode 100644 index 000000000000..ebd4ae4ac551 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swagger2SpringBoot.mustache @@ -0,0 +1,36 @@ +package {{basePackage}}; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.ExitCodeGenerator; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@SpringBootApplication +@EnableSwagger2 +@ComponentScan(basePackages = "{{basePackage}}") +public class Swagger2SpringBoot implements CommandLineRunner { + + @Override + public void run(String... arg0) throws Exception { + if (arg0.length > 0 && arg0[0].equals("exitcode")) { + throw new ExitException(); + } + } + + public static void main(String[] args) throws Exception { + new SpringApplication(Swagger2SpringBoot.class).run(args); + } + + class ExitException extends RuntimeException implements ExitCodeGenerator { + private static final long serialVersionUID = 1L; + + @Override + public int getExitCode() { + return 10; + } + + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache new file mode 100644 index 000000000000..1af646a6908a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache @@ -0,0 +1,40 @@ +package {{configPackage}}; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; + + + +@Configuration +{{>generatedAnnotation}} +public class SwaggerDocumentationConfig { + + ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("{{appName}}") + .description("{{{appDescription}}}") + .license("{{licenseInfo}}") + .licenseUrl("{{licenseUrl}}") + .termsOfServiceUrl("{{infoUrl}}") + .version("{{appVersion}}") + .contact(new Contact("","", "{{infoEmail}}")) + .build(); + } + + @Bean + public Docket customImplementation(){ + return new Docket(DocumentationType.SWAGGER_2) + .select() + .apis(RequestHandlerSelectors.basePackage("{{apiPackage}}")) + .build() + .apiInfo(apiInfo()); + } + +} diff --git a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig index 22823c956262..7eff4431bb74 100644 --- a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig @@ -28,6 +28,7 @@ io.swagger.codegen.languages.ScalatraServerCodegen io.swagger.codegen.languages.SilexServerCodegen io.swagger.codegen.languages.SinatraServerCodegen io.swagger.codegen.languages.SlimFrameworkServerCodegen +io.swagger.codegen.languages.SpringBootServerCodegen io.swagger.codegen.languages.SpringMVCServerCodegen io.swagger.codegen.languages.StaticDocCodegen io.swagger.codegen.languages.StaticHtmlGenerator diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java new file mode 100644 index 000000000000..af70fc1834ab --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java @@ -0,0 +1,32 @@ +package io.swagger.codegen.options; + +import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.languages.SpringBootServerCodegen; + +import java.util.HashMap; +import java.util.Map; + +public class SpringBootServerOptionsProvider extends JavaOptionsProvider { + public static final String CONFIG_PACKAGE_VALUE = "configPackage"; + public static final String BASE_PACKAGE_VALUE = "basePackage"; + public static final String LIBRARY_VALUE = "j8-async"; //FIXME hidding value from super class + + @Override + public String getLanguage() { + return "springboot"; + } + + @Override + public Map createOptions() { + Map options = new HashMap(super.createOptions()); + options.put(SpringBootServerCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE); + options.put(SpringBootServerCodegen.BASE_PACKAGE, BASE_PACKAGE_VALUE); + options.put(CodegenConstants.LIBRARY, LIBRARY_VALUE); + return options; + } + + @Override + public boolean isServer() { + return true; + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java new file mode 100644 index 000000000000..a7ecdd9d9744 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java @@ -0,0 +1,60 @@ +package io.swagger.codegen.springBoot; + +import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.java.JavaClientOptionsTest; +import io.swagger.codegen.languages.SpringBootServerCodegen; +import io.swagger.codegen.options.SpringBootServerOptionsProvider; + +import mockit.Expectations; +import mockit.Tested; + +public class SpringBootServerOptionsTest extends JavaClientOptionsTest { + + @Tested + private SpringBootServerCodegen clientCodegen; + + public SpringBootServerOptionsTest() { + super(new SpringBootServerOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void setExpectations() { + new Expectations(clientCodegen) {{ + clientCodegen.setModelPackage(SpringBootServerOptionsProvider.MODEL_PACKAGE_VALUE); + times = 1; + clientCodegen.setApiPackage(SpringBootServerOptionsProvider.API_PACKAGE_VALUE); + times = 1; + clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SpringBootServerOptionsProvider.SORT_PARAMS_VALUE)); + times = 1; + clientCodegen.setInvokerPackage(SpringBootServerOptionsProvider.INVOKER_PACKAGE_VALUE); + times = 1; + clientCodegen.setGroupId(SpringBootServerOptionsProvider.GROUP_ID_VALUE); + times = 1; + clientCodegen.setArtifactId(SpringBootServerOptionsProvider.ARTIFACT_ID_VALUE); + times = 1; + clientCodegen.setArtifactVersion(SpringBootServerOptionsProvider.ARTIFACT_VERSION_VALUE); + times = 1; + clientCodegen.setSourceFolder(SpringBootServerOptionsProvider.SOURCE_FOLDER_VALUE); + times = 1; + clientCodegen.setLocalVariablePrefix(SpringBootServerOptionsProvider.LOCAL_PREFIX_VALUE); + times = 1; + clientCodegen.setSerializableModel(Boolean.valueOf(SpringBootServerOptionsProvider.SERIALIZABLE_MODEL_VALUE)); + times = 1; + clientCodegen.setLibrary(SpringBootServerOptionsProvider.LIBRARY_VALUE); + times = 1; + clientCodegen.setFullJavaUtil(Boolean.valueOf(SpringBootServerOptionsProvider.FULL_JAVA_UTIL_VALUE)); + times = 1; + clientCodegen.setConfigPackage(SpringBootServerOptionsProvider.CONFIG_PACKAGE_VALUE); + times = 1; + clientCodegen.setBasePackage(SpringBootServerOptionsProvider.BASE_PACKAGE_VALUE); + times = 1; + + }}; + } +} diff --git a/samples/server/petstore/springboot/README.md b/samples/server/petstore/springboot/README.md new file mode 100644 index 000000000000..8f9855eedf93 --- /dev/null +++ b/samples/server/petstore/springboot/README.md @@ -0,0 +1,18 @@ +# Swagger generated server + +Spring Boot Server + + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. +This is an example of building a swagger-enabled server in Java using the SpringBoot framework. + +The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as an simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/ + +Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot/pom.xml b/samples/server/petstore/springboot/pom.xml new file mode 100644 index 000000000000..139b3da9ab47 --- /dev/null +++ b/samples/server/petstore/springboot/pom.xml @@ -0,0 +1,54 @@ + + 4.0.0 + io.swagger + swagger-springboot-server + jar + swagger-springboot-server + 1.0.0 + + 2.4.0 + + + org.springframework.boot + spring-boot-starter-parent + 1.3.3.RELEASE + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + \ No newline at end of file diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/Swagger2SpringBoot.java b/samples/server/petstore/springboot/src/main/java/io/swagger/Swagger2SpringBoot.java new file mode 100644 index 000000000000..2cc65db2b815 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/Swagger2SpringBoot.java @@ -0,0 +1,36 @@ +package io.swagger; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.ExitCodeGenerator; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@SpringBootApplication +@EnableSwagger2 +@ComponentScan(basePackages = "io.swagger") +public class Swagger2SpringBoot implements CommandLineRunner { + + @Override + public void run(String... arg0) throws Exception { + if (arg0.length > 0 && arg0[0].equals("exitcode")) { + throw new ExitException(); + } + } + + public static void main(String[] args) throws Exception { + new SpringApplication(Swagger2SpringBoot.class).run(args); + } + + class ExitException extends RuntimeException implements ExitCodeGenerator { + private static final long serialVersionUID = 1L; + + @Override + public int getExitCode() { + return 10; + } + + } +} \ No newline at end of file diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java new file mode 100644 index 000000000000..c7499fe4ff21 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java @@ -0,0 +1,10 @@ +package io.swagger.api; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class ApiException extends Exception{ + private int code; + public ApiException (int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java new file mode 100644 index 000000000000..0df82935399a --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -0,0 +1,27 @@ +package io.swagger.api; + +import java.io.IOException; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class ApiOriginFilter implements javax.servlet.Filter { + @Override + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + @Override + public void destroy() { + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } +} \ No newline at end of file diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java new file mode 100644 index 000000000000..c7d9f8fdb589 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -0,0 +1,69 @@ +package io.swagger.api; + +import javax.xml.bind.annotation.XmlTransient; + +@javax.xml.bind.annotation.XmlRootElement +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java new file mode 100644 index 000000000000..3a513d8713eb --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java @@ -0,0 +1,10 @@ +package io.swagger.api; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class NotFoundException extends ApiException { + private int code; + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java new file mode 100644 index 000000000000..127a788cf73b --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java @@ -0,0 +1,237 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import io.swagger.model.Pet; +import java.io.File; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import static org.springframework.http.MediaType.*; + +@Controller +@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/pet", description = "the pet API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class PetApi { + + @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "", + produces = { "application/json", "application/xml" }, + consumes = { "application/json", "application/xml" }, + method = RequestMethod.POST) + public ResponseEntity addPet( + +@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/{petId}", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.DELETE) + public ResponseEntity deletePet( +@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId + +, + +@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/findByStatus", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.GET) + public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status + + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/findByTags", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.GET) + public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags + + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }), + @Authorization(value = "api_key") + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), + @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/{petId}", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.GET) + public ResponseEntity getPetById( +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Pet not found", response = Void.class), + @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "", + produces = { "application/json", "application/xml" }, + consumes = { "application/json", "application/xml" }, + method = RequestMethod.PUT) + public ResponseEntity updatePet( + +@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/{petId}", + produces = { "application/json", "application/xml" }, + consumes = { "application/x-www-form-urlencoded" }, + method = RequestMethod.POST) + public ResponseEntity updatePetWithForm( +@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId + +, + + + +@ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name +, + + + +@ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/{petId}/uploadImage", + produces = { "application/json", "application/xml" }, + consumes = { "multipart/form-data" }, + method = RequestMethod.POST) + public ResponseEntity uploadFile( +@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId + +, + + + +@ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata +, + + +@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java new file mode 100644 index 000000000000..9044f63f97b9 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -0,0 +1,102 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import java.util.Map; +import io.swagger.model.Order; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import static org.springframework.http.MediaType.*; + +@Controller +@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/store", description = "the store API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class StoreApi { + + @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/order/{orderId}", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.DELETE) + public ResponseEntity deleteOrder( +@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { + @Authorization(value = "api_key") + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/inventory", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.GET) + public ResponseEntity> getInventory() + throws NotFoundException { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), + @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/order/{orderId}", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.GET) + public ResponseEntity getOrderById( +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/order", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.POST) + public ResponseEntity placeOrder( + +@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java new file mode 100644 index 000000000000..c0409a9237b3 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -0,0 +1,177 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import io.swagger.model.User; +import java.util.List; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import static org.springframework.http.MediaType.*; + +@Controller +@RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/user", description = "the user API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class UserApi { + + @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.POST) + public ResponseEntity createUser( + +@ApiParam(value = "Created user object" ) @RequestBody User body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/createWithArray", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.POST) + public ResponseEntity createUsersWithArrayInput( + +@ApiParam(value = "List of user object" ) @RequestBody List body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/createWithList", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.POST) + public ResponseEntity createUsersWithListInput( + +@ApiParam(value = "List of user object" ) @RequestBody List body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/{username}", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.DELETE) + public ResponseEntity deleteUser( +@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Get user by user name", notes = "", response = User.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = User.class), + @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), + @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/{username}", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.GET) + public ResponseEntity getUserByName( +@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Logs user into the system", notes = "", response = String.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = String.class), + @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/login", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.GET) + public ResponseEntity loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username + + +, + @ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password + + +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/logout", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.GET) + public ResponseEntity logoutUser() + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/{username}", + produces = { "application/json", "application/xml" }, + + method = RequestMethod.PUT) + public ResponseEntity updateUser( +@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username + +, + + +@ApiParam(value = "Updated user object" ) @RequestBody User body +) + throws NotFoundException { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/HomeController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/HomeController.java new file mode 100644 index 000000000000..14fcf37acff3 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/HomeController.java @@ -0,0 +1,16 @@ +package io.swagger.configuration; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Home redirection to swagger api documentation + */ +@Controller +public class HomeController { + @RequestMapping(value = "/") + public String index() { + System.out.println("swagger-ui.html"); + return "redirect:swagger-ui.html"; + } +} \ No newline at end of file diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java new file mode 100644 index 000000000000..54c04e222b3f --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -0,0 +1,40 @@ +package io.swagger.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; + + + +@Configuration +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class SwaggerDocumentationConfig { + + ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("Swagger Petstore") + .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") + .license("Apache 2.0") + .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") + .termsOfServiceUrl("") + .version("1.0.0") + .contact(new Contact("","", "apiteam@wordnik.com")) + .build(); + } + + @Bean + public Docket customImplementation(){ + return new Docket(DocumentationType.SWAGGER_2) + .select() + .apis(RequestHandlerSelectors.basePackage("io.swagger.api")) + .build() + .apiInfo(apiInfo()); + } + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java new file mode 100644 index 000000000000..b672ce0839b4 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -0,0 +1,71 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class Category { + + private Long id = null; + private String name = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" name: ").append(name).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java new file mode 100644 index 000000000000..38d97525c8b1 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -0,0 +1,134 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class Order { + + private Long id = null; + private Long petId = null; + private Integer quantity = null; + private Date shipDate = null; + public enum StatusEnum { + placed, approved, delivered, + }; + + private StatusEnum status = null; + private Boolean complete = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("petId") + public Long getPetId() { + return petId; + } + public void setPetId(Long petId) { + this.petId = petId; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("quantity") + public Integer getQuantity() { + return quantity; + } + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + /** + * Order Status + **/ + @ApiModelProperty(value = "Order Status") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("complete") + public Boolean getComplete() { + return complete; + } + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" petId: ").append(petId).append("\n"); + sb.append(" quantity: ").append(quantity).append("\n"); + sb.append(" shipDate: ").append(shipDate).append("\n"); + sb.append(" status: ").append(status).append("\n"); + sb.append(" complete: ").append(complete).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java new file mode 100644 index 000000000000..caa76cd78d8c --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -0,0 +1,137 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Category; +import io.swagger.model.Tag; +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class Pet { + + private Long id = null; + private Category category = null; + private String name = null; + private List photoUrls = new ArrayList(); + private List tags = new ArrayList(); + public enum StatusEnum { + available, pending, sold, + }; + + private StatusEnum status = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("category") + public Category getCategory() { + return category; + } + public void setCategory(Category category) { + this.category = category; + } + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("tags") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + + /** + * pet status in the store + **/ + @ApiModelProperty(value = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" category: ").append(category).append("\n"); + sb.append(" name: ").append(name).append("\n"); + sb.append(" photoUrls: ").append(photoUrls).append("\n"); + sb.append(" tags: ").append(tags).append("\n"); + sb.append(" status: ").append(status).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java new file mode 100644 index 000000000000..8aa0ca904b7c --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -0,0 +1,71 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class Tag { + + private Long id = null; + private String name = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" name: ").append(name).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java new file mode 100644 index 000000000000..21432ba3355b --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -0,0 +1,156 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +public class User { + + private Long id = null; + private String username = null; + private String firstName = null; + private String lastName = null; + private String email = null; + private String password = null; + private String phone = null; + private Integer userStatus = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("email") + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("password") + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("phone") + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * User Status + **/ + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" username: ").append(username).append("\n"); + sb.append(" firstName: ").append(firstName).append("\n"); + sb.append(" lastName: ").append(lastName).append("\n"); + sb.append(" email: ").append(email).append("\n"); + sb.append(" password: ").append(password).append("\n"); + sb.append(" phone: ").append(phone).append("\n"); + sb.append(" userStatus: ").append(userStatus).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/springboot/src/main/resources/application.properties b/samples/server/petstore/springboot/src/main/resources/application.properties new file mode 100644 index 000000000000..858a5f007b5f --- /dev/null +++ b/samples/server/petstore/springboot/src/main/resources/application.properties @@ -0,0 +1,2 @@ +springfox.documentation.swagger.v2.path=/api-docs +#server.port=8090 \ No newline at end of file From 41b7649e620ead6dd0312db9ce38335f07371edb Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 4 May 2016 10:39:30 -0700 Subject: [PATCH 105/170] fixed array return type return as pointer issue --- .../codegen/languages/GoClientCodegen.java | 8 ++++- .../src/main/resources/go/api.mustache | 8 ++--- .../petstore/go/go-petstore/docs/PetApi.md | 8 ++--- .../petstore/go/go-petstore/docs/StoreApi.md | 12 +++---- .../petstore/go/go-petstore/docs/UserApi.md | 8 ++--- .../client/petstore/go/go-petstore/pet_api.go | 36 +++++++++---------- .../petstore/go/go-petstore/store_api.go | 28 +++++++-------- .../petstore/go/go-petstore/user_api.go | 22 ++++++------ samples/client/petstore/go/pet_api_test.go | 35 +++++++++--------- 9 files changed, 85 insertions(+), 80 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java index fe25436c9019..e9162205e7b4 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java @@ -401,7 +401,13 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { listIterator.add(newImportMap); } } - + // add pointer to return type string if it is not array + for (CodegenOperation operation : operations) { + if((operation.returnContainer == null || operation.returnContainer != "array") + && operation.returnType != null) { + operation.returnType = "*" + operation.returnType; + } + } return objs; } diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index cd32f831d716..fbc0ac0b0d4a 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -37,7 +37,7 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}} { {{#allParams}} * @param {{paramName}} {{description}} {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ -func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}*{{{returnType}}}, {{/returnType}}*APIResponse, error) { +func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*APIResponse, error) { var httpMethod = "{{httpMethod}}" // create path and map variables @@ -46,7 +46,7 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{ {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if &{{paramName}} == nil { - return {{#returnType}}new({{{returnType}}}), {{/returnType}}nil, errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + return {{#returnType}}*new({{{returnType}}}), {{/returnType}}nil, errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") }{{/required}}{{/allParams}} headerParams := make(map[string]string) @@ -113,10 +113,10 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{ {{#returnType}} var successPayload = new({{returnType}}){{/returnType}} httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return {{#returnType}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err + return {{#returnType}}*successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err } {{#returnType}} err = json.Unmarshal(httpResponse.Body(), &successPayload){{/returnType}} - return {{#returnType}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err + return {{#returnType}}*successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err } {{/operation}}{{/operations}} diff --git a/samples/client/petstore/go/go-petstore/docs/PetApi.md b/samples/client/petstore/go/go-petstore/docs/PetApi.md index e96bdc1a15e2..b0788fb19322 100644 --- a/samples/client/petstore/go/go-petstore/docs/PetApi.md +++ b/samples/client/petstore/go/go-petstore/docs/PetApi.md @@ -132,7 +132,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetPetById** -> Pet GetPetById($petId) +> *Pet GetPetById($petId) Find pet by ID @@ -147,7 +147,7 @@ Name | Type | Description | Notes ### Return type -[**Pet**](Pet.md) +[***Pet**](Pet.md) ### Authorization @@ -221,7 +221,7 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **UploadFile** -> ModelApiResponse UploadFile($petId, $additionalMetadata, $file) +> *ModelApiResponse UploadFile($petId, $additionalMetadata, $file) uploads an image @@ -238,7 +238,7 @@ Name | Type | Description | Notes ### Return type -[**ModelApiResponse**](ApiResponse.md) +[***ModelApiResponse**](ApiResponse.md) ### Authorization diff --git a/samples/client/petstore/go/go-petstore/docs/StoreApi.md b/samples/client/petstore/go/go-petstore/docs/StoreApi.md index 1ee858d2e309..15a05e6158fa 100644 --- a/samples/client/petstore/go/go-petstore/docs/StoreApi.md +++ b/samples/client/petstore/go/go-petstore/docs/StoreApi.md @@ -40,7 +40,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetInventory** -> map[string]int32 GetInventory() +> *map[string]int32 GetInventory() Returns pet inventories by status @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**map[string]int32**](map.md) +[***map[string]int32**](map.md) ### Authorization @@ -66,7 +66,7 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetOrderById** -> Order GetOrderById($orderId) +> *Order GetOrderById($orderId) Find purchase order by ID @@ -81,7 +81,7 @@ Name | Type | Description | Notes ### Return type -[**Order**](Order.md) +[***Order**](Order.md) ### Authorization @@ -95,7 +95,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **PlaceOrder** -> Order PlaceOrder($body) +> *Order PlaceOrder($body) Place an order for a pet @@ -110,7 +110,7 @@ Name | Type | Description | Notes ### Return type -[**Order**](Order.md) +[***Order**](Order.md) ### Authorization diff --git a/samples/client/petstore/go/go-petstore/docs/UserApi.md b/samples/client/petstore/go/go-petstore/docs/UserApi.md index 4950105ca861..9063e0522293 100644 --- a/samples/client/petstore/go/go-petstore/docs/UserApi.md +++ b/samples/client/petstore/go/go-petstore/docs/UserApi.md @@ -131,7 +131,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetUserByName** -> User GetUserByName($username) +> *User GetUserByName($username) Get user by user name @@ -146,7 +146,7 @@ Name | Type | Description | Notes ### Return type -[**User**](User.md) +[***User**](User.md) ### Authorization @@ -160,7 +160,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **LoginUser** -> string LoginUser($username, $password) +> *string LoginUser($username, $password) Logs user into the system @@ -176,7 +176,7 @@ Name | Type | Description | Notes ### Return type -**string** +***string** ### Authorization diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index c5eb1f7ef3e4..5d2a447dfe36 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -171,7 +171,7 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) { * @param status Status values that need to be considered for filter * @return []Pet */ -func (a PetApi) FindPetsByStatus(status []string) (*[]Pet, *APIResponse, error) { +func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -179,7 +179,7 @@ func (a PetApi) FindPetsByStatus(status []string) (*[]Pet, *APIResponse, error) // verify the required parameter 'status' is set if &status == nil { - return new([]Pet), nil, errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") + return *new([]Pet), nil, errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") } headerParams := make(map[string]string) @@ -224,10 +224,10 @@ func (a PetApi) FindPetsByStatus(status []string) (*[]Pet, *APIResponse, error) var successPayload = new([]Pet) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -237,7 +237,7 @@ func (a PetApi) FindPetsByStatus(status []string) (*[]Pet, *APIResponse, error) * @param tags Tags to filter by * @return []Pet */ -func (a PetApi) FindPetsByTags(tags []string) (*[]Pet, *APIResponse, error) { +func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -245,7 +245,7 @@ func (a PetApi) FindPetsByTags(tags []string) (*[]Pet, *APIResponse, error) { // verify the required parameter 'tags' is set if &tags == nil { - return new([]Pet), nil, errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") + return *new([]Pet), nil, errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") } headerParams := make(map[string]string) @@ -290,10 +290,10 @@ func (a PetApi) FindPetsByTags(tags []string) (*[]Pet, *APIResponse, error) { var successPayload = new([]Pet) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -301,7 +301,7 @@ func (a PetApi) FindPetsByTags(tags []string) (*[]Pet, *APIResponse, error) { * Returns a single pet * * @param petId ID of pet to return - * @return Pet + * @return *Pet */ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { @@ -312,7 +312,7 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { // verify the required parameter 'petId' is set if &petId == nil { - return new(Pet), nil, errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") + return *new(*Pet), nil, errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") } headerParams := make(map[string]string) @@ -350,13 +350,13 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(Pet) + var successPayload = new(*Pet) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -501,7 +501,7 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload - * @return ModelApiResponse + * @return *ModelApiResponse */ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (*ModelApiResponse, *APIResponse, error) { @@ -512,7 +512,7 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File // verify the required parameter 'petId' is set if &petId == nil { - return new(ModelApiResponse), nil, errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") + return *new(*ModelApiResponse), nil, errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") } headerParams := make(map[string]string) @@ -556,12 +556,12 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File fileBytes = fbs fileName = file.Name() - var successPayload = new(ModelApiResponse) + var successPayload = new(*ModelApiResponse) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index 53aafd569aa8..7e71e2e7220a 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -90,7 +90,7 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) { * Returns pet inventories by status * Returns a map of status codes to quantities * - * @return map[string]int32 + * @return *map[string]int32 */ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) { @@ -133,13 +133,13 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) { if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(map[string]int32) + var successPayload = new(*map[string]int32) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -147,7 +147,7 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) { * 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 - * @return Order + * @return *Order */ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { @@ -158,7 +158,7 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { // verify the required parameter 'orderId' is set if &orderId == nil { - return new(Order), nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") + return *new(*Order), nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") } headerParams := make(map[string]string) @@ -192,13 +192,13 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(Order) + var successPayload = new(*Order) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -206,7 +206,7 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { * * * @param body order placed for purchasing the pet - * @return Order + * @return *Order */ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) { @@ -216,7 +216,7 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return new(Order), nil, errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") + return *new(*Order), nil, errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") } headerParams := make(map[string]string) @@ -253,12 +253,12 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) { // body params postBody = &body - var successPayload = new(Order) + var successPayload = new(*Order) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index e096fd506ec0..410c6e73ad04 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -274,7 +274,7 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) { * * * @param username The name that needs to be fetched. Use user1 for testing. - * @return User + * @return *User */ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { @@ -285,7 +285,7 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return new(User), nil, errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") + return *new(*User), nil, errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") } headerParams := make(map[string]string) @@ -319,13 +319,13 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(User) + var successPayload = new(*User) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -334,7 +334,7 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { * * @param username The user name for login * @param password The password for login in clear text - * @return string + * @return *string */ func (a UserApi) LoginUser(username string, password string) (*string, *APIResponse, error) { @@ -344,11 +344,11 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo // verify the required parameter 'username' is set if &username == nil { - return new(string), nil, errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") + return *new(*string), nil, errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") } // verify the required parameter 'password' is set if &password == nil { - return new(string), nil, errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") + return *new(*string), nil, errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") } headerParams := make(map[string]string) @@ -388,13 +388,13 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(string) + var successPayload = new(*string) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(httpResponse.RawResponse), err + return *successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** diff --git a/samples/client/petstore/go/pet_api_test.go b/samples/client/petstore/go/pet_api_test.go index 2f3b27428049..fdda15acbe52 100644 --- a/samples/client/petstore/go/pet_api_test.go +++ b/samples/client/petstore/go/pet_api_test.go @@ -18,8 +18,8 @@ func TestAddPet(t *testing.T) { t.Errorf("Error while adding pet") t.Log(err) } - if *apiResponse.Response.StatusCode != 200 { - t.Log(*apiResponse.Response) + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) } } @@ -32,8 +32,8 @@ func TestFindPetsByStatusWithMissingParam(t *testing.T) { t.Errorf("Error while testing TestFindPetsByStatusWithMissingParam") t.Log(err) } - if *apiResponse.Response.StatusCode != 200 { - t.Log(*apiResponse) + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse) } } @@ -52,8 +52,8 @@ func TestGetPetById(t *testing.T) { //t.Log(resp) } - if *apiResponse.Response.StatusCode != 200 { - t.Log(*apiResponse.Response) + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) } } @@ -67,8 +67,8 @@ func TestGetPetByIdWithInvalidID(t *testing.T) { } else { t.Log(resp) } - if *apiResponse.Response.StatusCode != 200 { - t.Log(*apiResponse.Response) + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) } } @@ -79,10 +79,10 @@ func TestUpdatePetWithForm(t *testing.T) { if err != nil { t.Errorf("Error while updating pet by id") t.Log(err) - t.Log(*apiResponse) + t.Log(apiResponse) } - if *apiResponse.Response.StatusCode != 200 { - t.Log(*apiResponse.Response) + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) } } @@ -92,10 +92,9 @@ func TestFindPetsByStatus(t *testing.T) { if err != nil { t.Errorf("Error while getting pet by id") t.Log(err) - t.Log(*apiResponse) + t.Log(apiResponse) } else { - t.Log(*apiResponse) - if len(*resp) == 0 { + if len(resp) == 0 { t.Errorf("Error no pets returned") } else { assert := assert.New(t) @@ -104,8 +103,8 @@ func TestFindPetsByStatus(t *testing.T) { } } - if *apiResponse.Response.StatusCode != 200 { - t.Log(*apiResponse.Response) + if apiResponse.Response.StatusCode != 200 { + t.Log(apiResponse.Response) } } } @@ -121,7 +120,7 @@ func TestUploadFile(t *testing.T) { t.Log(err) } - if *apiResponse.Response.StatusCode != 200 { + if apiResponse.Response.StatusCode != 200 { t.Log(apiResponse.Response) } } @@ -134,7 +133,7 @@ func TestDeletePet(t *testing.T) { t.Errorf("Error while deleting pet by id") t.Log(err) } - if *apiResponse.Response.StatusCode != 200 { + if apiResponse.Response.StatusCode != 200 { t.Log(apiResponse.Response) } } From bbeb1a3f6fea84a14f86447e66b251f7f6b70857 Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Wed, 4 May 2016 14:13:51 -0400 Subject: [PATCH 106/170] add dev-dependencies --- .../src/main/resources/TypeScript-Fetch/package.json | 7 ++++++- .../src/main/resources/TypeScript-Fetch/tsconfig.json | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json index 94206a9f3a14..722c87cc3237 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json @@ -1,5 +1,10 @@ { + "private": true, "dependencies": { "isomorphic-fetch": "^2.2.1" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" } -} +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json index ea2d7b83410c..fc93dc1610e1 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { - "target": "es5", - "sourceMap": true + "target": "es5" }, "exclude": [ "node_modules", From 82770e9566699c4c55b1123cb88d3c7b3e29a2ea Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 4 May 2016 13:20:38 -0700 Subject: [PATCH 107/170] Issue #2756: add null checking to avoid null exception --- .../src/main/resources/csharp/api.mustache | 4 ++-- .../src/main/csharp/IO/Swagger/Api/PetApi.cs | 8 ++++---- .../src/main/csharp/IO/Swagger/Api/StoreApi.cs | 4 ++-- .../src/main/csharp/IO/Swagger/Api/UserApi.cs | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache index 85af270c213b..2b3f224cfc58 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache @@ -227,7 +227,7 @@ namespace {{packageName}}.Api if ({{paramName}} != null) {{#isFile}}localVarFileParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}localVarFormParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}} {{/formParams}} {{#bodyParam}} - if ({{paramName}}.GetType() != typeof(byte[])) + if ({{paramName}} != null && {{paramName}}.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize({{paramName}}); // http body (model) parameter } @@ -360,7 +360,7 @@ namespace {{packageName}}.Api if ({{paramName}} != null) {{#isFile}}localVarFileParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}localVarFormParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}} {{/formParams}} {{#bodyParam}} - if ({{paramName}}.GetType() != typeof(byte[])) + if ({{paramName}} != null && {{paramName}}.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize({{paramName}}); // http body (model) parameter } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs index 75d8dd830c7b..ada1bcbed304 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs @@ -512,7 +512,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -597,7 +597,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -1296,7 +1296,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -1381,7 +1381,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs index a2c32ea3f7ec..bbe6343ee84c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs @@ -737,7 +737,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -815,7 +815,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs index a94b733e44bb..f4b36e47e325 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs @@ -494,7 +494,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -571,7 +571,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -647,7 +647,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -724,7 +724,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -800,7 +800,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -877,7 +877,7 @@ namespace IO.Swagger.Api // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -1519,7 +1519,7 @@ namespace IO.Swagger.Api // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } @@ -1602,7 +1602,7 @@ namespace IO.Swagger.Api // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - if (body.GetType() != typeof(byte[])) + if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } From 9b1d43c6f539add1b436ea52f5351125c2da7f3a Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Wed, 4 May 2016 21:44:52 -0400 Subject: [PATCH 108/170] [csharp] default optionalProjectFileFlag to true Possible breaking change. optionalProjectFileFlag handles the generation of csproj and sln files. Not modifying the plurality of the option to reduce the impact of the breaking change for existing settings: optionalProjectFileFlag=true => generates additional .sln file optionalProjectFileFlag=false => no change unspecified => additional files (csproj, sln) may overwrite existing files --- bin/csharp-petstore.sh | 2 +- bin/windows/csharp-petstore.bat | 2 +- .../io/swagger/codegen/languages/AbstractCSharpCodegen.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/csharp-petstore.sh b/bin/csharp-petstore.sh index 15b80bc71f7c..a82efa9af108 100755 --- a/bin/csharp-petstore.sh +++ b/bin/csharp-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClient -DoptionalProjectFile=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClient" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/csharp-petstore.bat b/bin/windows/csharp-petstore.bat index 29338524c020..fbfc18d334d5 100755 --- a/bin/windows/csharp-petstore.bat +++ b/bin/windows/csharp-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -t modules\swagger-codegen\src\main\resources\csharp -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l csharp -o samples\client\petstore\csharp\SwaggerClient -DoptionalProjectFile=true +set ags=generate -t modules\swagger-codegen\src\main\resources\csharp -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l csharp -o samples\client\petstore\csharp\SwaggerClient java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java index cd9bbc728fc8..b2ae82544f58 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java @@ -12,7 +12,7 @@ import java.util.*; public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig { protected boolean optionalAssemblyInfoFlag = true; - protected boolean optionalProjectFileFlag = false; + protected boolean optionalProjectFileFlag = true; protected boolean optionalEmitDefaultValue = false; protected boolean optionalMethodArgumentFlag = true; protected boolean useDateTimeOffsetFlag = false; From 22ea2d87e092ee151bbd142f181b9c6624987401 Mon Sep 17 00:00:00 2001 From: abcsun Date: Thu, 5 May 2016 11:41:14 +0800 Subject: [PATCH 109/170] add validation to model --- .../src/main/resources/php/model.mustache | 64 +++- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 2 +- .../SwaggerClient-php/lib/Model/Animal.php | 41 ++- .../lib/Model/ApiResponse.php | 53 +++- .../php/SwaggerClient-php/lib/Model/Cat.php | 35 ++- .../SwaggerClient-php/lib/Model/Category.php | 44 ++- .../php/SwaggerClient-php/lib/Model/Dog.php | 35 ++- .../lib/Model/FormatTest.php | 281 +++++++++++++++++- .../lib/Model/Model200Response.php | 35 ++- .../lib/Model/ModelReturn.php | 35 ++- .../php/SwaggerClient-php/lib/Model/Name.php | 59 +++- .../php/SwaggerClient-php/lib/Model/Order.php | 86 +++++- .../php/SwaggerClient-php/lib/Model/Pet.php | 98 +++++- .../lib/Model/SpecialModelName.php | 35 ++- .../php/SwaggerClient-php/lib/Model/Tag.php | 44 ++- .../php/SwaggerClient-php/lib/Model/User.php | 98 +++++- 17 files changed, 987 insertions(+), 60 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index f230286a1207..f4f415cd4a43 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -135,6 +135,51 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA } } + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + {{#vars}}{{#required}} + if ($this->{{name}} === null) { + $invalid_properties[] = "'${{name}}' can't be null"; + }{{/required}} + {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + if (!in_array($this->{{name}}, $allowed_values))) { + $invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}."; + }{{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if (strlen($this->{{name}}) > {{maxLength}}) { + $invalid_properties[] = "invalid value for '${{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; + } + {{/maxLength}} + {{#minLength}} + if (strlen($this->{{name}}) < {{minLength}}) { + $invalid_properties[] = "invalid value for '${{name}}', the character length must be bigger than or equal to {{{minLength}}}."; + } + {{/minLength}} + {{#maximum}} + if ($this->{{name}} > {{maximum}}) { + $invalid_properties[] = "invalid value for '${{name}}', must be smaller than or equal to {{maximum}}."; + } + {{/maximum}} + {{#minimum}} + if ($this->{{name}} < {{minimum}}) { + $invalid_properties[] = "invalid value for '${{name}}', must be bigger than or equal to {{minimum}}."; + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", $this->{{name}})) { + $invalid_properties[] = "invalid value for '${{name}}', must be conform to the pattern {{pattern}}."; + } + {{/pattern}}{{/hasValidation}}{{/vars}} + return $invalid_properties; + } + /** * validate all the parameters in the model * return true if all passed @@ -143,12 +188,14 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA */ public function valid() { - {{#vars}} - {{#required}} + {{#vars}}{{#required}} if ($this->{{name}} === null) { return false; - } - {{/required}} + }{{/required}} + {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + if (!in_array($this->{{name}}, $allowed_values))) { + return false; + }{{/isEnum}} {{#hasValidation}} {{#maxLength}} if (strlen($this->{{name}}) > {{maxLength}}) { @@ -174,9 +221,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA if (!preg_match("{{pattern}}", $this->{{name}})) { return false; } - {{/pattern}} - {{/hasValidation}} - {{/vars}} + {{/pattern}}{{/hasValidation}}{{/vars}} return true; } @@ -224,10 +269,9 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA {{/minimum}} {{#pattern}} if (!preg_match("{{pattern}}", ${{name}})) { - throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{pattern}}.'); } - {{/pattern}} - {{/hasValidation}} + {{/pattern}}{{/hasValidation}} $this->{{name}} = ${{name}}; return $this; } diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index e7d9b552b043..c202495f7ac4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-29T03:01:58.276Z +- Build date: 2016-05-05T03:40:26.342Z - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index ee15a10d025a..8fefa9340588 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -198,7 +198,7 @@ class FakeApi if (strlen($password) > 64) { throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); } - if (strlen($password) > 10) { + if (strlen($password) < 10) { throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); } 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 3f01e789547e..82d29699f8a4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -118,9 +118,47 @@ class Animal implements ArrayAccess $this->{$discrimintor} = static::$swaggerModelName; if ($data != null) { - $this->class_name = $data["class_name"]; + if (isset($data["class_name"])) { + $this->class_name = $data["class_name"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + if ($this->class_name === null) { + $invalid_properties[] = "'$class_name' can't be null"; + } + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + if ($this->class_name === null) { + return false; + } + + + return true; + } + + /** * Gets class_name * @return string @@ -138,6 +176,7 @@ class Animal implements ArrayAccess public function setClassName($class_name) { + $this->class_name = $class_name; return $this; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 4f467a5aab55..e6e7b7bcd841 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -133,11 +133,55 @@ class ApiResponse implements ArrayAccess if ($data != null) { - $this->code = $data["code"]; - $this->type = $data["type"]; - $this->message = $data["message"]; + if (isset($data["code"])) { + $this->code = $data["code"]; + } + if (isset($data["type"])) { + $this->type = $data["type"]; + } + if (isset($data["message"])) { + $this->message = $data["message"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + + + + + return true; + } + + /** * Gets code * @return int @@ -155,6 +199,7 @@ class ApiResponse implements ArrayAccess public function setCode($code) { + $this->code = $code; return $this; } @@ -175,6 +220,7 @@ class ApiResponse implements ArrayAccess public function setType($type) { + $this->type = $type; return $this; } @@ -195,6 +241,7 @@ class ApiResponse implements ArrayAccess public function setMessage($message) { + $this->message = $message; return $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 e0eaf7a106d6..4bc0f89d9e28 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -115,9 +115,41 @@ class Cat extends Animal implements ArrayAccess parent::__construct($data); if ($data != null) { - $this->declawed = $data["declawed"]; + if (isset($data["declawed"])) { + $this->declawed = $data["declawed"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + return true; + } + + /** * Gets declawed * @return bool @@ -135,6 +167,7 @@ class Cat extends Animal implements ArrayAccess public function setDeclawed($declawed) { + $this->declawed = $declawed; return $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 fb6eed3af292..55b391feabd7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -124,10 +124,48 @@ class Category implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->name = $data["name"]; + if (isset($data["id"])) { + $this->id = $data["id"]; + } + if (isset($data["name"])) { + $this->name = $data["name"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + + + return true; + } + + /** * Gets id * @return int @@ -145,6 +183,7 @@ class Category implements ArrayAccess public function setId($id) { + $this->id = $id; return $this; } @@ -165,6 +204,7 @@ class Category implements ArrayAccess public function setName($name) { + $this->name = $name; return $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 6fd43d3a9447..d092850ab799 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -115,9 +115,41 @@ class Dog extends Animal implements ArrayAccess parent::__construct($data); if ($data != null) { - $this->breed = $data["breed"]; + if (isset($data["breed"])) { + $this->breed = $data["breed"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + return true; + } + + /** * Gets breed * @return string @@ -135,6 +167,7 @@ class Dog extends Animal implements ArrayAccess public function setBreed($breed) { + $this->breed = $breed; return $this; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 7bfe30c0ef76..6f5c75d28ebc 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -214,20 +214,220 @@ class FormatTest implements ArrayAccess if ($data != null) { - $this->integer = $data["integer"]; - $this->int32 = $data["int32"]; - $this->int64 = $data["int64"]; - $this->number = $data["number"]; - $this->float = $data["float"]; - $this->double = $data["double"]; - $this->string = $data["string"]; - $this->byte = $data["byte"]; - $this->binary = $data["binary"]; - $this->date = $data["date"]; - $this->date_time = $data["date_time"]; - $this->password = $data["password"]; + if (isset($data["integer"])) { + $this->integer = $data["integer"]; + } + if (isset($data["int32"])) { + $this->int32 = $data["int32"]; + } + if (isset($data["int64"])) { + $this->int64 = $data["int64"]; + } + if (isset($data["number"])) { + $this->number = $data["number"]; + } + if (isset($data["float"])) { + $this->float = $data["float"]; + } + if (isset($data["double"])) { + $this->double = $data["double"]; + } + if (isset($data["string"])) { + $this->string = $data["string"]; + } + if (isset($data["byte"])) { + $this->byte = $data["byte"]; + } + if (isset($data["binary"])) { + $this->binary = $data["binary"]; + } + if (isset($data["date"])) { + $this->date = $data["date"]; + } + if (isset($data["date_time"])) { + $this->date_time = $data["date_time"]; + } + if (isset($data["password"])) { + $this->password = $data["password"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + if ($this->integer > 100.0) { + $invalid_properties[] = "invalid value for '$integer', must be smaller than or equal to 100.0."; + } + if ($this->integer < 10.0) { + $invalid_properties[] = "invalid value for '$integer', must be bigger than or equal to 10.0."; + } + + + if ($this->int32 > 200.0) { + $invalid_properties[] = "invalid value for '$int32', must be smaller than or equal to 200.0."; + } + if ($this->int32 < 20.0) { + $invalid_properties[] = "invalid value for '$int32', must be bigger than or equal to 20.0."; + } + + + + if ($this->number === null) { + $invalid_properties[] = "'$number' can't be null"; + } + + if ($this->number > 543.2) { + $invalid_properties[] = "invalid value for '$number', must be smaller than or equal to 543.2."; + } + if ($this->number < 32.1) { + $invalid_properties[] = "invalid value for '$number', must be bigger than or equal to 32.1."; + } + + + if ($this->float > 987.6) { + $invalid_properties[] = "invalid value for '$float', must be smaller than or equal to 987.6."; + } + if ($this->float < 54.3) { + $invalid_properties[] = "invalid value for '$float', must be bigger than or equal to 54.3."; + } + + + if ($this->double > 123.4) { + $invalid_properties[] = "invalid value for '$double', must be smaller than or equal to 123.4."; + } + if ($this->double < 67.8) { + $invalid_properties[] = "invalid value for '$double', must be bigger than or equal to 67.8."; + } + + + if (!preg_match("/[a-z]/i", $this->string)) { + $invalid_properties[] = "invalid value for '$string', must be conform to the pattern /[a-z]/i."; + } + + if ($this->byte === null) { + $invalid_properties[] = "'$byte' can't be null"; + } + + + + + if ($this->date === null) { + $invalid_properties[] = "'$date' can't be null"; + } + + + + + if ($this->password === null) { + $invalid_properties[] = "'$password' can't be null"; + } + + if (strlen($this->password) > 64) { + $invalid_properties[] = "invalid value for '$password', the character length must be smaller than or equal to 64."; + } + if (strlen($this->password) < 10) { + $invalid_properties[] = "invalid value for '$password', the character length must be bigger than or equal to 10."; + } + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + if ($this->integer > 100.0) { + return false; + } + if ($this->integer < 10.0) { + return false; + } + + + if ($this->int32 > 200.0) { + return false; + } + if ($this->int32 < 20.0) { + return false; + } + + + + if ($this->number === null) { + return false; + } + + if ($this->number > 543.2) { + return false; + } + if ($this->number < 32.1) { + return false; + } + + + if ($this->float > 987.6) { + return false; + } + if ($this->float < 54.3) { + return false; + } + + + if ($this->double > 123.4) { + return false; + } + if ($this->double < 67.8) { + return false; + } + + + if (!preg_match("/[a-z]/i", $this->string)) { + return false; + } + + if ($this->byte === null) { + return false; + } + + + + + if ($this->date === null) { + return false; + } + + + + + if ($this->password === null) { + return false; + } + + if (strlen($this->password) > 64) { + return false; + } + if (strlen($this->password) < 10) { + return false; + } + + return true; + } + + /** * Gets integer * @return int @@ -245,6 +445,14 @@ class FormatTest implements ArrayAccess public function setInteger($integer) { + + if ($integer > 100.0) { + throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.0.'); + } + if ($integer < 10.0) { + throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.0.'); + } + $this->integer = $integer; return $this; } @@ -265,6 +473,14 @@ class FormatTest implements ArrayAccess public function setInt32($int32) { + + if ($int32 > 200.0) { + throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.0.'); + } + if ($int32 < 20.0) { + throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.0.'); + } + $this->int32 = $int32; return $this; } @@ -285,6 +501,7 @@ class FormatTest implements ArrayAccess public function setInt64($int64) { + $this->int64 = $int64; return $this; } @@ -305,6 +522,14 @@ class FormatTest implements ArrayAccess public function setNumber($number) { + + if ($number > 543.2) { + throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be smaller than or equal to 543.2.'); + } + if ($number < 32.1) { + throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.'); + } + $this->number = $number; return $this; } @@ -325,6 +550,14 @@ class FormatTest implements ArrayAccess public function setFloat($float) { + + if ($float > 987.6) { + throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be smaller than or equal to 987.6.'); + } + if ($float < 54.3) { + throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.'); + } + $this->float = $float; return $this; } @@ -345,6 +578,14 @@ class FormatTest implements ArrayAccess public function setDouble($double) { + + if ($double > 123.4) { + throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be smaller than or equal to 123.4.'); + } + if ($double < 67.8) { + throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.'); + } + $this->double = $double; return $this; } @@ -365,6 +606,11 @@ class FormatTest implements ArrayAccess public function setString($string) { + + if (!preg_match("/[a-z]/i", $string)) { + throw new \InvalidArgumentException('invalid value for $string when calling FormatTest., must be conform to the pattern /[a-z]/i.'); + } + $this->string = $string; return $this; } @@ -385,6 +631,7 @@ class FormatTest implements ArrayAccess public function setByte($byte) { + $this->byte = $byte; return $this; } @@ -405,6 +652,7 @@ class FormatTest implements ArrayAccess public function setBinary($binary) { + $this->binary = $binary; return $this; } @@ -425,6 +673,7 @@ class FormatTest implements ArrayAccess public function setDate($date) { + $this->date = $date; return $this; } @@ -445,6 +694,7 @@ class FormatTest implements ArrayAccess public function setDateTime($date_time) { + $this->date_time = $date_time; return $this; } @@ -465,6 +715,13 @@ class FormatTest implements ArrayAccess public function setPassword($password) { + if (strlen($password) > 64) { + throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be smaller than or equal to 64.'); + } + if (strlen($password) < 10) { + throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.'); + } + $this->password = $password; return $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 8d62f9531ec6..1ee9011b8f74 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -115,9 +115,41 @@ class Model200Response implements ArrayAccess if ($data != null) { - $this->name = $data["name"]; + if (isset($data["name"])) { + $this->name = $data["name"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + return true; + } + + /** * Gets name * @return int @@ -135,6 +167,7 @@ class Model200Response implements ArrayAccess public function setName($name) { + $this->name = $name; return $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 d4660e118fde..d15f82a5057f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -115,9 +115,41 @@ class ModelReturn implements ArrayAccess if ($data != null) { - $this->return = $data["return"]; + if (isset($data["return"])) { + $this->return = $data["return"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + return true; + } + + /** * Gets return * @return int @@ -135,6 +167,7 @@ class ModelReturn implements ArrayAccess public function setReturn($return) { + $this->return = $return; return $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 9e1c4b927620..991ab945b4e4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -133,11 +133,61 @@ class Name implements ArrayAccess if ($data != null) { - $this->name = $data["name"]; - $this->snake_case = $data["snake_case"]; - $this->property = $data["property"]; + if (isset($data["name"])) { + $this->name = $data["name"]; + } + if (isset($data["snake_case"])) { + $this->snake_case = $data["snake_case"]; + } + if (isset($data["property"])) { + $this->property = $data["property"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + if ($this->name === null) { + $invalid_properties[] = "'$name' can't be null"; + } + + + + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + if ($this->name === null) { + return false; + } + + + + + + + return true; + } + + /** * Gets name * @return int @@ -155,6 +205,7 @@ class Name implements ArrayAccess public function setName($name) { + $this->name = $name; return $this; } @@ -175,6 +226,7 @@ class Name implements ArrayAccess public function setSnakeCase($snake_case) { + $this->snake_case = $snake_case; return $this; } @@ -195,6 +247,7 @@ class Name implements ArrayAccess public function setProperty($property) { + $this->property = $property; return $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 7ee5c124d2cd..a7b6b22f4c74 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -160,14 +160,82 @@ class Order implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->pet_id = $data["pet_id"]; - $this->quantity = $data["quantity"]; - $this->ship_date = $data["ship_date"]; - $this->status = $data["status"]; - $this->complete = $data["complete"]; + if (isset($data["id"])) { + $this->id = $data["id"]; + } + if (isset($data["pet_id"])) { + $this->pet_id = $data["pet_id"]; + } + if (isset($data["quantity"])) { + $this->quantity = $data["quantity"]; + } + if (isset($data["ship_date"])) { + $this->ship_date = $data["ship_date"]; + } + if (isset($data["status"])) { + $this->status = $data["status"]; + } + if (isset($data["complete"])) { + $this->complete = $data["complete"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + + + + + + + $allowed_values = array("placed", "approved", "delivered"); + if (!in_array($this->status, $allowed_values))) { + $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; + } + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + + + + + + + $allowed_values = array("placed", "approved", "delivered"); + if (!in_array($this->status, $allowed_values))) { + return false; + } + + + + return true; + } + + /** * Gets id * @return int @@ -185,6 +253,7 @@ class Order implements ArrayAccess public function setId($id) { + $this->id = $id; return $this; } @@ -205,6 +274,7 @@ class Order implements ArrayAccess public function setPetId($pet_id) { + $this->pet_id = $pet_id; return $this; } @@ -225,6 +295,7 @@ class Order implements ArrayAccess public function setQuantity($quantity) { + $this->quantity = $quantity; return $this; } @@ -245,6 +316,7 @@ class Order implements ArrayAccess public function setShipDate($ship_date) { + $this->ship_date = $ship_date; return $this; } @@ -268,6 +340,7 @@ class Order implements ArrayAccess if (!in_array($status, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'placed', 'approved', 'delivered'"); } + $this->status = $status; return $this; } @@ -288,6 +361,7 @@ class Order implements ArrayAccess public function setComplete($complete) { + $this->complete = $complete; return $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 3a9e46cd3fb4..319d23a839e5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -160,14 +160,94 @@ class Pet implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->category = $data["category"]; - $this->name = $data["name"]; - $this->photo_urls = $data["photo_urls"]; - $this->tags = $data["tags"]; - $this->status = $data["status"]; + if (isset($data["id"])) { + $this->id = $data["id"]; + } + if (isset($data["category"])) { + $this->category = $data["category"]; + } + if (isset($data["name"])) { + $this->name = $data["name"]; + } + if (isset($data["photo_urls"])) { + $this->photo_urls = $data["photo_urls"]; + } + if (isset($data["tags"])) { + $this->tags = $data["tags"]; + } + if (isset($data["status"])) { + $this->status = $data["status"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + + + if ($this->name === null) { + $invalid_properties[] = "'$name' can't be null"; + } + + + if ($this->photo_urls === null) { + $invalid_properties[] = "'$photo_urls' can't be null"; + } + + + + + $allowed_values = array("available", "pending", "sold"); + if (!in_array($this->status, $allowed_values))) { + $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; + } + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + + + if ($this->name === null) { + return false; + } + + + if ($this->photo_urls === null) { + return false; + } + + + + + $allowed_values = array("available", "pending", "sold"); + if (!in_array($this->status, $allowed_values))) { + return false; + } + + return true; + } + + /** * Gets id * @return int @@ -185,6 +265,7 @@ class Pet implements ArrayAccess public function setId($id) { + $this->id = $id; return $this; } @@ -205,6 +286,7 @@ class Pet implements ArrayAccess public function setCategory($category) { + $this->category = $category; return $this; } @@ -225,6 +307,7 @@ class Pet implements ArrayAccess public function setName($name) { + $this->name = $name; return $this; } @@ -245,6 +328,7 @@ class Pet implements ArrayAccess public function setPhotoUrls($photo_urls) { + $this->photo_urls = $photo_urls; return $this; } @@ -265,6 +349,7 @@ class Pet implements ArrayAccess public function setTags($tags) { + $this->tags = $tags; return $this; } @@ -288,6 +373,7 @@ class Pet implements ArrayAccess if (!in_array($status, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'"); } + $this->status = $status; return $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 fb748811cf27..200470d99d27 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -115,9 +115,41 @@ class SpecialModelName implements ArrayAccess if ($data != null) { - $this->special_property_name = $data["special_property_name"]; + if (isset($data["special_property_name"])) { + $this->special_property_name = $data["special_property_name"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + return true; + } + + /** * Gets special_property_name * @return int @@ -135,6 +167,7 @@ class SpecialModelName implements ArrayAccess public function setSpecialPropertyName($special_property_name) { + $this->special_property_name = $special_property_name; return $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 4bb56401c48b..e493bdfd3e39 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -124,10 +124,48 @@ class Tag implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->name = $data["name"]; + if (isset($data["id"])) { + $this->id = $data["id"]; + } + if (isset($data["name"])) { + $this->name = $data["name"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + + + return true; + } + + /** * Gets id * @return int @@ -145,6 +183,7 @@ class Tag implements ArrayAccess public function setId($id) { + $this->id = $id; return $this; } @@ -165,6 +204,7 @@ class Tag implements ArrayAccess public function setName($name) { + $this->name = $name; return $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 da9cc20ff4cc..3b09cea0fd23 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -178,16 +178,90 @@ class User implements ArrayAccess if ($data != null) { - $this->id = $data["id"]; - $this->username = $data["username"]; - $this->first_name = $data["first_name"]; - $this->last_name = $data["last_name"]; - $this->email = $data["email"]; - $this->password = $data["password"]; - $this->phone = $data["phone"]; - $this->user_status = $data["user_status"]; + if (isset($data["id"])) { + $this->id = $data["id"]; + } + if (isset($data["username"])) { + $this->username = $data["username"]; + } + if (isset($data["first_name"])) { + $this->first_name = $data["first_name"]; + } + if (isset($data["last_name"])) { + $this->last_name = $data["last_name"]; + } + if (isset($data["email"])) { + $this->email = $data["email"]; + } + if (isset($data["password"])) { + $this->password = $data["password"]; + } + if (isset($data["phone"])) { + $this->phone = $data["phone"]; + } + if (isset($data["user_status"])) { + $this->user_status = $data["user_status"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + + + + + + + + + + + + + + + + + + return $invalid_properties; + } + + /** + * validate all the parameters in the model + * return true if all passed + * + * @return bool [description] + */ + public function valid() + { + + + + + + + + + + + + + + + + + + return true; + } + + /** * Gets id * @return int @@ -205,6 +279,7 @@ class User implements ArrayAccess public function setId($id) { + $this->id = $id; return $this; } @@ -225,6 +300,7 @@ class User implements ArrayAccess public function setUsername($username) { + $this->username = $username; return $this; } @@ -245,6 +321,7 @@ class User implements ArrayAccess public function setFirstName($first_name) { + $this->first_name = $first_name; return $this; } @@ -265,6 +342,7 @@ class User implements ArrayAccess public function setLastName($last_name) { + $this->last_name = $last_name; return $this; } @@ -285,6 +363,7 @@ class User implements ArrayAccess public function setEmail($email) { + $this->email = $email; return $this; } @@ -305,6 +384,7 @@ class User implements ArrayAccess public function setPassword($password) { + $this->password = $password; return $this; } @@ -325,6 +405,7 @@ class User implements ArrayAccess public function setPhone($phone) { + $this->phone = $phone; return $this; } @@ -345,6 +426,7 @@ class User implements ArrayAccess public function setUserStatus($user_status) { + $this->user_status = $user_status; return $this; } From 39cbee5ca26895d78592ae5d6b3f82f6e77dff52 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 5 May 2016 15:23:56 +0800 Subject: [PATCH 110/170] rename springboot sh, chmod a+x, add ModelApiResponse --- ...rver2.sh => springboot-petstore-server.sh} | 0 .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 49 +++++------ .../main/java/io/swagger/api/StoreApi.java | 14 +-- .../src/main/java/io/swagger/api/UserApi.java | 30 +++---- .../SwaggerDocumentationConfig.java | 6 +- .../main/java/io/swagger/model/Category.java | 2 +- .../io/swagger/model/ModelApiResponse.java | 85 +++++++++++++++++++ .../src/main/java/io/swagger/model/Order.java | 4 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 15 files changed, 143 insertions(+), 61 deletions(-) rename bin/{springboot-petstore-server2.sh => springboot-petstore-server.sh} (100%) mode change 100644 => 100755 create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java diff --git a/bin/springboot-petstore-server2.sh b/bin/springboot-petstore-server.sh old mode 100644 new mode 100755 similarity index 100% rename from bin/springboot-petstore-server2.sh rename to bin/springboot-petstore-server.sh diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java index c7499fe4ff21..adcd36c99e88 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java index 0df82935399a..fbd1f7cf197b 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java index c7d9f8fdb589..95287af8af9b 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java index 3a513d8713eb..4c97537ad076 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java index 127a788cf73b..a0c84087eafc 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java @@ -4,6 +4,7 @@ import io.swagger.model.*; import io.swagger.model.Pet; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; @@ -26,7 +27,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @@ -38,12 +39,12 @@ public class PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) public ResponseEntity addPet( -@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body ) throws NotFoundException { // do some magic! @@ -60,7 +61,7 @@ public class PetApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) public ResponseEntity deletePet( @@ -77,7 +78,7 @@ public class PetApi { } - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -87,10 +88,10 @@ public class PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) @RequestMapping(value = "/findByStatus", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status + public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status ) @@ -100,7 +101,7 @@ public class PetApi { } - @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -110,10 +111,10 @@ public class PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) @RequestMapping(value = "/findByTags", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags + public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags ) @@ -123,11 +124,7 @@ public class PetApi { } - @ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }), + @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }) @ApiResponses(value = { @@ -135,11 +132,11 @@ public class PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) public ResponseEntity getPetById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId +@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId ) throws NotFoundException { @@ -159,12 +156,12 @@ public class PetApi { @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) public ResponseEntity updatePet( -@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body ) throws NotFoundException { // do some magic! @@ -181,11 +178,11 @@ public class PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) public ResponseEntity updatePetWithForm( -@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId +@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId , @@ -204,19 +201,19 @@ public class PetApi { } - @ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = { + @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) @RequestMapping(value = "/{petId}/uploadImage", - produces = { "application/json", "application/xml" }, + produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - public ResponseEntity uploadFile( + public ResponseEntity uploadFile( @ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId , @@ -231,7 +228,7 @@ public class PetApi { ) throws NotFoundException { // do some magic! - return new ResponseEntity(HttpStatus.OK); + return new ResponseEntity(HttpStatus.OK); } } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java index 9044f63f97b9..ccbf7ef42119 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -26,7 +26,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @@ -34,7 +34,7 @@ public class StoreApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) public ResponseEntity deleteOrder( @@ -53,7 +53,7 @@ public class StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) @RequestMapping(value = "/inventory", - produces = { "application/json", "application/xml" }, + produces = { "application/json" }, method = RequestMethod.GET) public ResponseEntity> getInventory() @@ -69,11 +69,11 @@ public class StoreApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) public ResponseEntity getOrderById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId ) throws NotFoundException { @@ -87,12 +87,12 @@ public class StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) @RequestMapping(value = "/order", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity placeOrder( -@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body +@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index c0409a9237b3..03b65828d341 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -26,19 +26,19 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUser( -@ApiParam(value = "Created user object" ) @RequestBody User body +@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body ) throws NotFoundException { // do some magic! @@ -50,12 +50,12 @@ public class UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/createWithArray", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUsersWithArrayInput( -@ApiParam(value = "List of user object" ) @RequestBody List body +@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body ) throws NotFoundException { // do some magic! @@ -67,12 +67,12 @@ public class UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/createWithList", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUsersWithListInput( -@ApiParam(value = "List of user object" ) @RequestBody List body +@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body ) throws NotFoundException { // do some magic! @@ -85,7 +85,7 @@ public class UserApi { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) public ResponseEntity deleteUser( @@ -104,7 +104,7 @@ public class UserApi { @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) public ResponseEntity getUserByName( @@ -122,14 +122,14 @@ public class UserApi { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) @RequestMapping(value = "/login", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username + public ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username , - @ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password + @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password ) @@ -143,7 +143,7 @@ public class UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/logout", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) public ResponseEntity logoutUser() @@ -158,7 +158,7 @@ public class UserApi { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) public ResponseEntity updateUser( @@ -167,7 +167,7 @@ public class UserApi { , -@ApiParam(value = "Updated user object" ) @RequestBody User body +@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 54c04e222b3f..069ea9b8d0c1 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -13,18 +13,18 @@ import springfox.documentation.spring.web.plugins.Docket; @Configuration -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class SwaggerDocumentationConfig { ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") - .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") + .description("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.") .license("Apache 2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") - .contact(new Contact("","", "apiteam@wordnik.com")) + .contact(new Contact("","", "apiteam@swagger.io")) .build(); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java index b672ce0839b4..3e5a05eccbb4 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java new file mode 100644 index 000000000000..598976f0ceec --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java @@ -0,0 +1,85 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") +public class ModelApiResponse { + + private Integer code = null; + private String type = null; + private String message = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("type") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(code).append("\n"); + sb.append(" type: ").append(type).append("\n"); + sb.append(" message: ").append(message).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java index 38d97525c8b1..f9af13e9d514 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class Order { private Long id = null; @@ -25,7 +25,7 @@ public class Order { }; private StatusEnum status = null; - private Boolean complete = null; + private Boolean complete = false; /** **/ diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java index caa76cd78d8c..d27376b35bb3 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java index 8aa0ca904b7c..cbb158c47d47 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java index 21432ba3355b..13a62d53a715 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00") public class User { private Long id = null; From 3b8a66bb8c3296a3b4edb5925131ff327063b6fd Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 5 May 2016 15:31:17 +0800 Subject: [PATCH 111/170] rename spsringboot sh, change permission, add ModelApiResponse.java --- ...rver2.sh => springboot-petstore-server.sh} | 0 .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 49 +++++------ .../main/java/io/swagger/api/StoreApi.java | 14 +-- .../src/main/java/io/swagger/api/UserApi.java | 30 +++---- .../SwaggerDocumentationConfig.java | 6 +- .../main/java/io/swagger/model/Category.java | 2 +- .../io/swagger/model/ModelApiResponse.java | 85 +++++++++++++++++++ .../src/main/java/io/swagger/model/Order.java | 4 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 15 files changed, 143 insertions(+), 61 deletions(-) rename bin/{springboot-petstore-server2.sh => springboot-petstore-server.sh} (100%) mode change 100644 => 100755 create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java diff --git a/bin/springboot-petstore-server2.sh b/bin/springboot-petstore-server.sh old mode 100644 new mode 100755 similarity index 100% rename from bin/springboot-petstore-server2.sh rename to bin/springboot-petstore-server.sh diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java index c7499fe4ff21..1652afba0ad7 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java index 0df82935399a..d18415d8e7c9 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java index c7d9f8fdb589..a58b9c19e97f 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java index 3a513d8713eb..8770f484be13 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java index 127a788cf73b..7f66bdc75f7d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java @@ -4,6 +4,7 @@ import io.swagger.model.*; import io.swagger.model.Pet; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; @@ -26,7 +27,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @@ -38,12 +39,12 @@ public class PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) public ResponseEntity addPet( -@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body ) throws NotFoundException { // do some magic! @@ -60,7 +61,7 @@ public class PetApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) public ResponseEntity deletePet( @@ -77,7 +78,7 @@ public class PetApi { } - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -87,10 +88,10 @@ public class PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) @RequestMapping(value = "/findByStatus", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status + public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status ) @@ -100,7 +101,7 @@ public class PetApi { } - @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -110,10 +111,10 @@ public class PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) @RequestMapping(value = "/findByTags", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags + public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags ) @@ -123,11 +124,7 @@ public class PetApi { } - @ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }), + @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @Authorization(value = "api_key") }) @ApiResponses(value = { @@ -135,11 +132,11 @@ public class PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) public ResponseEntity getPetById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId +@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId ) throws NotFoundException { @@ -159,12 +156,12 @@ public class PetApi { @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) public ResponseEntity updatePet( -@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body ) throws NotFoundException { // do some magic! @@ -181,11 +178,11 @@ public class PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) public ResponseEntity updatePetWithForm( -@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId +@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId , @@ -204,19 +201,19 @@ public class PetApi { } - @ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = { + @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") }) }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) @RequestMapping(value = "/{petId}/uploadImage", - produces = { "application/json", "application/xml" }, + produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - public ResponseEntity uploadFile( + public ResponseEntity uploadFile( @ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId , @@ -231,7 +228,7 @@ public class PetApi { ) throws NotFoundException { // do some magic! - return new ResponseEntity(HttpStatus.OK); + return new ResponseEntity(HttpStatus.OK); } } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java index 9044f63f97b9..8cf2283e4fe4 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -26,7 +26,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @@ -34,7 +34,7 @@ public class StoreApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) public ResponseEntity deleteOrder( @@ -53,7 +53,7 @@ public class StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) @RequestMapping(value = "/inventory", - produces = { "application/json", "application/xml" }, + produces = { "application/json" }, method = RequestMethod.GET) public ResponseEntity> getInventory() @@ -69,11 +69,11 @@ public class StoreApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) public ResponseEntity getOrderById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId ) throws NotFoundException { @@ -87,12 +87,12 @@ public class StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) @RequestMapping(value = "/order", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity placeOrder( -@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body +@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index c0409a9237b3..36c500fadedb 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -26,19 +26,19 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUser( -@ApiParam(value = "Created user object" ) @RequestBody User body +@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body ) throws NotFoundException { // do some magic! @@ -50,12 +50,12 @@ public class UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/createWithArray", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUsersWithArrayInput( -@ApiParam(value = "List of user object" ) @RequestBody List body +@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body ) throws NotFoundException { // do some magic! @@ -67,12 +67,12 @@ public class UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/createWithList", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) public ResponseEntity createUsersWithListInput( -@ApiParam(value = "List of user object" ) @RequestBody List body +@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body ) throws NotFoundException { // do some magic! @@ -85,7 +85,7 @@ public class UserApi { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) public ResponseEntity deleteUser( @@ -104,7 +104,7 @@ public class UserApi { @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) public ResponseEntity getUserByName( @@ -122,14 +122,14 @@ public class UserApi { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) @RequestMapping(value = "/login", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username + public ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username , - @ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password + @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password ) @@ -143,7 +143,7 @@ public class UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/logout", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.GET) public ResponseEntity logoutUser() @@ -158,7 +158,7 @@ public class UserApi { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) public ResponseEntity updateUser( @@ -167,7 +167,7 @@ public class UserApi { , -@ApiParam(value = "Updated user object" ) @RequestBody User body +@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 54c04e222b3f..185c0e087946 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -13,18 +13,18 @@ import springfox.documentation.spring.web.plugins.Docket; @Configuration -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class SwaggerDocumentationConfig { ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") - .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") + .description("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.") .license("Apache 2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") - .contact(new Contact("","", "apiteam@wordnik.com")) + .contact(new Contact("","", "apiteam@swagger.io")) .build(); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java index b672ce0839b4..411a206a7f6d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java new file mode 100644 index 000000000000..73a0717d5e54 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java @@ -0,0 +1,85 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +public class ModelApiResponse { + + private Integer code = null; + private String type = null; + private String message = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("type") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(code).append("\n"); + sb.append(" type: ").append(type).append("\n"); + sb.append(" message: ").append(message).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java index 38d97525c8b1..3f8bbd49e375 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class Order { private Long id = null; @@ -25,7 +25,7 @@ public class Order { }; private StatusEnum status = null; - private Boolean complete = null; + private Boolean complete = false; /** **/ diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java index caa76cd78d8c..1507c988f3bd 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java index 8aa0ca904b7c..665a5c002701 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java index 21432ba3355b..dd8cd876e7b4 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") public class User { private Long id = null; From e04c4ec640d48004d877f0c8e4db93d3fef77bd2 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 5 May 2016 17:12:28 +0800 Subject: [PATCH 112/170] add typescript-fetch client generator --- bin/typescript-fetch-petstore.sh | 31 + bin/windows/typescript-fetch.bat | 10 + .../TypeScriptFetchClientCodegen.java | 2 +- .../TypeScriptFetchClientOptionsProvider.java | 2 + .../TypeScriptFetchClientOptionsTest.java | 2 + .../client/petstore/typescript-fetch/api.ts | 859 ++++++++++++++++++ .../petstore/typescript-fetch/assign.ts | 18 + .../petstore/typescript-fetch/git_push.sh | 52 ++ .../petstore/typescript-fetch/package.json | 10 + .../petstore/typescript-fetch/tsconfig.json | 11 + .../petstore/typescript-fetch/typings.json | 9 + 11 files changed, 1005 insertions(+), 1 deletion(-) create mode 100755 bin/typescript-fetch-petstore.sh create mode 100755 bin/windows/typescript-fetch.bat create mode 100644 samples/client/petstore/typescript-fetch/api.ts create mode 100644 samples/client/petstore/typescript-fetch/assign.ts create mode 100644 samples/client/petstore/typescript-fetch/git_push.sh create mode 100644 samples/client/petstore/typescript-fetch/package.json create mode 100644 samples/client/petstore/typescript-fetch/tsconfig.json create mode 100644 samples/client/petstore/typescript-fetch/typings.json diff --git a/bin/typescript-fetch-petstore.sh b/bin/typescript-fetch-petstore.sh new file mode 100755 index 000000000000..a4fc62dac90f --- /dev/null +++ b/bin/typescript-fetch-petstore.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-fetch -o samples/client/petstore/typescript-fetch/" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/typescript-fetch.bat b/bin/windows/typescript-fetch.bat new file mode 100755 index 000000000000..b3ff19ea2117 --- /dev/null +++ b/bin/windows/typescript-fetch.bat @@ -0,0 +1,10 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate -t modules\swagger-codegen\src\main\resources\typescript-fetch -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-fetch -o samples\client\petstore\typescript-fetch + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java index 6d34adfad8d7..804f48d79f78 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java @@ -13,7 +13,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege @Override public String getHelp() { - return "Generates a TypeScript client library using Fetch API."; + return "Generates a TypeScript client library using Fetch API (beta)."; } @Override diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java index 6981dd3702c6..46452af16223 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java @@ -8,6 +8,7 @@ import java.util.Map; public class TypeScriptFetchClientOptionsProvider implements OptionsProvider { public static final String SORT_PARAMS_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; + public static final Boolean SUPPORTS_ES6_VALUE = false; public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; @Override @@ -21,6 +22,7 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider { return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) + .put(CodegenConstants.SUPPORTS_ES6, String.valueOf(SUPPORTS_ES6_VALUE)) .build(); } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchClientOptionsTest.java index d6d0849de296..09f16799ad9b 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescriptfetch/TypeScriptFetchClientOptionsTest.java @@ -29,6 +29,8 @@ public class TypeScriptFetchClientOptionsTest extends AbstractOptionsTest { times = 1; clientCodegen.setModelPropertyNaming(TypeScriptFetchClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); times = 1; + clientCodegen.setSupportsES6(TypeScriptFetchClientOptionsProvider.SUPPORTS_ES6_VALUE); + times = 1; }}; } } diff --git a/samples/client/petstore/typescript-fetch/api.ts b/samples/client/petstore/typescript-fetch/api.ts new file mode 100644 index 000000000000..0c8f4201e4cf --- /dev/null +++ b/samples/client/petstore/typescript-fetch/api.ts @@ -0,0 +1,859 @@ +import * as querystring from 'querystring'; +import * as fetch from 'isomorphic-fetch'; +import {assign} from './assign'; + + +export interface Category { + "id"?: number; + "name"?: string; +} + +export interface Order { + "id"?: number; + "petId"?: number; + "quantity"?: number; + "shipDate"?: Date; + + /** + * Order Status + */ + "status"?: Order.StatusEnum; + "complete"?: boolean; +} + + +export enum StatusEnum { + placed = 'placed', + approved = 'approved', + delivered = 'delivered' +} +export interface Pet { + "id"?: number; + "category"?: Category; + "name": string; + "photoUrls": Array; + "tags"?: Array; + + /** + * pet status in the store + */ + "status"?: Pet.StatusEnum; +} + + +export enum StatusEnum { + available = 'available', + pending = 'pending', + sold = 'sold' +} +export interface Tag { + "id"?: number; + "name"?: string; +} + +export interface User { + "id"?: number; + "username"?: string; + "firstName"?: string; + "lastName"?: string; + "email"?: string; + "password"?: string; + "phone"?: string; + + /** + * User Status + */ + "userStatus"?: number; +} + + +//export namespace { + 'use strict'; + + export class PetApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + */ + public addPet (params: { body?: Pet; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet (params: { petId: number; apiKey?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling deletePet'); + } + headerParams['api_key'] = params.apiKey; + + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus (params: { status?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise> { + const localVarPath = this.basePath + '/pet/findByStatus'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.status !== undefined) { + queryParameters['status'] = params.status; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Finds Pets by tags + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + */ + public findPetsByTags (params: { tags?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise> { + const localVarPath = this.basePath + '/pet/findByTags'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.tags !== undefined) { + queryParameters['tags'] = params.tags; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * 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 + */ + public getPetById (params: { petId: number; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling getPetById'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + */ + public updatePet (params: { body?: Pet; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'PUT', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithForm (params: { petId: string; name?: string; status?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling updatePetWithForm'); + } + formParams['name'] = params.name; + + formParams['status'] = params.status; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: querystring.stringify(formParams), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile (params: { petId: number; additionalMetadata?: string; file?: any; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling uploadFile'); + } + formParams['additionalMetadata'] = params.additionalMetadata; + + formParams['file'] = params.file; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: querystring.stringify(formParams), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + } +//} +//export namespace { + 'use strict'; + + export class StoreApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder (params: { orderId: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(params.orderId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'orderId' is set + if (params.orderId == null) { + throw new Error('Missing required parameter orderId when calling deleteOrder'); + } + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + public getInventory (params: { }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{ [key: string]: number; }> { + const localVarPath = this.basePath + '/store/inventory'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Find purchase order by ID + * 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 + */ + public getOrderById (params: { orderId: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(params.orderId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'orderId' is set + if (params.orderId == null) { + throw new Error('Missing required parameter orderId when calling getOrderById'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + */ + public placeOrder (params: { body?: Order; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/store/order'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + } +//} +//export namespace { + 'use strict'; + + export class UserApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + */ + public createUser (params: { body?: User; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithArrayInput (params: { body?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/createWithArray'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithListInput (params: { body?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/createWithList'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + */ + public deleteUser (params: { username: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling deleteUser'); + } + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (params: { username: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling getUserByName'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser (params: { username?: string; password?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/user/login'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.username !== undefined) { + queryParameters['username'] = params.username; + } + + if (params.password !== undefined) { + queryParameters['password'] = params.password; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Logs out current logged in user session + * + */ + public logoutUser (params: { }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/logout'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param body Updated user object + */ + public updateUser (params: { username: string; body?: User; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling updateUser'); + } + let fetchParams = { + method: 'PUT', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + var error = new Error(response.statusText); + error['response'] = response; + throw error; + } + }); + } + } +//} diff --git a/samples/client/petstore/typescript-fetch/assign.ts b/samples/client/petstore/typescript-fetch/assign.ts new file mode 100644 index 000000000000..040f87d7d98b --- /dev/null +++ b/samples/client/petstore/typescript-fetch/assign.ts @@ -0,0 +1,18 @@ +export function assign (target, ...args) { + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + for (let source of args) { + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; +}; \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/git_push.sh b/samples/client/petstore/typescript-fetch/git_push.sh new file mode 100644 index 000000000000..ed374619b139 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/typescript-fetch/package.json b/samples/client/petstore/typescript-fetch/package.json new file mode 100644 index 000000000000..722c87cc3237 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/package.json @@ -0,0 +1,10 @@ +{ + "private": true, + "dependencies": { + "isomorphic-fetch": "^2.2.1" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/tsconfig.json b/samples/client/petstore/typescript-fetch/tsconfig.json new file mode 100644 index 000000000000..fc93dc1610e1 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es5" + }, + "exclude": [ + "node_modules", + "typings/browser", + "typings/main", + "typings/main.d.ts" + ] +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/typings.json b/samples/client/petstore/typescript-fetch/typings.json new file mode 100644 index 000000000000..c22f086f7f05 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/typings.json @@ -0,0 +1,9 @@ +{ + "version": false, + "dependencies": {}, + "ambientDependencies": { + "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", + "node": "registry:dt/node#4.0.0+20160423143914", + "isomorphic-fetch": "github:leonyu/DefinitelyTyped/isomorphic-fetch/isomorphic-fetch.d.ts#isomorphic-fetch-fix-module" + } +} From ebdf12bcd4ab8afdcb6ad1952bb0e86a33f9550a Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Thu, 5 May 2016 11:41:58 -0700 Subject: [PATCH 113/170] fixed code gen using {{#isListContainer}}*{{/isListContainer}} field --- .../codegen/languages/GoClientCodegen.java | 8 +------ .../src/main/resources/go/api.mustache | 10 ++++----- .../petstore/go/go-petstore/docs/PetApi.md | 8 +++---- .../petstore/go/go-petstore/docs/StoreApi.md | 12 +++++----- .../petstore/go/go-petstore/docs/UserApi.md | 8 +++---- .../client/petstore/go/go-petstore/pet_api.go | 16 +++++++------- .../petstore/go/go-petstore/store_api.go | 22 +++++++++---------- .../petstore/go/go-petstore/user_api.go | 18 +++++++-------- 8 files changed, 48 insertions(+), 54 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java index e9162205e7b4..fe25436c9019 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java @@ -401,13 +401,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { listIterator.add(newImportMap); } } - // add pointer to return type string if it is not array - for (CodegenOperation operation : operations) { - if((operation.returnContainer == null || operation.returnContainer != "array") - && operation.returnType != null) { - operation.returnType = "*" + operation.returnType; - } - } + return objs; } diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index fbc0ac0b0d4a..480db023f6ba 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -35,9 +35,9 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}} { * {{notes}}{{/notes}} * {{#allParams}} * @param {{paramName}} {{description}} -{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} +{{/allParams}} * @return {{#returnType}}{{^isListContainer}}*{{/isListContainer}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ -func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*APIResponse, error) { +func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{^isListContainer}}*{{/isListContainer}}{{{returnType}}}, {{/returnType}}*APIResponse, error) { var httpMethod = "{{httpMethod}}" // create path and map variables @@ -46,7 +46,7 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{ {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if &{{paramName}} == nil { - return {{#returnType}}*new({{{returnType}}}), {{/returnType}}nil, errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}new({{{returnType}}}), {{/returnType}}nil, errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") }{{/required}}{{/allParams}} headerParams := make(map[string]string) @@ -113,10 +113,10 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{ {{#returnType}} var successPayload = new({{returnType}}){{/returnType}} httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return {{#returnType}}*successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err + return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err } {{#returnType}} err = json.Unmarshal(httpResponse.Body(), &successPayload){{/returnType}} - return {{#returnType}}*successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err + return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err } {{/operation}}{{/operations}} diff --git a/samples/client/petstore/go/go-petstore/docs/PetApi.md b/samples/client/petstore/go/go-petstore/docs/PetApi.md index b0788fb19322..e96bdc1a15e2 100644 --- a/samples/client/petstore/go/go-petstore/docs/PetApi.md +++ b/samples/client/petstore/go/go-petstore/docs/PetApi.md @@ -132,7 +132,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetPetById** -> *Pet GetPetById($petId) +> Pet GetPetById($petId) Find pet by ID @@ -147,7 +147,7 @@ Name | Type | Description | Notes ### Return type -[***Pet**](Pet.md) +[**Pet**](Pet.md) ### Authorization @@ -221,7 +221,7 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **UploadFile** -> *ModelApiResponse UploadFile($petId, $additionalMetadata, $file) +> ModelApiResponse UploadFile($petId, $additionalMetadata, $file) uploads an image @@ -238,7 +238,7 @@ Name | Type | Description | Notes ### Return type -[***ModelApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ApiResponse.md) ### Authorization diff --git a/samples/client/petstore/go/go-petstore/docs/StoreApi.md b/samples/client/petstore/go/go-petstore/docs/StoreApi.md index 15a05e6158fa..1ee858d2e309 100644 --- a/samples/client/petstore/go/go-petstore/docs/StoreApi.md +++ b/samples/client/petstore/go/go-petstore/docs/StoreApi.md @@ -40,7 +40,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetInventory** -> *map[string]int32 GetInventory() +> map[string]int32 GetInventory() Returns pet inventories by status @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[***map[string]int32**](map.md) +[**map[string]int32**](map.md) ### Authorization @@ -66,7 +66,7 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetOrderById** -> *Order GetOrderById($orderId) +> Order GetOrderById($orderId) Find purchase order by ID @@ -81,7 +81,7 @@ Name | Type | Description | Notes ### Return type -[***Order**](Order.md) +[**Order**](Order.md) ### Authorization @@ -95,7 +95,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **PlaceOrder** -> *Order PlaceOrder($body) +> Order PlaceOrder($body) Place an order for a pet @@ -110,7 +110,7 @@ Name | Type | Description | Notes ### Return type -[***Order**](Order.md) +[**Order**](Order.md) ### Authorization diff --git a/samples/client/petstore/go/go-petstore/docs/UserApi.md b/samples/client/petstore/go/go-petstore/docs/UserApi.md index 9063e0522293..4950105ca861 100644 --- a/samples/client/petstore/go/go-petstore/docs/UserApi.md +++ b/samples/client/petstore/go/go-petstore/docs/UserApi.md @@ -131,7 +131,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetUserByName** -> *User GetUserByName($username) +> User GetUserByName($username) Get user by user name @@ -146,7 +146,7 @@ Name | Type | Description | Notes ### Return type -[***User**](User.md) +[**User**](User.md) ### Authorization @@ -160,7 +160,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **LoginUser** -> *string LoginUser($username, $password) +> string LoginUser($username, $password) Logs user into the system @@ -176,7 +176,7 @@ Name | Type | Description | Notes ### Return type -***string** +**string** ### Authorization diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index 5d2a447dfe36..f70ceaa65f0e 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -312,7 +312,7 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { // verify the required parameter 'petId' is set if &petId == nil { - return *new(*Pet), nil, errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") + return new(Pet), nil, errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") } headerParams := make(map[string]string) @@ -350,13 +350,13 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(*Pet) + var successPayload = new(Pet) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -512,7 +512,7 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File // verify the required parameter 'petId' is set if &petId == nil { - return *new(*ModelApiResponse), nil, errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") + return new(ModelApiResponse), nil, errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") } headerParams := make(map[string]string) @@ -556,12 +556,12 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File fileBytes = fbs fileName = file.Name() - var successPayload = new(*ModelApiResponse) + var successPayload = new(ModelApiResponse) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index 7e71e2e7220a..56af72236393 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -133,13 +133,13 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) { if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(*map[string]int32) + var successPayload = new(map[string]int32) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -158,7 +158,7 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { // verify the required parameter 'orderId' is set if &orderId == nil { - return *new(*Order), nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") + return new(Order), nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") } headerParams := make(map[string]string) @@ -192,13 +192,13 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(*Order) + var successPayload = new(Order) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -216,7 +216,7 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *new(*Order), nil, errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") + return new(Order), nil, errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") } headerParams := make(map[string]string) @@ -253,12 +253,12 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) { // body params postBody = &body - var successPayload = new(*Order) + var successPayload = new(Order) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index 410c6e73ad04..1ed8b9a599a4 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -285,7 +285,7 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *new(*User), nil, errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") + return new(User), nil, errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") } headerParams := make(map[string]string) @@ -319,13 +319,13 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(*User) + var successPayload = new(User) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** @@ -344,11 +344,11 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo // verify the required parameter 'username' is set if &username == nil { - return *new(*string), nil, errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") + return new(string), nil, errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") } // verify the required parameter 'password' is set if &password == nil { - return *new(*string), nil, errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") + return new(string), nil, errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") } headerParams := make(map[string]string) @@ -388,13 +388,13 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(*string) + var successPayload = new(string) httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(httpResponse.RawResponse), err + return successPayload, NewAPIResponse(httpResponse.RawResponse), err } /** From e5ab34b6587242cff4a09192d5b0bf09c6a697d1 Mon Sep 17 00:00:00 2001 From: Griffin Schneider Date: Thu, 5 May 2016 15:54:22 -0400 Subject: [PATCH 114/170] Replace 'BEARER' with 'Bearer' everywhere. RFC6750 indicates that the correct header format is 'Bearer ', not 'BEARER '. --- .../src/main/resources/csharp/README.mustache | 4 +-- .../main/resources/csharp/api_doc.mustache | 4 +-- .../objc/Configuration-body.mustache | 2 +- .../src/main/resources/objc/README.mustache | 4 +-- .../src/main/resources/objc/api_doc.mustache | 4 +-- .../src/main/resources/perl/README.mustache | 4 +-- .../src/main/resources/perl/api_doc.mustache | 4 +-- .../src/main/resources/php/README.mustache | 4 +-- .../src/main/resources/php/api_doc.mustache | 4 +-- .../src/main/resources/python/README.mustache | 4 +-- .../main/resources/python/api_doc.mustache | 4 +-- .../src/main/resources/ruby/README.mustache | 4 +-- .../src/main/resources/ruby/api_doc.mustache | 4 +-- .../Lib/SwaggerClient/README.mustache | 20 ++++++------ .../Lib/SwaggerClient/docs/PetApi.md | 4 +-- .../Lib/SwaggerClient/docs/StoreApi.md | 4 +-- .../objc/SwaggerClient/SWGConfiguration.m | 2 +- .../client/petstore/objc/docs/SWGPetApi.md | 4 +-- .../client/petstore/objc/docs/SWGStoreApi.md | 4 +-- samples/client/petstore/perl/docs/PetApi.md | 12 +++---- samples/client/petstore/perl/docs/StoreApi.md | 32 +++++++++---------- samples/client/petstore/perl/test.pl | 2 +- .../php/SwaggerClient-php/docs/PetApi.md | 4 +-- .../php/SwaggerClient-php/docs/StoreApi.md | 4 +-- samples/client/petstore/python/docs/PetApi.md | 4 +-- .../client/petstore/python/docs/StoreApi.md | 4 +-- samples/client/petstore/ruby/docs/PetApi.md | 4 +-- samples/client/petstore/ruby/docs/StoreApi.md | 4 +-- 28 files changed, 79 insertions(+), 79 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/README.mustache b/modules/swagger-codegen/src/main/resources/csharp/README.mustache index 06660a3c615c..c7fb29fafabf 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/README.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/README.mustache @@ -72,8 +72,8 @@ namespace Example Configuration.Default.Password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}} // Configure API key authorization: {{{name}}} Configuration.Default.ApiKey.Add('{{{keyParamName}}}', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}} // Configure OAuth2 access token for authorization: {{{name}}} Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache index e445191085a3..677ad3edbe13 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache @@ -37,8 +37,8 @@ namespace Example Configuration.Default.Password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}} // Configure API key authorization: {{{name}}} Configuration.Default.ApiKey.Add('{{{keyParamName}}}', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}} // Configure OAuth2 access token for authorization: {{{name}}} Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} diff --git a/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache b/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache index 4f5442ed213b..527e16c2b917 100644 --- a/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache @@ -72,7 +72,7 @@ return @""; } else { - return [NSString stringWithFormat:@"BEARER %@", self.accessToken]; + return [NSString stringWithFormat:@"Bearer %@", self.accessToken]; } } diff --git a/modules/swagger-codegen/src/main/resources/objc/README.mustache b/modules/swagger-codegen/src/main/resources/objc/README.mustache index c0bc1178b0b3..ed48e239596f 100644 --- a/modules/swagger-codegen/src/main/resources/objc/README.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/README.mustache @@ -70,8 +70,8 @@ Please follow the [installation procedure](#installation--usage) and then run th {{/isBasic}}{{#isApiKey}} // Configure API key authorization: (authentication scheme: {{{name}}}) [apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"{{{keyParamName}}}"]; -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -//[apiConfig setApiKeyPrefix:@"BEARER" forApiKeyIdentifier:@"{{{keyParamName}}}"]; +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"{{{keyParamName}}}"]; {{/isApiKey}}{{#isOAuth}} // Configure OAuth2 access token for authorization: (authentication scheme: {{{name}}}) [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; diff --git a/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache b/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache index 3400300c8dcb..c27f64253889 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache @@ -31,8 +31,8 @@ Method | HTTP request | Description {{/isBasic}}{{#isApiKey}} // Configure API key authorization: (authentication scheme: {{{name}}}) [apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"{{{keyParamName}}}"]; -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -//[apiConfig setApiKeyPrefix:@"BEARER" forApiKeyIdentifier:@"{{{keyParamName}}}"]; +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"{{{keyParamName}}}"]; {{/isApiKey}}{{#isOAuth}} // Configure OAuth2 access token for authorization: (authentication scheme: {{{name}}}) [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; diff --git a/modules/swagger-codegen/src/main/resources/perl/README.mustache b/modules/swagger-codegen/src/main/resources/perl/README.mustache index b312193f1cc6..d47d482742d3 100644 --- a/modules/swagger-codegen/src/main/resources/perl/README.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/README.mustache @@ -257,8 +257,8 @@ ${{{moduleName}}}::Configuration::username = 'YOUR_USERNAME'; ${{{moduleName}}}::Configuration::password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} ${{{moduleName}}}::Configuration::api_key->{'{{{keyParamName}}}'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#${{{moduleName}}}::Configuration::api_key_prefix->{'{{{keyParamName}}}'} = 'BEARER';{{/isApiKey}}{{#isOAuth}} +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#${{{moduleName}}}::Configuration::api_key_prefix->{'{{{keyParamName}}}'} = 'Bearer';{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} ${{{moduleName}}}::Configuration::access_token = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} diff --git a/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache b/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache index c68934ece2a8..17dc3903152d 100644 --- a/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache @@ -31,8 +31,8 @@ ${{{moduleName}}}::Configuration::username = 'YOUR_USERNAME'; ${{{moduleName}}}::Configuration::password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} ${{{moduleName}}}::Configuration::api_key->{'{{{keyParamName}}}'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#${{{moduleName}}}::Configuration::api_key_prefix->{'{{{keyParamName}}}'} = "BEARER";{{/isApiKey}}{{#isOAuth}} +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#${{{moduleName}}}::Configuration::api_key_prefix->{'{{{keyParamName}}}'} = "Bearer";{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} ${{{moduleName}}}::Configuration::access_token = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} diff --git a/modules/swagger-codegen/src/main/resources/php/README.mustache b/modules/swagger-codegen/src/main/resources/php/README.mustache index e64b0bf22c61..39f64dc86e53 100644 --- a/modules/swagger-codegen/src/main/resources/php/README.mustache +++ b/modules/swagger-codegen/src/main/resources/php/README.mustache @@ -68,8 +68,8 @@ require_once(__DIR__ . '/vendor/autoload.php'); {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}} // Configure API key authorization: {{{name}}} {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}} // Configure OAuth2 access token for authorization: {{{name}}} {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} diff --git a/modules/swagger-codegen/src/main/resources/php/api_doc.mustache b/modules/swagger-codegen/src/main/resources/php/api_doc.mustache index ba3529e969cf..baa8461f86f8 100644 --- a/modules/swagger-codegen/src/main/resources/php/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api_doc.mustache @@ -27,8 +27,8 @@ require_once(__DIR__ . '/vendor/autoload.php'); {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}} // Configure API key authorization: {{{name}}} {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}} // Configure OAuth2 access token for authorization: {{{name}}} {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} diff --git a/modules/swagger-codegen/src/main/resources/python/README.mustache b/modules/swagger-codegen/src/main/resources/python/README.mustache index 8fe1045f6618..08f2d835c4cb 100644 --- a/modules/swagger-codegen/src/main/resources/python/README.mustache +++ b/modules/swagger-codegen/src/main/resources/python/README.mustache @@ -61,8 +61,8 @@ from pprint import pprint {{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} {{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' -# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}} +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} {{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} diff --git a/modules/swagger-codegen/src/main/resources/python/api_doc.mustache b/modules/swagger-codegen/src/main/resources/python/api_doc.mustache index 99a05f8c43df..8eb25a87b06c 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_doc.mustache @@ -29,8 +29,8 @@ from pprint import pprint {{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} {{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' -# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}} +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} {{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} diff --git a/modules/swagger-codegen/src/main/resources/ruby/README.mustache b/modules/swagger-codegen/src/main/resources/ruby/README.mustache index f4bafd9b0ea3..076192b75ce4 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/README.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/README.mustache @@ -67,8 +67,8 @@ require '{{{gemName}}}' config.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} config.api_key['{{{keyParamName}}}'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}} + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}} {{/authMethods}}end diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache index 169920a4bc3f..a2cee7f93612 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache @@ -29,8 +29,8 @@ require '{{{gemName}}}' config.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} config.api_key['{{{keyParamName}}}'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}} + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}} {{/authMethods}}end diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache index d5f5ce413b39..6a7b6cd5e3c0 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache @@ -50,27 +50,27 @@ public void main(){ Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; // Configure API key authorization: test_api_client_id Configuration.Default.ApiKey.Add('x-test_api_client_id', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_id', 'BEARER'); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_id', 'Bearer'); // Configure API key authorization: test_api_client_secret Configuration.Default.ApiKey.Add('x-test_api_client_secret', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_secret', 'BEARER'); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_secret', 'Bearer'); // Configure API key authorization: api_key Configuration.Default.ApiKey.Add('api_key', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('api_key', 'BEARER'); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('api_key', 'Bearer'); // Configure HTTP basic authorization: test_http_basic Configuration.Default.Username = 'YOUR_USERNAME'; Configuration.Default.Password = 'YOUR_PASSWORD'; // Configure API key authorization: test_api_key_query Configuration.Default.ApiKey.Add('test_api_key_query', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('test_api_key_query', 'BEARER'); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('test_api_key_query', 'Bearer'); // Configure API key authorization: test_api_key_header Configuration.Default.ApiKey.Add('test_api_key_header', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('test_api_key_header', 'BEARER'); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('test_api_key_header', 'Bearer'); var apiInstance = new (); diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md index 6d05169a4ccf..837859e4b7e3 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md @@ -294,8 +294,8 @@ namespace Example // Configure API key authorization: api_key Configuration.Default.ApiKey.Add('api_key', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('api_key', 'BEARER'); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('api_key', 'Bearer'); var apiInstance = new PetApi(); var petId = 789; // long? | ID of pet to return diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md index f558166ecb04..a5d5ff0454d1 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md @@ -94,8 +94,8 @@ namespace Example // Configure API key authorization: api_key Configuration.Default.ApiKey.Add('api_key', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('api_key', 'BEARER'); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('api_key', 'Bearer'); var apiInstance = new StoreApi(); diff --git a/samples/client/petstore/objc/SwaggerClient/SWGConfiguration.m b/samples/client/petstore/objc/SwaggerClient/SWGConfiguration.m index c9d80f5c488b..dd1596bf8ce3 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGConfiguration.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGConfiguration.m @@ -72,7 +72,7 @@ return @""; } else { - return [NSString stringWithFormat:@"BEARER %@", self.accessToken]; + return [NSString stringWithFormat:@"Bearer %@", self.accessToken]; } } diff --git a/samples/client/petstore/objc/docs/SWGPetApi.md b/samples/client/petstore/objc/docs/SWGPetApi.md index 78a54942c2fa..c69e6ce02c80 100644 --- a/samples/client/petstore/objc/docs/SWGPetApi.md +++ b/samples/client/petstore/objc/docs/SWGPetApi.md @@ -283,8 +283,8 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; // Configure API key authorization: (authentication scheme: api_key) [apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"]; -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -//[apiConfig setApiKeyPrefix:@"BEARER" forApiKeyIdentifier:@"api_key"]; +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"]; NSNumber* petId = @789; // ID of pet that needs to be fetched diff --git a/samples/client/petstore/objc/docs/SWGStoreApi.md b/samples/client/petstore/objc/docs/SWGStoreApi.md index 1eacf83431a5..7c9b20696d08 100644 --- a/samples/client/petstore/objc/docs/SWGStoreApi.md +++ b/samples/client/petstore/objc/docs/SWGStoreApi.md @@ -81,8 +81,8 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; // Configure API key authorization: (authentication scheme: api_key) [apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"]; -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -//[apiConfig setApiKeyPrefix:@"BEARER" forApiKeyIdentifier:@"api_key"]; +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"]; diff --git a/samples/client/petstore/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index c696eac92cdf..829dc3a08ef3 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -269,8 +269,8 @@ use Data::Dumper; # Configure API key authorization: api_key $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; @@ -320,8 +320,8 @@ use Data::Dumper; # Configure API key authorization: api_key $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; @@ -371,8 +371,8 @@ use Data::Dumper; # Configure API key authorization: api_key $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index 15b02bca3fde..c5eb55a3f124 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -73,12 +73,12 @@ use Data::Dumper; # Configure API key authorization: test_api_client_id $WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "Bearer"; # Configure API key authorization: test_api_client_secret $WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "Bearer"; my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $status = 'status_example'; # string | Status value that needs to be considered for query @@ -126,8 +126,8 @@ use Data::Dumper; # Configure API key authorization: api_key $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; my $api_instance = WWW::SwaggerClient::StoreApi->new(); @@ -171,8 +171,8 @@ use Data::Dumper; # Configure API key authorization: api_key $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; my $api_instance = WWW::SwaggerClient::StoreApi->new(); @@ -216,12 +216,12 @@ use Data::Dumper; # Configure API key authorization: test_api_key_header $WWW::SwaggerClient::Configuration::api_key->{'test_api_key_header'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_header'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_header'} = "Bearer"; # Configure API key authorization: test_api_key_query $WWW::SwaggerClient::Configuration::api_key->{'test_api_key_query'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_query'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_query'} = "Bearer"; my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $order_id = 'order_id_example'; # string | ID of pet that needs to be fetched @@ -269,12 +269,12 @@ use Data::Dumper; # Configure API key authorization: test_api_client_id $WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "Bearer"; # Configure API key authorization: test_api_client_secret $WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; +# uncomment below to setup prefix (e.g. Bearer) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "Bearer"; my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $body = WWW::SwaggerClient::Object::Order->new(); # Order | order placed for purchasing the pet diff --git a/samples/client/petstore/perl/test.pl b/samples/client/petstore/perl/test.pl index 626d25357fc2..a5b608aa4030 100755 --- a/samples/client/petstore/perl/test.pl +++ b/samples/client/petstore/perl/test.pl @@ -17,7 +17,7 @@ use DateTime; $WWW::SwaggerClient::Configuration::http_user_agent = 'Perl-Swagger-Test'; $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'ZZZZZZZZZZZZZZ'; -$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = 'BEARER'; +$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = 'Bearer'; $WWW::SwaggerClient::Configuration::username = 'username'; $WWW::SwaggerClient::Configuration::password = 'password'; diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md index a2a06445c738..bf119270a58d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md @@ -220,8 +220,8 @@ require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api_key Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer'); $api_instance = new Swagger\Client\Api\PetApi(); $pet_id = 789; // int | ID of pet to return diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md index 8198bf3dbf4f..7040df371a46 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md @@ -68,8 +68,8 @@ require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api_key Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer'); $api_instance = new Swagger\Client\Api\StoreApi(); diff --git a/samples/client/petstore/python/docs/PetApi.md b/samples/client/petstore/python/docs/PetApi.md index 3b14d2b80621..fb69778f6115 100644 --- a/samples/client/petstore/python/docs/PetApi.md +++ b/samples/client/petstore/python/docs/PetApi.md @@ -230,8 +230,8 @@ from pprint import pprint # Configure API key authorization: api_key swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY' -# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# swagger_client.configuration.api_key_prefix['api_key'] = 'Bearer' # create an instance of the API class api_instance = swagger_client.PetApi() diff --git a/samples/client/petstore/python/docs/StoreApi.md b/samples/client/petstore/python/docs/StoreApi.md index 04b4300d58de..537009bde523 100644 --- a/samples/client/petstore/python/docs/StoreApi.md +++ b/samples/client/petstore/python/docs/StoreApi.md @@ -72,8 +72,8 @@ from pprint import pprint # Configure API key authorization: api_key swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY' -# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# swagger_client.configuration.api_key_prefix['api_key'] = 'Bearer' # create an instance of the API class api_instance = swagger_client.StoreApi() diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md index d485993c6ed3..d5a498c6ff09 100644 --- a/samples/client/petstore/ruby/docs/PetApi.md +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -239,8 +239,8 @@ require 'petstore' Petstore.configure do |config| # Configure API key authorization: api_key config.api_key['api_key'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['api_key'] = 'BEARER' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['api_key'] = 'Bearer' end api_instance = Petstore::PetApi.new diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index 8c607b9d7c9b..c38a41eeef44 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -71,8 +71,8 @@ require 'petstore' Petstore.configure do |config| # Configure API key authorization: api_key config.api_key['api_key'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['api_key'] = 'BEARER' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['api_key'] = 'Bearer' end api_instance = Petstore::StoreApi.new From 0f1842bb06665706c66b9fe88353426d6356ca81 Mon Sep 17 00:00:00 2001 From: xming Date: Fri, 6 May 2016 10:35:45 +0800 Subject: [PATCH 115/170] add datatype link under responses --- .../swagger-codegen/src/main/resources/htmlDocs/index.mustache | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache index fa0e662b67f2..1216cae0c201 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache @@ -127,6 +127,7 @@ {{#responses}}

{{code}}

{{message}} + {{#simpleType}}{{dataType}}{{/simpleType}} {{#examples}}

Example data

Content-Type: {{{contentType}}}
From 70d6e64a8d0f2ae6c253afc874fb6951fb992ec3 Mon Sep 17 00:00:00 2001 From: xming Date: Fri, 6 May 2016 15:31:09 +0800 Subject: [PATCH 116/170] add link to param type --- .../swagger-codegen/src/main/resources/htmlDocs/index.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache index 1216cae0c201..60da5979a89c 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache @@ -159,7 +159,7 @@

{{classname}} Up

- {{#vars}}
{{name}} {{^required}}(optional){{/required}}
{{datatype}} {{description}}
+ {{#vars}}
{{name}} {{^required}}(optional){{/required}}
{{^isPrimitiveType}}{{datatype}}{{/isPrimitiveType}} {{description}}
{{#isEnum}}
Enum:
{{#_enum}}
{{this}}
{{/_enum}} From 3a80a4ff1e3a9d1eebad7fb18db10c6c3ce647ee Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 6 May 2016 16:36:45 +0800 Subject: [PATCH 117/170] fix double byte characters in description, upgrade to lang3 --- modules/swagger-codegen/pom.xml | 4 +- .../io/swagger/codegen/DefaultCodegen.java | 6 +- .../languages/AbstractCSharpCodegen.java | 2 +- .../AbstractTypeScriptClientCodegen.java | 2 +- .../languages/AkkaScalaClientCodegen.java | 2 +- .../languages/AndroidClientCodegen.java | 2 +- .../languages/AspNet5ServerCodegen.java | 2 +- .../languages/CSharpClientCodegen.java | 4 +- .../languages/ClojureClientCodegen.java | 2 +- .../codegen/languages/FlashClientCodegen.java | 2 +- .../codegen/languages/GoClientCodegen.java | 4 +- .../codegen/languages/JMeterCodegen.java | 2 +- .../codegen/languages/JavaClientCodegen.java | 6 +- .../languages/JavaResteasyServerCodegen.java | 2 +- .../languages/JavascriptClientCodegen.java | 2 +- ...JavascriptClosureAngularClientCodegen.java | 2 +- .../codegen/languages/LumenServerCodegen.java | 2 +- .../codegen/languages/ObjcClientCodegen.java | 2 +- .../codegen/languages/PerlClientCodegen.java | 2 +- .../languages/PythonClientCodegen.java | 2 +- .../codegen/languages/RubyClientCodegen.java | 2 +- .../codegen/languages/ScalaClientCodegen.java | 2 +- .../languages/SinatraServerCodegen.java | 2 +- .../codegen/languages/StaticDocCodegen.java | 2 +- .../languages/StaticHtmlGenerator.java | 2 +- .../codegen/languages/SwaggerGenerator.java | 2 +- .../languages/SwaggerYamlGenerator.java | 2 +- .../codegen/languages/SwiftCodegen.java | 6 +- .../codegen/languages/TizenClientCodegen.java | 2 +- .../statichtml/StaticHtmlTagsTest.java | 2 +- ...ith-fake-endpoints-models-for-testing.yaml | 12 +- pom.xml | 2 +- .../petstore/php/SwaggerClient-php/README.md | 6 +- .../php/SwaggerClient-php/docs/EnumClass.md | 9 + .../php/SwaggerClient-php/docs/EnumTest.md | 12 + .../php/SwaggerClient-php/docs/FakeApi.md | 12 + .../php/SwaggerClient-php/lib/Api/FakeApi.php | 8 + .../SwaggerClient-php/lib/Model/EnumClass.php | 182 ++++++++++ .../SwaggerClient-php/lib/Model/EnumTest.php | 318 ++++++++++++++++++ .../lib/Tests/EnumClassTest.php | 70 ++++ .../lib/Tests/EnumTestTest.php | 70 ++++ .../lib/Tests/FakeApiTest.php | 4 + samples/client/petstore/ruby/README.md | 9 +- .../client/petstore/ruby/docs/AnimalFarm.md | 7 + .../client/petstore/ruby/docs/EnumClass.md | 7 + samples/client/petstore/ruby/docs/EnumTest.md | 10 + samples/client/petstore/ruby/docs/FakeApi.md | 8 +- samples/client/petstore/ruby/lib/petstore.rb | 3 + .../ruby/lib/petstore/api/fake_api.rb | 8 +- .../ruby/lib/petstore/models/animal_farm.rb | 179 ++++++++++ .../ruby/lib/petstore/models/enum_class.rb | 184 ++++++++++ .../ruby/lib/petstore/models/enum_test.rb | 248 ++++++++++++++ 52 files changed, 1392 insertions(+), 54 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumTestTest.php create mode 100644 samples/client/petstore/ruby/docs/AnimalFarm.md create mode 100644 samples/client/petstore/ruby/docs/EnumClass.md create mode 100644 samples/client/petstore/ruby/docs/EnumTest.md create mode 100644 samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb create mode 100644 samples/client/petstore/ruby/lib/petstore/models/enum_class.rb create mode 100644 samples/client/petstore/ruby/lib/petstore/models/enum_test.rb diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml index afaecfc35126..9ea75ad3c882 100644 --- a/modules/swagger-codegen/pom.xml +++ b/modules/swagger-codegen/pom.xml @@ -252,8 +252,8 @@ ${slf4j-version} - commons-lang - commons-lang + org.apache.commons + commons-lang3 ${commons-lang-version} 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 db000e9c63ed..f350339127bf 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 @@ -9,8 +9,8 @@ import io.swagger.models.parameters.*; import io.swagger.models.properties.*; import io.swagger.models.properties.PropertyBuilder.PropertyId; import io.swagger.util.Json; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -325,7 +325,7 @@ public class DefaultCodegen { @SuppressWarnings("static-method") public String escapeText(String input) { if (input != null) { - return StringEscapeUtils.escapeJava(input).replace("\\/", "/"); + return StringEscapeUtils.unescapeJava(StringEscapeUtils.escapeJava(input).replace("\\/", "/")).replaceAll("[\\t\\n\\r]"," "); } return input; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java index e9d6457f6f0c..0058468efc89 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java @@ -2,7 +2,7 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; import io.swagger.models.properties.*; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index 55c1df5438c1..9e30ae657c82 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -6,7 +6,7 @@ import io.swagger.models.properties.*; import java.util.*; import java.io.File; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AkkaScalaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AkkaScalaClientCodegen.java index 523fa6ae8c62..43faca235d05 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AkkaScalaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AkkaScalaClientCodegen.java @@ -26,7 +26,7 @@ import io.swagger.models.properties.LongProperty; import io.swagger.models.properties.MapProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.StringProperty; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java index c0bead5c695c..bed84f855bf4 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java @@ -14,7 +14,7 @@ import java.io.File; import java.util.Arrays; import java.util.HashSet; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java index cf8915974e63..90bea4a8a6b3 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java @@ -2,7 +2,7 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; import io.swagger.models.properties.*; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 1212795e1bbb..5780466ddbc8 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 @@ -25,8 +25,8 @@ import java.util.Map; import java.util.ArrayList; import java.util.Iterator; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.WordUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.text.WordUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java index 2c60a30754bc..73ef83bc9cc6 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java @@ -11,7 +11,7 @@ import io.swagger.models.Contact; import io.swagger.models.Info; import io.swagger.models.License; import io.swagger.models.Swagger; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.File; import java.util.Map; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlashClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlashClientCodegen.java index b5699a93a341..a9eb1a97de70 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlashClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlashClientCodegen.java @@ -17,7 +17,7 @@ import io.swagger.models.properties.LongProperty; import io.swagger.models.properties.MapProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.StringProperty; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.File; import java.util.Arrays; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java index fe25436c9019..4e34424eab73 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java @@ -9,7 +9,7 @@ import io.swagger.models.parameters.Parameter; import java.io.File; import java.util.*; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -450,4 +450,4 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { public void setPackageVersion(String packageVersion) { this.packageVersion = packageVersion; } -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JMeterCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JMeterCodegen.java index 903cb7ba76eb..2d08c9741e9d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JMeterCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JMeterCodegen.java @@ -183,4 +183,4 @@ public class JMeterCodegen extends DefaultCodegen implements CodegenConfig { type = swaggerType; return toModelName(type); } -} \ No newline at end of file +} 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 e607670313c2..bc839f07d189 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 @@ -9,9 +9,9 @@ import io.swagger.models.Swagger; import io.swagger.models.parameters.FormParameter; import io.swagger.models.parameters.Parameter; import io.swagger.models.properties.*; -import org.apache.commons.lang.BooleanUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.WordUtils; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; +//import org.apache.commons.lang3.WordUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java index 5f715a436217..b919430035d3 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java @@ -4,7 +4,7 @@ import io.swagger.codegen.*; import io.swagger.models.Operation; import io.swagger.models.Path; import io.swagger.models.Swagger; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.File; import java.util.*; 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 feec76d8de2b..41f55a50c2b6 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 @@ -33,7 +33,7 @@ import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; import io.swagger.models.properties.StringProperty; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClosureAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClosureAngularClientCodegen.java index 2a2dfd86c9d6..55c3fab96b00 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClosureAngularClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClosureAngularClientCodegen.java @@ -8,7 +8,7 @@ import java.util.TreeSet; import java.util.*; import java.io.File; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implements CodegenConfig { public JavascriptClosureAngularClientCodegen() { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java index 55e72f793846..fbd98c034df0 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java @@ -232,4 +232,4 @@ public class LumenServerCodegen extends DefaultCodegen implements CodegenConfig type = swaggerType; return toModelName(type); } -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 21e319f6ec96..44ab79ddcc47 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { public static final String CLASS_PREFIX = "classPrefix"; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PerlClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PerlClientCodegen.java index e4744bf037c0..e17084a3bc5b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PerlClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PerlClientCodegen.java @@ -27,7 +27,7 @@ import java.util.Arrays; import java.util.HashSet; import java.util.regex.Matcher; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { public static final String MODULE_NAME = "moduleName"; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index 1bc95cfdd677..1c057834ecf4 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -13,7 +13,7 @@ import java.io.File; import java.util.Arrays; import java.util.HashSet; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig { protected String packageName; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java index f9c0990c182b..aeb8e524e9db 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java @@ -19,7 +19,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java index a13c7a54e701..992693810da9 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java @@ -26,7 +26,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig { protected String invokerPackage = "io.swagger.client"; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SinatraServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SinatraServerCodegen.java index bb7706b13fe0..fb3ceab7d78b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SinatraServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SinatraServerCodegen.java @@ -17,7 +17,7 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Map; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticDocCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticDocCodegen.java index 3ff35f170fd4..c64fcfb04efa 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticDocCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticDocCodegen.java @@ -85,4 +85,4 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig { public String modelFileFolder() { return outputFolder + File.separator + sourceFolder + File.separator + "models"; } -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java index 65ec85299308..0db05d5bc0ab 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java @@ -101,4 +101,4 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig } return objs; } -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerGenerator.java index b34e6bba5ab1..6282f72d8b79 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerGenerator.java @@ -52,4 +52,4 @@ public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig { LOGGER.error(e.getMessage(), e); } } -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerYamlGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerYamlGenerator.java index 5442000280f7..48f0197068bd 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerYamlGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwaggerYamlGenerator.java @@ -51,4 +51,4 @@ public class SwaggerYamlGenerator extends DefaultCodegen implements CodegenConfi LOGGER.error(e.getMessage(), e); } } -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java index 7b6bf8fbdc37..ba846857cb99 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java @@ -13,9 +13,9 @@ import io.swagger.models.parameters.Parameter; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.MapProperty; import io.swagger.models.properties.Property; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.WordUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.text.WordUtils; import javax.annotation.Nullable; import java.util.*; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TizenClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TizenClientCodegen.java index c3f6d7ab99a2..ec58781ab2b2 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TizenClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TizenClientCodegen.java @@ -25,7 +25,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public class TizenClientCodegen extends DefaultCodegen implements CodegenConfig { protected static String PREFIX = "Sami"; diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/statichtml/StaticHtmlTagsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/statichtml/StaticHtmlTagsTest.java index ad84f8ca0c78..0ba3d9e2fee0 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/statichtml/StaticHtmlTagsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/statichtml/StaticHtmlTagsTest.java @@ -12,7 +12,7 @@ import java.util.Set; import javax.annotation.Nullable; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.junit.rules.TemporaryFolder; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 068fb8054d8f..92e9cb251b13 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -564,8 +564,16 @@ paths: post: tags: - fake - summary: Fake endpoint for testing various parameters - description: Fake endpoint for testing various parameters + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 operationId: testEndpointParameters produces: - application/xml diff --git a/pom.xml b/pom.xml index 9ac1890ea914..1b5c3d7580f3 100644 --- a/pom.xml +++ b/pom.xml @@ -567,7 +567,7 @@ 1.2 4.8.1 1.0.0 - 2.4 + 3.4 1.7.12 3.2.1 1.12 diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index a5cba5dcbb77..ab81085c3ad2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-06T10:33:16.765+08:00 +- Build date: 2016-05-06T16:24:00.420+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -88,6 +88,10 @@ 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* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md new file mode 100644 index 000000000000..67f017becd0c --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md @@ -0,0 +1,9 @@ +# EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md new file mode 100644 index 000000000000..2ef9e6adaacb --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md @@ -0,0 +1,12 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_string** | **string** | | [optional] +**enum_integer** | **int** | | [optional] +**enum_number** | **double** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md index 93c24ef7eebc..4acf36fa6969 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md @@ -5,14 +5,26 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 + # **testEndpointParameters** > testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password) Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 + Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 + ### Example ```php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 376572544de2..32acfa9e2032 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -94,6 +94,10 @@ class FakeApi * testEndpointParameters * * Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 + * * @param float $number None (required) * @param double $double None (required) @@ -121,6 +125,10 @@ class FakeApi * testEndpointParametersWithHttpInfo * * Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 + * * @param float $number None (required) * @param double $double None (required) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php new file mode 100644 index 000000000000..66f2ba082296 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -0,0 +1,182 @@ +container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php new file mode 100644 index 000000000000..1f3213e7516e --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -0,0 +1,318 @@ + 'string', + 'enum_integer' => 'int', + 'enum_number' => 'double' + ); + + static function swaggerTypes() { + return self::$swaggerTypes; + } + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + static $attributeMap = array( + 'enum_string' => 'enum_string', + 'enum_integer' => 'enum_integer', + 'enum_number' => 'enum_number' + ); + + static function attributeMap() { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'enum_string' => 'setEnumString', + 'enum_integer' => 'setEnumInteger', + 'enum_number' => 'setEnumNumber' + ); + + static function setters() { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'enum_string' => 'getEnumString', + 'enum_integer' => 'getEnumInteger', + 'enum_number' => 'getEnumNumber' + ); + + static function getters() { + return self::$getters; + } + + const ENUM_STRING_UPPER = 'UPPER'; + const ENUM_STRING_LOWER = 'lower'; + const ENUM_INTEGER_1 = 1; + const ENUM_INTEGER_MINUS_1 = -1; + const ENUM_NUMBER_1_DOT_1 = 1.1; + const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2; + + + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumStringAllowableValues() { + return [ + self::ENUM_STRING_UPPER, + self::ENUM_STRING_LOWER, + ]; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumIntegerAllowableValues() { + return [ + self::ENUM_INTEGER_1, + self::ENUM_INTEGER_MINUS_1, + ]; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumNumberAllowableValues() { + return [ + self::ENUM_NUMBER_1_DOT_1, + self::ENUM_NUMBER_MINUS_1_DOT_2, + ]; + } + + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['enum_string'] + * @var string + */ + 'enum_string' => null, + + /** + * $container['enum_integer'] + * @var int + */ + 'enum_integer' => null, + + /** + * $container['enum_number'] + * @var double + */ + 'enum_number' => null, + ); + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + + + if ($data != null) { + $this->container['enum_string'] = $data['enum_string']; + $this->container['enum_integer'] = $data['enum_integer']; + $this->container['enum_number'] = $data['enum_number']; + } + } + /** + * Gets enum_string + * @return string + */ + public function getEnumString() + { + return $this->container['enum_string']; + } + + /** + * Sets enum_string + * @param string $enum_string + * @return $this + */ + public function setEnumString($enum_string) + { + $allowed_values = array('UPPER', 'lower'); + if (!in_array($enum_string, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_string', must be one of 'UPPER', 'lower'"); + } + $this->container['enum_string'] = $enum_string; + return $this; + } + /** + * Gets enum_integer + * @return int + */ + public function getEnumInteger() + { + return $this->container['enum_integer']; + } + + /** + * Sets enum_integer + * @param int $enum_integer + * @return $this + */ + public function setEnumInteger($enum_integer) + { + $allowed_values = array('1', '-1'); + if (!in_array($enum_integer, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_integer', must be one of '1', '-1'"); + } + $this->container['enum_integer'] = $enum_integer; + return $this; + } + /** + * Gets enum_number + * @return double + */ + public function getEnumNumber() + { + return $this->container['enum_number']; + } + + /** + * Sets enum_number + * @param double $enum_number + * @return $this + */ + public function setEnumNumber($enum_number) + { + $allowed_values = array('1.1', '-1.2'); + if (!in_array($enum_number, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_number', must be one of '1.1', '-1.2'"); + } + $this->container['enum_number'] = $enum_number; + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php new file mode 100644 index 000000000000..4d901dfd1c95 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php @@ -0,0 +1,70 @@ + e puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}" @@ -91,7 +91,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*Petstore::FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters +*Petstore::FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status @@ -117,10 +117,13 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Petstore::Animal](docs/Animal.md) + - [Petstore::AnimalFarm](docs/AnimalFarm.md) - [Petstore::ApiResponse](docs/ApiResponse.md) - [Petstore::Cat](docs/Cat.md) - [Petstore::Category](docs/Category.md) - [Petstore::Dog](docs/Dog.md) + - [Petstore::EnumClass](docs/EnumClass.md) + - [Petstore::EnumTest](docs/EnumTest.md) - [Petstore::FormatTest](docs/FormatTest.md) - [Petstore::Model200Response](docs/Model200Response.md) - [Petstore::ModelReturn](docs/ModelReturn.md) diff --git a/samples/client/petstore/ruby/docs/AnimalFarm.md b/samples/client/petstore/ruby/docs/AnimalFarm.md new file mode 100644 index 000000000000..30d704dc7d1d --- /dev/null +++ b/samples/client/petstore/ruby/docs/AnimalFarm.md @@ -0,0 +1,7 @@ +# Petstore::AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/ruby/docs/EnumClass.md b/samples/client/petstore/ruby/docs/EnumClass.md new file mode 100644 index 000000000000..8d56e1f88734 --- /dev/null +++ b/samples/client/petstore/ruby/docs/EnumClass.md @@ -0,0 +1,7 @@ +# Petstore::EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/ruby/docs/EnumTest.md b/samples/client/petstore/ruby/docs/EnumTest.md new file mode 100644 index 000000000000..ad3ee5c31bb7 --- /dev/null +++ b/samples/client/petstore/ruby/docs/EnumTest.md @@ -0,0 +1,10 @@ +# Petstore::EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_string** | **String** | | [optional] +**enum_integer** | **Integer** | | [optional] +**enum_number** | **Float** | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md index 32f2902d930a..c0312e00f515 100644 --- a/samples/client/petstore/ruby/docs/FakeApi.md +++ b/samples/client/petstore/ruby/docs/FakeApi.md @@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters +[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # **test_endpoint_parameters** > test_endpoint_parameters(number, double, string, byte, opts) -Fake endpoint for testing various parameters +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example ```ruby @@ -41,7 +41,7 @@ opts = { } begin - #Fake endpoint for testing various parameters + #Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 api_instance.test_endpoint_parameters(number, double, string, byte, opts) rescue Petstore::ApiError => e puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}" diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index f203db3f5bab..1ca35820523a 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -22,10 +22,13 @@ require 'petstore/configuration' # Models require 'petstore/models/animal' +require 'petstore/models/animal_farm' require 'petstore/models/api_response' require 'petstore/models/cat' require 'petstore/models/category' require 'petstore/models/dog' +require 'petstore/models/enum_class' +require 'petstore/models/enum_test' require 'petstore/models/format_test' require 'petstore/models/model_200_response' require 'petstore/models/model_return' diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index a0cf2913f43a..68f6fea9d2be 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -24,8 +24,8 @@ module Petstore @api_client = api_client end - # Fake endpoint for testing various parameters - # Fake endpoint for testing various parameters + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # @param number None # @param double None # @param string None @@ -45,8 +45,8 @@ module Petstore return nil end - # Fake endpoint for testing various parameters - # Fake endpoint for testing various parameters + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # @param number None # @param double None # @param string None diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb b/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb new file mode 100644 index 000000000000..62ca66ce38be --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb @@ -0,0 +1,179 @@ +=begin +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'date' + +module Petstore + class AnimalFarm + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /^Array<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /^(true|t|yes|y|1)$/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb new file mode 100644 index 000000000000..4dc0bb6c16b7 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb @@ -0,0 +1,184 @@ +=begin +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'date' + +module Petstore + class EnumClass + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + allowed_values = ["_abc", "-efg", "(xyz)"] + if @EnumClass && !allowed_values.include?(EnumClass) + invalid_properties.push("invalid value for 'EnumClass', must be one of #{allowed_values}.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /^Array<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /^(true|t|yes|y|1)$/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb new file mode 100644 index 000000000000..3f045b3490e2 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb @@ -0,0 +1,248 @@ +=begin +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'date' + +module Petstore + class EnumTest + attr_accessor :enum_string + + attr_accessor :enum_integer + + attr_accessor :enum_number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enum_string' => :'enum_string', + :'enum_integer' => :'enum_integer', + :'enum_number' => :'enum_number' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'enum_string' => :'String', + :'enum_integer' => :'Integer', + :'enum_number' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'enum_string') + self.enum_string = attributes[:'enum_string'] + end + + if attributes.has_key?(:'enum_integer') + self.enum_integer = attributes[:'enum_integer'] + end + + if attributes.has_key?(:'enum_number') + self.enum_number = attributes[:'enum_number'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + allowed_values = ["UPPER", "lower"] + if @enum_string && !allowed_values.include?(@enum_string) + return false + end + allowed_values = ["1", "-1"] + if @enum_integer && !allowed_values.include?(@enum_integer) + return false + end + allowed_values = ["1.1", "-1.2"] + if @enum_number && !allowed_values.include?(@enum_number) + return false + end + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] enum_string Object to be assigned + def enum_string=(enum_string) + allowed_values = ["UPPER", "lower"] + if enum_string && !allowed_values.include?(enum_string) + fail ArgumentError, "invalid value for 'enum_string', must be one of #{allowed_values}." + end + @enum_string = enum_string + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] enum_integer Object to be assigned + def enum_integer=(enum_integer) + allowed_values = ["1", "-1"] + if enum_integer && !allowed_values.include?(enum_integer) + fail ArgumentError, "invalid value for 'enum_integer', must be one of #{allowed_values}." + end + @enum_integer = enum_integer + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] enum_number Object to be assigned + def enum_number=(enum_number) + allowed_values = ["1.1", "-1.2"] + if enum_number && !allowed_values.include?(enum_number) + fail ArgumentError, "invalid value for 'enum_number', must be one of #{allowed_values}." + end + @enum_number = enum_number + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enum_string == o.enum_string && + enum_integer == o.enum_integer && + enum_number == o.enum_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [enum_string, enum_integer, enum_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /^Array<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /^(true|t|yes|y|1)$/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end From 65d85b776019fb04130d82e936c29d20b592dbd2 Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Fri, 6 May 2016 10:46:03 +0200 Subject: [PATCH 118/170] ResponseDeserializer for separating deserialization and service logic --- .../codegen/languages/ObjcClientCodegen.java | 4 +- .../resources/objc/ApiClient-body.mustache | 155 +----------- .../resources/objc/ApiClient-header.mustache | 22 +- .../objc/ResponseDeserializer-body.mustache | 221 ++++++++++++++++++ .../objc/ResponseDeserializer-header.mustache | 45 ++++ samples/client/petstore/objc/README.md | 4 +- .../objc/SwaggerClient/SWGApiClient.h | 22 +- .../objc/SwaggerClient/SWGApiClient.m | 155 +----------- .../SwaggerClient/SWGResponseDeserializer.h | 45 ++++ .../SwaggerClient/SWGResponseDeserializer.m | 221 ++++++++++++++++++ .../Tests/DeserializationTest.m | 91 +++++++- .../SwaggerClientTests/Tests/PetApiTest.m | 2 +- samples/client/petstore/objc/git_push.sh | 4 +- 13 files changed, 627 insertions(+), 364 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache create mode 100644 modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache create mode 100644 samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.h create mode 100644 samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 21e319f6ec96..9340eafd360c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -109,7 +109,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { "break", "enum", "register", "typedef", "case", "extern", "return", "union", "char", "float", "short", "unsigned", - "const", "for", "signed", "void", + "co nst", "for", "signed", "void", "continue", "goto", "sizeof", "volatile", "default", "if", "id", "static", "while", "do", "int", "struct", "_Packed", @@ -223,6 +223,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("JSONResponseSerializer-body.mustache", swaggerFolder, classPrefix + "JSONResponseSerializer.m")); supportingFiles.add(new SupportingFile("JSONRequestSerializer-body.mustache", swaggerFolder, classPrefix + "JSONRequestSerializer.m")); supportingFiles.add(new SupportingFile("JSONRequestSerializer-header.mustache", swaggerFolder, classPrefix + "JSONRequestSerializer.h")); + supportingFiles.add(new SupportingFile("ResponseDeserializer-body.mustache", swaggerFolder, classPrefix + "ResponseDeserializer.m")); + supportingFiles.add(new SupportingFile("ResponseDeserializer-header.mustache", swaggerFolder, classPrefix + "ResponseDeserializer.h")); supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.m", swaggerFolder, "JSONValueTransformer+ISO8601.m")); supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.h", swaggerFolder, "JSONValueTransformer+ISO8601.h")); supportingFiles.add(new SupportingFile("Configuration-body.mustache", swaggerFolder, classPrefix + "Configuration.m")); diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache index 18b756f78b0e..a8644bab0304 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache @@ -2,10 +2,6 @@ NSString *const {{classPrefix}}ResponseObjectErrorKey = @"{{classPrefix}}ResponseObject"; -NSString *const {{classPrefix}}DeserializationErrorDomainKey = @"{{classPrefix}}DeserializationErrorDomainKey"; - -NSInteger const {{classPrefix}}TypeMismatchErrorCode = 143553; - static long requestId = 0; static bool offlineState = false; static NSMutableSet * queuedRequests = nil; @@ -33,6 +29,7 @@ static void (^reachabilityChangeBlock)(int); self.requestSerializer = [AFJSONRequestSerializer serializer]; self.responseSerializer = [AFJSONResponseSerializer serializer]; self.securityPolicy = [self customSecurityPolicy]; + self.responseDeserializer = [[{{classPrefix}}ResponseDeserializer alloc] init]; // configure reachability [self configureCacheReachibility]; } @@ -290,154 +287,6 @@ static void (^reachabilityChangeBlock)(int); [self.reachabilityManager startMonitoring]; } -#pragma mark - Deserialize methods - -- (id) deserialize:(id) data class:(NSString *) class error:(NSError **) error { - // return nil if data is nil or class is nil - if (!data || !class) { - return nil; - } - - // remove "*" from class, if ends with "*" - if ([class hasSuffix:@"*"]) { - class = [class substringToIndex:[class length] - 1]; - } - - // pure object - if ([class isEqualToString:@"NSObject"]) { - return data; - } - - NSRegularExpression *regexp = nil; - NSTextCheckingResult *match = nil; - NSMutableArray *resultArray = nil; - NSMutableDictionary *resultDict = nil; - NSString *innerType = nil; - - // list of models - NSString *arrayOfModelsPat = @"NSArray<(.+)>"; - regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat - options:NSRegularExpressionCaseInsensitive - error:nil]; - - match = [regexp firstMatchInString:class - options:0 - range:NSMakeRange(0, [class length])]; - - if (match) { - if(![data isKindOfClass: [NSArray class]]) { - if(error) { - NSDictionary * userInfo = @{NSLocalizedDescriptionKey : NSLocalizedString(@"Received response is not an array", nil)}; - *error = [NSError errorWithDomain:{{classPrefix}}DeserializationErrorDomainKey code:{{classPrefix}}TypeMismatchErrorCode userInfo:userInfo]; - } - return nil; - } - NSArray *dataArray = data; - innerType = [class substringWithRange:[match rangeAtIndex:1]]; - - resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]]; - [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - id arrObj = [self deserialize:obj class:innerType error:error]; - if(arrObj) { - [resultArray addObject:arrObj]; - } else { - * stop = YES; - } - }]; - - return resultArray; - } - - // list of primitives - NSString *arrayOfPrimitivesPat = @"NSArray\\* /\\* (.+) \\*/"; - regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfPrimitivesPat - options:NSRegularExpressionCaseInsensitive - error:nil]; - match = [regexp firstMatchInString:class - options:0 - range:NSMakeRange(0, [class length])]; - - if (match) { - NSArray *dataArray = data; - innerType = [class substringWithRange:[match rangeAtIndex:1]]; - - resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]]; - [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - id arrObj = [self deserialize:obj class:innerType error:error]; - if(arrObj) { - [resultArray addObject:arrObj]; - } else { - * stop = YES; - } - }]; - - return resultArray; - } - - // map - NSString *dictPat = @"NSDictionary\\* /\\* (.+?), (.+) \\*/"; - regexp = [NSRegularExpression regularExpressionWithPattern:dictPat - options:NSRegularExpressionCaseInsensitive - error:nil]; - match = [regexp firstMatchInString:class - options:0 - range:NSMakeRange(0, [class length])]; - - if (match) { - NSDictionary *dataDict = data; - NSString *valueType = [class substringWithRange:[match rangeAtIndex:2]]; - - resultDict = [NSMutableDictionary dictionaryWithCapacity:[dataDict count]]; - [data enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - id dicObj = [self deserialize:obj class:valueType error:error]; - if(dicObj) { - [resultDict setValue:dicObj forKey:key]; - } else { - * stop = YES; - } - }]; - - return resultDict; - } - - // primitives - NSArray *primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"]; - - if ([primitiveTypes containsObject:class]) { - if ([class isEqualToString:@"NSString"]) { - return [NSString stringWithString:data]; - } - else if ([class isEqualToString:@"NSDate"]) { - return [NSDate dateWithISO8601String:data]; - } - else if ([class isEqualToString:@"NSNumber"]) { - // NSNumber from NSNumber - if ([data isKindOfClass:[NSNumber class]]) { - return data; - } - else if ([data isKindOfClass:[NSString class]]) { - // NSNumber (NSCFBoolean) from NSString - if ([[data lowercaseString] isEqualToString:@"true"] || [[data lowercaseString] isEqualToString:@"false"]) { - return [NSNumber numberWithBool:[data boolValue]]; - // NSNumber from NSString - } else { - NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - formatter.numberStyle = NSNumberFormatterDecimalStyle; - return [formatter numberFromString:data]; - } - } - } - } - - // model - Class ModelClass = NSClassFromString(class); - if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) { - return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error]; - } - - return nil; -} - #pragma mark - Operation Methods - (void) operationWithCompletionBlock: (NSURLRequest *)request @@ -661,7 +510,7 @@ static void (^reachabilityChangeBlock)(int); else { [self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { NSError * serializationError; - id response = [self deserialize:data class:responseType error:&serializationError]; + id response = [self.responseDeserializer deserialize:data class:responseType error:&serializationError]; if(!response && !error){ error = serializationError; } diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache index 1cf3db5e5233..c7caa7ab11e3 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache @@ -5,7 +5,7 @@ #import "{{classPrefix}}JSONRequestSerializer.h" #import "{{classPrefix}}QueryParamCollection.h" #import "{{classPrefix}}Configuration.h" - +#import "{{classPrefix}}ResponseDeserializer.h" /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen @@ -25,16 +25,6 @@ */ extern NSString *const {{classPrefix}}ResponseObjectErrorKey; -/** - * A key for deserialization ErrorDomain - */ -extern NSString *const {{classPrefix}}DeserializationErrorDomainKey; - -/** - * Code for deserialization type mismatch error - */ -extern NSInteger const {{classPrefix}}TypeMismatchErrorCode; - /** * Log debug message macro */ @@ -49,6 +39,7 @@ extern NSInteger const {{classPrefix}}TypeMismatchErrorCode; /// In order to ensure the HTTPResponseHeaders are correct, it is recommended to initialize one {{classPrefix}}ApiClient instance per thread. @property(nonatomic, readonly) NSDictionary* HTTPResponseHeaders; +@property(nonatomic, strong) id<{{classPrefix}}ResponseDeserializer> responseDeserializer; /** * Clears Cache */ @@ -176,15 +167,6 @@ extern NSInteger const {{classPrefix}}TypeMismatchErrorCode; queryParams:(NSDictionary **)querys WithAuthSettings:(NSArray *)authSettings; -/** - * Deserializes the given data to Objective-C object. - * - * @param data The data will be deserialized. - * @param class The type of objective-c object. - * @param error The error - */ -- (id) deserialize:(id) data class:(NSString *) class error:(NSError**)error; - /** * Logs request and response * diff --git a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache new file mode 100644 index 000000000000..9b325eca10d9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache @@ -0,0 +1,221 @@ +#import "{{classPrefix}}ResponseDeserializer.h" +#import +#import + +NSString *const {{classPrefix}}DeserializationErrorDomainKey = @"{{classPrefix}}DeserializationErrorDomainKey"; + +NSInteger const {{classPrefix}}TypeMismatchErrorCode = 143553; + +NSInteger const {{classPrefix}}EmptyValueOccurredErrorCode = 143509; + +@interface {{classPrefix}}ResponseDeserializer () + +@property (nonatomic, strong) NSNumberFormatter* numberFormatter; +@property (nonatomic, strong) NSArray *primitiveTypes; +@property (nonatomic, strong) NSArray *basicReturnTypes; + +@property (nonatomic, strong) NSRegularExpression* arrayOfModelsPatExpression; +@property (nonatomic, strong) NSRegularExpression* arrayOfPrimitivesPatExpression; +@property (nonatomic, strong) NSRegularExpression* dictPatExpression; +@property (nonatomic, strong) NSRegularExpression* dictModelsPatExpression; + +@end + +@implementation {{classPrefix}}ResponseDeserializer + +- (instancetype)init { + self = [super init]; + if (self) { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.numberStyle = NSNumberFormatterDecimalStyle; + _numberFormatter = formatter; + _primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"]; + _basicReturnTypes = @[@"NSObject", @"id"]; + _arrayOfModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray<(.+)>" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _arrayOfPrimitivesPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray\\* /\\* (.+) \\*/" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _dictPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSDictionary\\* /\\* (.+?), (.+) \\*/" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _dictModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSDictionary\\<(.+?), (.+)*\\>" + options:NSRegularExpressionCaseInsensitive + error:nil]; + } + return self; +} + +#pragma mark - Deserialize methods + +- (id) deserialize:(id) data class:(NSString *) className error:(NSError **) error { + // return nil if data is nil or className is nil + if (!data || !className || [data isKindOfClass:[NSNull class]]) { + return nil; + } + + // remove "*" from className, if ends with "*" + if ([className hasSuffix:@"*"]) { + className = [className substringToIndex:[className length] - 1]; + } + // pure object + if ([self.basicReturnTypes containsObject:className]) { + return data; + } + + // primitives + if ([self.primitiveTypes containsObject:className]) { + return [self deserializePrimitiveValue:data class:className error:error]; + } + + NSTextCheckingResult *match = nil; + + // list of models + match = [self.arrayOfModelsPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + if (match) { + NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; + return [self deserializeArrayValue:data innerType:innerType error:error]; + } + + // list of primitives + match = [self.arrayOfPrimitivesPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + if (match) { + NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; + return [self deserializeArrayValue:data innerType:innerType error:error]; + } + + // map + match = [self.dictPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + if (match) { + NSString *valueType = [className substringWithRange:[match rangeAtIndex:2]]; + return [self deserializeDictionaryValue:data valueType:valueType error:error]; + } + + match = [self.dictModelsPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + if (match) { + NSRange range =[match rangeAtIndex:2]; + range = NSMakeRange(range.location, [className length] - range.location -1); + NSString *valueType = [className substringWithRange:range]; + return [self deserializeDictionaryValue:data valueType:valueType error:error]; + } + + // model + Class ModelClass = NSClassFromString(className); + if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) { + return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error]; + } + + return nil; +} + +- (id) deserializeDictionaryValue:(id) data valueType:(NSString *) valueType error:(NSError**)error { + if(![data isKindOfClass: [NSDictionary class]]) { + if(error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSDictionary class]) data:data]; + } + return nil; + } + __block NSMutableDictionary *resultDict = [NSMutableDictionary dictionaryWithCapacity:[data count]]; + for (id key in [data allKeys]) { + id obj = [data valueForKey:key]; + id dicObj = [self deserialize:obj class:valueType error:error]; + if(dicObj) { + [resultDict setValue:dicObj forKey:key]; + } else if([obj isKindOfClass:[NSNull class]]) { + if(self.treatNullAsError) { + if (error) { + *error = [self emptyValueOccurredError]; + } + resultDict = nil; + break; + } + } else { + resultDict = nil; + break; + } + } + return resultDict; +} + +- (id) deserializeArrayValue:(id) data innerType:(NSString *) innerType error:(NSError**)error { + if(![data isKindOfClass: [NSArray class]]) { + if(error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSArray class]) data:data]; + } + return nil; + } + NSMutableArray* resultArray = [NSMutableArray arrayWithCapacity:[data count]]; + for (id obj in data) { + id arrObj = [self deserialize:obj class:innerType error:error]; + if(arrObj) { + [resultArray addObject:arrObj]; + } else if([obj isKindOfClass:[NSNull class]]) { + if(self.treatNullAsError) { + if (error) { + *error = [self emptyValueOccurredError]; + } + resultArray = nil; + break; + } + } else { + resultArray = nil; + break; + } + } + return resultArray; +}; + +- (id) deserializePrimitiveValue:(id) data class:(NSString *) className error:(NSError**)error { + if ([className isEqualToString:@"NSString"]) { + return [NSString stringWithString:data]; + } + else if ([className isEqualToString:@"NSDate"]) { + return [self deserializeDateValue:data error:error]; + } + else if ([className isEqualToString:@"NSNumber"]) { + // NSNumber from NSNumber + if ([data isKindOfClass:[NSNumber class]]) { + return data; + } + else if ([data isKindOfClass:[NSString class]]) { + // NSNumber (NSCFBoolean) from NSString + if ([[data lowercaseString] isEqualToString:@"true"] || [[data lowercaseString] isEqualToString:@"false"]) { + return @([data boolValue]); + // NSNumber from NSString + } else { + NSNumber* formattedValue = [self.numberFormatter numberFromString:data]; + if(!formattedValue && [data length] > 0 && error) { + *error = [self typeMismatchErrorWithExpectedType:className data:data]; + } + return formattedValue; + } + } + } + if(error) { + *error = [self typeMismatchErrorWithExpectedType:className data:data]; + } + return nil; +} + +- (id) deserializeDateValue:(id) data error:(NSError**)error { + NSDate *date =[NSDate dateWithISO8601String:data]; + if(!date && [data length] > 0 && error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSDate class]) data:data]; + } + return date; +}; + +-(NSError *)typeMismatchErrorWithExpectedType:(NSString *)expected data:(id)data { + NSString * message = [NSString stringWithFormat:NSLocalizedString(@"Received response [%@] is not an object of type %@",nil),data, expected]; + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:{{classPrefix}}DeserializationErrorDomainKey code:{{classPrefix}}TypeMismatchErrorCode userInfo:userInfo]; +} + +-(NSError *)emptyValueOccurredError { + NSString * message = NSLocalizedString(@"Received response contains null value in dictionary or array response",nil); + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:{{classPrefix}}DeserializationErrorDomainKey code:{{classPrefix}}EmptyValueOccurredErrorCode userInfo:userInfo]; +} + +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache new file mode 100644 index 000000000000..75894042eee6 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache @@ -0,0 +1,45 @@ +#import + +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +/** + * A key for deserialization ErrorDomain + */ +extern NSString *const {{classPrefix}}DeserializationErrorDomainKey; + +/** + * Code for deserialization type mismatch error + */ +extern NSInteger const {{classPrefix}}TypeMismatchErrorCode; + +/** + * Code for deserialization empty value error + */ +extern NSInteger const {{classPrefix}}EmptyValueOccurredErrorCode; + +@protocol {{classPrefix}}ResponseDeserializer + +/** + * Deserializes the given data to Objective-C object. + * + * @param data The data will be deserialized. + * @param class The type of objective-c object. + * @param error The error + */ +- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error; + +@end + +@interface {{classPrefix}}ResponseDeserializer : NSObject <{{classPrefix}}ResponseDeserializer> + +/** + * If an null value occurs in dictionary or array if set to YES whole response will be invalid else will be ignored + * @default NO + */ +@property (nonatomic, assign) BOOL treatNullAsError; + +@end diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index bd0f24851a72..888ecba46f11 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-04-25T18:52:19.055+02:00 +- Build date: 2016-05-06T10:30:53.676+02:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements @@ -19,7 +19,7 @@ The SDK requires [**ARC (Automatic Reference Counting)**](http://stackoverflow.c Add the following to the Podfile: ```ruby -pod 'SwaggerClient', :git => 'https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git' +pod 'SwaggerClient', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' ``` To specify a particular branch, append `, :branch => 'branch-name-here'` diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h index 5d40ef2f5f00..7dea87a3327d 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h @@ -5,7 +5,7 @@ #import "SWGJSONRequestSerializer.h" #import "SWGQueryParamCollection.h" #import "SWGConfiguration.h" - +#import "SWGResponseDeserializer.h" /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen @@ -29,16 +29,6 @@ */ extern NSString *const SWGResponseObjectErrorKey; -/** - * A key for deserialization ErrorDomain - */ -extern NSString *const SWGDeserializationErrorDomainKey; - -/** - * Code for deserialization type mismatch error - */ -extern NSInteger const SWGTypeMismatchErrorCode; - /** * Log debug message macro */ @@ -53,6 +43,7 @@ extern NSInteger const SWGTypeMismatchErrorCode; /// In order to ensure the HTTPResponseHeaders are correct, it is recommended to initialize one SWGApiClient instance per thread. @property(nonatomic, readonly) NSDictionary* HTTPResponseHeaders; +@property(nonatomic, strong) id responseDeserializer; /** * Clears Cache */ @@ -180,15 +171,6 @@ extern NSInteger const SWGTypeMismatchErrorCode; queryParams:(NSDictionary **)querys WithAuthSettings:(NSArray *)authSettings; -/** - * Deserializes the given data to Objective-C object. - * - * @param data The data will be deserialized. - * @param class The type of objective-c object. - * @param error The error - */ -- (id) deserialize:(id) data class:(NSString *) class error:(NSError**)error; - /** * Logs request and response * diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m index ecdf4aaafb28..5d5d2019b0f2 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m @@ -2,10 +2,6 @@ NSString *const SWGResponseObjectErrorKey = @"SWGResponseObject"; -NSString *const SWGDeserializationErrorDomainKey = @"SWGDeserializationErrorDomainKey"; - -NSInteger const SWGTypeMismatchErrorCode = 143553; - static long requestId = 0; static bool offlineState = false; static NSMutableSet * queuedRequests = nil; @@ -33,6 +29,7 @@ static void (^reachabilityChangeBlock)(int); self.requestSerializer = [AFJSONRequestSerializer serializer]; self.responseSerializer = [AFJSONResponseSerializer serializer]; self.securityPolicy = [self customSecurityPolicy]; + self.responseDeserializer = [[SWGResponseDeserializer alloc] init]; // configure reachability [self configureCacheReachibility]; } @@ -290,154 +287,6 @@ static void (^reachabilityChangeBlock)(int); [self.reachabilityManager startMonitoring]; } -#pragma mark - Deserialize methods - -- (id) deserialize:(id) data class:(NSString *) class error:(NSError **) error { - // return nil if data is nil or class is nil - if (!data || !class) { - return nil; - } - - // remove "*" from class, if ends with "*" - if ([class hasSuffix:@"*"]) { - class = [class substringToIndex:[class length] - 1]; - } - - // pure object - if ([class isEqualToString:@"NSObject"]) { - return data; - } - - NSRegularExpression *regexp = nil; - NSTextCheckingResult *match = nil; - NSMutableArray *resultArray = nil; - NSMutableDictionary *resultDict = nil; - NSString *innerType = nil; - - // list of models - NSString *arrayOfModelsPat = @"NSArray<(.+)>"; - regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat - options:NSRegularExpressionCaseInsensitive - error:nil]; - - match = [regexp firstMatchInString:class - options:0 - range:NSMakeRange(0, [class length])]; - - if (match) { - if(![data isKindOfClass: [NSArray class]]) { - if(error) { - NSDictionary * userInfo = @{NSLocalizedDescriptionKey : NSLocalizedString(@"Received response is not an array", nil)}; - *error = [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGTypeMismatchErrorCode userInfo:userInfo]; - } - return nil; - } - NSArray *dataArray = data; - innerType = [class substringWithRange:[match rangeAtIndex:1]]; - - resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]]; - [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - id arrObj = [self deserialize:obj class:innerType error:error]; - if(arrObj) { - [resultArray addObject:arrObj]; - } else { - * stop = YES; - } - }]; - - return resultArray; - } - - // list of primitives - NSString *arrayOfPrimitivesPat = @"NSArray\\* /\\* (.+) \\*/"; - regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfPrimitivesPat - options:NSRegularExpressionCaseInsensitive - error:nil]; - match = [regexp firstMatchInString:class - options:0 - range:NSMakeRange(0, [class length])]; - - if (match) { - NSArray *dataArray = data; - innerType = [class substringWithRange:[match rangeAtIndex:1]]; - - resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]]; - [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - id arrObj = [self deserialize:obj class:innerType error:error]; - if(arrObj) { - [resultArray addObject:arrObj]; - } else { - * stop = YES; - } - }]; - - return resultArray; - } - - // map - NSString *dictPat = @"NSDictionary\\* /\\* (.+?), (.+) \\*/"; - regexp = [NSRegularExpression regularExpressionWithPattern:dictPat - options:NSRegularExpressionCaseInsensitive - error:nil]; - match = [regexp firstMatchInString:class - options:0 - range:NSMakeRange(0, [class length])]; - - if (match) { - NSDictionary *dataDict = data; - NSString *valueType = [class substringWithRange:[match rangeAtIndex:2]]; - - resultDict = [NSMutableDictionary dictionaryWithCapacity:[dataDict count]]; - [data enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - id dicObj = [self deserialize:obj class:valueType error:error]; - if(dicObj) { - [resultDict setValue:dicObj forKey:key]; - } else { - * stop = YES; - } - }]; - - return resultDict; - } - - // primitives - NSArray *primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"]; - - if ([primitiveTypes containsObject:class]) { - if ([class isEqualToString:@"NSString"]) { - return [NSString stringWithString:data]; - } - else if ([class isEqualToString:@"NSDate"]) { - return [NSDate dateWithISO8601String:data]; - } - else if ([class isEqualToString:@"NSNumber"]) { - // NSNumber from NSNumber - if ([data isKindOfClass:[NSNumber class]]) { - return data; - } - else if ([data isKindOfClass:[NSString class]]) { - // NSNumber (NSCFBoolean) from NSString - if ([[data lowercaseString] isEqualToString:@"true"] || [[data lowercaseString] isEqualToString:@"false"]) { - return [NSNumber numberWithBool:[data boolValue]]; - // NSNumber from NSString - } else { - NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - formatter.numberStyle = NSNumberFormatterDecimalStyle; - return [formatter numberFromString:data]; - } - } - } - } - - // model - Class ModelClass = NSClassFromString(class); - if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) { - return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error]; - } - - return nil; -} - #pragma mark - Operation Methods - (void) operationWithCompletionBlock: (NSURLRequest *)request @@ -661,7 +510,7 @@ static void (^reachabilityChangeBlock)(int); else { [self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { NSError * serializationError; - id response = [self deserialize:data class:responseType error:&serializationError]; + id response = [self.responseDeserializer deserialize:data class:responseType error:&serializationError]; if(!response && !error){ error = serializationError; } diff --git a/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.h b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.h new file mode 100644 index 000000000000..26f2ba3a4e64 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.h @@ -0,0 +1,45 @@ +#import + +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +/** + * A key for deserialization ErrorDomain + */ +extern NSString *const SWGDeserializationErrorDomainKey; + +/** + * Code for deserialization type mismatch error + */ +extern NSInteger const SWGTypeMismatchErrorCode; + +/** + * Code for deserialization empty value error + */ +extern NSInteger const SWGEmptyValueOccurredErrorCode; + +@protocol SWGResponseDeserializer + +/** + * Deserializes the given data to Objective-C object. + * + * @param data The data will be deserialized. + * @param class The type of objective-c object. + * @param error The error + */ +- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error; + +@end + +@interface SWGResponseDeserializer : NSObject + +/** + * If an null value occurs in dictionary or array if set to YES whole response will be invalid else will be ignored + * @default NO + */ +@property (nonatomic, assign) BOOL treatNullAsError; + +@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m new file mode 100644 index 000000000000..2bf124604bb2 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m @@ -0,0 +1,221 @@ +#import "SWGResponseDeserializer.h" +#import +#import + +NSString *const SWGDeserializationErrorDomainKey = @"SWGDeserializationErrorDomainKey"; + +NSInteger const SWGTypeMismatchErrorCode = 143553; + +NSInteger const SWGEmptyValueOccurredErrorCode = 143509; + +@interface SWGResponseDeserializer () + +@property (nonatomic, strong) NSNumberFormatter* numberFormatter; +@property (nonatomic, strong) NSArray *primitiveTypes; +@property (nonatomic, strong) NSArray *basicReturnTypes; + +@property (nonatomic, strong) NSRegularExpression* arrayOfModelsPatExpression; +@property (nonatomic, strong) NSRegularExpression* arrayOfPrimitivesPatExpression; +@property (nonatomic, strong) NSRegularExpression* dictPatExpression; +@property (nonatomic, strong) NSRegularExpression* dictModelsPatExpression; + +@end + +@implementation SWGResponseDeserializer + +- (instancetype)init { + self = [super init]; + if (self) { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.numberStyle = NSNumberFormatterDecimalStyle; + _numberFormatter = formatter; + _primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"]; + _basicReturnTypes = @[@"NSObject", @"id"]; + _arrayOfModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray<(.+)>" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _arrayOfPrimitivesPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray\\* /\\* (.+) \\*/" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _dictPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSDictionary\\* /\\* (.+?), (.+) \\*/" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _dictModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSDictionary\\<(.+?), (.+)*\\>" + options:NSRegularExpressionCaseInsensitive + error:nil]; + } + return self; +} + +#pragma mark - Deserialize methods + +- (id) deserialize:(id) data class:(NSString *) className error:(NSError **) error { + // return nil if data is nil or className is nil + if (!data || !className || [data isKindOfClass:[NSNull class]]) { + return nil; + } + + // remove "*" from className, if ends with "*" + if ([className hasSuffix:@"*"]) { + className = [className substringToIndex:[className length] - 1]; + } + // pure object + if ([self.basicReturnTypes containsObject:className]) { + return data; + } + + // primitives + if ([self.primitiveTypes containsObject:className]) { + return [self deserializePrimitiveValue:data class:className error:error]; + } + + NSTextCheckingResult *match = nil; + + // list of models + match = [self.arrayOfModelsPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + if (match) { + NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; + return [self deserializeArrayValue:data innerType:innerType error:error]; + } + + // list of primitives + match = [self.arrayOfPrimitivesPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + if (match) { + NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; + return [self deserializeArrayValue:data innerType:innerType error:error]; + } + + // map + match = [self.dictPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + if (match) { + NSString *valueType = [className substringWithRange:[match rangeAtIndex:2]]; + return [self deserializeDictionaryValue:data valueType:valueType error:error]; + } + + match = [self.dictModelsPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + if (match) { + NSRange range =[match rangeAtIndex:2]; + range = NSMakeRange(range.location, [className length] - range.location -1); + NSString *valueType = [className substringWithRange:range]; + return [self deserializeDictionaryValue:data valueType:valueType error:error]; + } + + // model + Class ModelClass = NSClassFromString(className); + if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) { + return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error]; + } + + return nil; +} + +- (id) deserializeDictionaryValue:(id) data valueType:(NSString *) valueType error:(NSError**)error { + if(![data isKindOfClass: [NSDictionary class]]) { + if(error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSDictionary class]) data:data]; + } + return nil; + } + __block NSMutableDictionary *resultDict = [NSMutableDictionary dictionaryWithCapacity:[data count]]; + for (id key in [data allKeys]) { + id obj = [data valueForKey:key]; + id dicObj = [self deserialize:obj class:valueType error:error]; + if(dicObj) { + [resultDict setValue:dicObj forKey:key]; + } else if([obj isKindOfClass:[NSNull class]]) { + if(self.treatNullAsError) { + if (error) { + *error = [self emptyValueOccurredError]; + } + resultDict = nil; + break; + } + } else { + resultDict = nil; + break; + } + } + return resultDict; +} + +- (id) deserializeArrayValue:(id) data innerType:(NSString *) innerType error:(NSError**)error { + if(![data isKindOfClass: [NSArray class]]) { + if(error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSArray class]) data:data]; + } + return nil; + } + NSMutableArray* resultArray = [NSMutableArray arrayWithCapacity:[data count]]; + for (id obj in data) { + id arrObj = [self deserialize:obj class:innerType error:error]; + if(arrObj) { + [resultArray addObject:arrObj]; + } else if([obj isKindOfClass:[NSNull class]]) { + if(self.treatNullAsError) { + if (error) { + *error = [self emptyValueOccurredError]; + } + resultArray = nil; + break; + } + } else { + resultArray = nil; + break; + } + } + return resultArray; +}; + +- (id) deserializePrimitiveValue:(id) data class:(NSString *) className error:(NSError**)error { + if ([className isEqualToString:@"NSString"]) { + return [NSString stringWithString:data]; + } + else if ([className isEqualToString:@"NSDate"]) { + return [self deserializeDateValue:data error:error]; + } + else if ([className isEqualToString:@"NSNumber"]) { + // NSNumber from NSNumber + if ([data isKindOfClass:[NSNumber class]]) { + return data; + } + else if ([data isKindOfClass:[NSString class]]) { + // NSNumber (NSCFBoolean) from NSString + if ([[data lowercaseString] isEqualToString:@"true"] || [[data lowercaseString] isEqualToString:@"false"]) { + return @([data boolValue]); + // NSNumber from NSString + } else { + NSNumber* formattedValue = [self.numberFormatter numberFromString:data]; + if(!formattedValue && [data length] > 0 && error) { + *error = [self typeMismatchErrorWithExpectedType:className data:data]; + } + return formattedValue; + } + } + } + if(error) { + *error = [self typeMismatchErrorWithExpectedType:className data:data]; + } + return nil; +} + +- (id) deserializeDateValue:(id) data error:(NSError**)error { + NSDate *date =[NSDate dateWithISO8601String:data]; + if(!date && [data length] > 0 && error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSDate class]) data:data]; + } + return date; +}; + +-(NSError *)typeMismatchErrorWithExpectedType:(NSString *)expected data:(id)data { + NSString * message = [NSString stringWithFormat:NSLocalizedString(@"Received response [%@] is not an object of type %@",nil),data, expected]; + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGTypeMismatchErrorCode userInfo:userInfo]; +} + +-(NSError *)emptyValueOccurredError { + NSString * message = NSLocalizedString(@"Received response contains null value in dictionary or array response",nil); + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGEmptyValueOccurredErrorCode userInfo:userInfo]; +} + +@end diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m index 5f5d274b4b06..8241c00b0128 100644 --- a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m @@ -27,11 +27,28 @@ [formatter setDateFormat:@"yyyy-MM-dd"]; NSDate *date = [formatter dateFromString:dateStr]; NSError* error; - NSDate *deserializedDate = [apiClient deserialize:dateStr class:@"NSDate*" error:&error]; + NSDate *deserializedDate = [apiClient.responseDeserializer deserialize:dateStr class:@"NSDate*" error:&error]; XCTAssertNil(error); XCTAssertEqualWithAccuracy([date timeIntervalSinceReferenceDate], [deserializedDate timeIntervalSinceReferenceDate], 0.001); } +- (void)testDeserializeInvalidDate { + NSString *dateStr = @"random string"; + + NSError* error; + NSDate *deserializedDate = [apiClient.responseDeserializer deserialize:dateStr class:@"NSDate*" error:&error]; + XCTAssertNotNil(error); + XCTAssertNil(deserializedDate); +} + +- (void)testDeserializeEmptyDate { + NSString *dateStr = @""; + NSError* error; + NSDate *deserializedDate = [apiClient.responseDeserializer deserialize:dateStr class:@"NSDate*" error:&error]; + XCTAssertNil(error); + XCTAssertNil(deserializedDate); +} + - (void)testDeserializeDateTime { NSString *dateTimeStr = @"1997-07-16T19:20:30+00:00"; @@ -39,7 +56,7 @@ [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"]; NSDate *dateTime = [formatter dateFromString:dateTimeStr]; NSError* error; - NSDate *deserializedDateTime = [apiClient deserialize:dateTimeStr class:@"NSDate*" error:&error]; + NSDate *deserializedDateTime = [apiClient.responseDeserializer deserialize:dateTimeStr class:@"NSDate*" error:&error]; XCTAssertNil(error); XCTAssertEqualWithAccuracy([dateTime timeIntervalSinceReferenceDate], [deserializedDateTime timeIntervalSinceReferenceDate], 0.001); } @@ -47,7 +64,7 @@ - (void)testDeserializeObject { NSNumber *data = @1; NSError* error; - NSNumber *result = [apiClient deserialize:data class:@"NSObject*" error:&error]; + NSNumber *result = [apiClient.responseDeserializer deserialize:data class:@"NSObject*" error:&error]; XCTAssertNil(error); XCTAssertEqualObjects(data, result); } @@ -55,7 +72,7 @@ - (void)testDeserializeString { NSString *data = @"test string"; NSError* error; - NSString *result = [apiClient deserialize:data class:@"NSString*" error:&error]; + NSString *result = [apiClient.responseDeserializer deserialize:data class:@"NSString*" error:&error]; XCTAssertNil(error); XCTAssertTrue([result isEqualToString:data]); } @@ -63,12 +80,29 @@ - (void)testDeserializeListOfString { NSArray *data = @[@"test string"]; NSError* error; - NSArray *result = [apiClient deserialize:data class:@"NSArray* /* NSString */" error:&error]; + NSArray *result = [apiClient.responseDeserializer deserialize:data class:@"NSArray*" error:&error]; XCTAssertNil(error); XCTAssertTrue([result isKindOfClass:[NSArray class]]); XCTAssertTrue([result[0] isKindOfClass:[NSString class]]); } +- (void)testDeserializeInvalidListOfNumbers { + NSArray *data = @[@"test string"]; + NSError* error; + NSArray *result = [apiClient.responseDeserializer deserialize:data class:@"NSArray*" error:&error]; + XCTAssertNotNil(error); + XCTAssertNil(result); +} + +- (void)testDeserializeListOfNumbers { + NSArray *data = @[@"1.0"]; + NSError* error; + NSArray *result = [apiClient.responseDeserializer deserialize:data class:@"NSArray*" error:&error]; + XCTAssertNil(error); + XCTAssertTrue([result isKindOfClass:[NSArray class]]); + XCTAssertTrue([result[0] isKindOfClass:[NSNumber class]]); +} + - (void)testDeserializeListOfModels { NSArray *data = @[ @@ -92,7 +126,7 @@ }]; NSError* error; - NSArray *result = [apiClient deserialize:data class:@"NSArray*" error:&error]; + NSArray *result = [apiClient.responseDeserializer deserialize:data class:@"NSArray*" error:&error]; XCTAssertTrue([result isKindOfClass:[NSArray class]]); XCTAssertTrue([[result firstObject] isKindOfClass:[SWGPet class]]); @@ -123,7 +157,7 @@ } }; NSError* error; - NSDictionary *result = [apiClient deserialize:data class:@"NSDictionary* /* NSString, SWGPet */" error:&error]; + NSDictionary *result = [apiClient.responseDeserializer deserialize:data class:@"NSDictionary* /* NSString, SWGPet */" error:&error]; XCTAssertTrue([result isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"pet"] isKindOfClass:[SWGPet class]]); @@ -134,11 +168,44 @@ NSDictionary *data = @{ @"foo": @{ - @"bar": @1 + @"bar": @1, + @"bar2": [NSNull null] } }; + SWGResponseDeserializer* responseDeserializer = [[SWGResponseDeserializer alloc] init]; NSError* error; - NSDictionary *result = [apiClient deserialize:data class:@"NSDictionary* /* NSString, NSDictionary* /* NSString, NSNumber */ */" error:&error]; + NSDictionary *result = [responseDeserializer deserialize:data class:@"NSDictionary* /* NSString, NSDictionary* /* NSString, NSNumber */ */" error:&error]; + + XCTAssertTrue([result isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"foo"] isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"foo"][@"bar"] isKindOfClass:[NSNumber class]]); +} + + +- (void)testDeserializeNestedMapWithNullValue { + NSDictionary *data = + @{ + @"foo": @{ + @"bar": @1, + @"bar2": [NSNull null] + } + }; + SWGResponseDeserializer* responseDeserializer = [[SWGResponseDeserializer alloc] init]; + responseDeserializer.treatNullAsError = YES; + NSError* error; + NSDictionary *result = [responseDeserializer deserialize:data class:@"NSDictionary* /* NSString, NSDictionary* /* NSString, NSNumber */ */" error:&error]; + XCTAssertNil(result); + XCTAssertNotNil(error); +} + +- (void)testDeserializeNestedMap2 { + NSDictionary *data = @{ + @"foo": @{ + @"bar": @1 + } + }; + NSError* error; + NSDictionary *result = [apiClient.responseDeserializer deserialize:data class:@"NSDictionary*>*" error:&error]; XCTAssertTrue([result isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"foo"] isKindOfClass:[NSDictionary class]]); @@ -148,7 +215,7 @@ - (void)testDeserializeNestedList { NSArray *data = @[@[@"foo"]]; NSError* error; - NSArray *result = [apiClient deserialize:data class:@"NSArray* /* NSArray* /* NSString */ */" error:&error]; + NSArray *result = [apiClient.responseDeserializer deserialize:data class:@"NSArray* /* NSArray* /* NSString */ */" error:&error]; XCTAssertTrue([result isKindOfClass:[NSArray class]]); XCTAssertTrue([result[0] isKindOfClass:[NSArray class]]); @@ -161,11 +228,11 @@ data = @"true"; NSError* error; - result = [apiClient deserialize:data class:@"NSNumber*" error:&error]; + result = [apiClient.responseDeserializer deserialize:data class:@"NSNumber*" error:&error]; XCTAssertTrue([result isEqual:@YES]); data = @"false"; - result = [apiClient deserialize:data class:@"NSNumber*" error:&error]; + result = [apiClient.responseDeserializer deserialize:data class:@"NSNumber*" error:&error]; XCTAssertTrue([result isEqual:@NO]); } diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m index 7fd3d4f97c84..7ddc817e9ef2 100644 --- a/samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m @@ -165,7 +165,7 @@ which causes an exception when deserializing the data SWGTag* tag = [[SWGTag alloc] init]; tag.name = @"tony"; NSLog(@"%@", pet._id); - pet.tags = [[NSArray alloc] initWithObjects:tag, nil]; + pet.tags = (id)[[NSArray alloc] initWithObjects:tag, nil]; [api addPetWithBody:pet completionHandler:^(NSError *error) { if(error) { diff --git a/samples/client/petstore/objc/git_push.sh b/samples/client/petstore/objc/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/objc/git_push.sh +++ b/samples/client/petstore/objc/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi From 75cc10fdfa913cc1b0818ee316b20602e2b47e7d Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Fri, 6 May 2016 10:51:59 +0200 Subject: [PATCH 119/170] Fix typo --- .../java/io/swagger/codegen/languages/ObjcClientCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 9340eafd360c..0ecdfb667c9b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -109,7 +109,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { "break", "enum", "register", "typedef", "case", "extern", "return", "union", "char", "float", "short", "unsigned", - "co nst", "for", "signed", "void", + "const", "for", "signed", "void", "continue", "goto", "sizeof", "volatile", "default", "if", "id", "static", "while", "do", "int", "struct", "_Packed", From 385bf6d9eafdad8188711535d7c8efcacaf5a4a6 Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Fri, 6 May 2016 11:41:30 +0200 Subject: [PATCH 120/170] Additional UnknownResponseObjectErrorCode if response object expected type is an unknown type --- .../objc/ResponseDeserializer-body.mustache | 26 +++++++++++++------ .../objc/ResponseDeserializer-header.mustache | 5 ++++ samples/client/petstore/objc/README.md | 2 +- .../SwaggerClient/SWGResponseDeserializer.h | 5 ++++ .../SwaggerClient/SWGResponseDeserializer.m | 26 +++++++++++++------ .../Tests/DeserializationTest.m | 8 ++++++ 6 files changed, 55 insertions(+), 17 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache index 9b325eca10d9..27a59e39cdc6 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache @@ -8,6 +8,9 @@ NSInteger const {{classPrefix}}TypeMismatchErrorCode = 143553; NSInteger const {{classPrefix}}EmptyValueOccurredErrorCode = 143509; +NSInteger const {{classPrefix}}UnknownResponseObjectErrorCode = 143528; + + @interface {{classPrefix}}ResponseDeserializer () @property (nonatomic, strong) NSNumberFormatter* numberFormatter; @@ -70,33 +73,31 @@ NSInteger const {{classPrefix}}EmptyValueOccurredErrorCode = 143509; } NSTextCheckingResult *match = nil; - + NSRange range = NSMakeRange(0, [className length]); // list of models - match = [self.arrayOfModelsPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + match = [self.arrayOfModelsPatExpression firstMatchInString:className options:0 range:range]; if (match) { NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; return [self deserializeArrayValue:data innerType:innerType error:error]; } // list of primitives - match = [self.arrayOfPrimitivesPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + match = [self.arrayOfPrimitivesPatExpression firstMatchInString:className options:0 range:range]; if (match) { NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; return [self deserializeArrayValue:data innerType:innerType error:error]; } // map - match = [self.dictPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + match = [self.dictPatExpression firstMatchInString:className options:0 range:range]; if (match) { NSString *valueType = [className substringWithRange:[match rangeAtIndex:2]]; return [self deserializeDictionaryValue:data valueType:valueType error:error]; } - match = [self.dictModelsPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + match = [self.dictModelsPatExpression firstMatchInString:className options:0 range:range]; if (match) { - NSRange range =[match rangeAtIndex:2]; - range = NSMakeRange(range.location, [className length] - range.location -1); - NSString *valueType = [className substringWithRange:range]; + NSString *valueType = [className substringWithRange:[match rangeAtIndex:2]]; return [self deserializeDictionaryValue:data valueType:valueType error:error]; } @@ -106,6 +107,9 @@ NSInteger const {{classPrefix}}EmptyValueOccurredErrorCode = 143509; return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error]; } + if(error) { + *error = [self unknownResponseErrorWithExpectedType:className data:data]; + } return nil; } @@ -218,4 +222,10 @@ NSInteger const {{classPrefix}}EmptyValueOccurredErrorCode = 143509; return [NSError errorWithDomain:{{classPrefix}}DeserializationErrorDomainKey code:{{classPrefix}}EmptyValueOccurredErrorCode userInfo:userInfo]; } +-(NSError *)unknownResponseErrorWithExpectedType:(NSString *)expected data:(id)data { + NSString * message = [NSString stringWithFormat:NSLocalizedString(@"Unknown response expected type %@ [reponse: %@]",nil),expected,data]; + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:{{classPrefix}}DeserializationErrorDomainKey code:{{classPrefix}}UnknownResponseObjectErrorCode userInfo:userInfo]; +} + @end diff --git a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache index 75894042eee6..2dd038c13f03 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache @@ -21,6 +21,11 @@ extern NSInteger const {{classPrefix}}TypeMismatchErrorCode; */ extern NSInteger const {{classPrefix}}EmptyValueOccurredErrorCode; +/** + * Error code for unknown response + */ +extern NSInteger const {{classPrefix}}UnknownResponseObjectErrorCode; + @protocol {{classPrefix}}ResponseDeserializer /** diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index 888ecba46f11..4b0b92a259e9 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-05-06T10:30:53.676+02:00 +- Build date: 2016-05-06T11:35:18.146+02:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements diff --git a/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.h b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.h index 26f2ba3a4e64..b20ead44f83a 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.h @@ -21,6 +21,11 @@ extern NSInteger const SWGTypeMismatchErrorCode; */ extern NSInteger const SWGEmptyValueOccurredErrorCode; +/** + * Error code for unknown response + */ +extern NSInteger const SWGUnknownResponseObjectErrorCode; + @protocol SWGResponseDeserializer /** diff --git a/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m index 2bf124604bb2..fa5be3af3d27 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m @@ -8,6 +8,9 @@ NSInteger const SWGTypeMismatchErrorCode = 143553; NSInteger const SWGEmptyValueOccurredErrorCode = 143509; +NSInteger const SWGUnknownResponseObjectErrorCode = 143528; + + @interface SWGResponseDeserializer () @property (nonatomic, strong) NSNumberFormatter* numberFormatter; @@ -70,33 +73,31 @@ NSInteger const SWGEmptyValueOccurredErrorCode = 143509; } NSTextCheckingResult *match = nil; - + NSRange range = NSMakeRange(0, [className length]); // list of models - match = [self.arrayOfModelsPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + match = [self.arrayOfModelsPatExpression firstMatchInString:className options:0 range:range]; if (match) { NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; return [self deserializeArrayValue:data innerType:innerType error:error]; } // list of primitives - match = [self.arrayOfPrimitivesPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + match = [self.arrayOfPrimitivesPatExpression firstMatchInString:className options:0 range:range]; if (match) { NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; return [self deserializeArrayValue:data innerType:innerType error:error]; } // map - match = [self.dictPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + match = [self.dictPatExpression firstMatchInString:className options:0 range:range]; if (match) { NSString *valueType = [className substringWithRange:[match rangeAtIndex:2]]; return [self deserializeDictionaryValue:data valueType:valueType error:error]; } - match = [self.dictModelsPatExpression firstMatchInString:className options:0 range:NSMakeRange(0, [className length])]; + match = [self.dictModelsPatExpression firstMatchInString:className options:0 range:range]; if (match) { - NSRange range =[match rangeAtIndex:2]; - range = NSMakeRange(range.location, [className length] - range.location -1); - NSString *valueType = [className substringWithRange:range]; + NSString *valueType = [className substringWithRange:[match rangeAtIndex:2]]; return [self deserializeDictionaryValue:data valueType:valueType error:error]; } @@ -106,6 +107,9 @@ NSInteger const SWGEmptyValueOccurredErrorCode = 143509; return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error]; } + if(error) { + *error = [self unknownResponseErrorWithExpectedType:className data:data]; + } return nil; } @@ -218,4 +222,10 @@ NSInteger const SWGEmptyValueOccurredErrorCode = 143509; return [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGEmptyValueOccurredErrorCode userInfo:userInfo]; } +-(NSError *)unknownResponseErrorWithExpectedType:(NSString *)expected data:(id)data { + NSString * message = [NSString stringWithFormat:NSLocalizedString(@"Unknown response expected type %@ [reponse: %@]",nil),expected,data]; + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGUnknownResponseObjectErrorCode userInfo:userInfo]; +} + @end diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m index 8241c00b0128..3284336a64b4 100644 --- a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m @@ -61,6 +61,14 @@ XCTAssertEqualWithAccuracy([dateTime timeIntervalSinceReferenceDate], [deserializedDateTime timeIntervalSinceReferenceDate], 0.001); } +- (void)testDeserializeUnknownObject { + NSString *data = @"random string"; + NSError* error; + NSNumber *result = [apiClient.responseDeserializer deserialize:data class:@"DeserializationTest*" error:&error]; + XCTAssertNotNil(error); + XCTAssertNil(result); +} + - (void)testDeserializeObject { NSNumber *data = @1; NSError* error; From 3dbab1b8931492dbc03d105830b3d48fcd2025e4 Mon Sep 17 00:00:00 2001 From: xhh Date: Fri, 6 May 2016 17:36:07 +0800 Subject: [PATCH 121/170] JavaScript client: fix exporting of outer enum model --- .../partial_model_enum_class.mustache | 2 +- .../javascript/docs/InlineResponse200.md | 13 -- .../javascript/src/model/EnumClass.js | 2 +- .../javascript/src/model/InlineResponse200.js | 132 ------------------ 4 files changed, 2 insertions(+), 147 deletions(-) delete mode 100644 samples/client/petstore/javascript/docs/InlineResponse200.md delete mode 100644 samples/client/petstore/javascript/src/model/InlineResponse200.js diff --git a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache index c7d18d358414..c85e82aa764b 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache @@ -5,7 +5,7 @@ * @readonly */ {{/emitJSDoc}} - exports.{{classname}} = { + var exports = { {{#allowableValues}} {{#values}} {{#emitJSDoc}} diff --git a/samples/client/petstore/javascript/docs/InlineResponse200.md b/samples/client/petstore/javascript/docs/InlineResponse200.md deleted file mode 100644 index bbb11067e9a4..000000000000 --- a/samples/client/petstore/javascript/docs/InlineResponse200.md +++ /dev/null @@ -1,13 +0,0 @@ -# SwaggerPetstore.InlineResponse200 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**tags** | [**[Tag]**](Tag.md) | | [optional] -**id** | **Integer** | | -**category** | **Object** | | [optional] -**status** | **String** | pet status in the store | [optional] -**name** | **String** | | [optional] -**photoUrls** | **[String]** | | [optional] - - diff --git a/samples/client/petstore/javascript/src/model/EnumClass.js b/samples/client/petstore/javascript/src/model/EnumClass.js index 2ff3398113a1..268addcbaed3 100644 --- a/samples/client/petstore/javascript/src/model/EnumClass.js +++ b/samples/client/petstore/javascript/src/model/EnumClass.js @@ -21,7 +21,7 @@ * @enum {} * @readonly */ - exports.EnumClass = { + var exports = { /** * value: _abc * @const diff --git a/samples/client/petstore/javascript/src/model/InlineResponse200.js b/samples/client/petstore/javascript/src/model/InlineResponse200.js deleted file mode 100644 index f2abaf1bd1b7..000000000000 --- a/samples/client/petstore/javascript/src/model/InlineResponse200.js +++ /dev/null @@ -1,132 +0,0 @@ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Tag'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./Tag')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; - } - root.SwaggerPetstore.InlineResponse200 = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Tag); - } -}(this, function(ApiClient, Tag) { - 'use strict'; - - /** - * The InlineResponse200 model module. - * @module model/InlineResponse200 - * @version 1.0.0 - */ - - /** - * Constructs a new InlineResponse200. - * @alias module:model/InlineResponse200 - * @class - * @param id - */ - var exports = function(id) { - - - this['id'] = id; - - - - - }; - - /** - * Constructs a InlineResponse200 from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/InlineResponse200} obj Optional instance to populate. - * @return {module:model/InlineResponse200} The populated InlineResponse200 instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('tags')) { - obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]); - } - if (data.hasOwnProperty('id')) { - obj['id'] = ApiClient.convertToType(data['id'], 'Integer'); - } - if (data.hasOwnProperty('category')) { - obj['category'] = ApiClient.convertToType(data['category'], Object); - } - if (data.hasOwnProperty('status')) { - obj['status'] = ApiClient.convertToType(data['status'], 'String'); - } - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'String'); - } - if (data.hasOwnProperty('photoUrls')) { - obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); - } - } - return obj; - } - - - /** - * @member {Array.} tags - */ - exports.prototype['tags'] = undefined; - - /** - * @member {Integer} id - */ - exports.prototype['id'] = undefined; - - /** - * @member {Object} category - */ - exports.prototype['category'] = undefined; - - /** - * pet status in the store - * @member {module:model/InlineResponse200.StatusEnum} status - */ - exports.prototype['status'] = undefined; - - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; - - /** - * @member {Array.} photoUrls - */ - exports.prototype['photoUrls'] = undefined; - - - /** - * Allowed values for the status property. - * @enum {String} - * @readonly - */ - exports.StatusEnum = { - /** - * value: available - * @const - */ - AVAILABLE: "available", - - /** - * value: pending - * @const - */ - PENDING: "pending", - - /** - * value: sold - * @const - */ - SOLD: "sold" - }; - - return exports; -})); From 5acef6d634ece2d71874abdb56943a7d68df0ae5 Mon Sep 17 00:00:00 2001 From: xhh Date: Fri, 6 May 2016 18:02:32 +0800 Subject: [PATCH 122/170] Update petstore sample for JS-promise client --- bin/javascript-promise-petstore.sh | 2 +- .../petstore/javascript-promise/README.md | 52 +++++-- .../javascript-promise/docs/AnimalFarm.md | 7 + .../javascript-promise/docs/ApiResponse.md | 10 ++ .../javascript-promise/docs/EnumClass.md | 7 + .../javascript-promise/docs/EnumTest.md | 10 ++ .../javascript-promise/docs/FakeApi.md | 79 +++++++++++ .../javascript-promise/docs/FormatTest.md | 8 +- .../docs/InlineResponse200.md | 13 -- .../petstore/javascript-promise/docs/Name.md | 1 + .../petstore/javascript-promise/docs/Order.md | 2 +- .../javascript-promise/docs/PetApi.md | 88 ++++++------ .../javascript-promise/docs/StoreApi.md | 23 ++- .../javascript-promise/docs/UserApi.md | 76 +++++----- .../petstore/javascript-promise/package.json | 2 +- .../javascript-promise/src/ApiClient.js | 4 +- .../javascript-promise/src/api/FakeApi.js | 113 +++++++++++++++ .../javascript-promise/src/api/PetApi.js | 91 ++++++------ .../javascript-promise/src/api/StoreApi.js | 23 +-- .../javascript-promise/src/api/UserApi.js | 90 +++++++----- .../petstore/javascript-promise/src/index.js | 73 +++++++++- .../javascript-promise/src/model/Animal.js | 13 +- .../src/model/AnimalFarm.js | 64 +++++++++ .../src/model/ApiResponse.js | 83 +++++++++++ .../javascript-promise/src/model/Cat.js | 13 +- .../javascript-promise/src/model/Category.js | 7 +- .../javascript-promise/src/model/Dog.js | 13 +- .../javascript-promise/src/model/EnumClass.js | 44 ++++++ .../javascript-promise/src/model/EnumTest.js | 131 +++++++++++++++++ .../src/model/FormatTest.js | 52 ++++--- .../src/model/InlineResponse200.js | 132 ------------------ .../src/model/Model200Response.js | 9 +- .../src/model/ModelReturn.js | 9 +- .../javascript-promise/src/model/Name.js | 20 ++- .../javascript-promise/src/model/Order.js | 32 ++--- .../javascript-promise/src/model/Pet.js | 29 ++-- .../src/model/SpecialModelName.js | 9 +- .../javascript-promise/src/model/Tag.js | 7 +- .../javascript-promise/src/model/User.js | 13 +- .../javascript-promise/test/api/PetApiTest.js | 4 +- 40 files changed, 1014 insertions(+), 444 deletions(-) create mode 100644 samples/client/petstore/javascript-promise/docs/AnimalFarm.md create mode 100644 samples/client/petstore/javascript-promise/docs/ApiResponse.md create mode 100644 samples/client/petstore/javascript-promise/docs/EnumClass.md create mode 100644 samples/client/petstore/javascript-promise/docs/EnumTest.md create mode 100644 samples/client/petstore/javascript-promise/docs/FakeApi.md delete mode 100644 samples/client/petstore/javascript-promise/docs/InlineResponse200.md create mode 100644 samples/client/petstore/javascript-promise/src/api/FakeApi.js create mode 100644 samples/client/petstore/javascript-promise/src/model/AnimalFarm.js create mode 100644 samples/client/petstore/javascript-promise/src/model/ApiResponse.js create mode 100644 samples/client/petstore/javascript-promise/src/model/EnumClass.js create mode 100644 samples/client/petstore/javascript-promise/src/model/EnumTest.js delete mode 100644 samples/client/petstore/javascript-promise/src/model/InlineResponse200.js diff --git a/bin/javascript-promise-petstore.sh b/bin/javascript-promise-petstore.sh index f6e7ef139134..fac0f221424c 100755 --- a/bin/javascript-promise-petstore.sh +++ b/bin/javascript-promise-petstore.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript \ --i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l javascript \ +-i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l javascript \ -o samples/client/petstore/javascript-promise \ --additional-properties usePromises=true" diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index f1d10a435b65..ba181cae0896 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -1,12 +1,12 @@ # swagger-petstore SwaggerPetstore - JavaScript client for swagger-petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This SDK 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-01T12:08:53.092+08:00 +- Build date: 2016-05-06T17:51:36.114+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -53,18 +53,27 @@ Please follow the [installation](#installation) instruction and execute the foll ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; +var api = new SwaggerPetstore.FakeApi() -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +var _number = 3.4; // {Number} None -var api = new SwaggerPetstore.PetApi() +var _double = 1.2; // {Number} None + +var _string = "_string_example"; // {String} None + +var _byte = "B"; // {String} None var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'integer': 56, // {Integer} None + 'int32': 56, // {Integer} None + 'int64': 789, // {Integer} None + '_float': 3.4, // {Number} None + 'binary': "B", // {String} None + '_date': new Date("2013-10-20"), // {Date} None + 'dateTime': new Date("2013-10-20T19:20:30+01:00"), // {Date} None + 'password': "password_example" // {String} None }; -api.addPet(opts).then(function() { +api.testEndpointParameters(_number, _double, _string, _byte, opts).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -79,6 +88,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*SwaggerPetstore.FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters *SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *SwaggerPetstore.PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet *SwaggerPetstore.PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -103,9 +113,21 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [SwaggerPetstore.Animal](docs/Animal.md) + - [SwaggerPetstore.AnimalFarm](docs/AnimalFarm.md) + - [SwaggerPetstore.ApiResponse](docs/ApiResponse.md) + - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) + - [SwaggerPetstore.Dog](docs/Dog.md) + - [SwaggerPetstore.EnumClass](docs/EnumClass.md) + - [SwaggerPetstore.EnumTest](docs/EnumTest.md) + - [SwaggerPetstore.FormatTest](docs/FormatTest.md) + - [SwaggerPetstore.Model200Response](docs/Model200Response.md) + - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) + - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.Order](docs/Order.md) - [SwaggerPetstore.Pet](docs/Pet.md) + - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) - [SwaggerPetstore.Tag](docs/Tag.md) - [SwaggerPetstore.User](docs/User.md) @@ -113,12 +135,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -128,3 +144,9 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + diff --git a/samples/client/petstore/javascript-promise/docs/AnimalFarm.md b/samples/client/petstore/javascript-promise/docs/AnimalFarm.md new file mode 100644 index 000000000000..b72739a44c42 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/AnimalFarm.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript-promise/docs/ApiResponse.md b/samples/client/petstore/javascript-promise/docs/ApiResponse.md new file mode 100644 index 000000000000..0ee678b84afa --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/ApiResponse.md @@ -0,0 +1,10 @@ +# SwaggerPetstore.ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/EnumClass.md b/samples/client/petstore/javascript-promise/docs/EnumClass.md new file mode 100644 index 000000000000..5159ccfb4540 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/EnumClass.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript-promise/docs/EnumTest.md b/samples/client/petstore/javascript-promise/docs/EnumTest.md new file mode 100644 index 000000000000..724eea8a25e9 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/EnumTest.md @@ -0,0 +1,10 @@ +# SwaggerPetstore.EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumInteger** | **Integer** | | [optional] +**enumNumber** | **Number** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/FakeApi.md b/samples/client/petstore/javascript-promise/docs/FakeApi.md new file mode 100644 index 000000000000..83925c1266df --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/FakeApi.md @@ -0,0 +1,79 @@ +# SwaggerPetstore.FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters + + + +# **testEndpointParameters** +> testEndpointParameters(_number, _double, _string, _byte, opts) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var _number = 3.4; // Number | None + +var _double = 1.2; // Number | None + +var _string = "_string_example"; // String | None + +var _byte = "B"; // String | None + +var opts = { + 'integer': 56, // Integer | None + 'int32': 56, // Integer | None + 'int64': 789, // Integer | None + '_float': 3.4, // Number | None + 'binary': "B", // String | None + '_date': new Date("2013-10-20"), // Date | None + 'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None + 'password': "password_example" // String | None +}; +apiInstance.testEndpointParameters(_number, _double, _string, _byte, opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_number** | **Number**| None | + **_double** | **Number**| None | + **_string** | **String**| None | + **_byte** | **String**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Integer**| None | [optional] + **_float** | **Number**| None | [optional] + **binary** | **String**| None | [optional] + **_date** | **Date**| None | [optional] + **dateTime** | **Date**| None | [optional] + **password** | **String**| None | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/javascript-promise/docs/FormatTest.md b/samples/client/petstore/javascript-promise/docs/FormatTest.md index 57a4fb132d53..9600904ee6d4 100644 --- a/samples/client/petstore/javascript-promise/docs/FormatTest.md +++ b/samples/client/petstore/javascript-promise/docs/FormatTest.md @@ -10,9 +10,11 @@ Name | Type | Description | Notes **_float** | **Number** | | [optional] **_double** | **Number** | | [optional] **_string** | **String** | | [optional] -**_byte** | **String** | | [optional] +**_byte** | **String** | | **binary** | **String** | | [optional] -**_date** | **Date** | | [optional] -**dateTime** | **String** | | [optional] +**_date** | **Date** | | +**dateTime** | **Date** | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | diff --git a/samples/client/petstore/javascript-promise/docs/InlineResponse200.md b/samples/client/petstore/javascript-promise/docs/InlineResponse200.md deleted file mode 100644 index bbb11067e9a4..000000000000 --- a/samples/client/petstore/javascript-promise/docs/InlineResponse200.md +++ /dev/null @@ -1,13 +0,0 @@ -# SwaggerPetstore.InlineResponse200 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**tags** | [**[Tag]**](Tag.md) | | [optional] -**id** | **Integer** | | -**category** | **Object** | | [optional] -**status** | **String** | pet status in the store | [optional] -**name** | **String** | | [optional] -**photoUrls** | **[String]** | | [optional] - - diff --git a/samples/client/petstore/javascript-promise/docs/Name.md b/samples/client/petstore/javascript-promise/docs/Name.md index f0e693f2f564..3bdb76be0859 100644 --- a/samples/client/petstore/javascript-promise/docs/Name.md +++ b/samples/client/petstore/javascript-promise/docs/Name.md @@ -5,5 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | **snakeCase** | **Integer** | | [optional] +**property** | **String** | | [optional] diff --git a/samples/client/petstore/javascript-promise/docs/Order.md b/samples/client/petstore/javascript-promise/docs/Order.md index b34b67d3a56a..10503b582065 100644 --- a/samples/client/petstore/javascript-promise/docs/Order.md +++ b/samples/client/petstore/javascript-promise/docs/Order.md @@ -8,6 +8,6 @@ Name | Type | Description | Notes **quantity** | **Integer** | | [optional] **shipDate** | **Date** | | [optional] **status** | **String** | Order Status | [optional] -**complete** | **Boolean** | | [optional] +**complete** | **Boolean** | | [optional] [default to false] diff --git a/samples/client/petstore/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md index 0a0513875eb8..af66741523ba 100644 --- a/samples/client/petstore/javascript-promise/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise/docs/PetApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **addPet** -> addPet(opts) +> addPet(body) Add a new pet to the store @@ -33,10 +33,9 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var opts = { - 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store -}; -apiInstance.addPet(opts).then(function() { +var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store + +apiInstance.addPet(body).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -48,7 +47,7 @@ apiInstance.addPet(opts).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -61,7 +60,7 @@ null (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **deletePet** @@ -113,15 +112,15 @@ null (empty response body) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **findPetsByStatus** -> [Pet] findPetsByStatus(opts) +> [Pet] findPetsByStatus(status) Finds Pets by status -Multiple status values can be provided with comma seperated strings +Multiple status values can be provided with comma separated strings ### Example ```javascript @@ -134,10 +133,9 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var opts = { - 'status': ["available"] // [String] | Status values that need to be considered for filter -}; -apiInstance.findPetsByStatus(opts).then(function(data) { +var status = ["status_example"]; // [String] | Status values that need to be considered for filter + +apiInstance.findPetsByStatus(status).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -149,7 +147,7 @@ apiInstance.findPetsByStatus(opts).then(function(data) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**[String]**](String.md)| Status values that need to be considered for filter | [optional] [default to available] + **status** | [**[String]**](String.md)| Status values that need to be considered for filter | ### Return type @@ -162,15 +160,15 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **findPetsByTags** -> [Pet] findPetsByTags(opts) +> [Pet] findPetsByTags(tags) Finds Pets by tags -Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example ```javascript @@ -183,10 +181,9 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var opts = { - 'tags': ["tags_example"] // [String] | Tags to filter by -}; -apiInstance.findPetsByTags(opts).then(function(data) { +var tags = ["tags_example"]; // [String] | Tags to filter by + +apiInstance.findPetsByTags(tags).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -198,7 +195,7 @@ apiInstance.findPetsByTags(opts).then(function(data) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**[String]**](String.md)| Tags to filter by | [optional] + **tags** | [**[String]**](String.md)| Tags to filter by | ### Return type @@ -211,7 +208,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **getPetById** @@ -219,7 +216,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a single pet ### Example ```javascript @@ -232,13 +229,9 @@ api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //api_key.apiKeyPrefix = 'Token'; -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; - var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Integer | ID of pet that needs to be fetched +var petId = 789; // Integer | ID of pet to return apiInstance.getPetById(petId).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -252,7 +245,7 @@ apiInstance.getPetById(petId).then(function(data) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | + **petId** | **Integer**| ID of pet to return | ### Return type @@ -260,16 +253,16 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **updatePet** -> updatePet(opts) +> updatePet(body) Update an existing pet @@ -286,10 +279,9 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var opts = { - 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store -}; -apiInstance.updatePet(opts).then(function() { +var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store + +apiInstance.updatePet(body).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -301,7 +293,7 @@ apiInstance.updatePet(opts).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -314,7 +306,7 @@ null (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **updatePetWithForm** @@ -335,7 +327,7 @@ petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; var apiInstance = new SwaggerPetstore.PetApi(); -var petId = "petId_example"; // String | ID of pet that needs to be updated +var petId = 789; // Integer | ID of pet that needs to be updated var opts = { 'name': "name_example", // String | Updated name of the pet @@ -353,7 +345,7 @@ apiInstance.updatePetWithForm(petId, opts).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **String**| ID of pet that needs to be updated | + **petId** | **Integer**| ID of pet that needs to be updated | **name** | **String**| Updated name of the pet | [optional] **status** | **String**| Updated status of the pet | [optional] @@ -368,11 +360,11 @@ null (empty response body) ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **uploadFile** -> uploadFile(petId, opts) +> ApiResponse uploadFile(petId, opts) uploads an image @@ -395,8 +387,8 @@ var opts = { 'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server 'file': "/path/to/file.txt" // File | file to upload }; -apiInstance.uploadFile(petId, opts).then(function() { - console.log('API called successfully.'); +apiInstance.uploadFile(petId, opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); @@ -413,7 +405,7 @@ Name | Type | Description | Notes ### Return type -null (empty response body) +[**ApiResponse**](ApiResponse.md) ### Authorization @@ -422,5 +414,5 @@ null (empty response body) ### HTTP request headers - **Content-Type**: multipart/form-data - - **Accept**: application/json, application/xml + - **Accept**: application/json diff --git a/samples/client/petstore/javascript-promise/docs/StoreApi.md b/samples/client/petstore/javascript-promise/docs/StoreApi.md index ce57b57bc4f0..0d96cfc9e340 100644 --- a/samples/client/petstore/javascript-promise/docs/StoreApi.md +++ b/samples/client/petstore/javascript-promise/docs/StoreApi.md @@ -51,7 +51,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **getInventory** @@ -95,7 +95,7 @@ This endpoint does not need any parameter. ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/json # **getOrderById** @@ -111,7 +111,7 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = "orderId_example"; // String | ID of pet that needs to be fetched +var orderId = 789; // Integer | ID of pet that needs to be fetched apiInstance.getOrderById(orderId).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -125,7 +125,7 @@ apiInstance.getOrderById(orderId).then(function(data) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of pet that needs to be fetched | + **orderId** | **Integer**| ID of pet that needs to be fetched | ### Return type @@ -138,11 +138,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **placeOrder** -> Order placeOrder(opts) +> Order placeOrder(body) Place an order for a pet @@ -154,10 +154,9 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.StoreApi(); -var opts = { - 'body': new SwaggerPetstore.Order() // Order | order placed for purchasing the pet -}; -apiInstance.placeOrder(opts).then(function(data) { +var body = new SwaggerPetstore.Order(); // Order | order placed for purchasing the pet + +apiInstance.placeOrder(body).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -169,7 +168,7 @@ apiInstance.placeOrder(opts).then(function(data) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + **body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -182,5 +181,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md index 99b56e9cf3d4..2634d41e611e 100644 --- a/samples/client/petstore/javascript-promise/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **createUser** -> createUser(opts) +> createUser(body) Create user @@ -28,10 +28,9 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.UserApi(); -var opts = { - 'body': new SwaggerPetstore.User() // User | Created user object -}; -apiInstance.createUser(opts).then(function() { +var body = new SwaggerPetstore.User(); // User | Created user object + +apiInstance.createUser(body).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -43,7 +42,7 @@ apiInstance.createUser(opts).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | ### Return type @@ -56,11 +55,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **createUsersWithArrayInput** -> createUsersWithArrayInput(opts) +> createUsersWithArrayInput(body) Creates list of users with given input array @@ -72,10 +71,9 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.UserApi(); -var opts = { - 'body': [new SwaggerPetstore.User()] // [User] | List of user object -}; -apiInstance.createUsersWithArrayInput(opts).then(function() { +var body = [new SwaggerPetstore.User()]; // [User] | List of user object + +apiInstance.createUsersWithArrayInput(body).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -87,7 +85,7 @@ apiInstance.createUsersWithArrayInput(opts).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](User.md)| List of user object | [optional] + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -100,11 +98,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **createUsersWithListInput** -> createUsersWithListInput(opts) +> createUsersWithListInput(body) Creates list of users with given input array @@ -116,10 +114,9 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.UserApi(); -var opts = { - 'body': [new SwaggerPetstore.User()] // [User] | List of user object -}; -apiInstance.createUsersWithListInput(opts).then(function() { +var body = [new SwaggerPetstore.User()]; // [User] | List of user object + +apiInstance.createUsersWithListInput(body).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -131,7 +128,7 @@ apiInstance.createUsersWithListInput(opts).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](User.md)| List of user object | [optional] + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -144,7 +141,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **deleteUser** @@ -187,7 +184,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **getUserByName** @@ -230,11 +227,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **loginUser** -> 'String' loginUser(opts) +> 'String' loginUser(username, password) Logs user into the system @@ -246,11 +243,11 @@ var SwaggerPetstore = require('swagger-petstore'); var apiInstance = new SwaggerPetstore.UserApi(); -var opts = { - 'username': "username_example", // String | The user name for login - 'password': "password_example" // String | The password for login in clear text -}; -apiInstance.loginUser(opts).then(function(data) { +var username = "username_example"; // String | The user name for login + +var password = "password_example"; // String | The password for login in clear text + +apiInstance.loginUser(username, password).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -262,8 +259,8 @@ apiInstance.loginUser(opts).then(function(data) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [optional] - **password** | **String**| The password for login in clear text | [optional] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -276,7 +273,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **logoutUser** @@ -313,11 +310,11 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **updateUser** -> updateUser(username, opts) +> updateUser(username, body) Updated user @@ -331,10 +328,9 @@ var apiInstance = new SwaggerPetstore.UserApi(); var username = "username_example"; // String | name that need to be deleted -var opts = { - 'body': new SwaggerPetstore.User() // User | Updated user object -}; -apiInstance.updateUser(username, opts).then(function() { +var body = new SwaggerPetstore.User(); // User | Updated user object + +apiInstance.updateUser(username, body).then(function() { console.log('API called successfully.'); }, function(error) { console.error(error); @@ -347,7 +343,7 @@ apiInstance.updateUser(username, opts).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | [optional] + **body** | [**User**](User.md)| Updated user object | ### Return type @@ -360,5 +356,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/javascript-promise/package.json b/samples/client/petstore/javascript-promise/package.json index 72a48ac71de6..8ff02a78ae3f 100644 --- a/samples/client/petstore/javascript-promise/package.json +++ b/samples/client/petstore/javascript-promise/package.json @@ -1,7 +1,7 @@ { "name": "swagger-petstore", "version": "1.0.0", - "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", + "description": "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.", "license": "Apache 2.0", "main": "src/index.js", "scripts": { diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index ac0b172ff220..4033ad41e008 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -40,8 +40,8 @@ * @type {Array.} */ this.authentications = { - 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'petstore_auth': {type: 'oauth2'} + 'petstore_auth': {type: 'oauth2'}, + 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'} }; /** * The default HTTP headers to be included for all API calls. diff --git a/samples/client/petstore/javascript-promise/src/api/FakeApi.js b/samples/client/petstore/javascript-promise/src/api/FakeApi.js new file mode 100644 index 000000000000..84d262725a2f --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/api/FakeApi.js @@ -0,0 +1,113 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + /** + * Fake service. + * @module api/FakeApi + * @version 1.0.0 + */ + + /** + * Constructs a new FakeApi. + * @alias module:api/FakeApi + * @class + * @param {module:ApiClient} apiClient Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. + */ + var exports = function(apiClient) { + this.apiClient = apiClient || ApiClient.instance; + + + + /** + * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters + * @param {Number} _number None + * @param {Number} _double None + * @param {String} _string None + * @param {String} _byte None + * @param {Object} opts Optional parameters + * @param {Integer} opts.integer None + * @param {Integer} opts.int32 None + * @param {Integer} opts.int64 None + * @param {Number} opts._float None + * @param {String} opts.binary None + * @param {Date} opts._date None + * @param {Date} opts.dateTime None + * @param {String} opts.password None + */ + this.testEndpointParameters = function(_number, _double, _string, _byte, opts) { + opts = opts || {}; + var postBody = null; + + // verify the required parameter '_number' is set + if (_number == undefined || _number == null) { + throw "Missing the required parameter '_number' when calling testEndpointParameters"; + } + + // verify the required parameter '_double' is set + if (_double == undefined || _double == null) { + throw "Missing the required parameter '_double' when calling testEndpointParameters"; + } + + // verify the required parameter '_string' is set + if (_string == undefined || _string == null) { + throw "Missing the required parameter '_string' when calling testEndpointParameters"; + } + + // verify the required parameter '_byte' is set + if (_byte == undefined || _byte == null) { + throw "Missing the required parameter '_byte' when calling testEndpointParameters"; + } + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + 'integer': opts['integer'], + 'int32': opts['int32'], + 'int64': opts['int64'], + 'number': _number, + 'float': opts['_float'], + 'double': _double, + 'string': _string, + 'byte': _byte, + 'binary': opts['binary'], + 'date': opts['_date'], + 'dateTime': opts['dateTime'], + 'password': opts['password'] + }; + + var authNames = []; + var contentTypes = []; + var accepts = ['application/xml', 'application/json']; + var returnType = null; + + return this.apiClient.callApi( + '/fake', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + }; + + return exports; +})); diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 1b0855e52871..572fe19dbf24 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -1,18 +1,18 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Pet'], factory); + define(['ApiClient', 'model/Pet', 'model/ApiResponse'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/Pet')); + module.exports = factory(require('../ApiClient'), require('../model/Pet'), require('../model/ApiResponse')); } else { // Browser globals (root is window) if (!root.SwaggerPetstore) { root.SwaggerPetstore = {}; } - root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet); + root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet, root.SwaggerPetstore.ApiResponse); } -}(this, function(ApiClient, Pet) { +}(this, function(ApiClient, Pet, ApiResponse) { 'use strict'; /** @@ -36,12 +36,15 @@ /** * Add a new pet to the store * - * @param {Object} opts Optional parameters - * @param {module:model/Pet} opts.body Pet object that needs to be added to the store + * @param {module:model/Pet} body Pet object that needs to be added to the store */ - this.addPet = function(opts) { - opts = opts || {}; - var postBody = opts['body']; + this.addPet = function(body) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling addPet"; + } var pathParams = { @@ -55,7 +58,7 @@ var authNames = ['petstore_auth']; var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -96,7 +99,7 @@ var authNames = ['petstore_auth']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -109,20 +112,23 @@ /** * Finds Pets by status - * Multiple status values can be provided with comma seperated strings - * @param {Object} opts Optional parameters - * @param {Array.} opts.status Status values that need to be considered for filter (default to available) + * Multiple status values can be provided with comma separated strings + * @param {Array.} status Status values that need to be considered for filter * data is of type: {Array.} */ - this.findPetsByStatus = function(opts) { - opts = opts || {}; + this.findPetsByStatus = function(status) { var postBody = null; + // verify the required parameter 'status' is set + if (status == undefined || status == null) { + throw "Missing the required parameter 'status' when calling findPetsByStatus"; + } + var pathParams = { }; var queryParams = { - 'status': this.apiClient.buildCollectionParam(opts['status'], 'multi') + 'status': this.apiClient.buildCollectionParam(status, 'csv') }; var headerParams = { }; @@ -131,7 +137,7 @@ var authNames = ['petstore_auth']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = [Pet]; return this.apiClient.callApi( @@ -144,20 +150,23 @@ /** * Finds Pets by tags - * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param {Object} opts Optional parameters - * @param {Array.} opts.tags Tags to filter by + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param {Array.} tags Tags to filter by * data is of type: {Array.} */ - this.findPetsByTags = function(opts) { - opts = opts || {}; + this.findPetsByTags = function(tags) { var postBody = null; + // verify the required parameter 'tags' is set + if (tags == undefined || tags == null) { + throw "Missing the required parameter 'tags' when calling findPetsByTags"; + } + var pathParams = { }; var queryParams = { - 'tags': this.apiClient.buildCollectionParam(opts['tags'], 'multi') + 'tags': this.apiClient.buildCollectionParam(tags, 'csv') }; var headerParams = { }; @@ -166,7 +175,7 @@ var authNames = ['petstore_auth']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = [Pet]; return this.apiClient.callApi( @@ -179,8 +188,8 @@ /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param {Integer} petId ID of pet that needs to be fetched + * Returns a single pet + * @param {Integer} petId ID of pet to return * data is of type: {module:model/Pet} */ this.getPetById = function(petId) { @@ -202,9 +211,9 @@ var formParams = { }; - var authNames = ['api_key', 'petstore_auth']; + var authNames = ['api_key']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = Pet; return this.apiClient.callApi( @@ -218,12 +227,15 @@ /** * Update an existing pet * - * @param {Object} opts Optional parameters - * @param {module:model/Pet} opts.body Pet object that needs to be added to the store + * @param {module:model/Pet} body Pet object that needs to be added to the store */ - this.updatePet = function(opts) { - opts = opts || {}; - var postBody = opts['body']; + this.updatePet = function(body) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling updatePet"; + } var pathParams = { @@ -237,7 +249,7 @@ var authNames = ['petstore_auth']; var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -251,7 +263,7 @@ /** * Updates a pet in the store with form data * - * @param {String} petId ID of pet that needs to be updated + * @param {Integer} petId ID of pet that needs to be updated * @param {Object} opts Optional parameters * @param {String} opts.name Updated name of the pet * @param {String} opts.status Updated status of the pet @@ -280,7 +292,7 @@ var authNames = ['petstore_auth']; var contentTypes = ['application/x-www-form-urlencoded']; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -298,6 +310,7 @@ * @param {Object} opts Optional parameters * @param {String} opts.additionalMetadata Additional data to pass to server * @param {File} opts.file file to upload + * data is of type: {module:model/ApiResponse} */ this.uploadFile = function(petId, opts) { opts = opts || {}; @@ -323,8 +336,8 @@ var authNames = ['petstore_auth']; var contentTypes = ['multipart/form-data']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; + var accepts = ['application/json']; + var returnType = ApiResponse; return this.apiClient.callApi( '/pet/{petId}/uploadImage', 'POST', diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index 6c6f7ea5dc4c..f8b889256b28 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -59,7 +59,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -90,7 +90,7 @@ var authNames = ['api_key']; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/json']; var returnType = {'String': 'Integer'}; return this.apiClient.callApi( @@ -104,7 +104,7 @@ /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param {String} orderId ID of pet that needs to be fetched + * @param {Integer} orderId ID of pet that needs to be fetched * data is of type: {module:model/Order} */ this.getOrderById = function(orderId) { @@ -128,7 +128,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = Order; return this.apiClient.callApi( @@ -142,13 +142,16 @@ /** * Place an order for a pet * - * @param {Object} opts Optional parameters - * @param {module:model/Order} opts.body order placed for purchasing the pet + * @param {module:model/Order} body order placed for purchasing the pet * data is of type: {module:model/Order} */ - this.placeOrder = function(opts) { - opts = opts || {}; - var postBody = opts['body']; + this.placeOrder = function(body) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling placeOrder"; + } var pathParams = { @@ -162,7 +165,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = Order; return this.apiClient.callApi( diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index e58ee580d3b5..ff8f745735d5 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -36,12 +36,15 @@ /** * Create user * This can only be done by the logged in user. - * @param {Object} opts Optional parameters - * @param {module:model/User} opts.body Created user object + * @param {module:model/User} body Created user object */ - this.createUser = function(opts) { - opts = opts || {}; - var postBody = opts['body']; + this.createUser = function(body) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling createUser"; + } var pathParams = { @@ -55,7 +58,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -69,12 +72,15 @@ /** * Creates list of users with given input array * - * @param {Object} opts Optional parameters - * @param {Array.} opts.body List of user object + * @param {Array.} body List of user object */ - this.createUsersWithArrayInput = function(opts) { - opts = opts || {}; - var postBody = opts['body']; + this.createUsersWithArrayInput = function(body) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling createUsersWithArrayInput"; + } var pathParams = { @@ -88,7 +94,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -102,12 +108,15 @@ /** * Creates list of users with given input array * - * @param {Object} opts Optional parameters - * @param {Array.} opts.body List of user object + * @param {Array.} body List of user object */ - this.createUsersWithListInput = function(opts) { - opts = opts || {}; - var postBody = opts['body']; + this.createUsersWithListInput = function(body) { + var postBody = body; + + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling createUsersWithListInput"; + } var pathParams = { @@ -121,7 +130,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -158,7 +167,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -196,7 +205,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = User; return this.apiClient.callApi( @@ -210,21 +219,29 @@ /** * Logs user into the system * - * @param {Object} opts Optional parameters - * @param {String} opts.username The user name for login - * @param {String} opts.password The password for login in clear text + * @param {String} username The user name for login + * @param {String} password The password for login in clear text * data is of type: {'String'} */ - this.loginUser = function(opts) { - opts = opts || {}; + this.loginUser = function(username, password) { var postBody = null; + // verify the required parameter 'username' is set + if (username == undefined || username == null) { + throw "Missing the required parameter 'username' when calling loginUser"; + } + + // verify the required parameter 'password' is set + if (password == undefined || password == null) { + throw "Missing the required parameter 'password' when calling loginUser"; + } + var pathParams = { }; var queryParams = { - 'username': opts['username'], - 'password': opts['password'] + 'username': username, + 'password': password }; var headerParams = { }; @@ -233,7 +250,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = 'String'; return this.apiClient.callApi( @@ -263,7 +280,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( @@ -278,18 +295,21 @@ * Updated user * This can only be done by the logged in user. * @param {String} username name that need to be deleted - * @param {Object} opts Optional parameters - * @param {module:model/User} opts.body Updated user object + * @param {module:model/User} body Updated user object */ - this.updateUser = function(username, opts) { - opts = opts || {}; - var postBody = opts['body']; + this.updateUser = function(username, body) { + var postBody = body; // verify the required parameter 'username' is set if (username == undefined || username == null) { throw "Missing the required parameter 'username' when calling updateUser"; } + // verify the required parameter 'body' is set + if (body == undefined || body == null) { + throw "Missing the required parameter 'body' when calling updateUser"; + } + var pathParams = { 'username': username @@ -303,7 +323,7 @@ var authNames = []; var contentTypes = []; - var accepts = ['application/json', 'application/xml']; + var accepts = ['application/xml', 'application/json']; var returnType = null; return this.apiClient.callApi( diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index b0d17b3ef3a7..727b4782f458 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -1,16 +1,16 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Category', 'model/Order', 'model/Pet', 'model/Tag', 'model/User', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); + define(['ApiClient', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/Cat', 'model/Category', 'model/Dog', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/Order', 'model/Pet', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Category, Order, Pet, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Animal, AnimalFarm, ApiResponse, Cat, Category, Dog, EnumClass, EnumTest, FormatTest, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) { 'use strict'; /** - * This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters.
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose..
* The index module provides access to constructors for all the classes which comprise the public API. *

* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: @@ -46,11 +46,66 @@ * @property {module:ApiClient} */ ApiClient: ApiClient, + /** + * The Animal model constructor. + * @property {module:model/Animal} + */ + Animal: Animal, + /** + * The AnimalFarm model constructor. + * @property {module:model/AnimalFarm} + */ + AnimalFarm: AnimalFarm, + /** + * The ApiResponse model constructor. + * @property {module:model/ApiResponse} + */ + ApiResponse: ApiResponse, + /** + * The Cat model constructor. + * @property {module:model/Cat} + */ + Cat: Cat, /** * The Category model constructor. * @property {module:model/Category} */ Category: Category, + /** + * The Dog model constructor. + * @property {module:model/Dog} + */ + Dog: Dog, + /** + * The EnumClass model constructor. + * @property {module:model/EnumClass} + */ + EnumClass: EnumClass, + /** + * The EnumTest model constructor. + * @property {module:model/EnumTest} + */ + EnumTest: EnumTest, + /** + * The FormatTest model constructor. + * @property {module:model/FormatTest} + */ + FormatTest: FormatTest, + /** + * The Model200Response model constructor. + * @property {module:model/Model200Response} + */ + Model200Response: Model200Response, + /** + * The ModelReturn model constructor. + * @property {module:model/ModelReturn} + */ + ModelReturn: ModelReturn, + /** + * The Name model constructor. + * @property {module:model/Name} + */ + Name: Name, /** * The Order model constructor. * @property {module:model/Order} @@ -61,6 +116,11 @@ * @property {module:model/Pet} */ Pet: Pet, + /** + * The SpecialModelName model constructor. + * @property {module:model/SpecialModelName} + */ + SpecialModelName: SpecialModelName, /** * The Tag model constructor. * @property {module:model/Tag} @@ -71,6 +131,11 @@ * @property {module:model/User} */ User: User, + /** + * The FakeApi service constructor. + * @property {module:api/FakeApi} + */ + FakeApi: FakeApi, /** * The PetApi service constructor. * @property {module:api/PetApi} diff --git a/samples/client/petstore/javascript-promise/src/model/Animal.js b/samples/client/petstore/javascript-promise/src/model/Animal.js index 674471a30ee4..e42874c669b8 100644 --- a/samples/client/petstore/javascript-promise/src/model/Animal.js +++ b/samples/client/petstore/javascript-promise/src/model/Animal.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Animal model module. * @module model/Animal @@ -28,8 +31,9 @@ * @param className */ var exports = function(className) { + var _this = this; - this['className'] = className; + _this['className'] = className; }; /** @@ -40,7 +44,7 @@ * @return {module:model/Animal} The populated Animal instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('className')) { @@ -50,7 +54,6 @@ return obj; } - /** * @member {String} className */ @@ -61,3 +64,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js b/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js new file mode 100644 index 000000000000..d5f6aa2a424f --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js @@ -0,0 +1,64 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient', 'model/Animal'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./Animal')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.AnimalFarm = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); + } +}(this, function(ApiClient, Animal) { + 'use strict'; + + + + + /** + * The AnimalFarm model module. + * @module model/AnimalFarm + * @version 1.0.0 + */ + + /** + * Constructs a new AnimalFarm. + * @alias module:model/AnimalFarm + * @class + * @extends Array + */ + var exports = function() { + var _this = this; + _this = new Array(); + Object.setPrototypeOf(_this, exports); + + return _this; + }; + + /** + * Constructs a AnimalFarm from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/AnimalFarm} obj Optional instance to populate. + * @return {module:model/AnimalFarm} The populated AnimalFarm instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + ApiClient.constructFromObject(data, obj, Animal); + + } + return obj; + } + + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/src/model/ApiResponse.js b/samples/client/petstore/javascript-promise/src/model/ApiResponse.js new file mode 100644 index 000000000000..6d4c970264b0 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/ApiResponse.js @@ -0,0 +1,83 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.ApiResponse = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + + /** + * The ApiResponse model module. + * @module model/ApiResponse + * @version 1.0.0 + */ + + /** + * Constructs a new ApiResponse. + * @alias module:model/ApiResponse + * @class + */ + var exports = function() { + var _this = this; + + + + + }; + + /** + * Constructs a ApiResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ApiResponse} obj Optional instance to populate. + * @return {module:model/ApiResponse} The populated ApiResponse instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + if (data.hasOwnProperty('code')) { + obj['code'] = ApiClient.convertToType(data['code'], 'Integer'); + } + if (data.hasOwnProperty('type')) { + obj['type'] = ApiClient.convertToType(data['type'], 'String'); + } + if (data.hasOwnProperty('message')) { + obj['message'] = ApiClient.convertToType(data['message'], 'String'); + } + } + return obj; + } + + /** + * @member {Integer} code + */ + exports.prototype['code'] = undefined; + /** + * @member {String} type + */ + exports.prototype['type'] = undefined; + /** + * @member {String} message + */ + exports.prototype['message'] = undefined; + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/src/model/Cat.js b/samples/client/petstore/javascript-promise/src/model/Cat.js index c878af6edecf..a6b25bc6d584 100644 --- a/samples/client/petstore/javascript-promise/src/model/Cat.js +++ b/samples/client/petstore/javascript-promise/src/model/Cat.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', './Animal'], factory); + define(['ApiClient', 'model/Animal'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./Animal')); @@ -15,6 +15,9 @@ }(this, function(ApiClient, Animal) { 'use strict'; + + + /** * The Cat model module. * @module model/Cat @@ -29,7 +32,8 @@ * @param className */ var exports = function(className) { - Animal.call(this, className); + var _this = this; + Animal.call(_this, className); }; @@ -41,7 +45,7 @@ * @return {module:model/Cat} The populated Cat instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); Animal.constructFromObject(data, obj); if (data.hasOwnProperty('declawed')) { @@ -54,7 +58,6 @@ exports.prototype = Object.create(Animal.prototype); exports.prototype.constructor = exports; - /** * @member {Boolean} declawed */ @@ -65,3 +68,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/Category.js b/samples/client/petstore/javascript-promise/src/model/Category.js index 9956525e037c..9e2e19ac5bba 100644 --- a/samples/client/petstore/javascript-promise/src/model/Category.js +++ b/samples/client/petstore/javascript-promise/src/model/Category.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Category model module. * @module model/Category @@ -54,12 +57,10 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {String} name */ @@ -70,3 +71,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/Dog.js b/samples/client/petstore/javascript-promise/src/model/Dog.js index e5e55581a70d..ee17ae3467f2 100644 --- a/samples/client/petstore/javascript-promise/src/model/Dog.js +++ b/samples/client/petstore/javascript-promise/src/model/Dog.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', './Animal'], factory); + define(['ApiClient', 'model/Animal'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./Animal')); @@ -15,6 +15,9 @@ }(this, function(ApiClient, Animal) { 'use strict'; + + + /** * The Dog model module. * @module model/Dog @@ -29,7 +32,8 @@ * @param className */ var exports = function(className) { - Animal.call(this, className); + var _this = this; + Animal.call(_this, className); }; @@ -41,7 +45,7 @@ * @return {module:model/Dog} The populated Dog instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); Animal.constructFromObject(data, obj); if (data.hasOwnProperty('breed')) { @@ -54,7 +58,6 @@ exports.prototype = Object.create(Animal.prototype); exports.prototype.constructor = exports; - /** * @member {String} breed */ @@ -65,3 +68,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/EnumClass.js b/samples/client/petstore/javascript-promise/src/model/EnumClass.js new file mode 100644 index 000000000000..268addcbaed3 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/EnumClass.js @@ -0,0 +1,44 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.EnumClass = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + /** + * Enum class EnumClass. + * @enum {} + * @readonly + */ + var exports = { + /** + * value: _abc + * @const + */ + "_abc": "_abc", + /** + * value: -efg + * @const + */ + "-efg": "-efg", + /** + * value: (xyz) + * @const + */ + "(xyz)": "(xyz)" }; + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/src/model/EnumTest.js b/samples/client/petstore/javascript-promise/src/model/EnumTest.js new file mode 100644 index 000000000000..6f8f0de38365 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/EnumTest.js @@ -0,0 +1,131 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.EnumTest = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + + /** + * The EnumTest model module. + * @module model/EnumTest + * @version 1.0.0 + */ + + /** + * Constructs a new EnumTest. + * @alias module:model/EnumTest + * @class + */ + var exports = function() { + var _this = this; + + + + + }; + + /** + * Constructs a EnumTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/EnumTest} obj Optional instance to populate. + * @return {module:model/EnumTest} The populated EnumTest instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + if (data.hasOwnProperty('enum_string')) { + obj['enum_string'] = ApiClient.convertToType(data['enum_string'], 'String'); + } + if (data.hasOwnProperty('enum_integer')) { + obj['enum_integer'] = ApiClient.convertToType(data['enum_integer'], 'Integer'); + } + if (data.hasOwnProperty('enum_number')) { + obj['enum_number'] = ApiClient.convertToType(data['enum_number'], 'Number'); + } + } + return obj; + } + + /** + * @member {module:model/EnumTest.EnumStringEnum} enum_string + */ + exports.prototype['enum_string'] = undefined; + /** + * @member {module:model/EnumTest.EnumIntegerEnum} enum_integer + */ + exports.prototype['enum_integer'] = undefined; + /** + * @member {module:model/EnumTest.EnumNumberEnum} enum_number + */ + exports.prototype['enum_number'] = undefined; + + + /** + * Allowed values for the enum_string property. + * @enum {String} + * @readonly + */ + exports.EnumStringEnum = { + /** + * value: "UPPER" + * @const + */ + "UPPER": "UPPER", + /** + * value: "lower" + * @const + */ + "lower": "lower" }; + /** + * Allowed values for the enum_integer property. + * @enum {Integer} + * @readonly + */ + exports.EnumIntegerEnum = { + /** + * value: 1 + * @const + */ + "1": 1, + /** + * value: -1 + * @const + */ + "-1": -1 }; + /** + * Allowed values for the enum_number property. + * @enum {Number} + * @readonly + */ + exports.EnumNumberEnum = { + /** + * value: 1.1 + * @const + */ + "1.1": 1.1, + /** + * value: -1.2 + * @const + */ + "-1.2": -1.2 }; + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/src/model/FormatTest.js b/samples/client/petstore/javascript-promise/src/model/FormatTest.js index 46a9bc854fc6..ed9e0cfcaf89 100644 --- a/samples/client/petstore/javascript-promise/src/model/FormatTest.js +++ b/samples/client/petstore/javascript-promise/src/model/FormatTest.js @@ -1,7 +1,7 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient'], factory); + define(['ApiClient'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient')); @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The FormatTest model module. * @module model/FormatTest @@ -26,20 +29,26 @@ * @alias module:model/FormatTest * @class * @param _number + * @param _byte + * @param _date + * @param password */ - var exports = function(_number) { + var exports = function(_number, _byte, _date, password) { + var _this = this; - this['number'] = _number; - - + _this['number'] = _number; + _this['byte'] = _byte; + + _this['date'] = _date; + _this['password'] = password; }; /** @@ -50,7 +59,7 @@ * @return {module:model/FormatTest} The populated FormatTest instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('integer')) { @@ -84,70 +93,75 @@ obj['date'] = ApiClient.convertToType(data['date'], 'Date'); } if (data.hasOwnProperty('dateTime')) { - obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'String'); + obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); + } + if (data.hasOwnProperty('uuid')) { + obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); + } + if (data.hasOwnProperty('password')) { + obj['password'] = ApiClient.convertToType(data['password'], 'String'); } } return obj; } - /** * @member {Integer} integer */ exports.prototype['integer'] = undefined; - /** * @member {Integer} int32 */ exports.prototype['int32'] = undefined; - /** * @member {Integer} int64 */ exports.prototype['int64'] = undefined; - /** * @member {Number} number */ exports.prototype['number'] = undefined; - /** * @member {Number} float */ exports.prototype['float'] = undefined; - /** * @member {Number} double */ exports.prototype['double'] = undefined; - /** * @member {String} string */ exports.prototype['string'] = undefined; - /** * @member {String} byte */ exports.prototype['byte'] = undefined; - /** * @member {String} binary */ exports.prototype['binary'] = undefined; - /** * @member {Date} date */ exports.prototype['date'] = undefined; - /** - * @member {String} dateTime + * @member {Date} dateTime */ exports.prototype['dateTime'] = undefined; + /** + * @member {String} uuid + */ + exports.prototype['uuid'] = undefined; + /** + * @member {String} password + */ + exports.prototype['password'] = undefined; return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/InlineResponse200.js b/samples/client/petstore/javascript-promise/src/model/InlineResponse200.js deleted file mode 100644 index f2abaf1bd1b7..000000000000 --- a/samples/client/petstore/javascript-promise/src/model/InlineResponse200.js +++ /dev/null @@ -1,132 +0,0 @@ -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Tag'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./Tag')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; - } - root.SwaggerPetstore.InlineResponse200 = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Tag); - } -}(this, function(ApiClient, Tag) { - 'use strict'; - - /** - * The InlineResponse200 model module. - * @module model/InlineResponse200 - * @version 1.0.0 - */ - - /** - * Constructs a new InlineResponse200. - * @alias module:model/InlineResponse200 - * @class - * @param id - */ - var exports = function(id) { - - - this['id'] = id; - - - - - }; - - /** - * Constructs a InlineResponse200 from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/InlineResponse200} obj Optional instance to populate. - * @return {module:model/InlineResponse200} The populated InlineResponse200 instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('tags')) { - obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]); - } - if (data.hasOwnProperty('id')) { - obj['id'] = ApiClient.convertToType(data['id'], 'Integer'); - } - if (data.hasOwnProperty('category')) { - obj['category'] = ApiClient.convertToType(data['category'], Object); - } - if (data.hasOwnProperty('status')) { - obj['status'] = ApiClient.convertToType(data['status'], 'String'); - } - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'String'); - } - if (data.hasOwnProperty('photoUrls')) { - obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); - } - } - return obj; - } - - - /** - * @member {Array.} tags - */ - exports.prototype['tags'] = undefined; - - /** - * @member {Integer} id - */ - exports.prototype['id'] = undefined; - - /** - * @member {Object} category - */ - exports.prototype['category'] = undefined; - - /** - * pet status in the store - * @member {module:model/InlineResponse200.StatusEnum} status - */ - exports.prototype['status'] = undefined; - - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; - - /** - * @member {Array.} photoUrls - */ - exports.prototype['photoUrls'] = undefined; - - - /** - * Allowed values for the status property. - * @enum {String} - * @readonly - */ - exports.StatusEnum = { - /** - * value: available - * @const - */ - AVAILABLE: "available", - - /** - * value: pending - * @const - */ - PENDING: "pending", - - /** - * value: sold - * @const - */ - SOLD: "sold" - }; - - return exports; -})); diff --git a/samples/client/petstore/javascript-promise/src/model/Model200Response.js b/samples/client/petstore/javascript-promise/src/model/Model200Response.js index 8381185d9d08..1d83d420287f 100644 --- a/samples/client/petstore/javascript-promise/src/model/Model200Response.js +++ b/samples/client/petstore/javascript-promise/src/model/Model200Response.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Model200Response model module. * @module model/Model200Response @@ -28,6 +31,7 @@ * @class */ var exports = function() { + var _this = this; }; @@ -40,7 +44,7 @@ * @return {module:model/Model200Response} The populated Model200Response instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('name')) { @@ -50,7 +54,6 @@ return obj; } - /** * @member {Integer} name */ @@ -61,3 +64,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js index 9549db64d465..d0236e77b174 100644 --- a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The ModelReturn model module. * @module model/ModelReturn @@ -28,6 +31,7 @@ * @class */ var exports = function() { + var _this = this; }; @@ -40,7 +44,7 @@ * @return {module:model/ModelReturn} The populated ModelReturn instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('return')) { @@ -50,7 +54,6 @@ return obj; } - /** * @member {Integer} return */ @@ -61,3 +64,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/Name.js b/samples/client/petstore/javascript-promise/src/model/Name.js index 08a5a34c29a6..93d1d55deb27 100644 --- a/samples/client/petstore/javascript-promise/src/model/Name.js +++ b/samples/client/petstore/javascript-promise/src/model/Name.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Name model module. * @module model/Name @@ -29,8 +32,10 @@ * @param name */ var exports = function(name) { + var _this = this; + + _this['name'] = name; - this['name'] = name; }; @@ -42,7 +47,7 @@ * @return {module:model/Name} The populated Name instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('name')) { @@ -51,23 +56,30 @@ if (data.hasOwnProperty('snake_case')) { obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Integer'); } + if (data.hasOwnProperty('property')) { + obj['property'] = ApiClient.convertToType(data['property'], 'String'); + } } return obj; } - /** * @member {Integer} name */ exports.prototype['name'] = undefined; - /** * @member {Integer} snake_case */ exports.prototype['snake_case'] = undefined; + /** + * @member {String} property + */ + exports.prototype['property'] = undefined; return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/Order.js b/samples/client/petstore/javascript-promise/src/model/Order.js index 664908b77a9a..57f77d84ccd0 100644 --- a/samples/client/petstore/javascript-promise/src/model/Order.js +++ b/samples/client/petstore/javascript-promise/src/model/Order.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Order model module. * @module model/Order @@ -70,37 +73,32 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {Integer} petId */ exports.prototype['petId'] = undefined; - /** * @member {Integer} quantity */ exports.prototype['quantity'] = undefined; - /** * @member {Date} shipDate */ exports.prototype['shipDate'] = undefined; - /** * Order Status * @member {module:model/Order.StatusEnum} status */ exports.prototype['status'] = undefined; - /** * @member {Boolean} complete + * @default false */ - exports.prototype['complete'] = undefined; + exports.prototype['complete'] = false; /** @@ -108,25 +106,25 @@ * @enum {String} * @readonly */ - exports.StatusEnum = { + exports.StatusEnum = { /** - * value: placed + * value: "placed" * @const */ - PLACED: "placed", - + "placed": "placed", /** - * value: approved + * value: "approved" * @const */ - APPROVED: "approved", - + "approved": "approved", /** - * value: delivered + * value: "delivered" * @const */ - DELIVERED: "delivered" - }; + "delivered": "delivered" }; + return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/Pet.js b/samples/client/petstore/javascript-promise/src/model/Pet.js index ae907d35ca2f..fe14361dbf2e 100644 --- a/samples/client/petstore/javascript-promise/src/model/Pet.js +++ b/samples/client/petstore/javascript-promise/src/model/Pet.js @@ -15,6 +15,9 @@ }(this, function(ApiClient, Category, Tag) { 'use strict'; + + + /** * The Pet model module. * @module model/Pet @@ -72,32 +75,26 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {module:model/Category} category */ exports.prototype['category'] = undefined; - /** * @member {String} name */ exports.prototype['name'] = undefined; - /** * @member {Array.} photoUrls */ exports.prototype['photoUrls'] = undefined; - /** * @member {Array.} tags */ exports.prototype['tags'] = undefined; - /** * pet status in the store * @member {module:model/Pet.StatusEnum} status @@ -110,25 +107,25 @@ * @enum {String} * @readonly */ - exports.StatusEnum = { + exports.StatusEnum = { /** - * value: available + * value: "available" * @const */ - AVAILABLE: "available", - + "available": "available", /** - * value: pending + * value: "pending" * @const */ - PENDING: "pending", - + "pending": "pending", /** - * value: sold + * value: "sold" * @const */ - SOLD: "sold" - }; + "sold": "sold" }; + return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js b/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js index 8694196cdd96..d5a0e992a73e 100644 --- a/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The SpecialModelName model module. * @module model/SpecialModelName @@ -27,6 +30,7 @@ * @class */ var exports = function() { + var _this = this; }; @@ -39,7 +43,7 @@ * @return {module:model/SpecialModelName} The populated SpecialModelName instance. */ exports.constructFromObject = function(data, obj) { - if (data) { + if (data) { obj = obj || new exports(); if (data.hasOwnProperty('$special[property.name]')) { @@ -49,7 +53,6 @@ return obj; } - /** * @member {Integer} $special[property.name] */ @@ -60,3 +63,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/Tag.js b/samples/client/petstore/javascript-promise/src/model/Tag.js index d9ab35fb8b53..443d312b76ab 100644 --- a/samples/client/petstore/javascript-promise/src/model/Tag.js +++ b/samples/client/petstore/javascript-promise/src/model/Tag.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The Tag model module. * @module model/Tag @@ -54,12 +57,10 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {String} name */ @@ -70,3 +71,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/src/model/User.js b/samples/client/petstore/javascript-promise/src/model/User.js index 3bc6aaab630e..2360c7c6314b 100644 --- a/samples/client/petstore/javascript-promise/src/model/User.js +++ b/samples/client/petstore/javascript-promise/src/model/User.js @@ -15,6 +15,9 @@ }(this, function(ApiClient) { 'use strict'; + + + /** * The User model module. * @module model/User @@ -78,42 +81,34 @@ return obj; } - /** * @member {Integer} id */ exports.prototype['id'] = undefined; - /** * @member {String} username */ exports.prototype['username'] = undefined; - /** * @member {String} firstName */ exports.prototype['firstName'] = undefined; - /** * @member {String} lastName */ exports.prototype['lastName'] = undefined; - /** * @member {String} email */ exports.prototype['email'] = undefined; - /** * @member {String} password */ exports.prototype['password'] = undefined; - /** * @member {String} phone */ exports.prototype['phone'] = undefined; - /** * User Status * @member {Integer} userStatus @@ -125,3 +120,5 @@ return exports; })); + + diff --git a/samples/client/petstore/javascript-promise/test/api/PetApiTest.js b/samples/client/petstore/javascript-promise/test/api/PetApiTest.js index 1119546014d3..98debb8ea195 100644 --- a/samples/client/petstore/javascript-promise/test/api/PetApiTest.js +++ b/samples/client/petstore/javascript-promise/test/api/PetApiTest.js @@ -49,7 +49,7 @@ var createRandomPet = function() { describe('PetApi', function() { it('should create and get pet', function(done) { var pet = createRandomPet(); - api.addPet({body: pet}) + api.addPet(pet) .then(function() { return api.getPetById(pet.id) }) @@ -63,7 +63,7 @@ describe('PetApi', function() { .to.be(getProperty(getProperty(pet, "getCategory", "category"), "getName", "name")); api.deletePet(pet.id); - done(); + done(); }); }); }); From fa68f84ec64f48c29008f6508a43587a5c2c34fe Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Fri, 6 May 2016 12:13:34 +0200 Subject: [PATCH 123/170] - Remove petsotre demo leftovers - Moved description method to basic class --- .../main/resources/objc/Object-body.mustache | 9 ++++ .../main/resources/objc/model-body.mustache | 25 ++------- samples/client/petstore/objc/README.md | 2 +- .../objc/SwaggerClient/SWG200Response.h | 20 -------- .../objc/SwaggerClient/SWG200Response.m | 51 ------------------- .../petstore/objc/SwaggerClient/SWGCategory.m | 24 ++------- .../objc/SwaggerClient/SWGInlineResponse200.h | 32 ------------ .../objc/SwaggerClient/SWGInlineResponse200.m | 51 ------------------- .../petstore/objc/SwaggerClient/SWGName.h | 22 -------- .../petstore/objc/SwaggerClient/SWGName.m | 51 ------------------- .../petstore/objc/SwaggerClient/SWGObject.m | 9 ++++ .../petstore/objc/SwaggerClient/SWGOrder.m | 24 ++------- .../petstore/objc/SwaggerClient/SWGPet.m | 24 ++------- .../petstore/objc/SwaggerClient/SWGReturn.h | 20 -------- .../petstore/objc/SwaggerClient/SWGReturn.m | 51 ------------------- .../objc/SwaggerClient/SWGSpecialModelName_.h | 20 -------- .../objc/SwaggerClient/SWGSpecialModelName_.m | 51 ------------------- .../petstore/objc/SwaggerClient/SWGTag.m | 24 ++------- .../petstore/objc/SwaggerClient/SWGUser.m | 24 ++------- 19 files changed, 43 insertions(+), 491 deletions(-) delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWG200Response.h delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWG200Response.m delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWGInlineResponse200.h delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWGInlineResponse200.m delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWGName.h delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWGName.m delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWGReturn.h delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWGReturn.m delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWGSpecialModelName_.h delete mode 100644 samples/client/petstore/objc/SwaggerClient/SWGSpecialModelName_.m diff --git a/modules/swagger-codegen/src/main/resources/objc/Object-body.mustache b/modules/swagger-codegen/src/main/resources/objc/Object-body.mustache index 122484f1ad44..b4599c34f3f1 100644 --- a/modules/swagger-codegen/src/main/resources/objc/Object-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/Object-body.mustache @@ -1,4 +1,13 @@ #import "{{classPrefix}}Object.h" @implementation {{classPrefix}}Object + +/** + * Gets the string presentation of the object. + * This method will be called when logging model object using `NSLog`. + */ +- (NSString *)description { + return [[self toDictionary] description]; +} + @end diff --git a/modules/swagger-codegen/src/main/resources/objc/model-body.mustache b/modules/swagger-codegen/src/main/resources/objc/model-body.mustache index ec5ab3b9f80c..776cd55ccef2 100644 --- a/modules/swagger-codegen/src/main/resources/objc/model-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/model-body.mustache @@ -6,13 +6,11 @@ - (instancetype)init { self = [super init]; - if (self) { // initalise property's default value, if any {{#vars}}{{#defaultValue}}self.{{name}} = {{{defaultValue}}}; {{/defaultValue}}{{/vars}} } - return self; } @@ -22,7 +20,6 @@ */ - (id)initWithDictionary:(NSDictionary *)dict error:(NSError *__autoreleasing *)err { - NSString * discriminatedClassName = [dict valueForKey:@"{{discriminator}}"]; if(discriminatedClassName == nil ){ @@ -45,8 +42,7 @@ * Maps json key to property name. * This method is used by `JSONModel`. */ -+ (JSONKeyMapper *)keyMapper -{ ++ (JSONKeyMapper *)keyMapper { return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }]; } @@ -55,24 +51,11 @@ * If `propertyName` is optional, then return `YES`, otherwise return `NO`. * This method is used by `JSONModel`. */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + NSArray *optionalProperties = @[{{#vars}}{{^required}}@"{{name}}"{{#hasMore}}, {{/hasMore}}{{/required}}{{/vars}}]; + return [optionalProperties containsObject:propertyName]; - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; } {{/model}} diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index 4b0b92a259e9..a3550545c246 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-05-06T11:35:18.146+02:00 +- Build date: 2016-05-06T12:20:47.112+02:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements diff --git a/samples/client/petstore/objc/SwaggerClient/SWG200Response.h b/samples/client/petstore/objc/SwaggerClient/SWG200Response.h deleted file mode 100644 index c576bc204ad8..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWG200Response.h +++ /dev/null @@ -1,20 +0,0 @@ -#import -#import "SWGObject.h" - -/** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ - - - -@protocol SWG200Response -@end - -@interface SWG200Response : SWGObject - - -@property(nonatomic) NSNumber* name; - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWG200Response.m b/samples/client/petstore/objc/SwaggerClient/SWG200Response.m deleted file mode 100644 index 9cafc782f1a6..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWG200Response.m +++ /dev/null @@ -1,51 +0,0 @@ -#import "SWG200Response.h" - -@implementation SWG200Response - -- (instancetype)init { - self = [super init]; - - if (self) { - // initalise property's default value, if any - - } - - return self; -} - - -/** - * Maps json key to property name. - * This method is used by `JSONModel`. - */ -+ (JSONKeyMapper *)keyMapper -{ - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"name": @"name" }]; -} - -/** - * Indicates whether the property with the given name is optional. - * If `propertyName` is optional, then return `YES`, otherwise return `NO`. - * This method is used by `JSONModel`. - */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ - NSArray *optionalProperties = @[@"name"]; - - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; -} - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGCategory.m b/samples/client/petstore/objc/SwaggerClient/SWGCategory.m index c323eda5a0af..29e3bc16226d 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGCategory.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGCategory.m @@ -4,12 +4,10 @@ - (instancetype)init { self = [super init]; - if (self) { // initalise property's default value, if any } - return self; } @@ -18,8 +16,7 @@ * Maps json key to property name. * This method is used by `JSONModel`. */ -+ (JSONKeyMapper *)keyMapper -{ ++ (JSONKeyMapper *)keyMapper { return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; } @@ -28,24 +25,11 @@ * If `propertyName` is optional, then return `YES`, otherwise return `NO`. * This method is used by `JSONModel`. */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + NSArray *optionalProperties = @[@"_id", @"name"]; + return [optionalProperties containsObject:propertyName]; - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; } @end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGInlineResponse200.h b/samples/client/petstore/objc/SwaggerClient/SWGInlineResponse200.h deleted file mode 100644 index 577434faae62..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWGInlineResponse200.h +++ /dev/null @@ -1,32 +0,0 @@ -#import -#import "SWGObject.h" - -/** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ - -#import "SWGTag.h" - - -@protocol SWGInlineResponse200 -@end - -@interface SWGInlineResponse200 : SWGObject - - -@property(nonatomic) NSArray* /* NSString */ photoUrls; - -@property(nonatomic) NSString* name; - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSObject* category; - -@property(nonatomic) NSArray* tags; -/* pet status in the store [optional] - */ -@property(nonatomic) NSString* status; - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGInlineResponse200.m b/samples/client/petstore/objc/SwaggerClient/SWGInlineResponse200.m deleted file mode 100644 index 5fbe9ec6ec25..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWGInlineResponse200.m +++ /dev/null @@ -1,51 +0,0 @@ -#import "SWGInlineResponse200.h" - -@implementation SWGInlineResponse200 - -- (instancetype)init { - self = [super init]; - - if (self) { - // initalise property's default value, if any - - } - - return self; -} - - -/** - * Maps json key to property name. - * This method is used by `JSONModel`. - */ -+ (JSONKeyMapper *)keyMapper -{ - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"photoUrls": @"photoUrls", @"name": @"name", @"id": @"_id", @"category": @"category", @"tags": @"tags", @"status": @"status" }]; -} - -/** - * Indicates whether the property with the given name is optional. - * If `propertyName` is optional, then return `YES`, otherwise return `NO`. - * This method is used by `JSONModel`. - */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ - NSArray *optionalProperties = @[@"photoUrls", @"name", @"category", @"tags", @"status"]; - - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; -} - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGName.h b/samples/client/petstore/objc/SwaggerClient/SWGName.h deleted file mode 100644 index fd34af7b66ab..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWGName.h +++ /dev/null @@ -1,22 +0,0 @@ -#import -#import "SWGObject.h" - -/** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ - - - -@protocol SWGName -@end - -@interface SWGName : SWGObject - - -@property(nonatomic) NSNumber* name; - -@property(nonatomic) NSNumber* snakeCase; - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGName.m b/samples/client/petstore/objc/SwaggerClient/SWGName.m deleted file mode 100644 index 16aec784549f..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWGName.m +++ /dev/null @@ -1,51 +0,0 @@ -#import "SWGName.h" - -@implementation SWGName - -- (instancetype)init { - self = [super init]; - - if (self) { - // initalise property's default value, if any - - } - - return self; -} - - -/** - * Maps json key to property name. - * This method is used by `JSONModel`. - */ -+ (JSONKeyMapper *)keyMapper -{ - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"name": @"name", @"snake_case": @"snakeCase" }]; -} - -/** - * Indicates whether the property with the given name is optional. - * If `propertyName` is optional, then return `YES`, otherwise return `NO`. - * This method is used by `JSONModel`. - */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ - NSArray *optionalProperties = @[@"snakeCase"]; - - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; -} - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGObject.m b/samples/client/petstore/objc/SwaggerClient/SWGObject.m index 1f897ab1d56f..8085c404f7e2 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGObject.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGObject.m @@ -1,4 +1,13 @@ #import "SWGObject.h" @implementation SWGObject + +/** + * Gets the string presentation of the object. + * This method will be called when logging model object using `NSLog`. + */ +- (NSString *)description { + return [[self toDictionary] description]; +} + @end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGOrder.m b/samples/client/petstore/objc/SwaggerClient/SWGOrder.m index e41bc7a188dd..d10ed802b8d7 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGOrder.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGOrder.m @@ -4,12 +4,10 @@ - (instancetype)init { self = [super init]; - if (self) { // initalise property's default value, if any } - return self; } @@ -18,8 +16,7 @@ * Maps json key to property name. * This method is used by `JSONModel`. */ -+ (JSONKeyMapper *)keyMapper -{ ++ (JSONKeyMapper *)keyMapper { return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }]; } @@ -28,24 +25,11 @@ * If `propertyName` is optional, then return `YES`, otherwise return `NO`. * This method is used by `JSONModel`. */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"complete"]; + return [optionalProperties containsObject:propertyName]; - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; } @end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGPet.m b/samples/client/petstore/objc/SwaggerClient/SWGPet.m index 86389c2590b5..98e75189ed3a 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGPet.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGPet.m @@ -4,12 +4,10 @@ - (instancetype)init { self = [super init]; - if (self) { // initalise property's default value, if any } - return self; } @@ -18,8 +16,7 @@ * Maps json key to property name. * This method is used by `JSONModel`. */ -+ (JSONKeyMapper *)keyMapper -{ ++ (JSONKeyMapper *)keyMapper { return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }]; } @@ -28,24 +25,11 @@ * If `propertyName` is optional, then return `YES`, otherwise return `NO`. * This method is used by `JSONModel`. */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + NSArray *optionalProperties = @[@"_id", @"category", @"tags", @"status"]; + return [optionalProperties containsObject:propertyName]; - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; } @end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGReturn.h b/samples/client/petstore/objc/SwaggerClient/SWGReturn.h deleted file mode 100644 index fcce78f36819..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWGReturn.h +++ /dev/null @@ -1,20 +0,0 @@ -#import -#import "SWGObject.h" - -/** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ - - - -@protocol SWGReturn -@end - -@interface SWGReturn : SWGObject - - -@property(nonatomic) NSNumber* _return; - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGReturn.m b/samples/client/petstore/objc/SwaggerClient/SWGReturn.m deleted file mode 100644 index ad97f1b15e9e..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWGReturn.m +++ /dev/null @@ -1,51 +0,0 @@ -#import "SWGReturn.h" - -@implementation SWGReturn - -- (instancetype)init { - self = [super init]; - - if (self) { - // initalise property's default value, if any - - } - - return self; -} - - -/** - * Maps json key to property name. - * This method is used by `JSONModel`. - */ -+ (JSONKeyMapper *)keyMapper -{ - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"return": @"_return" }]; -} - -/** - * Indicates whether the property with the given name is optional. - * If `propertyName` is optional, then return `YES`, otherwise return `NO`. - * This method is used by `JSONModel`. - */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ - NSArray *optionalProperties = @[@"_return"]; - - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; -} - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGSpecialModelName_.h b/samples/client/petstore/objc/SwaggerClient/SWGSpecialModelName_.h deleted file mode 100644 index 88187b28877b..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWGSpecialModelName_.h +++ /dev/null @@ -1,20 +0,0 @@ -#import -#import "SWGObject.h" - -/** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ - - - -@protocol SWGSpecialModelName_ -@end - -@interface SWGSpecialModelName_ : SWGObject - - -@property(nonatomic) NSNumber* specialPropertyName; - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGSpecialModelName_.m b/samples/client/petstore/objc/SwaggerClient/SWGSpecialModelName_.m deleted file mode 100644 index 9e1e680787dc..000000000000 --- a/samples/client/petstore/objc/SwaggerClient/SWGSpecialModelName_.m +++ /dev/null @@ -1,51 +0,0 @@ -#import "SWGSpecialModelName_.h" - -@implementation SWGSpecialModelName_ - -- (instancetype)init { - self = [super init]; - - if (self) { - // initalise property's default value, if any - - } - - return self; -} - - -/** - * Maps json key to property name. - * This method is used by `JSONModel`. - */ -+ (JSONKeyMapper *)keyMapper -{ - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"$special[property.name]": @"specialPropertyName" }]; -} - -/** - * Indicates whether the property with the given name is optional. - * If `propertyName` is optional, then return `YES`, otherwise return `NO`. - * This method is used by `JSONModel`. - */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ - NSArray *optionalProperties = @[@"specialPropertyName"]; - - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; -} - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGTag.m b/samples/client/petstore/objc/SwaggerClient/SWGTag.m index 9eb00a157e3d..8ad1742750d4 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGTag.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGTag.m @@ -4,12 +4,10 @@ - (instancetype)init { self = [super init]; - if (self) { // initalise property's default value, if any } - return self; } @@ -18,8 +16,7 @@ * Maps json key to property name. * This method is used by `JSONModel`. */ -+ (JSONKeyMapper *)keyMapper -{ ++ (JSONKeyMapper *)keyMapper { return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; } @@ -28,24 +25,11 @@ * If `propertyName` is optional, then return `YES`, otherwise return `NO`. * This method is used by `JSONModel`. */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + NSArray *optionalProperties = @[@"_id", @"name"]; + return [optionalProperties containsObject:propertyName]; - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; } @end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGUser.m b/samples/client/petstore/objc/SwaggerClient/SWGUser.m index 2445dd378545..2551108cb5f9 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGUser.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGUser.m @@ -4,12 +4,10 @@ - (instancetype)init { self = [super init]; - if (self) { // initalise property's default value, if any } - return self; } @@ -18,8 +16,7 @@ * Maps json key to property name. * This method is used by `JSONModel`. */ -+ (JSONKeyMapper *)keyMapper -{ ++ (JSONKeyMapper *)keyMapper { return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }]; } @@ -28,24 +25,11 @@ * If `propertyName` is optional, then return `YES`, otherwise return `NO`. * This method is used by `JSONModel`. */ -+ (BOOL)propertyIsOptional:(NSString *)propertyName -{ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + NSArray *optionalProperties = @[@"_id", @"username", @"firstName", @"lastName", @"email", @"password", @"phone", @"userStatus"]; + return [optionalProperties containsObject:propertyName]; - if ([optionalProperties containsObject:propertyName]) { - return YES; - } - else { - return NO; - } -} - -/** - * Gets the string presentation of the object. - * This method will be called when logging model object using `NSLog`. - */ -- (NSString *)description { - return [[self toDictionary] description]; } @end From 020a9fcdc053b0bd67372726f9b08bf582df0708 Mon Sep 17 00:00:00 2001 From: xhh Date: Fri, 6 May 2016 18:41:15 +0800 Subject: [PATCH 124/170] Fix enum model docs for JS and Java clients --- .../languages/JavascriptClientCodegen.java | 37 +---- .../resources/Java/enum_outer_doc.mustache | 6 +- .../okhttp-gson/enum_outer_doc.mustache | 2 +- .../resources/Javascript/model_doc.mustache | 20 ++- .../partial_model_enum_class.mustache | 8 +- .../petstore/java/default/docs/AnimalFarm.md | 9 ++ .../petstore/java/default/docs/EnumClass.md | 8 +- .../petstore/java/default/docs/FakeApi.md | 4 +- .../petstore/java/default/docs/FormatTest.md | 1 + .../java/io/swagger/client/api/FakeApi.java | 3 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/model/AnimalFarm.java | 53 ++++++++ .../client/petstore/java/feign/git_push.sh | 4 +- .../java/io/swagger/client/api/FakeApi.java | 5 +- .../io/swagger/client/model/AnimalFarm.java | 53 ++++++++ .../io/swagger/client/model/FormatTest.java | 24 +++- .../petstore/java/jersey2/docs/AnimalFarm.md | 9 ++ .../petstore/java/jersey2/docs/EnumClass.md | 14 ++ .../petstore/java/jersey2/docs/EnumTest.md | 36 +++++ .../petstore/java/jersey2/docs/FakeApi.md | 75 ++++++++++ .../petstore/java/jersey2/docs/FormatTest.md | 7 +- .../petstore/java/jersey2/docs/Order.md | 6 +- .../client/petstore/java/jersey2/docs/Pet.md | 6 +- .../client/petstore/java/jersey2/git_push.sh | 4 +- .../java/io/swagger/client/api/FakeApi.java | 128 ++++++++++++++++++ .../java/io/swagger/client/model/Animal.java | 3 +- .../io/swagger/client/model/AnimalFarm.java | 53 ++++++++ .../java/io/swagger/client/model/Cat.java | 5 +- .../io/swagger/client/model/Category.java | 5 +- .../java/io/swagger/client/model/Dog.java | 5 +- .../io/swagger/client/model/EnumTest.java | 7 +- .../io/swagger/client/model/FormatTest.java | 46 +++++-- .../client/model/Model200Response.java | 6 +- .../client/model/ModelApiResponse.java | 8 +- .../io/swagger/client/model/ModelReturn.java | 6 +- .../java/io/swagger/client/model/Name.java | 42 +++--- .../java/io/swagger/client/model/Order.java | 27 ++-- .../java/io/swagger/client/model/Pet.java | 13 +- .../client/model/SpecialModelName.java | 3 +- .../java/io/swagger/client/model/Tag.java | 5 +- .../java/io/swagger/client/model/User.java | 17 ++- .../java/okhttp-gson/docs/AnimalFarm.md | 9 ++ .../java/okhttp-gson/docs/EnumClass.md | 6 +- .../petstore/java/okhttp-gson/docs/FakeApi.md | 4 +- .../java/okhttp-gson/docs/FormatTest.md | 1 + .../petstore/java/okhttp-gson/git_push.sh | 4 +- .../java/io/swagger/client/api/FakeApi.java | 9 +- .../io/swagger/client/model/AnimalFarm.java | 53 ++++++++ .../io/swagger/client/model/FormatTest.java | 17 ++- .../client/petstore/java/retrofit/git_push.sh | 4 +- .../java/io/swagger/client/api/FakeApi.java | 5 +- .../io/swagger/client/model/AnimalFarm.java | 53 ++++++++ .../io/swagger/client/model/FormatTest.java | 17 ++- .../petstore/java/retrofit2/git_push.sh | 4 +- .../java/io/swagger/client/api/FakeApi.java | 3 +- .../io/swagger/client/model/AnimalFarm.java | 53 ++++++++ .../io/swagger/client/model/FormatTest.java | 17 ++- .../petstore/java/retrofit2rx/git_push.sh | 4 +- .../io/swagger/client/model/AnimalFarm.java | 53 ++++++++ .../io/swagger/client/model/FormatTest.java | 7 +- .../javascript-promise/docs/EnumClass.md | 11 +- .../javascript-promise/docs/EnumTest.md | 33 +++++ .../petstore/javascript-promise/docs/Order.md | 13 ++ .../petstore/javascript-promise/docs/Pet.md | 13 ++ .../javascript-promise/src/model/EnumClass.js | 6 +- samples/client/petstore/javascript/README.md | 15 +- .../petstore/javascript/docs/AnimalFarm.md | 7 + .../petstore/javascript/docs/EnumClass.md | 11 +- .../petstore/javascript/docs/EnumTest.md | 33 +++++ .../client/petstore/javascript/docs/Order.md | 13 ++ .../client/petstore/javascript/docs/Pet.md | 13 ++ .../petstore/javascript/src/ApiClient.js | 4 +- .../client/petstore/javascript/src/index.js | 11 +- .../javascript/src/model/AnimalFarm.js | 64 +++++++++ .../javascript/src/model/EnumClass.js | 6 +- 75 files changed, 1153 insertions(+), 198 deletions(-) create mode 100644 samples/client/petstore/java/default/docs/AnimalFarm.md create mode 100644 samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AnimalFarm.java create mode 100644 samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java create mode 100644 samples/client/petstore/java/jersey2/docs/AnimalFarm.md create mode 100644 samples/client/petstore/java/jersey2/docs/EnumClass.md create mode 100644 samples/client/petstore/java/jersey2/docs/EnumTest.md create mode 100644 samples/client/petstore/java/jersey2/docs/FakeApi.md create mode 100644 samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java create mode 100644 samples/client/petstore/java/okhttp-gson/docs/AnimalFarm.md create mode 100644 samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java create mode 100644 samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/AnimalFarm.java create mode 100644 samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/AnimalFarm.java create mode 100644 samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/AnimalFarm.java create mode 100644 samples/client/petstore/javascript/docs/AnimalFarm.md create mode 100644 samples/client/petstore/javascript/src/model/AnimalFarm.js diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java index feec76d8de2b..d654363727c7 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 @@ -839,6 +839,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo @SuppressWarnings("unchecked") @Override public Map postProcessModels(Map objs) { + objs = super.postProcessModelsEnum(objs); List models = (List) objs.get("models"); for (Object _mo : models) { Map mo = (Map) _mo; @@ -853,8 +854,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo cm.vendorExtensions.put("x-all-required", allRequired); for (CodegenProperty var : cm.vars) { - Map allowableValues = var.allowableValues; - // Add JSDoc @type value for this property. String jsDocType = getJSDocTypeWithBraces(cm, var); var.vendorExtensions.put("x-jsdoc-type", jsDocType); @@ -862,40 +861,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo if (Boolean.TRUE.equals(var.required)) { required.add(var.name); } - - // 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 (Object value : values) { - Map enumVar = new HashMap(); - String enumName; - if (truncateIdx == 0) { - enumName = value.toString(); - } else { - enumName = value.toString().substring(truncateIdx); - if ("".equals(enumName)) { - enumName = value.toString(); - } - } - enumVar.put("name", toEnumVarName(enumName, var.datatype)); - enumVar.put("value",toEnumValue(value.toString(), var.datatype)); - enumVars.add(enumVar); - } - allowableValues.put("enumVars", enumVars); } if (supportsInheritance) { diff --git a/modules/swagger-codegen/src/main/resources/Java/enum_outer_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/enum_outer_doc.mustache index 14b5d524c4a3..20c512aaeae4 100644 --- a/modules/swagger-codegen/src/main/resources/Java/enum_outer_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/enum_outer_doc.mustache @@ -2,6 +2,6 @@ ## Enum -{{#allowableValues}} -* `{{.}}` -{{/allowableValues}} +{{#allowableValues}}{{#enumVars}} +* `{{name}}` (value: `{{{value}}}`) +{{/enumVars}}{{/allowableValues}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache index b5370c1360b7..20c512aaeae4 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache @@ -3,5 +3,5 @@ ## Enum {{#allowableValues}}{{#enumVars}} -* `{{name}}` (value: `{{value}}`) +* `{{name}}` (value: `{{{value}}}`) {{/enumVars}}{{/allowableValues}} diff --git a/modules/swagger-codegen/src/main/resources/Javascript/model_doc.mustache b/modules/swagger-codegen/src/main/resources/Javascript/model_doc.mustache index 306d8a2b3f7d..4f2324fa2a75 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/model_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/model_doc.mustache @@ -1,9 +1,25 @@ -{{#models}}{{#model}}# {{moduleName}}.{{classname}} +{{#models}}{{#model}}{{#isEnum}}# {{moduleName}}.{{classname}} + +## Enum + +{{#allowableValues}}{{#enumVars}} +* `{{name}}` (value: `{{{value}}}`) +{{/enumVars}}{{/allowableValues}} +{{/isEnum}}{{^isEnum}}# {{moduleName}}.{{classname}} ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} {{/vars}} +{{#vars}}{{#isEnum}} -{{/model}}{{/models}} + +## Enum: {{datatypeWithEnum}} + +{{#allowableValues}}{{#enumVars}} +* `{{name}}` (value: `{{{value}}}`) +{{/enumVars}}{{/allowableValues}} + +{{/isEnum}}{{/vars}} +{{/isEnum}}{{/model}}{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache index c85e82aa764b..9ad7e3d3a90d 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache @@ -7,16 +7,16 @@ {{/emitJSDoc}} var exports = { {{#allowableValues}} - {{#values}} + {{#enumVars}} {{#emitJSDoc}} /** - * value: {{{.}}} + * value: {{{value}}} * @const */ {{/emitJSDoc}} - "{{{.}}}": "{{{.}}}"{{^-last}}, + "{{name}}": {{{value}}}{{^-last}}, {{/-last}} - {{/values}} + {{/enumVars}} {{/allowableValues}} }; diff --git a/samples/client/petstore/java/default/docs/AnimalFarm.md b/samples/client/petstore/java/default/docs/AnimalFarm.md new file mode 100644 index 000000000000..c7c7f1ddcce6 --- /dev/null +++ b/samples/client/petstore/java/default/docs/AnimalFarm.md @@ -0,0 +1,9 @@ + +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + + diff --git a/samples/client/petstore/java/default/docs/EnumClass.md b/samples/client/petstore/java/default/docs/EnumClass.md index de0bc8a95ac8..c746edc3cb1e 100644 --- a/samples/client/petstore/java/default/docs/EnumClass.md +++ b/samples/client/petstore/java/default/docs/EnumClass.md @@ -3,6 +3,12 @@ ## Enum -* `{values=[_abc, -efg, (xyz)], enumVars=[{name=_ABC, value="_abc"}, {name=_EFG, value="-efg"}, {name=_XYZ_, value="(xyz)"}]}` + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + diff --git a/samples/client/petstore/java/default/docs/FakeApi.md b/samples/client/petstore/java/default/docs/FakeApi.md index f642566c8e77..c1fdd3103218 100644 --- a/samples/client/petstore/java/default/docs/FakeApi.md +++ b/samples/client/petstore/java/default/docs/FakeApi.md @@ -23,7 +23,7 @@ Fake endpoint for testing various parameters FakeApi apiInstance = new FakeApi(); -String number = "number_example"; // String | None +BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None String string = "string_example"; // String | None byte[] _byte = B; // byte[] | None @@ -47,7 +47,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **String**| None | + **number** | **BigDecimal**| None | **_double** | **Double**| None | **string** | **String**| None | **_byte** | **byte[]**| None | diff --git a/samples/client/petstore/java/default/docs/FormatTest.md b/samples/client/petstore/java/default/docs/FormatTest.md index 5e54362e5353..dc2b559dad28 100644 --- a/samples/client/petstore/java/default/docs/FormatTest.md +++ b/samples/client/petstore/java/default/docs/FormatTest.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **binary** | **byte[]** | | [optional] **date** | [**Date**](Date.md) | | **dateTime** | [**Date**](Date.md) | | [optional] +**uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java index ddfaff67d0f5..efa202418d6e 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,6 +7,7 @@ import io.swagger.client.ApiClient; import io.swagger.client.Configuration; import io.swagger.client.Pair; +import java.math.BigDecimal; import java.util.Date; import java.util.ArrayList; @@ -51,7 +52,7 @@ public class FakeApi { * @param password None (optional) * @throws ApiException if fails to make API call */ - public void testEndpointParameters(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set 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 c4ff05ec24f8..584c85aaae47 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,8 +8,8 @@ import io.swagger.client.Configuration; import io.swagger.client.Pair; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.ModelApiResponse; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AnimalFarm.java new file mode 100644 index 000000000000..9dbd29436ad2 --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -0,0 +1,53 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.client.model.Animal; +import java.util.ArrayList; +import java.util.List; + + +/** + * AnimalFarm + */ + +public class AnimalFarm extends ArrayList { + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/feign/git_push.sh b/samples/client/petstore/java/feign/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/java/feign/git_push.sh +++ b/samples/client/petstore/java/feign/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index b92a064d3e5b..b1dc92805abd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -2,6 +2,7 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; +import java.math.BigDecimal; import java.util.Date; import java.util.ArrayList; @@ -10,7 +11,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:05.435+08:00") public interface FakeApi extends ApiClient.Api { @@ -36,5 +37,5 @@ public interface FakeApi extends ApiClient.Api { "Content-type: application/x-www-form-urlencoded", "Accepts: application/json", }) - void testEndpointParameters(@Param("number") String number, @Param("_double") Double _double, @Param("string") String string, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("binary") byte[] binary, @Param("date") Date date, @Param("dateTime") Date dateTime, @Param("password") String password); + void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("string") String string, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("binary") byte[] binary, @Param("date") Date date, @Param("dateTime") Date dateTime, @Param("password") String password); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java new file mode 100644 index 000000000000..f38bf504d500 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -0,0 +1,53 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.client.model.Animal; +import java.util.ArrayList; +import java.util.List; + + +/** + * AnimalFarm + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:05.435+08:00") +public class AnimalFarm extends ArrayList { + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java index 53aa13638a77..072decf80798 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java @@ -11,7 +11,7 @@ import java.util.Date; /** * FormatTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:05.435+08:00") public class FormatTest { private Integer integer = null; @@ -25,6 +25,7 @@ public class FormatTest { private byte[] binary = null; private Date date = null; private Date dateTime = null; + private String uuid = null; private String password = null; @@ -225,6 +226,23 @@ public class FormatTest { } + /** + **/ + public FormatTest uuid(String uuid) { + this.uuid = uuid; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** **/ public FormatTest password(String password) { @@ -262,12 +280,13 @@ public class FormatTest { Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, password); + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } @Override @@ -286,6 +305,7 @@ public class FormatTest { sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/jersey2/docs/AnimalFarm.md b/samples/client/petstore/java/jersey2/docs/AnimalFarm.md new file mode 100644 index 000000000000..c7c7f1ddcce6 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/AnimalFarm.md @@ -0,0 +1,9 @@ + +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + + diff --git a/samples/client/petstore/java/jersey2/docs/EnumClass.md b/samples/client/petstore/java/jersey2/docs/EnumClass.md new file mode 100644 index 000000000000..c746edc3cb1e --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/EnumClass.md @@ -0,0 +1,14 @@ + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/jersey2/docs/EnumTest.md b/samples/client/petstore/java/jersey2/docs/EnumTest.md new file mode 100644 index 000000000000..deb1951c5528 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/EnumTest.md @@ -0,0 +1,36 @@ + +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] +**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] + + + +## Enum: EnumStringEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" + + + +## Enum: EnumIntegerEnum +Name | Value +---- | ----- +NUMBER_1 | 1 +NUMBER_MINUS_1 | -1 + + + +## Enum: EnumNumberEnum +Name | Value +---- | ----- +NUMBER_1_DOT_1 | 1.1 +NUMBER_MINUS_1_DOT_2 | -1.2 + + + diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2/docs/FakeApi.md new file mode 100644 index 000000000000..c1fdd3103218 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/FakeApi.md @@ -0,0 +1,75 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters + + + +# **testEndpointParameters** +> testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal number = new BigDecimal(); // BigDecimal | None +Double _double = 3.4D; // Double | None +String string = "string_example"; // String | None +byte[] _byte = B; // byte[] | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 789L; // Long | None +Float _float = 3.4F; // Float | None +byte[] binary = B; // byte[] | None +Date date = new Date(); // Date | None +Date dateTime = new Date(); // Date | None +String password = "password_example"; // String | None +try { + apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **string** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **binary** | **byte[]**| None | [optional] + **date** | **Date**| None | [optional] + **dateTime** | **Date**| None | [optional] + **password** | **String**| None | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/java/jersey2/docs/FormatTest.md b/samples/client/petstore/java/jersey2/docs/FormatTest.md index 8e400e7bcd77..dc2b559dad28 100644 --- a/samples/client/petstore/java/jersey2/docs/FormatTest.md +++ b/samples/client/petstore/java/jersey2/docs/FormatTest.md @@ -11,11 +11,12 @@ Name | Type | Description | Notes **_float** | **Float** | | [optional] **_double** | **Double** | | [optional] **string** | **String** | | [optional] -**_byte** | **byte[]** | | [optional] +**_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] -**date** | [**Date**](Date.md) | | [optional] +**date** | [**Date**](Date.md) | | **dateTime** | [**Date**](Date.md) | | [optional] -**password** | **String** | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | diff --git a/samples/client/petstore/java/jersey2/docs/Order.md b/samples/client/petstore/java/jersey2/docs/Order.md index b1709c14eee0..29ca3ddbc6b2 100644 --- a/samples/client/petstore/java/jersey2/docs/Order.md +++ b/samples/client/petstore/java/jersey2/docs/Order.md @@ -16,9 +16,9 @@ Name | Type | Description | Notes ## Enum: StatusEnum Name | Value ---- | ----- -PLACED | placed -APPROVED | approved -DELIVERED | delivered +PLACED | "placed" +APPROVED | "approved" +DELIVERED | "delivered" diff --git a/samples/client/petstore/java/jersey2/docs/Pet.md b/samples/client/petstore/java/jersey2/docs/Pet.md index 20a1c298dd61..5b63109ef924 100644 --- a/samples/client/petstore/java/jersey2/docs/Pet.md +++ b/samples/client/petstore/java/jersey2/docs/Pet.md @@ -16,9 +16,9 @@ Name | Type | Description | Notes ## Enum: StatusEnum Name | Value ---- | ----- -AVAILABLE | available -PENDING | pending -SOLD | sold +AVAILABLE | "available" +PENDING | "pending" +SOLD | "sold" diff --git a/samples/client/petstore/java/jersey2/git_push.sh b/samples/client/petstore/java/jersey2/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/java/jersey2/git_push.sh +++ b/samples/client/petstore/java/jersey2/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java new file mode 100644 index 000000000000..33c74e7a51cb --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java @@ -0,0 +1,128 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import javax.ws.rs.core.GenericType; + +import java.math.BigDecimal; +import java.util.Date; + +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-05-06T18:35:03.551+08:00") +public class FakeApi { + private ApiClient apiClient; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @throws ApiException if fails to make API call + */ + public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + } + + // verify the required parameter 'string' is set + if (string == null) { + throw new ApiException(400, "Missing the required parameter 'string' when calling testEndpointParameters"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + } + + // create path and map variables + String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + if (integer != null) + localVarFormParams.put("integer", integer); +if (int32 != null) + localVarFormParams.put("int32", int32); +if (int64 != null) + localVarFormParams.put("int64", int64); +if (number != null) + localVarFormParams.put("number", number); +if (_float != null) + localVarFormParams.put("float", _float); +if (_double != null) + localVarFormParams.put("double", _double); +if (string != null) + localVarFormParams.put("string", string); +if (_byte != null) + localVarFormParams.put("byte", _byte); +if (binary != null) + localVarFormParams.put("binary", binary); +if (date != null) + localVarFormParams.put("date", date); +if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); +if (password != null) + localVarFormParams.put("password", password); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } +} diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java index 1a3029ec9229..0781e60a4d49 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Animal */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class Animal { private String className = null; @@ -31,7 +31,6 @@ public class Animal { this.className = className; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java new file mode 100644 index 000000000000..04767c63252e --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -0,0 +1,53 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.client.model.Animal; +import java.util.ArrayList; +import java.util.List; + + +/** + * AnimalFarm + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") +public class AnimalFarm extends ArrayList { + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java index c877047cd458..8acadb9a2f63 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; /** * Cat */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class Cat extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Cat extends Animal { this.className = className; } - + /** **/ public Cat declawed(Boolean declawed) { @@ -50,7 +50,6 @@ public class Cat extends Animal { this.declawed = declawed; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java index b9cb49513463..763fcccf2a7b 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Category */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+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,7 +49,6 @@ public class Category { this.name = name; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java index 15d3ce320b2c..a9e7e2acce02 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; /** * Dog */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class Dog extends Animal { private String className = null; @@ -33,7 +33,7 @@ public class Dog extends Animal { this.className = className; } - + /** **/ public Dog breed(String breed) { @@ -50,7 +50,6 @@ public class Dog extends Animal { this.breed = breed; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java index 6b8ee8102be9..8152b4405993 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * EnumTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class EnumTest { @@ -97,7 +97,7 @@ public class EnumTest { this.enumString = enumString; } - + /** **/ public EnumTest enumInteger(EnumIntegerEnum enumInteger) { @@ -114,7 +114,7 @@ public class EnumTest { this.enumInteger = enumInteger; } - + /** **/ public EnumTest enumNumber(EnumNumberEnum enumNumber) { @@ -131,7 +131,6 @@ public class EnumTest { this.enumNumber = enumNumber; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java index 774ce0ebcfec..4098e37a8a99 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java @@ -8,10 +8,10 @@ import java.math.BigDecimal; import java.util.Date; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * FormatTest + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class FormatTest { private Integer integer = null; @@ -25,10 +25,13 @@ public class FormatTest { private byte[] binary = null; private Date date = null; private Date dateTime = null; + private String uuid = null; private String password = null; /** + * minimum: 10.0 + * maximum: 100.0 **/ public FormatTest integer(Integer integer) { this.integer = integer; @@ -46,6 +49,8 @@ public class FormatTest { /** + * minimum: 20.0 + * maximum: 200.0 **/ public FormatTest int32(Integer int32) { this.int32 = int32; @@ -80,6 +85,8 @@ public class FormatTest { /** + * minimum: 32.1 + * maximum: 543.2 **/ public FormatTest number(BigDecimal number) { this.number = number; @@ -97,6 +104,8 @@ public class FormatTest { /** + * minimum: 54.3 + * maximum: 987.6 **/ public FormatTest _float(Float _float) { this._float = _float; @@ -114,6 +123,8 @@ public class FormatTest { /** + * minimum: 67.8 + * maximum: 123.4 **/ public FormatTest _double(Double _double) { this._double = _double; @@ -154,7 +165,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("byte") public byte[] getByte() { return _byte; @@ -188,7 +199,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("date") public Date getDate() { return date; @@ -215,6 +226,23 @@ public class FormatTest { } + /** + **/ + public FormatTest uuid(String uuid) { + this.uuid = uuid; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** **/ public FormatTest password(String password) { @@ -222,7 +250,7 @@ public class FormatTest { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("password") public String getPassword() { return password; @@ -252,12 +280,13 @@ public class FormatTest { Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, password); + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } @Override @@ -276,6 +305,7 @@ public class FormatTest { sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java index 36f04c225f61..0101cd5e8e3a 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java @@ -7,9 +7,10 @@ import io.swagger.annotations.ApiModelProperty; /** - * Model200Response + * Model for testing model name starting with number */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@ApiModel(description = "Model for testing model name starting with number") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class Model200Response { private Integer name = null; @@ -31,7 +32,6 @@ public class Model200Response { this.name = name; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java index 5a3f9254bae8..af6f23fd7824 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:58:40.273+08:00") +/** + * ModelApiResponse + */ +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java index 62224f3b2c38..827c22bef67b 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java @@ -7,9 +7,10 @@ import io.swagger.annotations.ApiModelProperty; /** - * ModelReturn + * Model for testing reserved words */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@ApiModel(description = "Model for testing reserved words") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class ModelReturn { private Integer _return = null; @@ -31,7 +32,6 @@ public class ModelReturn { this._return = _return; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java index 92bf36a79524..b7209d46b191 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java @@ -7,13 +7,15 @@ import io.swagger.annotations.ApiModelProperty; /** - * Name + * Model for testing model name same as property name */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@ApiModel(description = "Model for testing model name same as property name") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class Name { private Integer name = null; private Integer snakeCase = null; + private String property = null; /** @@ -23,7 +25,7 @@ public class Name { return this; } - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("name") public Integer getName() { return name; @@ -32,24 +34,30 @@ 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 void setSnakeCase(Integer snakeCase) { - this.snakeCase = snakeCase; + + + /** + **/ + public Name property(String property) { + this.property = property; + return this; + } + + @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) { @@ -61,12 +69,13 @@ public class Name { } Name name = (Name) o; return Objects.equals(this.name, name.name) && - Objects.equals(this.snakeCase, name.snakeCase); + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property); } @Override public int hashCode() { - return Objects.hash(name, snakeCase); + return Objects.hash(name, snakeCase, property); } @Override @@ -76,6 +85,7 @@ 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/jersey2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java index 116f07dc14d5..322b2b832cb1 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java @@ -11,7 +11,7 @@ import java.util.Date; /** * Order */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class Order { private Long id = null; @@ -40,17 +40,27 @@ public class Order { } } - private StatusEnum status = StatusEnum.PLACED; - private Boolean complete = null; + private StatusEnum status = null; + private Boolean complete = false; + /** + **/ + 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) { @@ -67,7 +77,7 @@ public class Order { this.petId = petId; } - + /** **/ public Order quantity(Integer quantity) { @@ -84,7 +94,7 @@ public class Order { this.quantity = quantity; } - + /** **/ public Order shipDate(Date shipDate) { @@ -101,7 +111,7 @@ public class Order { this.shipDate = shipDate; } - + /** * Order Status **/ @@ -119,7 +129,7 @@ public class Order { this.status = status; } - + /** **/ public Order complete(Boolean complete) { @@ -136,7 +146,6 @@ public class Order { this.complete = complete; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java index 82dc1e9a1a40..07becbd4107e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java @@ -14,7 +14,7 @@ import java.util.List; /** * Pet */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class Pet { private Long id = null; @@ -63,7 +63,7 @@ public class Pet { this.id = id; } - + /** **/ public Pet category(Category category) { @@ -80,7 +80,7 @@ public class Pet { this.category = category; } - + /** **/ public Pet name(String name) { @@ -97,7 +97,7 @@ public class Pet { this.name = name; } - + /** **/ public Pet photoUrls(List photoUrls) { @@ -114,7 +114,7 @@ public class Pet { this.photoUrls = photoUrls; } - + /** **/ public Pet tags(List tags) { @@ -131,7 +131,7 @@ public class Pet { this.tags = tags; } - + /** * pet status in the store **/ @@ -149,7 +149,6 @@ public class Pet { this.status = status; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java index 12e360e83a46..fccd55df94d6 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * SpecialModelName */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+08:00") public class SpecialModelName { private Long specialPropertyName = null; @@ -31,7 +31,6 @@ public class SpecialModelName { this.specialPropertyName = specialPropertyName; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java index 0c579b9ed7e7..417f95d4a2f6 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Tag */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+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,7 +49,6 @@ public class Tag { this.name = name; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java index 48933177c5f6..bf361b5a7653 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; /** * User */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-12T23:06:12.393+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-06T18:35:03.551+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,7 +158,6 @@ public class User { this.userStatus = userStatus; } - @Override public boolean equals(java.lang.Object o) { diff --git a/samples/client/petstore/java/okhttp-gson/docs/AnimalFarm.md b/samples/client/petstore/java/okhttp-gson/docs/AnimalFarm.md new file mode 100644 index 000000000000..c7c7f1ddcce6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/AnimalFarm.md @@ -0,0 +1,9 @@ + +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/EnumClass.md b/samples/client/petstore/java/okhttp-gson/docs/EnumClass.md index d03195a19a41..c746edc3cb1e 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/EnumClass.md +++ b/samples/client/petstore/java/okhttp-gson/docs/EnumClass.md @@ -4,11 +4,11 @@ ## Enum -* `_ABC` (value: `"_abc"`) +* `_ABC` (value: `"_abc"`) -* `_EFG` (value: `"-efg"`) +* `_EFG` (value: `"-efg"`) -* `_XYZ_` (value: `"(xyz)"`) +* `_XYZ_` (value: `"(xyz)"`) diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md index f642566c8e77..c1fdd3103218 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md @@ -23,7 +23,7 @@ Fake endpoint for testing various parameters FakeApi apiInstance = new FakeApi(); -String number = "number_example"; // String | None +BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None String string = "string_example"; // String | None byte[] _byte = B; // byte[] | None @@ -47,7 +47,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **String**| None | + **number** | **BigDecimal**| None | **_double** | **Double**| None | **string** | **String**| None | **_byte** | **byte[]**| None | diff --git a/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md b/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md index 5e54362e5353..dc2b559dad28 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **binary** | **byte[]** | | [optional] **date** | [**Date**](Date.md) | | **dateTime** | [**Date**](Date.md) | | [optional] +**uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/okhttp-gson/git_push.sh b/samples/client/petstore/java/okhttp-gson/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/java/okhttp-gson/git_push.sh +++ b/samples/client/petstore/java/okhttp-gson/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index dd6d8236607a..e021970cdb72 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -17,6 +17,7 @@ import com.squareup.okhttp.Response; import java.io.IOException; +import java.math.BigDecimal; import java.util.Date; import java.lang.reflect.Type; @@ -45,7 +46,7 @@ public class FakeApi { } /* Build call for testEndpointParameters */ - private Call testEndpointParametersCall(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private Call testEndpointParametersCall(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set @@ -147,7 +148,7 @@ public class FakeApi { * @param password None (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public void testEndpointParameters(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { testEndpointParametersWithHttpInfo(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } @@ -169,7 +170,7 @@ public class FakeApi { * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse testEndpointParametersWithHttpInfo(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, null, null); return apiClient.execute(call); } @@ -193,7 +194,7 @@ public class FakeApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call testEndpointParametersAsync(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ApiCallback callback) throws ApiException { + public Call testEndpointParametersAsync(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java new file mode 100644 index 000000000000..8be2f1ecd0d3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -0,0 +1,53 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.client.model.Animal; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + + +/** + * AnimalFarm + */ +public class AnimalFarm extends ArrayList { + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java index 0fc4082d1196..af3fec2a2eac 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java @@ -47,6 +47,9 @@ public class FormatTest { @SerializedName("dateTime") private Date dateTime = null; + @SerializedName("uuid") + private String uuid = null; + @SerializedName("password") private String password = null; @@ -170,6 +173,16 @@ public class FormatTest { this.dateTime = dateTime; } + /** + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + /** **/ @ApiModelProperty(required = true, value = "") @@ -201,12 +214,13 @@ public class FormatTest { Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, password); + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } @Override @@ -225,6 +239,7 @@ public class FormatTest { sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/retrofit/git_push.sh b/samples/client/petstore/java/retrofit/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/java/retrofit/git_push.sh +++ b/samples/client/petstore/java/retrofit/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java index 03f5b9aff1b0..89fb9ddba73a 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java @@ -6,6 +6,7 @@ import retrofit.Callback; import retrofit.http.*; import retrofit.mime.*; +import java.math.BigDecimal; import java.util.Date; import java.util.ArrayList; @@ -36,7 +37,7 @@ public interface FakeApi { @FormUrlEncoded @POST("/fake") Void testEndpointParameters( - @Field("number") String number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password + @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password ); /** @@ -61,6 +62,6 @@ public interface FakeApi { @FormUrlEncoded @POST("/fake") void testEndpointParameters( - @Field("number") String number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password, Callback cb + @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password, Callback cb ); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/AnimalFarm.java new file mode 100644 index 000000000000..c7d37b1512c2 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -0,0 +1,53 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.client.model.Animal; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + + + + + +public class AnimalFarm extends ArrayList { + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnimalFarm animalFarm = (AnimalFarm) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java index 40d1ca0ecea9..694335531fde 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java @@ -47,6 +47,9 @@ public class FormatTest { @SerializedName("dateTime") private Date dateTime = null; + @SerializedName("uuid") + private String uuid = null; + @SerializedName("password") private String password = null; @@ -170,6 +173,16 @@ public class FormatTest { this.dateTime = dateTime; } + /** + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + /** **/ @ApiModelProperty(required = true, value = "") @@ -201,12 +214,13 @@ public class FormatTest { Objects.equals(binary, formatTest.binary) && Objects.equals(date, formatTest.date) && Objects.equals(dateTime, formatTest.dateTime) && + Objects.equals(uuid, formatTest.uuid) && Objects.equals(password, formatTest.password); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, password); + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } @Override @@ -225,6 +239,7 @@ public class FormatTest { sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/retrofit2/git_push.sh b/samples/client/petstore/java/retrofit2/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/java/retrofit2/git_push.sh +++ b/samples/client/petstore/java/retrofit2/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index dc732e67ae73..28db89beefd6 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -8,6 +8,7 @@ import retrofit2.http.*; import okhttp3.RequestBody; +import java.math.BigDecimal; import java.util.Date; import java.util.ArrayList; @@ -37,7 +38,7 @@ public interface FakeApi { @FormUrlEncoded @POST("fake") Call testEndpointParameters( - @Field("number") String number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password + @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password ); } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/AnimalFarm.java new file mode 100644 index 000000000000..c7d37b1512c2 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -0,0 +1,53 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.client.model.Animal; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + + + + + +public class AnimalFarm extends ArrayList { + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnimalFarm animalFarm = (AnimalFarm) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/FormatTest.java index 40d1ca0ecea9..694335531fde 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/FormatTest.java @@ -47,6 +47,9 @@ public class FormatTest { @SerializedName("dateTime") private Date dateTime = null; + @SerializedName("uuid") + private String uuid = null; + @SerializedName("password") private String password = null; @@ -170,6 +173,16 @@ public class FormatTest { this.dateTime = dateTime; } + /** + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + /** **/ @ApiModelProperty(required = true, value = "") @@ -201,12 +214,13 @@ public class FormatTest { Objects.equals(binary, formatTest.binary) && Objects.equals(date, formatTest.date) && Objects.equals(dateTime, formatTest.dateTime) && + Objects.equals(uuid, formatTest.uuid) && Objects.equals(password, formatTest.password); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, password); + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } @Override @@ -225,6 +239,7 @@ public class FormatTest { sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/retrofit2rx/git_push.sh b/samples/client/petstore/java/retrofit2rx/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/java/retrofit2rx/git_push.sh +++ b/samples/client/petstore/java/retrofit2rx/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/AnimalFarm.java new file mode 100644 index 000000000000..c7d37b1512c2 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -0,0 +1,53 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.client.model.Animal; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + + + + + +public class AnimalFarm extends ArrayList { + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnimalFarm animalFarm = (AnimalFarm) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java index 4106b15caaf8..694335531fde 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java @@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.Date; -import java.util.UUID; import com.google.gson.annotations.SerializedName; @@ -49,7 +48,7 @@ public class FormatTest { private Date dateTime = null; @SerializedName("uuid") - private UUID uuid = null; + private String uuid = null; @SerializedName("password") private String password = null; @@ -177,10 +176,10 @@ public class FormatTest { /** **/ @ApiModelProperty(value = "") - public UUID getUuid() { + public String getUuid() { return uuid; } - public void setUuid(UUID uuid) { + public void setUuid(String uuid) { this.uuid = uuid; } diff --git a/samples/client/petstore/javascript-promise/docs/EnumClass.md b/samples/client/petstore/javascript-promise/docs/EnumClass.md index 5159ccfb4540..04b89362941b 100644 --- a/samples/client/petstore/javascript-promise/docs/EnumClass.md +++ b/samples/client/petstore/javascript-promise/docs/EnumClass.md @@ -1,7 +1,12 @@ # SwaggerPetstore.EnumClass -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +## Enum + + +* `_abc` (value: `"_abc"`) + +* `-efg` (value: `"-efg"`) + +* `(xyz)` (value: `"(xyz)"`) diff --git a/samples/client/petstore/javascript-promise/docs/EnumTest.md b/samples/client/petstore/javascript-promise/docs/EnumTest.md index 724eea8a25e9..22c4da11b9d3 100644 --- a/samples/client/petstore/javascript-promise/docs/EnumTest.md +++ b/samples/client/petstore/javascript-promise/docs/EnumTest.md @@ -8,3 +8,36 @@ Name | Type | Description | Notes **enumNumber** | **Number** | | [optional] + +## Enum: EnumStringEnum + + +* `UPPER` (value: `"UPPER"`) + +* `lower` (value: `"lower"`) + + + + + +## Enum: EnumIntegerEnum + + +* `1` (value: `1`) + +* `-1` (value: `-1`) + + + + + +## Enum: EnumNumberEnum + + +* `1.1` (value: `1.1`) + +* `-1.2` (value: `-1.2`) + + + + diff --git a/samples/client/petstore/javascript-promise/docs/Order.md b/samples/client/petstore/javascript-promise/docs/Order.md index 10503b582065..95ee5946ed26 100644 --- a/samples/client/petstore/javascript-promise/docs/Order.md +++ b/samples/client/petstore/javascript-promise/docs/Order.md @@ -11,3 +11,16 @@ Name | Type | Description | Notes **complete** | **Boolean** | | [optional] [default to false] + +## Enum: StatusEnum + + +* `placed` (value: `"placed"`) + +* `approved` (value: `"approved"`) + +* `delivered` (value: `"delivered"`) + + + + diff --git a/samples/client/petstore/javascript-promise/docs/Pet.md b/samples/client/petstore/javascript-promise/docs/Pet.md index f1b049dcadd0..a08333731c0d 100644 --- a/samples/client/petstore/javascript-promise/docs/Pet.md +++ b/samples/client/petstore/javascript-promise/docs/Pet.md @@ -11,3 +11,16 @@ Name | Type | Description | Notes **status** | **String** | pet status in the store | [optional] + +## Enum: StatusEnum + + +* `available` (value: `"available"`) + +* `pending` (value: `"pending"`) + +* `sold` (value: `"sold"`) + + + + diff --git a/samples/client/petstore/javascript-promise/src/model/EnumClass.js b/samples/client/petstore/javascript-promise/src/model/EnumClass.js index 268addcbaed3..e9bf5219ee53 100644 --- a/samples/client/petstore/javascript-promise/src/model/EnumClass.js +++ b/samples/client/petstore/javascript-promise/src/model/EnumClass.js @@ -23,17 +23,17 @@ */ var exports = { /** - * value: _abc + * value: "_abc" * @const */ "_abc": "_abc", /** - * value: -efg + * value: "-efg" * @const */ "-efg": "-efg", /** - * value: (xyz) + * value: "(xyz)" * @const */ "(xyz)": "(xyz)" }; diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 651e1e6047fd..1bf60abb9c32 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-03T11:05:41.851+08:00 +- Build date: 2016-05-06T18:34:50.267+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -117,6 +117,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [SwaggerPetstore.Animal](docs/Animal.md) + - [SwaggerPetstore.AnimalFarm](docs/AnimalFarm.md) - [SwaggerPetstore.ApiResponse](docs/ApiResponse.md) - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) @@ -137,12 +138,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -152,3 +147,9 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + diff --git a/samples/client/petstore/javascript/docs/AnimalFarm.md b/samples/client/petstore/javascript/docs/AnimalFarm.md new file mode 100644 index 000000000000..b72739a44c42 --- /dev/null +++ b/samples/client/petstore/javascript/docs/AnimalFarm.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript/docs/EnumClass.md b/samples/client/petstore/javascript/docs/EnumClass.md index 5159ccfb4540..04b89362941b 100644 --- a/samples/client/petstore/javascript/docs/EnumClass.md +++ b/samples/client/petstore/javascript/docs/EnumClass.md @@ -1,7 +1,12 @@ # SwaggerPetstore.EnumClass -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +## Enum + + +* `_abc` (value: `"_abc"`) + +* `-efg` (value: `"-efg"`) + +* `(xyz)` (value: `"(xyz)"`) diff --git a/samples/client/petstore/javascript/docs/EnumTest.md b/samples/client/petstore/javascript/docs/EnumTest.md index 724eea8a25e9..22c4da11b9d3 100644 --- a/samples/client/petstore/javascript/docs/EnumTest.md +++ b/samples/client/petstore/javascript/docs/EnumTest.md @@ -8,3 +8,36 @@ Name | Type | Description | Notes **enumNumber** | **Number** | | [optional] + +## Enum: EnumStringEnum + + +* `UPPER` (value: `"UPPER"`) + +* `lower` (value: `"lower"`) + + + + + +## Enum: EnumIntegerEnum + + +* `1` (value: `1`) + +* `-1` (value: `-1`) + + + + + +## Enum: EnumNumberEnum + + +* `1.1` (value: `1.1`) + +* `-1.2` (value: `-1.2`) + + + + diff --git a/samples/client/petstore/javascript/docs/Order.md b/samples/client/petstore/javascript/docs/Order.md index 10503b582065..95ee5946ed26 100644 --- a/samples/client/petstore/javascript/docs/Order.md +++ b/samples/client/petstore/javascript/docs/Order.md @@ -11,3 +11,16 @@ Name | Type | Description | Notes **complete** | **Boolean** | | [optional] [default to false] + +## Enum: StatusEnum + + +* `placed` (value: `"placed"`) + +* `approved` (value: `"approved"`) + +* `delivered` (value: `"delivered"`) + + + + diff --git a/samples/client/petstore/javascript/docs/Pet.md b/samples/client/petstore/javascript/docs/Pet.md index f1b049dcadd0..a08333731c0d 100644 --- a/samples/client/petstore/javascript/docs/Pet.md +++ b/samples/client/petstore/javascript/docs/Pet.md @@ -11,3 +11,16 @@ Name | Type | Description | Notes **status** | **String** | pet status in the store | [optional] + +## Enum: StatusEnum + + +* `available` (value: `"available"`) + +* `pending` (value: `"pending"`) + +* `sold` (value: `"sold"`) + + + + diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index d45704dcdac9..2598dd8d9ea9 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -40,8 +40,8 @@ * @type {Array.} */ this.authentications = { - 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'petstore_auth': {type: 'oauth2'} + 'petstore_auth': {type: 'oauth2'}, + 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'} }; /** * The default HTTP headers to be included for all API calls. diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index 2c3fb27ef652..727b4782f458 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,12 +1,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Animal', 'model/ApiResponse', 'model/Cat', 'model/Category', 'model/Dog', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/Order', 'model/Pet', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); + define(['ApiClient', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/Cat', 'model/Category', 'model/Dog', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/Order', 'model/Pet', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/ApiResponse'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Animal, ApiResponse, Cat, Category, Dog, EnumClass, EnumTest, FormatTest, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Animal, AnimalFarm, ApiResponse, Cat, Category, Dog, EnumClass, EnumTest, FormatTest, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -51,6 +51,11 @@ * @property {module:model/Animal} */ Animal: Animal, + /** + * The AnimalFarm model constructor. + * @property {module:model/AnimalFarm} + */ + AnimalFarm: AnimalFarm, /** * The ApiResponse model constructor. * @property {module:model/ApiResponse} diff --git a/samples/client/petstore/javascript/src/model/AnimalFarm.js b/samples/client/petstore/javascript/src/model/AnimalFarm.js new file mode 100644 index 000000000000..d5f6aa2a424f --- /dev/null +++ b/samples/client/petstore/javascript/src/model/AnimalFarm.js @@ -0,0 +1,64 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient', 'model/Animal'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./Animal')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.AnimalFarm = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); + } +}(this, function(ApiClient, Animal) { + 'use strict'; + + + + + /** + * The AnimalFarm model module. + * @module model/AnimalFarm + * @version 1.0.0 + */ + + /** + * Constructs a new AnimalFarm. + * @alias module:model/AnimalFarm + * @class + * @extends Array + */ + var exports = function() { + var _this = this; + _this = new Array(); + Object.setPrototypeOf(_this, exports); + + return _this; + }; + + /** + * Constructs a AnimalFarm from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/AnimalFarm} obj Optional instance to populate. + * @return {module:model/AnimalFarm} The populated AnimalFarm instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + ApiClient.constructFromObject(data, obj, Animal); + + } + return obj; + } + + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript/src/model/EnumClass.js b/samples/client/petstore/javascript/src/model/EnumClass.js index 268addcbaed3..e9bf5219ee53 100644 --- a/samples/client/petstore/javascript/src/model/EnumClass.js +++ b/samples/client/petstore/javascript/src/model/EnumClass.js @@ -23,17 +23,17 @@ */ var exports = { /** - * value: _abc + * value: "_abc" * @const */ "_abc": "_abc", /** - * value: -efg + * value: "-efg" * @const */ "-efg": "-efg", /** - * value: (xyz) + * value: "(xyz)" * @const */ "(xyz)": "(xyz)" }; From b3937c26564f8194ba2b62c41280d20f770206fa Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Wed, 4 May 2016 17:38:53 -0400 Subject: [PATCH 125/170] Package management option ES6 target Fix enum --- .../TypeScriptFetchClientCodegen.java | 63 ++++++++++++++----- .../resources/TypeScript-Fetch/api.mustache | 10 +-- .../main/resources/TypeScript-Fetch/assign.ts | 2 +- .../resources/TypeScript-Fetch/package.json | 10 --- .../TypeScript-Fetch/package.json.mustache | 17 +++++ .../resources/TypeScript-Fetch/tsconfig.json | 11 ---- .../TypeScript-Fetch/tsconfig.json.mustache | 14 +++++ .../{typings.json => typings.json.mustache} | 4 +- .../TypeScriptFetchClientOptionsProvider.java | 5 ++ 9 files changed, 92 insertions(+), 44 deletions(-) delete mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json create mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json create mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache rename modules/swagger-codegen/src/main/resources/TypeScript-Fetch/{typings.json => typings.json.mustache} (56%) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java index 804f48d79f78..5bc848a7c78a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java @@ -1,11 +1,47 @@ package io.swagger.codegen.languages; +import io.swagger.codegen.CliOption; import io.swagger.codegen.SupportingFile; import java.io.File; public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodegen { + public static final String NPM_NAME = "npmName"; + public static final String NPM_VERSION = "npmVersion"; + + protected String npmName = null; + protected String npmVersion = "1.0.0"; + + public TypeScriptFetchClientCodegen() { + super(); + outputFolder = "generated-code/typescript-fetch"; + embeddedTemplateDir = templateDir = "TypeScript-Fetch"; + this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package")); + this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); + } + + @Override + public void processOpts() { + super.processOpts(); + final String defaultFolder = apiPackage().replace('.', File.separatorChar); + + supportingFiles.add(new SupportingFile("api.mustache", null, "api.ts")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("assign.ts", defaultFolder, "assign.ts")); + supportingFiles.add(new SupportingFile("package.json.mustache", "", "package.json")); + supportingFiles.add(new SupportingFile("typings.json.mustache", "", "typings.json")); + supportingFiles.add(new SupportingFile("tsconfig.json.mustache", "", "tsconfig.json")); + + if(additionalProperties.containsKey(NPM_NAME)) { + this.setNpmName(additionalProperties.get(NPM_NAME).toString()); + } + + if (additionalProperties.containsKey(NPM_VERSION)) { + this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString()); + } + } + @Override public String getName() { return "typescript-fetch"; @@ -16,23 +52,20 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege return "Generates a TypeScript client library using Fetch API (beta)."; } - @Override - public void processOpts() { - super.processOpts(); - final String defaultFolder = apiPackage().replace('.', File.separatorChar); - - supportingFiles.add(new SupportingFile("api.mustache", null, "api.ts")); - supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - supportingFiles.add(new SupportingFile("assign.ts", defaultFolder, "assign.ts")); - supportingFiles.add(new SupportingFile("package.json", "", "package.json")); - supportingFiles.add(new SupportingFile("typings.json", "", "typings.json")); - supportingFiles.add(new SupportingFile("tsconfig.json", "", "tsconfig.json")); + public String getNpmName() { + return npmName; } - public TypeScriptFetchClientCodegen() { - super(); - outputFolder = "generated-code/typescript-fetch"; - embeddedTemplateDir = templateDir = "TypeScript-Fetch"; + public void setNpmName(String npmName) { + this.npmName = npmName; + } + + public String getNpmVersion() { + return npmVersion; + } + + public void setNpmVersion(String npmVersion) { + this.npmVersion = npmVersion; } } diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache index 02e6816ff262..67d61999aa0c 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache @@ -23,14 +23,14 @@ export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ } {{#hasEnums}} +export namespace {{classname}} { {{#vars}} {{#isEnum}} -export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} - {{.}} = '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}} -} +export type {{datatypeWithEnum}} = {{#allowableValues}}{{#values}}'{{.}}'{{^-last}} | {{/-last}}{{/values}}{{/allowableValues}}; {{/isEnum}} {{/vars}} +} {{/hasEnums}} {{/model}} {{/models}} @@ -119,8 +119,8 @@ export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} if (response.status >= 200 && response.status < 300) { return response.json(); } else { - var error = new Error(response.statusText); - error['response'] = response; + let error = new Error(response.statusText); + (error as any).response = response; throw error; } }); diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/assign.ts b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/assign.ts index 040f87d7d98b..233551441479 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/assign.ts +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/assign.ts @@ -1,4 +1,4 @@ -export function assign (target, ...args) { +export function assign (target: any, ...args: any[]) { 'use strict'; if (target === undefined || target === null) { throw new TypeError('Cannot convert undefined or null to object'); diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json deleted file mode 100644 index 722c87cc3237..000000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "private": true, - "dependencies": { - "isomorphic-fetch": "^2.2.1" - }, - "devDependencies": { - "typescript": "^1.8.10", - "typings": "^0.8.1" - } -} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache new file mode 100644 index 000000000000..7e94923c1428 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache @@ -0,0 +1,17 @@ +{ + "name": "{{#npmName}}{{{npmName}}}{{/npmName}}{{^npmName}}typescript-fetch-api{{/npmName}}", + "version": "{{#npmVersion}}{{{npmVersion}}}{{/npmVersion}}{{^npmVersion}}0.0.0{{/npmVersion}}", + "private": true, + "main": "dist/api.js", + "browser": "dist/api.js", + "dependencies": { + "isomorphic-fetch": "^2.2.1" + }, + "scripts" : { + "install" : "typings install && tsc" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json deleted file mode 100644 index fc93dc1610e1..000000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "target": "es5" - }, - "exclude": [ - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" - ] -} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache new file mode 100644 index 000000000000..457b7f53db8d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist" + }, + "exclude": [ + "node_modules", + "typings/browser", + "typings/main", + "typings/main.d.ts" + ] +} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache similarity index 56% rename from modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json rename to modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache index c22f086f7f05..1d1b679de8c1 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache @@ -2,8 +2,8 @@ "version": false, "dependencies": {}, "ambientDependencies": { - "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", - "node": "registry:dt/node#4.0.0+20160423143914", +{{^supportsES6}} "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", +{{/supportsES6}} "node": "registry:dt/node#4.0.0+20160423143914", "isomorphic-fetch": "github:leonyu/DefinitelyTyped/isomorphic-fetch/isomorphic-fetch.d.ts#isomorphic-fetch-fix-module" } } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java index 46452af16223..cc5be4fe4560 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java @@ -2,6 +2,7 @@ package io.swagger.codegen.options; import com.google.common.collect.ImmutableMap; import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.languages.TypeScriptFetchClientCodegen; import java.util.Map; @@ -10,6 +11,8 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider { public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final Boolean SUPPORTS_ES6_VALUE = false; public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; + private static final String NMP_NAME = "npmName"; + private static final String NMP_VERSION = "1.0.0"; @Override public String getLanguage() { @@ -23,6 +26,8 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider { .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) .put(CodegenConstants.SUPPORTS_ES6, String.valueOf(SUPPORTS_ES6_VALUE)) + .put(TypeScriptFetchClientCodegen.NPM_NAME, NMP_NAME) + .put(TypeScriptFetchClientCodegen.NPM_VERSION, NMP_VERSION) .build(); } From 64548d9bf5d73d54f1fa84751357d40776ad89a1 Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Fri, 6 May 2016 15:54:15 -0400 Subject: [PATCH 126/170] Update bin --- bin/typescript-fetch-petstore-target-es6.json | 3 ++ bin/typescript-fetch-petstore-target-es6.sh | 31 +++++++++++++++++++ ...petstore-target-with-package-metadata.json | 4 +++ ...h-petstore-target-with-package-metadata.sh | 31 +++++++++++++++++++ bin/typescript-fetch-petstore.sh | 2 +- 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 bin/typescript-fetch-petstore-target-es6.json create mode 100755 bin/typescript-fetch-petstore-target-es6.sh create mode 100644 bin/typescript-fetch-petstore-target-with-package-metadata.json create mode 100755 bin/typescript-fetch-petstore-target-with-package-metadata.sh diff --git a/bin/typescript-fetch-petstore-target-es6.json b/bin/typescript-fetch-petstore-target-es6.json new file mode 100644 index 000000000000..83914bd569c4 --- /dev/null +++ b/bin/typescript-fetch-petstore-target-es6.json @@ -0,0 +1,3 @@ +{ + "supportsES6": true +} diff --git a/bin/typescript-fetch-petstore-target-es6.sh b/bin/typescript-fetch-petstore-target-es6.sh new file mode 100755 index 000000000000..3734e7e34494 --- /dev/null +++ b/bin/typescript-fetch-petstore-target-es6.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-fetch -c bin/typescript-fetch-petstore-target-es6.json -o samples/client/petstore/typescript-fetch/default-es6" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore-target-with-package-metadata.json b/bin/typescript-fetch-petstore-target-with-package-metadata.json new file mode 100644 index 000000000000..b8193c8fa74f --- /dev/null +++ b/bin/typescript-fetch-petstore-target-with-package-metadata.json @@ -0,0 +1,4 @@ +{ + "npmName": "@swagger/typescript-fetch-petstore", + "npmVersion": "0.0.1" +} diff --git a/bin/typescript-fetch-petstore-target-with-package-metadata.sh b/bin/typescript-fetch-petstore-target-with-package-metadata.sh new file mode 100755 index 000000000000..3c4978c8a80e --- /dev/null +++ b/bin/typescript-fetch-petstore-target-with-package-metadata.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-fetch -c bin/typescript-fetch-petstore-target-with-package-metadata.json -o samples/client/petstore/typescript-fetch/with-package-metadata" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore.sh b/bin/typescript-fetch-petstore.sh index a4fc62dac90f..6283285c7368 100755 --- a/bin/typescript-fetch-petstore.sh +++ b/bin/typescript-fetch-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-fetch -o samples/client/petstore/typescript-fetch/" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-fetch -o samples/client/petstore/typescript-fetch/default" java $JAVA_OPTS -jar $executable $ags From f5a802d9affa461df022893081383e24b0c7d7f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Fri, 6 May 2016 23:36:49 +0200 Subject: [PATCH 127/170] [PHP] Fix default values in derived classes Fixes flaw in 9f40a82310b36764e5d8ee055983c888ac4d88a6. --- .../src/main/resources/php/model.mustache | 33 +++++++++---------- ...ith-fake-endpoints-models-for-testing.yaml | 3 ++ .../SwaggerClient-php/tests/PetApiTest.php | 14 ++++++++ 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 0ccf65862e74..3844943005d5 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -36,6 +36,7 @@ namespace {{modelPackage}}; use \ArrayAccess; + /** * {{classname}} Class Doc Comment * @@ -62,7 +63,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function swaggerTypes() { return self::$swaggerTypes{{#parentSchema}} + parent::swaggerTypes(){{/parentSchema}}; } @@ -75,7 +76,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function attributeMap() { return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap; } @@ -88,7 +89,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function setters() { return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters; } @@ -126,13 +127,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple * Associative array for storing property values * @var mixed[] */ - protected $container = array({{#vars}} - /** - * $container['{{{name}}}']{{#description}} {{{description}}}{{/description}} - * @var {{datatype}} - */ - '{{{name}}}' => {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}, - {{/vars}}); + protected $container = array(); /** * Constructor @@ -140,18 +135,22 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function __construct(array $data = null) { - {{#parentSchema}}parent::__construct($data);{{/parentSchema}} - {{#discriminator}}// Initialize discriminator property with the model name. + {{#parentSchema}} + parent::__construct($data); + + {{/parentSchema}} + {{#vars}} + $this->container['{{name}}'] = isset($data['{{name}}']) ? $data['{{name}}'] : {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}; + {{/vars}} + {{#discriminator}} + + // Initialize discriminator property with the model name. $discrimintor = array_search('{{discriminator}}', self::$attributeMap); $this->container[$discrimintor] = static::$swaggerModelName; {{/discriminator}} - - if ($data != null) { - {{#vars}}$this->container['{{name}}'] = $data['{{name}}'];{{#hasMore}} - {{/hasMore}}{{/vars}} - } } {{#vars}} + /** * Gets {{name}} * @return {{datatype}} diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 068fb8054d8f..1245e50f3b57 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -842,6 +842,9 @@ definitions: properties: className: type: string + color: + type: string + default: 'red' AnimalFarm: type: array items: diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index 0695eb9d981a..9feabf142cfa 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -450,6 +450,20 @@ class PetApiTest extends \PHPUnit_Framework_TestCase } } + // test if default values works + public function testDefaultValues() + { + // add some animals to the farm to make sure the ArrayAccess + // interface works + $dog = new Swagger\Client\Model\Dog(); + $animal = new Swagger\Client\Model\Animal(); + + // assert we can look up the animals in the farm by array + // indices (let's try a random order) + $this->assertSame('red', $dog->getColor()); + $this->assertSame('red', $animal->getColor()); + } + } ?> From bf8b7b760c7b4306610823509c590fbb1083fe19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Fri, 6 May 2016 23:46:02 +0200 Subject: [PATCH 128/170] [PHP] Regenerate petstore sample --- .../petstore/php/SwaggerClient-php/README.md | 14 +- .../php/SwaggerClient-php/docs/Animal.md | 1 + .../docs/{200Response.md => EnumClass.md} | 3 +- .../php/SwaggerClient-php/docs/EnumTest.md | 12 + .../docs/InlineResponse200.md | 15 - .../SwaggerClient-php/lib/Model/Animal.php | 57 ++- .../lib/Model/AnimalFarm.php | 12 +- .../lib/Model/ApiResponse.php | 40 +- .../php/SwaggerClient-php/lib/Model/Cat.php | 22 +- .../SwaggerClient-php/lib/Model/Category.php | 31 +- .../php/SwaggerClient-php/lib/Model/Dog.php | 22 +- .../SwaggerClient-php/lib/Model/EnumClass.php | 178 +++++++++ .../SwaggerClient-php/lib/Model/EnumTest.php | 300 ++++++++++++++ .../lib/Model/FormatTest.php | 130 ++---- .../lib/Model/InlineResponse200.php | 375 ------------------ .../lib/Model/Model200Response.php | 22 +- .../lib/Model/ModelReturn.php | 22 +- .../php/SwaggerClient-php/lib/Model/Name.php | 40 +- .../php/SwaggerClient-php/lib/Model/Order.php | 67 +--- .../php/SwaggerClient-php/lib/Model/Pet.php | 67 +--- .../lib/Model/SpecialModelName.php | 22 +- .../php/SwaggerClient-php/lib/Model/Tag.php | 31 +- .../php/SwaggerClient-php/lib/Model/User.php | 85 +--- .../lib/ObjectSerializer.php | 2 +- ...eResponse200Test.php => EnumClassTest.php} | 10 +- .../lib/Tests/EnumTestTest.php | 70 ++++ 26 files changed, 780 insertions(+), 870 deletions(-) rename samples/client/petstore/php/SwaggerClient-php/docs/{200Response.md => EnumClass.md} (84%) create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md delete mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php delete mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php rename samples/client/petstore/php/SwaggerClient-php/lib/Tests/{InlineResponse200Test.php => EnumClassTest.php} (88%) create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumTestTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index a5cba5dcbb77..3afa7f222196 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-06T10:33:16.765+08:00 +- Build date: 2016-05-06T23:45:46.258+02:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -134,12 +134,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -149,6 +143,12 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Author diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md b/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md index 948a992f502a..c57fbe8ea4aa 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **string** | | +**color** | **string** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/200Response.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md similarity index 84% rename from samples/client/petstore/php/SwaggerClient-php/docs/200Response.md rename to samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md index 284a8795c619..67f017becd0c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/200Response.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md @@ -1,9 +1,8 @@ -# 200Response +# EnumClass ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md new file mode 100644 index 000000000000..2ef9e6adaacb --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md @@ -0,0 +1,12 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_string** | **string** | | [optional] +**enum_integer** | **int** | | [optional] +**enum_number** | **double** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md deleted file mode 100644 index 1c0b9237453b..000000000000 --- a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md +++ /dev/null @@ -1,15 +0,0 @@ -# InlineResponse200 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional] -**id** | **int** | | -**category** | **object** | | [optional] -**status** | **string** | pet status in the store | [optional] -**name** | **string** | | [optional] -**photo_urls** | **string[]** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php index 9e91fa7f02c3..0dcd70201fe8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Animal Class Doc Comment * @@ -57,9 +58,10 @@ class Animal implements ArrayAccess * @var string[] */ static $swaggerTypes = array( - 'class_name' => 'string' + 'class_name' => 'string', + 'color' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -69,9 +71,10 @@ class Animal implements ArrayAccess * @var string[] */ static $attributeMap = array( - 'class_name' => 'className' + 'class_name' => 'className', + 'color' => 'color' ); - + static function attributeMap() { return self::$attributeMap; } @@ -81,9 +84,10 @@ class Animal implements ArrayAccess * @var string[] */ static $setters = array( - 'class_name' => 'setClassName' + 'class_name' => 'setClassName', + 'color' => 'setColor' ); - + static function setters() { return self::$setters; } @@ -93,7 +97,8 @@ class Animal implements ArrayAccess * @var string[] */ static $getters = array( - 'class_name' => 'getClassName' + 'class_name' => 'getClassName', + 'color' => 'getColor' ); static function getters() { @@ -108,13 +113,7 @@ class Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['class_name'] - * @var string - */ - 'class_name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,15 +121,14 @@ class Animal implements ArrayAccess */ public function __construct(array $data = null) { - + $this->container['class_name'] = isset($data['class_name']) ? $data['class_name'] : null; + $this->container['color'] = isset($data['color']) ? $data['color'] : 'red'; + // Initialize discriminator property with the model name. $discrimintor = array_search('className', self::$attributeMap); $this->container[$discrimintor] = static::$swaggerModelName; - - if ($data != null) { - $this->container['class_name'] = $data['class_name']; - } } + /** * Gets class_name * @return string @@ -151,6 +149,27 @@ class Animal implements ArrayAccess $this->container['class_name'] = $class_name; return $this; } + + /** + * Gets color + * @return string + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * @param string $color + * @return $this + */ + public function setColor($color) + { + + $this->container['color'] = $color; + return $this; + } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php index b5e1ff9b81b0..53a9fc2bdd3f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * AnimalFarm Class Doc Comment * @@ -59,7 +60,7 @@ class AnimalFarm implements ArrayAccess static $swaggerTypes = array( ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class AnimalFarm implements ArrayAccess static $attributeMap = array( ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class AnimalFarm implements ArrayAccess static $setters = array( ); - + static function setters() { return self::$setters; } @@ -116,11 +117,6 @@ class AnimalFarm implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - - } } /** * Returns true if offset exists. False otherwise. diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 1d37832505d2..4c438a46eb8d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * ApiResponse Class Doc Comment * @@ -61,7 +62,7 @@ class ApiResponse implements ArrayAccess 'type' => 'string', 'message' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class ApiResponse implements ArrayAccess 'type' => 'type', 'message' => 'message' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class ApiResponse implements ArrayAccess 'type' => 'setType', 'message' => 'setMessage' ); - + static function setters() { return self::$setters; } @@ -116,25 +117,7 @@ class ApiResponse implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['code'] - * @var int - */ - 'code' => null, - - /** - * $container['type'] - * @var string - */ - 'type' => null, - - /** - * $container['message'] - * @var string - */ - 'message' => null, - ); + protected $container = array(); /** * Constructor @@ -142,14 +125,11 @@ class ApiResponse implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['code'] = $data['code']; - $this->container['type'] = $data['type']; - $this->container['message'] = $data['message']; - } + $this->container['code'] = isset($data['code']) ? $data['code'] : null; + $this->container['type'] = isset($data['type']) ? $data['type'] : null; + $this->container['message'] = isset($data['message']) ? $data['message'] : null; } + /** * Gets code * @return int @@ -170,6 +150,7 @@ class ApiResponse implements ArrayAccess $this->container['code'] = $code; return $this; } + /** * Gets type * @return string @@ -190,6 +171,7 @@ class ApiResponse implements ArrayAccess $this->container['type'] = $type; return $this; } + /** * Gets message * @return string 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 c22f5c0f6d97..3b3c5ea49c07 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Cat Class Doc Comment * @@ -59,7 +60,7 @@ class Cat extends Animal implements ArrayAccess static $swaggerTypes = array( 'declawed' => 'bool' ); - + static function swaggerTypes() { return self::$swaggerTypes + parent::swaggerTypes(); } @@ -71,7 +72,7 @@ class Cat extends Animal implements ArrayAccess static $attributeMap = array( 'declawed' => 'declawed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +84,7 @@ class Cat extends Animal implements ArrayAccess static $setters = array( 'declawed' => 'setDeclawed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -108,13 +109,7 @@ class Cat extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['declawed'] - * @var bool - */ - 'declawed' => null, - ); + protected $container = array(); /** * Constructor @@ -123,11 +118,10 @@ class Cat extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - - if ($data != null) { - $this->container['declawed'] = $data['declawed']; - } + + $this->container['declawed'] = isset($data['declawed']) ? $data['declawed'] : null; } + /** * Gets declawed * @return bool 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 567ac3f876ad..9b724ad1d2a6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Category Class Doc Comment * @@ -60,7 +61,7 @@ class Category implements ArrayAccess 'id' => 'int', 'name' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -73,7 +74,7 @@ class Category implements ArrayAccess 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +87,7 @@ class Category implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -112,19 +113,7 @@ class Category implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -132,13 +121,10 @@ class Category implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['name'] = $data['name']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } + /** * Gets id * @return int @@ -159,6 +145,7 @@ class Category implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets name * @return string 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 bb40336e6090..8ba1450116f5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Dog Class Doc Comment * @@ -59,7 +60,7 @@ class Dog extends Animal implements ArrayAccess static $swaggerTypes = array( 'breed' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes + parent::swaggerTypes(); } @@ -71,7 +72,7 @@ class Dog extends Animal implements ArrayAccess static $attributeMap = array( 'breed' => 'breed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +84,7 @@ class Dog extends Animal implements ArrayAccess static $setters = array( 'breed' => 'setBreed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -108,13 +109,7 @@ class Dog extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['breed'] - * @var string - */ - 'breed' => null, - ); + protected $container = array(); /** * Constructor @@ -123,11 +118,10 @@ class Dog extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - - if ($data != null) { - $this->container['breed'] = $data['breed']; - } + + $this->container['breed'] = isset($data['breed']) ? $data['breed'] : null; } + /** * Gets breed * @return string diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php new file mode 100644 index 000000000000..abc2f8c998a9 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -0,0 +1,178 @@ +container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php new file mode 100644 index 000000000000..e21f650072d2 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -0,0 +1,300 @@ + 'string', + 'enum_integer' => 'int', + 'enum_number' => 'double' + ); + + static function swaggerTypes() { + return self::$swaggerTypes; + } + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + static $attributeMap = array( + 'enum_string' => 'enum_string', + 'enum_integer' => 'enum_integer', + 'enum_number' => 'enum_number' + ); + + static function attributeMap() { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'enum_string' => 'setEnumString', + 'enum_integer' => 'setEnumInteger', + 'enum_number' => 'setEnumNumber' + ); + + static function setters() { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'enum_string' => 'getEnumString', + 'enum_integer' => 'getEnumInteger', + 'enum_number' => 'getEnumNumber' + ); + + static function getters() { + return self::$getters; + } + + const ENUM_STRING_UPPER = 'UPPER'; + const ENUM_STRING_LOWER = 'lower'; + const ENUM_INTEGER_1 = 1; + const ENUM_INTEGER_MINUS_1 = -1; + const ENUM_NUMBER_1_DOT_1 = 1.1; + const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2; + + + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumStringAllowableValues() { + return [ + self::ENUM_STRING_UPPER, + self::ENUM_STRING_LOWER, + ]; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumIntegerAllowableValues() { + return [ + self::ENUM_INTEGER_1, + self::ENUM_INTEGER_MINUS_1, + ]; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumNumberAllowableValues() { + return [ + self::ENUM_NUMBER_1_DOT_1, + self::ENUM_NUMBER_MINUS_1_DOT_2, + ]; + } + + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array(); + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + $this->container['enum_string'] = isset($data['enum_string']) ? $data['enum_string'] : null; + $this->container['enum_integer'] = isset($data['enum_integer']) ? $data['enum_integer'] : null; + $this->container['enum_number'] = isset($data['enum_number']) ? $data['enum_number'] : null; + } + + /** + * Gets enum_string + * @return string + */ + public function getEnumString() + { + return $this->container['enum_string']; + } + + /** + * Sets enum_string + * @param string $enum_string + * @return $this + */ + public function setEnumString($enum_string) + { + $allowed_values = array('UPPER', 'lower'); + if (!in_array($enum_string, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_string', must be one of 'UPPER', 'lower'"); + } + $this->container['enum_string'] = $enum_string; + return $this; + } + + /** + * Gets enum_integer + * @return int + */ + public function getEnumInteger() + { + return $this->container['enum_integer']; + } + + /** + * Sets enum_integer + * @param int $enum_integer + * @return $this + */ + public function setEnumInteger($enum_integer) + { + $allowed_values = array('1', '-1'); + if (!in_array($enum_integer, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_integer', must be one of '1', '-1'"); + } + $this->container['enum_integer'] = $enum_integer; + return $this; + } + + /** + * Gets enum_number + * @return double + */ + public function getEnumNumber() + { + return $this->container['enum_number']; + } + + /** + * Sets enum_number + * @param double $enum_number + * @return $this + */ + public function setEnumNumber($enum_number) + { + $allowed_values = array('1.1', '-1.2'); + if (!in_array($enum_number, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_number', must be one of '1.1', '-1.2'"); + } + $this->container['enum_number'] = $enum_number; + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 1ceace44c365..3925c7523729 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * FormatTest Class Doc Comment * @@ -71,7 +72,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'string', 'password' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -95,7 +96,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'uuid', 'password' => 'password' ); - + static function attributeMap() { return self::$attributeMap; } @@ -119,7 +120,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'setUuid', 'password' => 'setPassword' ); - + static function setters() { return self::$setters; } @@ -156,85 +157,7 @@ class FormatTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['integer'] - * @var int - */ - 'integer' => null, - - /** - * $container['int32'] - * @var int - */ - 'int32' => null, - - /** - * $container['int64'] - * @var int - */ - 'int64' => null, - - /** - * $container['number'] - * @var float - */ - 'number' => null, - - /** - * $container['float'] - * @var float - */ - 'float' => null, - - /** - * $container['double'] - * @var double - */ - 'double' => null, - - /** - * $container['string'] - * @var string - */ - 'string' => null, - - /** - * $container['byte'] - * @var string - */ - 'byte' => null, - - /** - * $container['binary'] - * @var string - */ - 'binary' => null, - - /** - * $container['date'] - * @var \DateTime - */ - 'date' => null, - - /** - * $container['date_time'] - * @var \DateTime - */ - 'date_time' => null, - - /** - * $container['uuid'] - * @var string - */ - 'uuid' => null, - - /** - * $container['password'] - * @var string - */ - 'password' => null, - ); + protected $container = array(); /** * Constructor @@ -242,24 +165,21 @@ class FormatTest implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['integer'] = $data['integer']; - $this->container['int32'] = $data['int32']; - $this->container['int64'] = $data['int64']; - $this->container['number'] = $data['number']; - $this->container['float'] = $data['float']; - $this->container['double'] = $data['double']; - $this->container['string'] = $data['string']; - $this->container['byte'] = $data['byte']; - $this->container['binary'] = $data['binary']; - $this->container['date'] = $data['date']; - $this->container['date_time'] = $data['date_time']; - $this->container['uuid'] = $data['uuid']; - $this->container['password'] = $data['password']; - } + $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; + $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; + $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; + $this->container['number'] = isset($data['number']) ? $data['number'] : null; + $this->container['float'] = isset($data['float']) ? $data['float'] : null; + $this->container['double'] = isset($data['double']) ? $data['double'] : null; + $this->container['string'] = isset($data['string']) ? $data['string'] : null; + $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; + $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; + $this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; } + /** * Gets integer * @return int @@ -280,6 +200,7 @@ class FormatTest implements ArrayAccess $this->container['integer'] = $integer; return $this; } + /** * Gets int32 * @return int @@ -300,6 +221,7 @@ class FormatTest implements ArrayAccess $this->container['int32'] = $int32; return $this; } + /** * Gets int64 * @return int @@ -320,6 +242,7 @@ class FormatTest implements ArrayAccess $this->container['int64'] = $int64; return $this; } + /** * Gets number * @return float @@ -340,6 +263,7 @@ class FormatTest implements ArrayAccess $this->container['number'] = $number; return $this; } + /** * Gets float * @return float @@ -360,6 +284,7 @@ class FormatTest implements ArrayAccess $this->container['float'] = $float; return $this; } + /** * Gets double * @return double @@ -380,6 +305,7 @@ class FormatTest implements ArrayAccess $this->container['double'] = $double; return $this; } + /** * Gets string * @return string @@ -400,6 +326,7 @@ class FormatTest implements ArrayAccess $this->container['string'] = $string; return $this; } + /** * Gets byte * @return string @@ -420,6 +347,7 @@ class FormatTest implements ArrayAccess $this->container['byte'] = $byte; return $this; } + /** * Gets binary * @return string @@ -440,6 +368,7 @@ class FormatTest implements ArrayAccess $this->container['binary'] = $binary; return $this; } + /** * Gets date * @return \DateTime @@ -460,6 +389,7 @@ class FormatTest implements ArrayAccess $this->container['date'] = $date; return $this; } + /** * Gets date_time * @return \DateTime @@ -480,6 +410,7 @@ class FormatTest implements ArrayAccess $this->container['date_time'] = $date_time; return $this; } + /** * Gets uuid * @return string @@ -500,6 +431,7 @@ class FormatTest implements ArrayAccess $this->container['uuid'] = $uuid; return $this; } + /** * Gets password * @return string diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php deleted file mode 100644 index d66a078a4e0d..000000000000 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ /dev/null @@ -1,375 +0,0 @@ - '\Swagger\Client\Model\Tag[]', - 'id' => 'int', - 'category' => 'object', - 'status' => 'string', - '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[] - */ - static $attributeMap = array( - 'tags' => 'tags', - 'id' => 'id', - 'category' => 'category', - 'status' => 'status', - 'name' => 'name', - 'photo_urls' => 'photoUrls' - ); - - static function attributeMap() { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - static $setters = array( - 'tags' => 'setTags', - 'id' => 'setId', - 'category' => 'setCategory', - 'status' => 'setStatus', - 'name' => 'setName', - 'photo_urls' => 'setPhotoUrls' - ); - - static function setters() { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - static $getters = array( - 'tags' => 'getTags', - 'id' => 'getId', - 'category' => 'getCategory', - 'status' => 'getStatus', - 'name' => 'getName', - 'photo_urls' => 'getPhotoUrls' - ); - - static function getters() { - return self::$getters; - } - - const STATUS_AVAILABLE = 'available'; - const STATUS_PENDING = 'pending'; - const STATUS_SOLD = 'sold'; - - - - /** - * Gets allowable values of the enum - * @return string[] - */ - public function getStatusAllowableValues() { - return [ - self::STATUS_AVAILABLE, - self::STATUS_PENDING, - self::STATUS_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 - * @param mixed[] $data Associated array of property value initalizing the model - */ - public function __construct(array $data = null) - { - - if ($data != null) { - $this->tags = $data["tags"]; - $this->id = $data["id"]; - $this->category = $data["category"]; - $this->status = $data["status"]; - $this->name = $data["name"]; - $this->photo_urls = $data["photo_urls"]; - } - } - - /** - * Gets tags. - * @return \Swagger\Client\Model\Tag[] - */ - public function getTags() - { - return $this->tags; - } - - /** - * Sets tags. - * @param \Swagger\Client\Model\Tag[] $tags - * @return $this - */ - public function setTags($tags) - { - - $this->tags = $tags; - return $this; - } - - /** - * Gets id. - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * Sets id. - * @param int $id - * @return $this - */ - public function setId($id) - { - - $this->id = $id; - return $this; - } - - /** - * Gets category. - * @return object - */ - public function getCategory() - { - return $this->category; - } - - /** - * Sets category. - * @param object $category - * @return $this - */ - public function setCategory($category) - { - - $this->category = $category; - return $this; - } - - /** - * Gets status. - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * Sets status. - * @param string $status pet status in the store - * @return $this - */ - public function setStatus($status) - { - $allowed_values = array("available", "pending", "sold"); - if (!in_array($status, $allowed_values)) { - throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'"); - } - $this->status = $status; - return $this; - } - - /** - * Gets name. - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Sets name. - * @param string $name - * @return $this - */ - public function setName($name) - { - - $this->name = $name; - return $this; - } - - /** - * Gets photo_urls. - * @return string[] - */ - public function getPhotoUrls() - { - return $this->photo_urls; - } - - /** - * Sets photo_urls. - * @param string[] $photo_urls - * @return $this - */ - public function setPhotoUrls($photo_urls) - { - - $this->photo_urls = $photo_urls; - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * @param integer $offset Offset - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->$offset); - } - - /** - * Gets offset. - * @param integer $offset Offset - * @return mixed - */ - public function offsetGet($offset) - { - return $this->$offset; - } - - /** - * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set - * @return void - */ - public function offsetSet($offset, $value) - { - $this->$offset = $value; - } - - /** - * Unsets offset. - * @param integer $offset Offset - * @return void - */ - public function offsetUnset($offset) - { - unset($this->$offset); - } - - /** - * Gets the string presentation of the object. - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); - } else { - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); - } - } -} - -?> diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php index 98b20ec86405..0ff50e3263a3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Model200Response Class Doc Comment * @@ -59,7 +60,7 @@ class Model200Response implements ArrayAccess static $swaggerTypes = array( 'name' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class Model200Response implements ArrayAccess static $attributeMap = array( 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class Model200Response implements ArrayAccess static $setters = array( 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class Model200Response implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['name'] - * @var int - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,12 +117,9 @@ class Model200Response implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['name'] = $data['name']; - } + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } + /** * Gets name * @return int 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 43d4f25cfc8e..e4c3524d8827 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * ModelReturn Class Doc Comment * @@ -59,7 +60,7 @@ class ModelReturn implements ArrayAccess static $swaggerTypes = array( 'return' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class ModelReturn implements ArrayAccess static $attributeMap = array( 'return' => 'return' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class ModelReturn implements ArrayAccess static $setters = array( 'return' => 'setReturn' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class ModelReturn implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['return'] - * @var int - */ - 'return' => null, - ); + protected $container = array(); /** * Constructor @@ -122,12 +117,9 @@ class ModelReturn implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['return'] = $data['return']; - } + $this->container['return'] = isset($data['return']) ? $data['return'] : null; } + /** * Gets return * @return int 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 ac876c4e7410..05c6a65d1a69 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Name Class Doc Comment * @@ -61,7 +62,7 @@ class Name implements ArrayAccess 'snake_case' => 'int', 'property' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class Name implements ArrayAccess 'snake_case' => 'snake_case', 'property' => 'property' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class Name implements ArrayAccess 'snake_case' => 'setSnakeCase', 'property' => 'setProperty' ); - + static function setters() { return self::$setters; } @@ -116,25 +117,7 @@ class Name implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['name'] - * @var int - */ - 'name' => null, - - /** - * $container['snake_case'] - * @var int - */ - 'snake_case' => null, - - /** - * $container['property'] - * @var string - */ - 'property' => null, - ); + protected $container = array(); /** * Constructor @@ -142,14 +125,11 @@ class Name implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['name'] = $data['name']; - $this->container['snake_case'] = $data['snake_case']; - $this->container['property'] = $data['property']; - } + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['snake_case'] = isset($data['snake_case']) ? $data['snake_case'] : null; + $this->container['property'] = isset($data['property']) ? $data['property'] : null; } + /** * Gets name * @return int @@ -170,6 +150,7 @@ class Name implements ArrayAccess $this->container['name'] = $name; return $this; } + /** * Gets snake_case * @return int @@ -190,6 +171,7 @@ class Name implements ArrayAccess $this->container['snake_case'] = $snake_case; return $this; } + /** * Gets property * @return string 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 15db8d7d7d86..b0b7dcba6fc6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Order Class Doc Comment * @@ -64,7 +65,7 @@ class Order implements ArrayAccess 'status' => 'string', 'complete' => 'bool' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -81,7 +82,7 @@ class Order implements ArrayAccess 'status' => 'status', 'complete' => 'complete' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +99,7 @@ class Order implements ArrayAccess 'status' => 'setStatus', 'complete' => 'setComplete' ); - + static function setters() { return self::$setters; } @@ -143,43 +144,7 @@ class Order implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['pet_id'] - * @var int - */ - 'pet_id' => null, - - /** - * $container['quantity'] - * @var int - */ - 'quantity' => null, - - /** - * $container['ship_date'] - * @var \DateTime - */ - 'ship_date' => null, - - /** - * $container['status'] Order Status - * @var string - */ - 'status' => null, - - /** - * $container['complete'] - * @var bool - */ - 'complete' => false, - ); + protected $container = array(); /** * Constructor @@ -187,17 +152,14 @@ class Order implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['pet_id'] = $data['pet_id']; - $this->container['quantity'] = $data['quantity']; - $this->container['ship_date'] = $data['ship_date']; - $this->container['status'] = $data['status']; - $this->container['complete'] = $data['complete']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['pet_id'] = isset($data['pet_id']) ? $data['pet_id'] : null; + $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; + $this->container['ship_date'] = isset($data['ship_date']) ? $data['ship_date'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['complete'] = isset($data['complete']) ? $data['complete'] : false; } + /** * Gets id * @return int @@ -218,6 +180,7 @@ class Order implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets pet_id * @return int @@ -238,6 +201,7 @@ class Order implements ArrayAccess $this->container['pet_id'] = $pet_id; return $this; } + /** * Gets quantity * @return int @@ -258,6 +222,7 @@ class Order implements ArrayAccess $this->container['quantity'] = $quantity; return $this; } + /** * Gets ship_date * @return \DateTime @@ -278,6 +243,7 @@ class Order implements ArrayAccess $this->container['ship_date'] = $ship_date; return $this; } + /** * Gets status * @return string @@ -301,6 +267,7 @@ class Order implements ArrayAccess $this->container['status'] = $status; return $this; } + /** * Gets complete * @return bool 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 0f15c9af4e78..699e602459c6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Pet Class Doc Comment * @@ -64,7 +65,7 @@ class Pet implements ArrayAccess 'tags' => '\Swagger\Client\Model\Tag[]', 'status' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -81,7 +82,7 @@ class Pet implements ArrayAccess 'tags' => 'tags', 'status' => 'status' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +99,7 @@ class Pet implements ArrayAccess 'tags' => 'setTags', 'status' => 'setStatus' ); - + static function setters() { return self::$setters; } @@ -143,43 +144,7 @@ class Pet implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['category'] - * @var \Swagger\Client\Model\Category - */ - 'category' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - - /** - * $container['photo_urls'] - * @var string[] - */ - 'photo_urls' => null, - - /** - * $container['tags'] - * @var \Swagger\Client\Model\Tag[] - */ - 'tags' => null, - - /** - * $container['status'] pet status in the store - * @var string - */ - 'status' => null, - ); + protected $container = array(); /** * Constructor @@ -187,17 +152,14 @@ class Pet implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['category'] = $data['category']; - $this->container['name'] = $data['name']; - $this->container['photo_urls'] = $data['photo_urls']; - $this->container['tags'] = $data['tags']; - $this->container['status'] = $data['status']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['category'] = isset($data['category']) ? $data['category'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['photo_urls'] = isset($data['photo_urls']) ? $data['photo_urls'] : null; + $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; } + /** * Gets id * @return int @@ -218,6 +180,7 @@ class Pet implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets category * @return \Swagger\Client\Model\Category @@ -238,6 +201,7 @@ class Pet implements ArrayAccess $this->container['category'] = $category; return $this; } + /** * Gets name * @return string @@ -258,6 +222,7 @@ class Pet implements ArrayAccess $this->container['name'] = $name; return $this; } + /** * Gets photo_urls * @return string[] @@ -278,6 +243,7 @@ class Pet implements ArrayAccess $this->container['photo_urls'] = $photo_urls; return $this; } + /** * Gets tags * @return \Swagger\Client\Model\Tag[] @@ -298,6 +264,7 @@ class Pet implements ArrayAccess $this->container['tags'] = $tags; return $this; } + /** * Gets status * @return string 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 628cfd5d2630..2a84ec5e4311 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * SpecialModelName Class Doc Comment * @@ -59,7 +60,7 @@ class SpecialModelName implements ArrayAccess static $swaggerTypes = array( 'special_property_name' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class SpecialModelName implements ArrayAccess static $attributeMap = array( 'special_property_name' => '$special[property.name]' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class SpecialModelName implements ArrayAccess static $setters = array( 'special_property_name' => 'setSpecialPropertyName' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class SpecialModelName implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['special_property_name'] - * @var int - */ - 'special_property_name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,12 +117,9 @@ class SpecialModelName implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['special_property_name'] = $data['special_property_name']; - } + $this->container['special_property_name'] = isset($data['special_property_name']) ? $data['special_property_name'] : null; } + /** * Gets special_property_name * @return int 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 f85bd4801481..c943bbf46bef 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Tag Class Doc Comment * @@ -60,7 +61,7 @@ class Tag implements ArrayAccess 'id' => 'int', 'name' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -73,7 +74,7 @@ class Tag implements ArrayAccess 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +87,7 @@ class Tag implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -112,19 +113,7 @@ class Tag implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -132,13 +121,10 @@ class Tag implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['name'] = $data['name']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } + /** * Gets id * @return int @@ -159,6 +145,7 @@ class Tag implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets name * @return string 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 2606c8f515d0..b622b735b835 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * User Class Doc Comment * @@ -66,7 +67,7 @@ class User implements ArrayAccess 'phone' => 'string', 'user_status' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -85,7 +86,7 @@ class User implements ArrayAccess 'phone' => 'phone', 'user_status' => 'userStatus' ); - + static function attributeMap() { return self::$attributeMap; } @@ -104,7 +105,7 @@ class User implements ArrayAccess 'phone' => 'setPhone', 'user_status' => 'setUserStatus' ); - + static function setters() { return self::$setters; } @@ -136,55 +137,7 @@ class User implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['username'] - * @var string - */ - 'username' => null, - - /** - * $container['first_name'] - * @var string - */ - 'first_name' => null, - - /** - * $container['last_name'] - * @var string - */ - 'last_name' => null, - - /** - * $container['email'] - * @var string - */ - 'email' => null, - - /** - * $container['password'] - * @var string - */ - 'password' => null, - - /** - * $container['phone'] - * @var string - */ - 'phone' => null, - - /** - * $container['user_status'] User Status - * @var int - */ - 'user_status' => null, - ); + protected $container = array(); /** * Constructor @@ -192,19 +145,16 @@ class User implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['username'] = $data['username']; - $this->container['first_name'] = $data['first_name']; - $this->container['last_name'] = $data['last_name']; - $this->container['email'] = $data['email']; - $this->container['password'] = $data['password']; - $this->container['phone'] = $data['phone']; - $this->container['user_status'] = $data['user_status']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['username'] = isset($data['username']) ? $data['username'] : null; + $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; + $this->container['last_name'] = isset($data['last_name']) ? $data['last_name'] : null; + $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['phone'] = isset($data['phone']) ? $data['phone'] : null; + $this->container['user_status'] = isset($data['user_status']) ? $data['user_status'] : null; } + /** * Gets id * @return int @@ -225,6 +175,7 @@ class User implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets username * @return string @@ -245,6 +196,7 @@ class User implements ArrayAccess $this->container['username'] = $username; return $this; } + /** * Gets first_name * @return string @@ -265,6 +217,7 @@ class User implements ArrayAccess $this->container['first_name'] = $first_name; return $this; } + /** * Gets last_name * @return string @@ -285,6 +238,7 @@ class User implements ArrayAccess $this->container['last_name'] = $last_name; return $this; } + /** * Gets email * @return string @@ -305,6 +259,7 @@ class User implements ArrayAccess $this->container['email'] = $email; return $this; } + /** * Gets password * @return string @@ -325,6 +280,7 @@ class User implements ArrayAccess $this->container['password'] = $password; return $this; } + /** * Gets phone * @return string @@ -345,6 +301,7 @@ class User implements ArrayAccess $this->container['phone'] = $phone; return $this; } + /** * Gets user_status * @return int diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index 3adaa899f5f8..ac63c18fbd5d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -256,7 +256,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { + } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/InlineResponse200Test.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php similarity index 88% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/InlineResponse200Test.php rename to samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php index 1bd1c822700a..4d901dfd1c95 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/InlineResponse200Test.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php @@ -1,6 +1,6 @@ Date: Fri, 6 May 2016 22:52:44 +0100 Subject: [PATCH 129/170] Add regex support --- .../src/main/resources/python/api.mustache | 4 +- .../src/main/resources/python/model.mustache | 35 +++++------ samples/client/petstore/python/README.md | 6 +- samples/client/petstore/python/git_push.sh | 4 +- .../python/swagger_client/apis/fake_api.py | 26 ++++++++ .../python/swagger_client/apis/pet_api.py | 9 +++ .../python/swagger_client/apis/store_api.py | 11 ++++ .../python/swagger_client/apis/user_api.py | 9 +++ .../python/swagger_client/models/animal.py | 2 + .../swagger_client/models/api_response.py | 4 ++ .../python/swagger_client/models/cat.py | 3 + .../python/swagger_client/models/category.py | 3 + .../python/swagger_client/models/dog.py | 3 + .../swagger_client/models/format_test.py | 61 +++++++++++++++++++ .../models/model_200_response.py | 2 + .../swagger_client/models/model_return.py | 2 + .../python/swagger_client/models/name.py | 4 ++ .../python/swagger_client/models/order.py | 7 +++ .../python/swagger_client/models/pet.py | 7 +++ .../models/special_model_name.py | 2 + .../python/swagger_client/models/tag.py | 3 + .../python/swagger_client/models/user.py | 9 +++ 22 files changed, 192 insertions(+), 24 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index 7902754e5fb3..399c7f584518 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -116,8 +116,8 @@ class {{classname}}(object): raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than or equal to `{{minimum}}`") {{/minimum}} {{#pattern}} - #if not re.match('{{pattern}}', '{{paramName}}' in params and params['{{paramName}}']): - # raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{pattern}}`") + if '{{paramName}}' in params and not re.match('{{pattern}}', params['{{paramName}}']): + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{pattern}}`") {{/pattern}} {{/hasValidation}} {{/allParams}} diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 3fce2b476971..0cb98a57ef05 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -80,34 +80,35 @@ class {{classname}}(object): "Invalid value for `{{name}}`, must be one of {0}" .format(allowed_values) ) - {{/isEnum}} - {{^isEnum}} +{{/isEnum}} +{{^isEnum}} +{{#hasValidation}} - {{#hasValidation}} if not {{name}}: raise ValueError("Invalid value for `{{name}}`, must not be `None`") - {{#maxLength}} +{{#maxLength}} if len({{name}}) > {{maxLength}}: raise ValueError("Invalid value for `{{name}}`, length must be less than `{{maxLength}}`") - {{/maxLength}} - {{#minLength}} +{{/maxLength}} +{{#minLength}} if len({{name}}) < {{minLength}}: raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`") - {{/minLength}} - {{#maximum}} +{{/minLength}} +{{#maximum}} if {{name}} > {{maximum}}: raise ValueError("Invalid value for `{{name}}`, must be a value less than or equal to `{{maximum}}`") - {{/maximum}} - {{#minimum}} +{{/maximum}} +{{#minimum}} if {{name}} < {{minimum}}: raise ValueError("Invalid value for `{{name}}`, must be a value greater than or equal to `{{minimum}}`") - {{/minimum}} - {{#pattern}} - #if not re.match('/[a-z]/i', {{name}}): - # raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{pattern}}`") - {{/pattern}} - {{/hasValidation}} - {{/isEnum}} +{{/minimum}} +{{#pattern}} + if not re.match('{{pattern}}', {{name}}): + raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{pattern}}`") +{{/pattern}} +{{/hasValidation}} +{{/isEnum}} + self._{{name}} = {{name}} {{/vars}} diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 6640785fae99..990d5e53651a 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-27T22:50:21.115+01:00 +- Build date: 2016-05-06T22:43:12.044+01:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -18,9 +18,9 @@ Python 2.7 and 3.4+ If the python package is hosted on Github, you can install directly from Github ```sh -pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git ``` -(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git`) +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) Then import the package: ```python diff --git a/samples/client/petstore/python/git_push.sh b/samples/client/petstore/python/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/python/git_push.sh +++ b/samples/client/petstore/python/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/python/swagger_client/apis/fake_api.py b/samples/client/petstore/python/swagger_client/apis/fake_api.py index 2b183794ef16..ba79874f6c70 100644 --- a/samples/client/petstore/python/swagger_client/apis/fake_api.py +++ b/samples/client/petstore/python/swagger_client/apis/fake_api.py @@ -21,6 +21,7 @@ from __future__ import absolute_import import sys import os +import re # python 2 and python 3 compatibility library from six import iteritems @@ -103,6 +104,31 @@ class FakeApi(object): if ('byte' not in params) or (params['byte'] is None): raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") + if 'number' in params and params['number'] > 543.2: + raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") + if 'number' in params and params['number'] < 32.1: + raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") + if 'double' in params and params['double'] > 123.4: + raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") + if 'double' in params and params['double'] < 67.8: + raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") + if 'string' in params and not re.match('[a-z]+', params['string']): + raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `[a-z]+`") + if 'integer' in params and params['integer'] > 100.0: + raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100.0`") + if 'integer' in params and params['integer'] < 10.0: + raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10.0`") + if 'int32' in params and params['int32'] > 200.0: + raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200.0`") + if 'int32' in params and params['int32'] < 20.0: + raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20.0`") + if 'float' in params and params['float'] > 987.6: + raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") + if 'password' in params and len(params['password']) > 64: + raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") + if 'password' in params and len(params['password']) < 10: + raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") + resource_path = '/fake'.replace('{format}', 'json') path_params = {} diff --git a/samples/client/petstore/python/swagger_client/apis/pet_api.py b/samples/client/petstore/python/swagger_client/apis/pet_api.py index cab854e30197..3b6d9ba82fed 100644 --- a/samples/client/petstore/python/swagger_client/apis/pet_api.py +++ b/samples/client/petstore/python/swagger_client/apis/pet_api.py @@ -21,6 +21,7 @@ from __future__ import absolute_import import sys import os +import re # python 2 and python 3 compatibility library from six import iteritems @@ -83,6 +84,7 @@ class PetApi(object): if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `add_pet`") + resource_path = '/pet'.replace('{format}', 'json') path_params = {} @@ -161,6 +163,7 @@ class PetApi(object): if ('pet_id' not in params) or (params['pet_id'] is None): raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") + resource_path = '/pet/{petId}'.replace('{format}', 'json') path_params = {} if 'pet_id' in params: @@ -240,6 +243,7 @@ class PetApi(object): if ('status' not in params) or (params['status'] is None): raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") + resource_path = '/pet/findByStatus'.replace('{format}', 'json') path_params = {} @@ -317,6 +321,7 @@ class PetApi(object): if ('tags' not in params) or (params['tags'] is None): raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") + resource_path = '/pet/findByTags'.replace('{format}', 'json') path_params = {} @@ -394,6 +399,7 @@ class PetApi(object): if ('pet_id' not in params) or (params['pet_id'] is None): raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") + resource_path = '/pet/{petId}'.replace('{format}', 'json') path_params = {} if 'pet_id' in params: @@ -471,6 +477,7 @@ class PetApi(object): if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `update_pet`") + resource_path = '/pet'.replace('{format}', 'json') path_params = {} @@ -550,6 +557,7 @@ class PetApi(object): if ('pet_id' not in params) or (params['pet_id'] is None): raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") + resource_path = '/pet/{petId}'.replace('{format}', 'json') path_params = {} if 'pet_id' in params: @@ -633,6 +641,7 @@ class PetApi(object): if ('pet_id' not in params) or (params['pet_id'] is None): raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") + resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json') path_params = {} if 'pet_id' in params: diff --git a/samples/client/petstore/python/swagger_client/apis/store_api.py b/samples/client/petstore/python/swagger_client/apis/store_api.py index 9391a6a60963..352ab7eae63b 100644 --- a/samples/client/petstore/python/swagger_client/apis/store_api.py +++ b/samples/client/petstore/python/swagger_client/apis/store_api.py @@ -21,6 +21,7 @@ from __future__ import absolute_import import sys import os +import re # python 2 and python 3 compatibility library from six import iteritems @@ -83,6 +84,9 @@ class StoreApi(object): if ('order_id' not in params) or (params['order_id'] is None): raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") + if 'order_id' in params and params['order_id'] < 1.0: + raise ValueError("Invalid value for parameter `order_id` when calling `delete_order`, must be a value greater than or equal to `1.0`") + resource_path = '/store/order/{orderId}'.replace('{format}', 'json') path_params = {} if 'order_id' in params: @@ -156,6 +160,7 @@ class StoreApi(object): del params['kwargs'] + resource_path = '/store/inventory'.replace('{format}', 'json') path_params = {} @@ -231,6 +236,11 @@ class StoreApi(object): if ('order_id' not in params) or (params['order_id'] is None): raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") + if 'order_id' in params and params['order_id'] > 5.0: + raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5.0`") + if 'order_id' in params and params['order_id'] < 1.0: + raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1.0`") + resource_path = '/store/order/{orderId}'.replace('{format}', 'json') path_params = {} if 'order_id' in params: @@ -308,6 +318,7 @@ class StoreApi(object): if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `place_order`") + resource_path = '/store/order'.replace('{format}', 'json') path_params = {} diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/swagger_client/apis/user_api.py index 733a950f3933..d5df6f0f5417 100644 --- a/samples/client/petstore/python/swagger_client/apis/user_api.py +++ b/samples/client/petstore/python/swagger_client/apis/user_api.py @@ -21,6 +21,7 @@ from __future__ import absolute_import import sys import os +import re # python 2 and python 3 compatibility library from six import iteritems @@ -83,6 +84,7 @@ class UserApi(object): if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `create_user`") + resource_path = '/user'.replace('{format}', 'json') path_params = {} @@ -160,6 +162,7 @@ class UserApi(object): if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") + resource_path = '/user/createWithArray'.replace('{format}', 'json') path_params = {} @@ -237,6 +240,7 @@ class UserApi(object): if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") + resource_path = '/user/createWithList'.replace('{format}', 'json') path_params = {} @@ -314,6 +318,7 @@ class UserApi(object): if ('username' not in params) or (params['username'] is None): raise ValueError("Missing the required parameter `username` when calling `delete_user`") + resource_path = '/user/{username}'.replace('{format}', 'json') path_params = {} if 'username' in params: @@ -391,6 +396,7 @@ class UserApi(object): if ('username' not in params) or (params['username'] is None): raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") + resource_path = '/user/{username}'.replace('{format}', 'json') path_params = {} if 'username' in params: @@ -472,6 +478,7 @@ class UserApi(object): if ('password' not in params) or (params['password'] is None): raise ValueError("Missing the required parameter `password` when calling `login_user`") + resource_path = '/user/login'.replace('{format}', 'json') path_params = {} @@ -547,6 +554,7 @@ class UserApi(object): del params['kwargs'] + resource_path = '/user/logout'.replace('{format}', 'json') path_params = {} @@ -626,6 +634,7 @@ class UserApi(object): if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `update_user`") + resource_path = '/user/{username}'.replace('{format}', 'json') path_params = {} if 'username' in params: diff --git a/samples/client/petstore/python/swagger_client/models/animal.py b/samples/client/petstore/python/swagger_client/models/animal.py index 762e3df5b374..0ae8f2b4bde0 100644 --- a/samples/client/petstore/python/swagger_client/models/animal.py +++ b/samples/client/petstore/python/swagger_client/models/animal.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Animal(object): @@ -66,6 +67,7 @@ class Animal(object): :param class_name: The class_name of this Animal. :type: str """ + self._class_name = class_name def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/api_response.py b/samples/client/petstore/python/swagger_client/models/api_response.py index c49bde7fbc6a..918b4a982237 100644 --- a/samples/client/petstore/python/swagger_client/models/api_response.py +++ b/samples/client/petstore/python/swagger_client/models/api_response.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class ApiResponse(object): @@ -72,6 +73,7 @@ class ApiResponse(object): :param code: The code of this ApiResponse. :type: int """ + self._code = code @property @@ -94,6 +96,7 @@ class ApiResponse(object): :param type: The type of this ApiResponse. :type: str """ + self._type = type @property @@ -116,6 +119,7 @@ class ApiResponse(object): :param message: The message of this ApiResponse. :type: str """ + self._message = message def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/cat.py b/samples/client/petstore/python/swagger_client/models/cat.py index 4744fc4821cd..fd2e5e4fce45 100644 --- a/samples/client/petstore/python/swagger_client/models/cat.py +++ b/samples/client/petstore/python/swagger_client/models/cat.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Cat(object): @@ -69,6 +70,7 @@ class Cat(object): :param class_name: The class_name of this Cat. :type: str """ + self._class_name = class_name @property @@ -91,6 +93,7 @@ class Cat(object): :param declawed: The declawed of this Cat. :type: bool """ + self._declawed = declawed def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/category.py b/samples/client/petstore/python/swagger_client/models/category.py index b8d540c51bd4..e4f4a993cab0 100644 --- a/samples/client/petstore/python/swagger_client/models/category.py +++ b/samples/client/petstore/python/swagger_client/models/category.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Category(object): @@ -69,6 +70,7 @@ class Category(object): :param id: The id of this Category. :type: int """ + self._id = id @property @@ -91,6 +93,7 @@ class Category(object): :param name: The name of this Category. :type: str """ + self._name = name def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/dog.py b/samples/client/petstore/python/swagger_client/models/dog.py index 3885dd314ef0..ac25ef018077 100644 --- a/samples/client/petstore/python/swagger_client/models/dog.py +++ b/samples/client/petstore/python/swagger_client/models/dog.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Dog(object): @@ -69,6 +70,7 @@ class Dog(object): :param class_name: The class_name of this Dog. :type: str """ + self._class_name = class_name @property @@ -91,6 +93,7 @@ class Dog(object): :param breed: The breed of this Dog. :type: str """ + self._breed = breed def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/format_test.py b/samples/client/petstore/python/swagger_client/models/format_test.py index 28f348edf047..eee1b5c9ef73 100644 --- a/samples/client/petstore/python/swagger_client/models/format_test.py +++ b/samples/client/petstore/python/swagger_client/models/format_test.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class FormatTest(object): @@ -102,6 +103,14 @@ class FormatTest(object): :param integer: The integer of this FormatTest. :type: int """ + + if not integer: + raise ValueError("Invalid value for `integer`, must not be `None`") + if integer > 100.0: + raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100.0`") + if integer < 10.0: + raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10.0`") + self._integer = integer @property @@ -124,6 +133,14 @@ class FormatTest(object): :param int32: The int32 of this FormatTest. :type: int """ + + if not int32: + raise ValueError("Invalid value for `int32`, must not be `None`") + if int32 > 200.0: + raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200.0`") + if int32 < 20.0: + raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20.0`") + self._int32 = int32 @property @@ -146,6 +163,7 @@ class FormatTest(object): :param int64: The int64 of this FormatTest. :type: int """ + self._int64 = int64 @property @@ -168,6 +186,14 @@ class FormatTest(object): :param number: The number of this FormatTest. :type: float """ + + if not number: + raise ValueError("Invalid value for `number`, must not be `None`") + if number > 543.2: + raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`") + if number < 32.1: + raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") + self._number = number @property @@ -190,6 +216,14 @@ class FormatTest(object): :param float: The float of this FormatTest. :type: float """ + + if not float: + raise ValueError("Invalid value for `float`, must not be `None`") + if float > 987.6: + raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`") + if float < 54.3: + raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") + self._float = float @property @@ -212,6 +246,14 @@ class FormatTest(object): :param double: The double of this FormatTest. :type: float """ + + if not double: + raise ValueError("Invalid value for `double`, must not be `None`") + if double > 123.4: + raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`") + if double < 67.8: + raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") + self._double = double @property @@ -234,6 +276,12 @@ class FormatTest(object): :param string: The string of this FormatTest. :type: str """ + + if not string: + raise ValueError("Invalid value for `string`, must not be `None`") + if not re.match('/[a-z]/i', string): + raise ValueError("Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") + self._string = string @property @@ -256,6 +304,7 @@ class FormatTest(object): :param byte: The byte of this FormatTest. :type: str """ + self._byte = byte @property @@ -278,6 +327,7 @@ class FormatTest(object): :param binary: The binary of this FormatTest. :type: str """ + self._binary = binary @property @@ -300,6 +350,7 @@ class FormatTest(object): :param date: The date of this FormatTest. :type: date """ + self._date = date @property @@ -322,6 +373,7 @@ class FormatTest(object): :param date_time: The date_time of this FormatTest. :type: datetime """ + self._date_time = date_time @property @@ -344,6 +396,7 @@ class FormatTest(object): :param uuid: The uuid of this FormatTest. :type: str """ + self._uuid = uuid @property @@ -366,6 +419,14 @@ class FormatTest(object): :param password: The password of this FormatTest. :type: str """ + + if not password: + raise ValueError("Invalid value for `password`, must not be `None`") + if len(password) > 64: + raise ValueError("Invalid value for `password`, length must be less than `64`") + if len(password) < 10: + raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") + self._password = password def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/model_200_response.py b/samples/client/petstore/python/swagger_client/models/model_200_response.py index 681de963e6e1..f99847cbdd57 100644 --- a/samples/client/petstore/python/swagger_client/models/model_200_response.py +++ b/samples/client/petstore/python/swagger_client/models/model_200_response.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Model200Response(object): @@ -66,6 +67,7 @@ class Model200Response(object): :param name: The name of this Model200Response. :type: int """ + self._name = name def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/model_return.py b/samples/client/petstore/python/swagger_client/models/model_return.py index 75b46259d6fa..8228f41943c6 100644 --- a/samples/client/petstore/python/swagger_client/models/model_return.py +++ b/samples/client/petstore/python/swagger_client/models/model_return.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class ModelReturn(object): @@ -66,6 +67,7 @@ class ModelReturn(object): :param _return: The _return of this ModelReturn. :type: int """ + self.__return = _return def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/name.py b/samples/client/petstore/python/swagger_client/models/name.py index 4fbf1a03211c..51345d131ffb 100644 --- a/samples/client/petstore/python/swagger_client/models/name.py +++ b/samples/client/petstore/python/swagger_client/models/name.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Name(object): @@ -72,6 +73,7 @@ class Name(object): :param name: The name of this Name. :type: int """ + self._name = name @property @@ -94,6 +96,7 @@ class Name(object): :param snake_case: The snake_case of this Name. :type: int """ + self._snake_case = snake_case @property @@ -116,6 +119,7 @@ class Name(object): :param _property: The _property of this Name. :type: str """ + self.__property = _property def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/order.py b/samples/client/petstore/python/swagger_client/models/order.py index 8fe90765e034..07f2c627d913 100644 --- a/samples/client/petstore/python/swagger_client/models/order.py +++ b/samples/client/petstore/python/swagger_client/models/order.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Order(object): @@ -81,6 +82,7 @@ class Order(object): :param id: The id of this Order. :type: int """ + self._id = id @property @@ -103,6 +105,7 @@ class Order(object): :param pet_id: The pet_id of this Order. :type: int """ + self._pet_id = pet_id @property @@ -125,6 +128,7 @@ class Order(object): :param quantity: The quantity of this Order. :type: int """ + self._quantity = quantity @property @@ -147,6 +151,7 @@ class Order(object): :param ship_date: The ship_date of this Order. :type: datetime """ + self._ship_date = ship_date @property @@ -175,6 +180,7 @@ class Order(object): "Invalid value for `status`, must be one of {0}" .format(allowed_values) ) + self._status = status @property @@ -197,6 +203,7 @@ class Order(object): :param complete: The complete of this Order. :type: bool """ + self._complete = complete def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/pet.py b/samples/client/petstore/python/swagger_client/models/pet.py index dfa614b1e9b7..60f762238f3a 100644 --- a/samples/client/petstore/python/swagger_client/models/pet.py +++ b/samples/client/petstore/python/swagger_client/models/pet.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Pet(object): @@ -81,6 +82,7 @@ class Pet(object): :param id: The id of this Pet. :type: int """ + self._id = id @property @@ -103,6 +105,7 @@ class Pet(object): :param category: The category of this Pet. :type: Category """ + self._category = category @property @@ -125,6 +128,7 @@ class Pet(object): :param name: The name of this Pet. :type: str """ + self._name = name @property @@ -147,6 +151,7 @@ class Pet(object): :param photo_urls: The photo_urls of this Pet. :type: list[str] """ + self._photo_urls = photo_urls @property @@ -169,6 +174,7 @@ class Pet(object): :param tags: The tags of this Pet. :type: list[Tag] """ + self._tags = tags @property @@ -197,6 +203,7 @@ class Pet(object): "Invalid value for `status`, must be one of {0}" .format(allowed_values) ) + self._status = status def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/special_model_name.py b/samples/client/petstore/python/swagger_client/models/special_model_name.py index 191798d7d9a9..3e45c0e44963 100644 --- a/samples/client/petstore/python/swagger_client/models/special_model_name.py +++ b/samples/client/petstore/python/swagger_client/models/special_model_name.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class SpecialModelName(object): @@ -66,6 +67,7 @@ class SpecialModelName(object): :param special_property_name: The special_property_name of this SpecialModelName. :type: int """ + self._special_property_name = special_property_name def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/tag.py b/samples/client/petstore/python/swagger_client/models/tag.py index 50f829d65e3b..f09a4c36df31 100644 --- a/samples/client/petstore/python/swagger_client/models/tag.py +++ b/samples/client/petstore/python/swagger_client/models/tag.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class Tag(object): @@ -69,6 +70,7 @@ class Tag(object): :param id: The id of this Tag. :type: int """ + self._id = id @property @@ -91,6 +93,7 @@ class Tag(object): :param name: The name of this Tag. :type: str """ + self._name = name def to_dict(self): diff --git a/samples/client/petstore/python/swagger_client/models/user.py b/samples/client/petstore/python/swagger_client/models/user.py index fd6d16824b3f..87d132a5037a 100644 --- a/samples/client/petstore/python/swagger_client/models/user.py +++ b/samples/client/petstore/python/swagger_client/models/user.py @@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software from pprint import pformat from six import iteritems +import re class User(object): @@ -87,6 +88,7 @@ class User(object): :param id: The id of this User. :type: int """ + self._id = id @property @@ -109,6 +111,7 @@ class User(object): :param username: The username of this User. :type: str """ + self._username = username @property @@ -131,6 +134,7 @@ class User(object): :param first_name: The first_name of this User. :type: str """ + self._first_name = first_name @property @@ -153,6 +157,7 @@ class User(object): :param last_name: The last_name of this User. :type: str """ + self._last_name = last_name @property @@ -175,6 +180,7 @@ class User(object): :param email: The email of this User. :type: str """ + self._email = email @property @@ -197,6 +203,7 @@ class User(object): :param password: The password of this User. :type: str """ + self._password = password @property @@ -219,6 +226,7 @@ class User(object): :param phone: The phone of this User. :type: str """ + self._phone = phone @property @@ -241,6 +249,7 @@ class User(object): :param user_status: The user_status of this User. :type: int """ + self._user_status = user_status def to_dict(self): From bff6c8bab4ffb04815e69d79ca5bd4b5195471f1 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 7 May 2016 08:47:30 +0800 Subject: [PATCH 130/170] add bitly --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c1617b9b79e7..8eca8ecd53ed 100644 --- a/README.md +++ b/README.md @@ -763,6 +763,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [Acunetix](https://www.acunetix.com/) - [Atlassian](https://www.atlassian.com/) - [beemo](http://www.beemo.eu) +- [bitly](https://bitly.com) - [Cachet Financial](http://www.cachetfinancial.com/) - [CloudBoost](https://www.CloudBoost.io/) - [Cupix](http://www.cupix.com) From 3629fbac44d7e36776f411136d70c0421dd779b9 Mon Sep 17 00:00:00 2001 From: zhenjun115 Date: Sat, 7 May 2016 14:12:19 +0800 Subject: [PATCH 131/170] add pom.mustache for android api client(using volley HTTP library);update android api client samples(using volley HTTP library); --- .../languages/AndroidClientCodegen.java | 2 +- .../android/libraries/volley/pom.mustache | 48 +++++++++++++++++++ .../client/petstore/android/volley/pom.xml | 17 +++++-- 3 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java index c0bead5c695c..324453991e0a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java @@ -317,7 +317,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi } private void addSupportingFilesForVolley() { - // supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); + supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); // supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle")); supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle")); supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml")); diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache new file mode 100644 index 000000000000..09f55a743a77 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache @@ -0,0 +1,48 @@ + + + 4.0.0 + io.swagger + volley + 1.0.0 + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + compile + + + org.apache.httpcomponents + httpcore + ${httpcomponents-httpcore-version} + compile + + + org.apache.httpcomponents + httpmime + ${httpcomponents-httpmime-version} + compile + + + com.google.code.gson + gson + ${google-code-gson-version} + compile + + + com.mcxiaoke.volley + library + ${volley-library-version} + aar + compile + + + + 1.5.0 + 4.4.4 + 4.5.2 + 2.3.1 + 1.0.19 + + diff --git a/samples/client/petstore/android/volley/pom.xml b/samples/client/petstore/android/volley/pom.xml index 2a3b8ef2f967..09f55a743a77 100644 --- a/samples/client/petstore/android/volley/pom.xml +++ b/samples/client/petstore/android/volley/pom.xml @@ -9,33 +9,40 @@ io.swagger swagger-annotations - 1.5.0 + ${swagger-annotations-version} compile org.apache.httpcomponents httpcore - 4.4.4 + ${httpcomponents-httpcore-version} compile org.apache.httpcomponents httpmime - 4.5.2 + ${httpcomponents-httpmime-version} compile com.google.code.gson gson - 2.3.1 + ${google-code-gson-version} compile com.mcxiaoke.volley library - 1.0.19 + ${volley-library-version} aar compile + + 1.5.0 + 4.4.4 + 4.5.2 + 2.3.1 + 1.0.19 + From 101f9a4086a795f970cdf999b5cda29207f6eb83 Mon Sep 17 00:00:00 2001 From: zhenjun115 Date: Sat, 7 May 2016 14:33:47 +0800 Subject: [PATCH 132/170] add generated markdown files to android api client for default and volley; --- .../languages/AndroidClientCodegen.java | 101 +++++ .../main/resources/android/README.mustache | 125 ++++++ .../main/resources/android/api_doc.mustache | 60 +++ .../main/resources/android/model_doc.mustache | 3 + .../main/resources/android/pojo_doc.mustache | 15 + .../client/petstore/android/default/README.md | 142 +++++++ .../petstore/android/default/docs/Category.md | 11 + .../petstore/android/default/docs/Order.md | 21 + .../petstore/android/default/docs/Pet.md | 21 + .../petstore/android/default/docs/PetApi.md | 365 ++++++++++++++++++ .../petstore/android/default/docs/StoreApi.md | 179 +++++++++ .../petstore/android/default/docs/Tag.md | 11 + .../petstore/android/default/docs/User.md | 17 + .../petstore/android/default/docs/UserApi.md | 354 +++++++++++++++++ .../petstore/android/default/git_push.sh | 4 +- .../client/petstore/android/volley/README.md | 142 +++++++ .../petstore/android/volley/docs/Category.md | 11 + .../petstore/android/volley/docs/Order.md | 21 + .../petstore/android/volley/docs/Pet.md | 21 + .../petstore/android/volley/docs/PetApi.md | 365 ++++++++++++++++++ .../petstore/android/volley/docs/StoreApi.md | 179 +++++++++ .../petstore/android/volley/docs/Tag.md | 11 + .../petstore/android/volley/docs/User.md | 17 + .../petstore/android/volley/docs/UserApi.md | 354 +++++++++++++++++ 24 files changed, 2548 insertions(+), 2 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/android/README.mustache create mode 100644 modules/swagger-codegen/src/main/resources/android/api_doc.mustache create mode 100644 modules/swagger-codegen/src/main/resources/android/model_doc.mustache create mode 100644 modules/swagger-codegen/src/main/resources/android/pojo_doc.mustache create mode 100644 samples/client/petstore/android/default/README.md create mode 100644 samples/client/petstore/android/default/docs/Category.md create mode 100644 samples/client/petstore/android/default/docs/Order.md create mode 100644 samples/client/petstore/android/default/docs/Pet.md create mode 100644 samples/client/petstore/android/default/docs/PetApi.md create mode 100644 samples/client/petstore/android/default/docs/StoreApi.md create mode 100644 samples/client/petstore/android/default/docs/Tag.md create mode 100644 samples/client/petstore/android/default/docs/User.md create mode 100644 samples/client/petstore/android/default/docs/UserApi.md create mode 100644 samples/client/petstore/android/volley/README.md create mode 100644 samples/client/petstore/android/volley/docs/Category.md create mode 100644 samples/client/petstore/android/volley/docs/Order.md create mode 100644 samples/client/petstore/android/volley/docs/Pet.md create mode 100644 samples/client/petstore/android/volley/docs/PetApi.md create mode 100644 samples/client/petstore/android/volley/docs/StoreApi.md create mode 100644 samples/client/petstore/android/volley/docs/Tag.md create mode 100644 samples/client/petstore/android/volley/docs/User.md create mode 100644 samples/client/petstore/android/volley/docs/UserApi.md diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java index 324453991e0a..0d021eba9f9c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java @@ -3,6 +3,7 @@ package io.swagger.codegen.languages; import io.swagger.codegen.CliOption; import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.CodegenParameter; import io.swagger.codegen.CodegenType; import io.swagger.codegen.DefaultCodegen; import io.swagger.codegen.SupportingFile; @@ -32,6 +33,8 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi // requestPackage and authPackage are used by the "volley" template/library protected String requestPackage = "io.swagger.client.request"; protected String authPackage = "io.swagger.client.auth"; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; public AndroidClientCodegen() { super(); @@ -123,6 +126,26 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar); } + @Override + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace( '/', File.separatorChar ); + } + + @Override + public String modelDocFileFolder() { + return ( outputFolder + "/" + modelDocPath ).replace( '/', File.separatorChar ); + } + + @Override + public String toApiDocFilename( String name ) { + return toApiName( name ); + } + + @Override + public String toModelDocFilename( String name ) { + return toModelName( name ); + } + @Override public String getTypeDeclaration(Property p) { if (p instanceof ArrayProperty) { @@ -224,6 +247,70 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi return toModelName(name); } + @Override + public void setParameterExampleValue(CodegenParameter p) { + String example; + + if (p.defaultValue == null) { + example = p.example; + } else { + example = p.defaultValue; + } + + String type = p.baseType; + if (type == null) { + type = p.dataType; + } + + if ("String".equals(type)) { + if (example == null) { + example = p.paramName + "_example"; + } + example = "\"" + escapeText(example) + "\""; + } else if ("Integer".equals(type) || "Short".equals(type)) { + if (example == null) { + example = "56"; + } + } else if ("Long".equals(type)) { + if (example == null) { + example = "56"; + } + example = example + "L"; + } else if ("Float".equals(type)) { + if (example == null) { + example = "3.4"; + } + example = example + "F"; + } else if ("Double".equals(type)) { + example = "3.4"; + example = example + "D"; + } else if ("Boolean".equals(type)) { + if (example == null) { + example = "true"; + } + } else if ("File".equals(type)) { + if (example == null) { + example = "/path/to/file"; + } + example = "new File(\"" + escapeText(example) + "\")"; + } else if ("Date".equals(type)) { + example = "new Date()"; + } else if (!languageSpecificPrimitives.contains(type)) { + // type is a model class, e.g. User + example = "new " + type + "()"; + } + + if (example == null) { + example = "null"; + } else if (Boolean.TRUE.equals(p.isListContainer)) { + example = "Arrays.asList(" + example + ")"; + } else if (Boolean.TRUE.equals(p.isMapContainer)) { + example = "new HashMap()"; + } + + p.example = example; + } + @Override public String toOperationId(String operationId) { // throw exception if method name is empty @@ -290,9 +377,23 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi this.setLibrary((String) additionalProperties.get(CodegenConstants.LIBRARY)); } + //make api and model doc path available in mustache template + additionalProperties.put( "apiDocPath", apiDocPath ); + additionalProperties.put( "modelDocPath", modelDocPath ); + if (StringUtils.isEmpty(getLibrary())) { + modelDocTemplateFiles.put( "model_doc.mustache", ".md" ); + apiDocTemplateFiles.put( "api_doc.mustache", ".md" ); + //supportingFiles.add(new SupportingFile("api_doc.mustache", apiDocPath, "api.md")); + //supportingFiles.add(new SupportingFile("model_doc.mustache", modelDocPath, "model.md")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); addSupportingFilesForDefault(); } else if ("volley".equals(getLibrary())) { + modelDocTemplateFiles.put( "model_doc.mustache", ".md" ); + apiDocTemplateFiles.put( "api_doc.mustache", ".md" ); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + //supportingFiles.add(new SupportingFile("api_doc.mustache", apiDocPath, "api.md")); + //supportingFiles.add(new SupportingFile("model_doc.mustache", modelDocPath, "model.md")); addSupportingFilesForVolley(); } } diff --git a/modules/swagger-codegen/src/main/resources/android/README.mustache b/modules/swagger-codegen/src/main/resources/android/README.mustache new file mode 100644 index 000000000000..8091b0adb063 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/android/README.mustache @@ -0,0 +1,125 @@ +# {{artifactId}} + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + {{{groupId}}} + {{{artifactId}}} + {{{artifactVersion}}} + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" +``` + +### Others + +At first generate the JAR by executing: + + mvn package + +Then manually install the following JARs: + +* target/{{{artifactId}}}-{{{artifactVersion}}}.jar +* target/lib/*.jar + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +import {{{package}}}.{{{classname}}}; + +public class {{{classname}}}Example { + + public static void main(String[] args) { + {{{classname}}} apiInstance = new {{{classname}}}(); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + e.printStackTrace(); + } + } +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation for Models + +{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) +{{/model}}{{/models}} + +## Documentation for Authorization + +{{^authMethods}}All endpoints do not require authorization. +{{/authMethods}}Authentication schemes defined for the API: +{{#authMethods}}### {{name}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorizatoin URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/android/api_doc.mustache b/modules/swagger-codegen/src/main/resources/android/api_doc.mustache new file mode 100644 index 000000000000..2fdcab749ab2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/android/api_doc.mustache @@ -0,0 +1,60 @@ +# {{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} + +# **{{operationId}}** +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + +{{summary}}{{#notes}} + +{{notes}}{{/notes}} + +### Example +```java +// Import classes: +//import {{{package}}}.{{{classname}}}; + +{{{classname}}} apiInstance = new {{{classname}}}(); +{{#allParams}} +{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} +try { + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + System.out.println(result);{{/returnType}} +} catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + e.printStackTrace(); +} +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/android/model_doc.mustache b/modules/swagger-codegen/src/main/resources/android/model_doc.mustache new file mode 100644 index 000000000000..658df8d53225 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/android/model_doc.mustache @@ -0,0 +1,3 @@ +{{#models}}{{#model}} +{{#isEnum}}{{>enum_outer_doc}}{{/isEnum}}{{^isEnum}}{{>pojo_doc}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/android/pojo_doc.mustache b/modules/swagger-codegen/src/main/resources/android/pojo_doc.mustache new file mode 100644 index 000000000000..0e4c07498669 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/android/pojo_doc.mustache @@ -0,0 +1,15 @@ +# {{classname}} + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isEnum}}[**{{datatypeWithEnum}}**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#readOnly}} [readonly]{{/readOnly}} +{{/vars}} +{{#vars}}{{#isEnum}} + + +## Enum: {{datatypeWithEnum}} +Name | Value +---- | -----{{#allowableValues}}{{#enumVars}} +{{name}} | {{value}}{{/enumVars}}{{/allowableValues}} +{{/isEnum}}{{/vars}} diff --git a/samples/client/petstore/android/default/README.md b/samples/client/petstore/android/default/README.md new file mode 100644 index 000000000000..a1c37674b81d --- /dev/null +++ b/samples/client/petstore/android/default/README.md @@ -0,0 +1,142 @@ +# swagger-android-client + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + io.swagger + swagger-android-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "io.swagger:swagger-android-client:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + + mvn package + +Then manually install the following JARs: + +* target/swagger-android-client-1.0.0.jar +* target/lib/*.jar + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import io.swagger.client.api.PetApi; + +public class PetApiExample { + + public static void main(String[] args) { + PetApi apiInstance = new PetApi(); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add 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* | [**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* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*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 +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. + +## Author + +apiteam@wordnik.com + diff --git a/samples/client/petstore/android/default/docs/Category.md b/samples/client/petstore/android/default/docs/Category.md new file mode 100644 index 000000000000..e2df08032787 --- /dev/null +++ b/samples/client/petstore/android/default/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/android/default/docs/Order.md b/samples/client/petstore/android/default/docs/Order.md new file mode 100644 index 000000000000..5746ce97fad3 --- /dev/null +++ b/samples/client/petstore/android/default/docs/Order.md @@ -0,0 +1,21 @@ + +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**Date**](Date.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- + + + diff --git a/samples/client/petstore/android/default/docs/Pet.md b/samples/client/petstore/android/default/docs/Pet.md new file mode 100644 index 000000000000..a4daa24feb60 --- /dev/null +++ b/samples/client/petstore/android/default/docs/Pet.md @@ -0,0 +1,21 @@ + +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- + + + diff --git a/samples/client/petstore/android/default/docs/PetApi.md b/samples/client/petstore/android/default/docs/PetApi.md new file mode 100644 index 000000000000..f8ba698c05af --- /dev/null +++ b/samples/client/petstore/android/default/docs/PetApi.md @@ -0,0 +1,365 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.addPet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | Pet id to delete +String apiKey = "apiKey_example"; // String | +try { + apiInstance.deletePet(petId, apiKey); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma seperated strings + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +List status = Arrays.asList("available"); // List | Status values that need to be considered for filter +try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [optional] [default to available] + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +List tags = Arrays.asList("tags_example"); // List | Tags to filter by +try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | [optional] + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet that needs to be fetched +try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet that needs to be fetched | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **updatePet** +> updatePet(body) + +Update an existing pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.updatePet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +String petId = "petId_example"; // String | ID of pet that needs to be updated +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet +try { + apiInstance.updatePetWithForm(petId, name, status); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **String**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json, application/xml + + +# **uploadFile** +> uploadFile(petId, additionalMetadata, file) + +uploads an image + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to update +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server +File file = new File("/path/to/file.txt"); // File | file to upload +try { + apiInstance.uploadFile(petId, additionalMetadata, file); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json, application/xml + diff --git a/samples/client/petstore/android/default/docs/StoreApi.md b/samples/client/petstore/android/default/docs/StoreApi.md new file mode 100644 index 000000000000..5d35bca0202f --- /dev/null +++ b/samples/client/petstore/android/default/docs/StoreApi.md @@ -0,0 +1,179 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```java +// Import classes: +//import io.swagger.client.api.StoreApi; + +StoreApi apiInstance = new StoreApi(); +String orderId = "orderId_example"; // String | ID of the order that needs to be deleted +try { + apiInstance.deleteOrder(orderId); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +//import io.swagger.client.api.StoreApi; + +StoreApi apiInstance = new StoreApi(); +try { + Map result = apiInstance.getInventory(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Map<String, Integer>**](Map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```java +// Import classes: +//import io.swagger.client.api.StoreApi; + +StoreApi apiInstance = new StoreApi(); +String orderId = "orderId_example"; // String | ID of pet that needs to be fetched +try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.StoreApi; + +StoreApi apiInstance = new StoreApi(); +Order body = new Order(); // Order | order placed for purchasing the pet +try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + diff --git a/samples/client/petstore/android/default/docs/Tag.md b/samples/client/petstore/android/default/docs/Tag.md new file mode 100644 index 000000000000..de6814b55d57 --- /dev/null +++ b/samples/client/petstore/android/default/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/android/default/docs/User.md b/samples/client/petstore/android/default/docs/User.md new file mode 100644 index 000000000000..8b6753dd284a --- /dev/null +++ b/samples/client/petstore/android/default/docs/User.md @@ -0,0 +1,17 @@ + +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **Integer** | User Status | [optional] + + + diff --git a/samples/client/petstore/android/default/docs/UserApi.md b/samples/client/petstore/android/default/docs/UserApi.md new file mode 100644 index 000000000000..f87e8f58827c --- /dev/null +++ b/samples/client/petstore/android/default/docs/UserApi.md @@ -0,0 +1,354 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +User body = new User(); // User | Created user object +try { + apiInstance.createUser(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithArrayInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithListInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be deleted +try { + apiInstance.deleteUser(username); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +try { + User result = apiInstance.getUserByName(username); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The user name for login +String password = "password_example"; // String | The password for login in clear text +try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | [optional] + **password** | **String**| The password for login in clear text | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +try { + apiInstance.logoutUser(); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | name that need to be deleted +User body = new User(); // User | Updated user object +try { + apiInstance.updateUser(username, body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + diff --git a/samples/client/petstore/android/default/git_push.sh b/samples/client/petstore/android/default/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/android/default/git_push.sh +++ b/samples/client/petstore/android/default/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/android/volley/README.md b/samples/client/petstore/android/volley/README.md new file mode 100644 index 000000000000..6f0a2c65f922 --- /dev/null +++ b/samples/client/petstore/android/volley/README.md @@ -0,0 +1,142 @@ +# swagger-petstore-android-volley + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + io.swagger + swagger-petstore-android-volley + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "io.swagger:swagger-petstore-android-volley:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + + mvn package + +Then manually install the following JARs: + +* target/swagger-petstore-android-volley-1.0.0.jar +* target/lib/*.jar + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import io.swagger.client.api.PetApi; + +public class PetApiExample { + + public static void main(String[] args) { + PetApi apiInstance = new PetApi(); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add 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* | [**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* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*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 +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. + +## Author + +apiteam@wordnik.com + diff --git a/samples/client/petstore/android/volley/docs/Category.md b/samples/client/petstore/android/volley/docs/Category.md new file mode 100644 index 000000000000..e2df08032787 --- /dev/null +++ b/samples/client/petstore/android/volley/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/android/volley/docs/Order.md b/samples/client/petstore/android/volley/docs/Order.md new file mode 100644 index 000000000000..5746ce97fad3 --- /dev/null +++ b/samples/client/petstore/android/volley/docs/Order.md @@ -0,0 +1,21 @@ + +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**Date**](Date.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- + + + diff --git a/samples/client/petstore/android/volley/docs/Pet.md b/samples/client/petstore/android/volley/docs/Pet.md new file mode 100644 index 000000000000..a4daa24feb60 --- /dev/null +++ b/samples/client/petstore/android/volley/docs/Pet.md @@ -0,0 +1,21 @@ + +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- + + + diff --git a/samples/client/petstore/android/volley/docs/PetApi.md b/samples/client/petstore/android/volley/docs/PetApi.md new file mode 100644 index 000000000000..f8ba698c05af --- /dev/null +++ b/samples/client/petstore/android/volley/docs/PetApi.md @@ -0,0 +1,365 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.addPet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | Pet id to delete +String apiKey = "apiKey_example"; // String | +try { + apiInstance.deletePet(petId, apiKey); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma seperated strings + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +List status = Arrays.asList("available"); // List | Status values that need to be considered for filter +try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [optional] [default to available] + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +List tags = Arrays.asList("tags_example"); // List | Tags to filter by +try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | [optional] + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet that needs to be fetched +try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet that needs to be fetched | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **updatePet** +> updatePet(body) + +Update an existing pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.updatePet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +String petId = "petId_example"; // String | ID of pet that needs to be updated +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet +try { + apiInstance.updatePetWithForm(petId, name, status); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **String**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json, application/xml + + +# **uploadFile** +> uploadFile(petId, additionalMetadata, file) + +uploads an image + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.PetApi; + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to update +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server +File file = new File("/path/to/file.txt"); // File | file to upload +try { + apiInstance.uploadFile(petId, additionalMetadata, file); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json, application/xml + diff --git a/samples/client/petstore/android/volley/docs/StoreApi.md b/samples/client/petstore/android/volley/docs/StoreApi.md new file mode 100644 index 000000000000..5d35bca0202f --- /dev/null +++ b/samples/client/petstore/android/volley/docs/StoreApi.md @@ -0,0 +1,179 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```java +// Import classes: +//import io.swagger.client.api.StoreApi; + +StoreApi apiInstance = new StoreApi(); +String orderId = "orderId_example"; // String | ID of the order that needs to be deleted +try { + apiInstance.deleteOrder(orderId); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +//import io.swagger.client.api.StoreApi; + +StoreApi apiInstance = new StoreApi(); +try { + Map result = apiInstance.getInventory(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Map<String, Integer>**](Map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```java +// Import classes: +//import io.swagger.client.api.StoreApi; + +StoreApi apiInstance = new StoreApi(); +String orderId = "orderId_example"; // String | ID of pet that needs to be fetched +try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.StoreApi; + +StoreApi apiInstance = new StoreApi(); +Order body = new Order(); // Order | order placed for purchasing the pet +try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + diff --git a/samples/client/petstore/android/volley/docs/Tag.md b/samples/client/petstore/android/volley/docs/Tag.md new file mode 100644 index 000000000000..de6814b55d57 --- /dev/null +++ b/samples/client/petstore/android/volley/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/android/volley/docs/User.md b/samples/client/petstore/android/volley/docs/User.md new file mode 100644 index 000000000000..8b6753dd284a --- /dev/null +++ b/samples/client/petstore/android/volley/docs/User.md @@ -0,0 +1,17 @@ + +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **Integer** | User Status | [optional] + + + diff --git a/samples/client/petstore/android/volley/docs/UserApi.md b/samples/client/petstore/android/volley/docs/UserApi.md new file mode 100644 index 000000000000..f87e8f58827c --- /dev/null +++ b/samples/client/petstore/android/volley/docs/UserApi.md @@ -0,0 +1,354 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +User body = new User(); // User | Created user object +try { + apiInstance.createUser(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithArrayInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithListInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be deleted +try { + apiInstance.deleteUser(username); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +try { + User result = apiInstance.getUserByName(username); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The user name for login +String password = "password_example"; // String | The password for login in clear text +try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | [optional] + **password** | **String**| The password for login in clear text | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +try { + apiInstance.logoutUser(); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.api.UserApi; + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | name that need to be deleted +User body = new User(); // User | Updated user object +try { + apiInstance.updateUser(username, body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + From df1d36cf4799d32d0045ebf4f5d3646fcaf81929 Mon Sep 17 00:00:00 2001 From: abcsun Date: Sat, 7 May 2016 15:55:38 +0800 Subject: [PATCH 133/170] modify the properties from container array --- .../src/main/resources/php/model.mustache | 28 ++++---- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../SwaggerClient-php/lib/Model/Animal.php | 4 +- .../SwaggerClient-php/lib/Model/EnumTest.php | 12 ++-- .../lib/Model/FormatTest.php | 68 +++++++++---------- .../php/SwaggerClient-php/lib/Model/Name.php | 4 +- .../php/SwaggerClient-php/lib/Model/Order.php | 4 +- .../php/SwaggerClient-php/lib/Model/Pet.php | 12 ++-- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index c62a7a14e434..34aaa63393ce 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -164,36 +164,36 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple { $invalid_properties = array(); {{#vars}}{{#required}} - if ($this->{{name}} === null) { + if ($this->container['{{name}}'] === null) { $invalid_properties[] = "'${{name}}' can't be null"; }{{/required}} {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); - if (!in_array($this->{{name}}, $allowed_values))) { + if (!in_array($this->container['{{name}}'], $allowed_values))) { $invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}."; }{{/isEnum}} {{#hasValidation}} {{#maxLength}} - if (strlen($this->{{name}}) > {{maxLength}}) { + if (strlen($this->container['{{name}}']) > {{maxLength}}) { $invalid_properties[] = "invalid value for '${{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; } {{/maxLength}} {{#minLength}} - if (strlen($this->{{name}}) < {{minLength}}) { + if (strlen($this->container['{{name}}']) < {{minLength}}) { $invalid_properties[] = "invalid value for '${{name}}', the character length must be bigger than or equal to {{{minLength}}}."; } {{/minLength}} {{#maximum}} - if ($this->{{name}} > {{maximum}}) { + if ($this->container['{{name}}'] > {{maximum}}) { $invalid_properties[] = "invalid value for '${{name}}', must be smaller than or equal to {{maximum}}."; } {{/maximum}} {{#minimum}} - if ($this->{{name}} < {{minimum}}) { + if ($this->container['{{name}}'] < {{minimum}}) { $invalid_properties[] = "invalid value for '${{name}}', must be bigger than or equal to {{minimum}}."; } {{/minimum}} {{#pattern}} - if (!preg_match("{{pattern}}", $this->{{name}})) { + if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { $invalid_properties[] = "invalid value for '${{name}}', must be conform to the pattern {{pattern}}."; } {{/pattern}}{{/hasValidation}}{{/vars}} @@ -209,36 +209,36 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple public function valid() { {{#vars}}{{#required}} - if ($this->{{name}} === null) { + if ($this->container['{{name}}'] === null) { return false; }{{/required}} {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); - if (!in_array($this->{{name}}, $allowed_values))) { + if (!in_array($this->container['{{name}}'], $allowed_values))) { return false; }{{/isEnum}} {{#hasValidation}} {{#maxLength}} - if (strlen($this->{{name}}) > {{maxLength}}) { + if (strlen($this->container['{{name}}']) > {{maxLength}}) { return false; } {{/maxLength}} {{#minLength}} - if (strlen($this->{{name}}) < {{minLength}}) { + if (strlen($this->container['{{name}}']) < {{minLength}}) { return false; } {{/minLength}} {{#maximum}} - if ($this->{{name}} > {{maximum}}) { + if ($this->container['{{name}}'] > {{maximum}}) { return false; } {{/maximum}} {{#minimum}} - if ($this->{{name}} < {{minimum}}) { + if ($this->container['{{name}}'] < {{minimum}}) { return false; } {{/minimum}} {{#pattern}} - if (!preg_match("{{pattern}}", $this->{{name}})) { + if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { return false; } {{/pattern}}{{/hasValidation}}{{/vars}} diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index e581145b26db..5917dc8a7d9f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-07T07:39:11.271Z +- Build date: 2016-05-07T07:50:05.452Z - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements 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 032d74d40e53..7c25695056e4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -143,7 +143,7 @@ class Animal implements ArrayAccess { $invalid_properties = array(); - if ($this->class_name === null) { + if ($this->container['class_name'] === null) { $invalid_properties[] = "'$class_name' can't be null"; } @@ -160,7 +160,7 @@ class Animal implements ArrayAccess public function valid() { - if ($this->class_name === null) { + if ($this->container['class_name'] === null) { return false; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index 2498f8629685..dce42791a04d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -206,17 +206,17 @@ class EnumTest implements ArrayAccess $invalid_properties = array(); $allowed_values = array("UPPER", "lower"); - if (!in_array($this->enum_string, $allowed_values))) { + if (!in_array($this->container['enum_string'], $allowed_values))) { $invalid_properties[] = "invalid value for '$enum_string', must be one of #{allowed_values}."; } $allowed_values = array("1", "-1"); - if (!in_array($this->enum_integer, $allowed_values))) { + if (!in_array($this->container['enum_integer'], $allowed_values))) { $invalid_properties[] = "invalid value for '$enum_integer', must be one of #{allowed_values}."; } $allowed_values = array("1.1", "-1.2"); - if (!in_array($this->enum_number, $allowed_values))) { + if (!in_array($this->container['enum_number'], $allowed_values))) { $invalid_properties[] = "invalid value for '$enum_number', must be one of #{allowed_values}."; } @@ -233,17 +233,17 @@ class EnumTest implements ArrayAccess { $allowed_values = array("UPPER", "lower"); - if (!in_array($this->enum_string, $allowed_values))) { + if (!in_array($this->container['enum_string'], $allowed_values))) { return false; } $allowed_values = array("1", "-1"); - if (!in_array($this->enum_integer, $allowed_values))) { + if (!in_array($this->container['enum_integer'], $allowed_values))) { return false; } $allowed_values = array("1.1", "-1.2"); - if (!in_array($this->enum_number, $allowed_values))) { + if (!in_array($this->container['enum_number'], $allowed_values))) { return false; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index d34dd167d324..7ab03733625e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -297,63 +297,63 @@ class FormatTest implements ArrayAccess $invalid_properties = array(); - if ($this->integer > 100.0) { + if ($this->container['integer'] > 100.0) { $invalid_properties[] = "invalid value for '$integer', must be smaller than or equal to 100.0."; } - if ($this->integer < 10.0) { + if ($this->container['integer'] < 10.0) { $invalid_properties[] = "invalid value for '$integer', must be bigger than or equal to 10.0."; } - if ($this->int32 > 200.0) { + if ($this->container['int32'] > 200.0) { $invalid_properties[] = "invalid value for '$int32', must be smaller than or equal to 200.0."; } - if ($this->int32 < 20.0) { + if ($this->container['int32'] < 20.0) { $invalid_properties[] = "invalid value for '$int32', must be bigger than or equal to 20.0."; } - if ($this->number === null) { + if ($this->container['number'] === null) { $invalid_properties[] = "'$number' can't be null"; } - if ($this->number > 543.2) { + if ($this->container['number'] > 543.2) { $invalid_properties[] = "invalid value for '$number', must be smaller than or equal to 543.2."; } - if ($this->number < 32.1) { + if ($this->container['number'] < 32.1) { $invalid_properties[] = "invalid value for '$number', must be bigger than or equal to 32.1."; } - if ($this->float > 987.6) { + if ($this->container['float'] > 987.6) { $invalid_properties[] = "invalid value for '$float', must be smaller than or equal to 987.6."; } - if ($this->float < 54.3) { + if ($this->container['float'] < 54.3) { $invalid_properties[] = "invalid value for '$float', must be bigger than or equal to 54.3."; } - if ($this->double > 123.4) { + if ($this->container['double'] > 123.4) { $invalid_properties[] = "invalid value for '$double', must be smaller than or equal to 123.4."; } - if ($this->double < 67.8) { + if ($this->container['double'] < 67.8) { $invalid_properties[] = "invalid value for '$double', must be bigger than or equal to 67.8."; } - if (!preg_match("/[a-z]/i", $this->string)) { + if (!preg_match("/[a-z]/i", $this->container['string'])) { $invalid_properties[] = "invalid value for '$string', must be conform to the pattern /[a-z]/i."; } - if ($this->byte === null) { + if ($this->container['byte'] === null) { $invalid_properties[] = "'$byte' can't be null"; } - if ($this->date === null) { + if ($this->container['date'] === null) { $invalid_properties[] = "'$date' can't be null"; } @@ -362,14 +362,14 @@ class FormatTest implements ArrayAccess - if ($this->password === null) { + if ($this->container['password'] === null) { $invalid_properties[] = "'$password' can't be null"; } - if (strlen($this->password) > 64) { + if (strlen($this->container['password']) > 64) { $invalid_properties[] = "invalid value for '$password', the character length must be smaller than or equal to 64."; } - if (strlen($this->password) < 10) { + if (strlen($this->container['password']) < 10) { $invalid_properties[] = "invalid value for '$password', the character length must be bigger than or equal to 10."; } @@ -386,63 +386,63 @@ class FormatTest implements ArrayAccess { - if ($this->integer > 100.0) { + if ($this->container['integer'] > 100.0) { return false; } - if ($this->integer < 10.0) { + if ($this->container['integer'] < 10.0) { return false; } - if ($this->int32 > 200.0) { + if ($this->container['int32'] > 200.0) { return false; } - if ($this->int32 < 20.0) { + if ($this->container['int32'] < 20.0) { return false; } - if ($this->number === null) { + if ($this->container['number'] === null) { return false; } - if ($this->number > 543.2) { + if ($this->container['number'] > 543.2) { return false; } - if ($this->number < 32.1) { + if ($this->container['number'] < 32.1) { return false; } - if ($this->float > 987.6) { + if ($this->container['float'] > 987.6) { return false; } - if ($this->float < 54.3) { + if ($this->container['float'] < 54.3) { return false; } - if ($this->double > 123.4) { + if ($this->container['double'] > 123.4) { return false; } - if ($this->double < 67.8) { + if ($this->container['double'] < 67.8) { return false; } - if (!preg_match("/[a-z]/i", $this->string)) { + if (!preg_match("/[a-z]/i", $this->container['string'])) { return false; } - if ($this->byte === null) { + if ($this->container['byte'] === null) { return false; } - if ($this->date === null) { + if ($this->container['date'] === null) { return false; } @@ -451,14 +451,14 @@ class FormatTest implements ArrayAccess - if ($this->password === null) { + if ($this->container['password'] === null) { return false; } - if (strlen($this->password) > 64) { + if (strlen($this->container['password']) > 64) { return false; } - if (strlen($this->password) < 10) { + if (strlen($this->container['password']) < 10) { return false; } 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 5d1625008894..53d12898bd76 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -166,7 +166,7 @@ class Name implements ArrayAccess { $invalid_properties = array(); - if ($this->name === null) { + if ($this->container['name'] === null) { $invalid_properties[] = "'$name' can't be null"; } @@ -187,7 +187,7 @@ class Name implements ArrayAccess public function valid() { - if ($this->name === null) { + if ($this->container['name'] === null) { return false; } 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 9928ddeea0ba..15638a9e3a3e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -229,7 +229,7 @@ class Order implements ArrayAccess $allowed_values = array("placed", "approved", "delivered"); - if (!in_array($this->status, $allowed_values))) { + if (!in_array($this->container['status'], $allowed_values))) { $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; } @@ -256,7 +256,7 @@ class Order implements ArrayAccess $allowed_values = array("placed", "approved", "delivered"); - if (!in_array($this->status, $allowed_values))) { + if (!in_array($this->container['status'], $allowed_values))) { return false; } 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 8fc13a040521..4025707d3690 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -224,12 +224,12 @@ class Pet implements ArrayAccess - if ($this->name === null) { + if ($this->container['name'] === null) { $invalid_properties[] = "'$name' can't be null"; } - if ($this->photo_urls === null) { + if ($this->container['photo_urls'] === null) { $invalid_properties[] = "'$photo_urls' can't be null"; } @@ -237,7 +237,7 @@ class Pet implements ArrayAccess $allowed_values = array("available", "pending", "sold"); - if (!in_array($this->status, $allowed_values))) { + if (!in_array($this->container['status'], $allowed_values))) { $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; } @@ -257,12 +257,12 @@ class Pet implements ArrayAccess - if ($this->name === null) { + if ($this->container['name'] === null) { return false; } - if ($this->photo_urls === null) { + if ($this->container['photo_urls'] === null) { return false; } @@ -270,7 +270,7 @@ class Pet implements ArrayAccess $allowed_values = array("available", "pending", "sold"); - if (!in_array($this->status, $allowed_values))) { + if (!in_array($this->container['status'], $allowed_values))) { return false; } From 77e56084ac889c198a92175c40c95d863bd805bd Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 7 May 2016 17:49:54 +0800 Subject: [PATCH 134/170] regenerate c# petstore sample --- .../csharp/SwaggerClient/IO.Swagger.sln | 10 +- .../petstore/csharp/SwaggerClient/README.md | 17 +- .../csharp/SwaggerClient/docs/AnimalFarm.md | 8 + .../csharp/SwaggerClient/docs/EnumClass.md | 8 + .../csharp/SwaggerClient/docs/EnumTest.md | 11 + .../csharp/SwaggerClient/docs/FormatTest.md | 2 +- .../IO.Swagger.Test/IO.Swagger.Test.csproj | 2 +- .../IO.Swagger.Test/Model/AnimalFarmTests.cs | 56 +++++ .../IO.Swagger.Test/Model/EnumClassTests.cs | 56 +++++ .../IO.Swagger.Test/Model/EnumTestTests.cs | 80 +++++++ .../src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/Model/AnimalFarm.cs | 91 ++++++++ .../src/IO.Swagger/Model/EnumClass.cs | 40 ++++ .../src/IO.Swagger/Model/EnumTest.cs | 199 ++++++++++++++++++ .../src/IO.Swagger/Model/FormatTest.cs | 79 ++++--- .../SwaggerClientTest.csproj | 19 +- .../SwaggerClientTest.userprefs | 10 +- ...ClientTest.csproj.FilesWrittenAbsolute.txt | 22 +- 18 files changed, 617 insertions(+), 95 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClient/docs/AnimalFarm.md create mode 100644 samples/client/petstore/csharp/SwaggerClient/docs/EnumClass.md create mode 100644 samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumClass.cs create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 08cd5875c2e6..72e6e04d1211 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{AC0D0300-7030-473F-B672-17C40187815A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}.Debug|Any CPU.Build.0 = Debug|Any CPU -{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}.Release|Any CPU.ActiveCfg = Release|Any CPU -{27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9}.Release|Any CPU.Build.0 = Release|Any CPU +{AC0D0300-7030-473F-B672-17C40187815A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{AC0D0300-7030-473F-B672-17C40187815A}.Debug|Any CPU.Build.0 = Debug|Any CPU +{AC0D0300-7030-473F-B672-17C40187815A}.Release|Any CPU.ActiveCfg = Release|Any CPU +{AC0D0300-7030-473F-B672-17C40187815A}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index 174b3292633c..1f7e9f634e03 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-05-01T20:17:48.968-04:00 +- Build date: 2016-05-07T17:39:09.181+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -113,10 +113,13 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Model.Animal](docs/Animal.md) + - [Model.AnimalFarm](docs/AnimalFarm.md) - [Model.ApiResponse](docs/ApiResponse.md) - [Model.Cat](docs/Cat.md) - [Model.Category](docs/Category.md) - [Model.Dog](docs/Dog.md) + - [Model.EnumClass](docs/EnumClass.md) + - [Model.EnumTest](docs/EnumTest.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.Model200Response](docs/Model200Response.md) - [Model.ModelReturn](docs/ModelReturn.md) @@ -131,6 +134,12 @@ Class | Method | HTTP request | Description ## Documentation for Authorization +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ### petstore_auth - **Type**: OAuth @@ -140,9 +149,3 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/AnimalFarm.md b/samples/client/petstore/csharp/SwaggerClient/docs/AnimalFarm.md new file mode 100644 index 000000000000..4d1cccb0cefe --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/AnimalFarm.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.AnimalFarm +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/EnumClass.md b/samples/client/petstore/csharp/SwaggerClient/docs/EnumClass.md new file mode 100644 index 000000000000..d936aad6f0b2 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/EnumClass.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.EnumClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md b/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md new file mode 100644 index 000000000000..f0f300021b5e --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/EnumTest.md @@ -0,0 +1,11 @@ +# IO.Swagger.Model.EnumTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumString** | **string** | | [optional] +**EnumInteger** | **int?** | | [optional] +**EnumNumber** | **double?** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md index 2672fee238c8..7ddfad04d05e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **Binary** | **byte[]** | | [optional] **Date** | **DateTime?** | | **DateTime** | **DateTime?** | | [optional] -**Uuid** | **Guid** | | [optional] +**Uuid** | **Guid?** | | [optional] **Password** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 618cc1885753..de3b57cfe78f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -65,7 +65,7 @@ - {27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9} + {AC0D0300-7030-473F-B672-17C40187815A} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs new file mode 100644 index 000000000000..5baa4d934852 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs @@ -0,0 +1,56 @@ +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing AnimalFarm + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class AnimalFarmTests + { + private AnimalFarm instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + instance = new AnimalFarm(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of AnimalFarm + /// + [Test] + public void AnimalFarmInstanceTest() + { + Assert.IsInstanceOf (instance, "instance is a AnimalFarm"); + } + + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs new file mode 100644 index 000000000000..8c81c81fbb13 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs @@ -0,0 +1,56 @@ +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing EnumClass + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class EnumClassTests + { + private EnumClass instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + instance = new EnumClass(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of EnumClass + /// + [Test] + public void EnumClassInstanceTest() + { + Assert.IsInstanceOf (instance, "instance is a EnumClass"); + } + + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs new file mode 100644 index 000000000000..2679b0852332 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs @@ -0,0 +1,80 @@ +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing EnumTest + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class EnumTestTests + { + private EnumTest instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + instance = new EnumTest(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of EnumTest + /// + [Test] + public void EnumTestInstanceTest() + { + Assert.IsInstanceOf (instance, "instance is a EnumTest"); + } + + /// + /// Test the property 'EnumString' + /// + [Test] + public void EnumStringTest() + { + // TODO: unit test for the property 'EnumString' + } + /// + /// Test the property 'EnumInteger' + /// + [Test] + public void EnumIntegerTest() + { + // TODO: unit test for the property 'EnumInteger' + } + /// + /// Test the property 'EnumNumber' + /// + [Test] + public void EnumNumberTest() + { + // TODO: unit test for the property 'EnumNumber' + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 36e6f0008e9c..5d9a64329c1e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {27FD0ED8-0F4A-458A-B564-6BFC0A02B9C9} + {AC0D0300-7030-473F-B672-17C40187815A} Library Properties Swagger Library diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs new file mode 100644 index 000000000000..76685fe84959 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs @@ -0,0 +1,91 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// AnimalFarm + /// + [DataContract] + public partial class AnimalFarm : List, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + public AnimalFarm() + { + + + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AnimalFarm {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public new string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as AnimalFarm); + } + + /// + /// Returns true if AnimalFarm instances are equal + /// + /// Instance of AnimalFarm to be compared + /// Boolean + public bool Equals(AnimalFarm other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumClass.cs new file mode 100644 index 000000000000..1fb5f0b66263 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumClass.cs @@ -0,0 +1,40 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// Gets or Sets EnumClass + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumClass + { + + /// + /// Enum Abc for "_abc" + /// + [EnumMember(Value = "_abc")] + Abc, + + /// + /// Enum efg for "-efg" + /// + [EnumMember(Value = "-efg")] + efg, + + /// + /// Enum xyz for "(xyz)" + /// + [EnumMember(Value = "(xyz)")] + xyz + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs new file mode 100644 index 000000000000..f8bebd6b2d76 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs @@ -0,0 +1,199 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// EnumTest + /// + [DataContract] + public partial class EnumTest : IEquatable + { + /// + /// Gets or Sets EnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumStringEnum + { + + /// + /// Enum Upper for "UPPER" + /// + [EnumMember(Value = "UPPER")] + Upper, + + /// + /// Enum Lower for "lower" + /// + [EnumMember(Value = "lower")] + Lower + } + + /// + /// Gets or Sets EnumInteger + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumIntegerEnum + { + + /// + /// Enum NUMBER_1 for 1 + /// + [EnumMember(Value = "1")] + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for -1 + /// + [EnumMember(Value = "-1")] + NUMBER_MINUS_1 = -1 + } + + /// + /// Gets or Sets EnumNumber + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumNumberEnum + { + + /// + /// Enum NUMBER_1_DOT_1 for 1.1 + /// + [EnumMember(Value = "1.1")] + NUMBER_1_DOT_1, + + /// + /// Enum NUMBER_MINUS_1_DOT_2 for -1.2 + /// + [EnumMember(Value = "-1.2")] + NUMBER_MINUS_1_DOT_2 + } + + /// + /// Gets or Sets EnumString + /// + [DataMember(Name="enum_string", EmitDefaultValue=false)] + public EnumStringEnum? EnumString { get; set; } + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public EnumIntegerEnum? EnumInteger { get; set; } + /// + /// Gets or Sets EnumNumber + /// + [DataMember(Name="enum_number", EmitDefaultValue=false)] + public EnumNumberEnum? EnumNumber { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// EnumString. + /// EnumInteger. + /// EnumNumber. + public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, EnumNumberEnum? EnumNumber = null) + { + + + this.EnumString = EnumString; + + this.EnumInteger = EnumInteger; + + this.EnumNumber = EnumNumber; + + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class EnumTest {\n"); + sb.Append(" EnumString: ").Append(EnumString).Append("\n"); +sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); +sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as EnumTest); + } + + /// + /// Returns true if EnumTest instances are equal + /// + /// Instance of EnumTest to be compared + /// Boolean + public bool Equals(EnumTest other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.EnumString == other.EnumString || + this.EnumString != null && + this.EnumString.Equals(other.EnumString) + ) && + ( + this.EnumInteger == other.EnumInteger || + this.EnumInteger != null && + this.EnumInteger.Equals(other.EnumInteger) + ) && + ( + this.EnumNumber == other.EnumNumber || + this.EnumNumber != null && + this.EnumNumber.Equals(other.EnumNumber) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.EnumString != null) + hash = hash * 59 + this.EnumString.GetHashCode(); + if (this.EnumInteger != null) + hash = hash * 59 + this.EnumInteger.GetHashCode(); + if (this.EnumNumber != null) + hash = hash * 59 + this.EnumNumber.GetHashCode(); + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs index 49e7d1041aad..33301f02a95d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs @@ -12,15 +12,13 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// FormatTest /// [DataContract] public partial class FormatTest : IEquatable - { - + { /// /// Initializes a new instance of the class. - /// Initializes a new instance of the class. /// /// Integer. /// Int32. @@ -35,7 +33,6 @@ namespace IO.Swagger.Model /// DateTime. /// Uuid. /// Password (required). - public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, Guid? Uuid = null, string Password = null) { // to ensure "Number" is required (not null) @@ -74,97 +71,93 @@ namespace IO.Swagger.Model { this.Password = Password; } - this.Integer = Integer; - this.Int32 = Int32; - this.Int64 = Int64; - this._Float = _Float; - this._Double = _Double; - this._String = _String; - this.Binary = Binary; - this.DateTime = DateTime; - this.Uuid = Uuid; + + + this.Integer = Integer; + + this.Int32 = Int32; + + this.Int64 = Int64; + + this._Float = _Float; + + this._Double = _Double; + + this._String = _String; + + this.Binary = Binary; + + this.DateTime = DateTime; + + this.Uuid = Uuid; } - - + /// /// Gets or Sets Integer /// [DataMember(Name="integer", EmitDefaultValue=false)] public int? Integer { get; set; } - /// /// Gets or Sets Int32 /// [DataMember(Name="int32", EmitDefaultValue=false)] public int? Int32 { get; set; } - /// /// Gets or Sets Int64 /// [DataMember(Name="int64", EmitDefaultValue=false)] public long? Int64 { get; set; } - /// /// Gets or Sets Number /// [DataMember(Name="number", EmitDefaultValue=false)] public double? Number { get; set; } - /// /// Gets or Sets _Float /// [DataMember(Name="float", EmitDefaultValue=false)] public float? _Float { get; set; } - /// /// Gets or Sets _Double /// [DataMember(Name="double", EmitDefaultValue=false)] public double? _Double { get; set; } - /// /// Gets or Sets _String /// [DataMember(Name="string", EmitDefaultValue=false)] public string _String { get; set; } - /// /// Gets or Sets _Byte /// [DataMember(Name="byte", EmitDefaultValue=false)] public byte[] _Byte { get; set; } - /// /// Gets or Sets Binary /// [DataMember(Name="binary", EmitDefaultValue=false)] public byte[] Binary { get; set; } - /// /// Gets or Sets Date /// [DataMember(Name="date", EmitDefaultValue=false)] public DateTime? Date { get; set; } - /// /// Gets or Sets DateTime /// [DataMember(Name="dateTime", EmitDefaultValue=false)] public DateTime? DateTime { get; set; } - /// /// Gets or Sets Uuid /// [DataMember(Name="uuid", EmitDefaultValue=false)] public Guid? Uuid { get; set; } - /// /// Gets or Sets Password /// [DataMember(Name="password", EmitDefaultValue=false)] public string Password { get; set; } - /// /// Returns the string presentation of the object /// @@ -174,22 +167,22 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class FormatTest {\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Int32: ").Append(Int32).Append("\n"); - sb.Append(" Int64: ").Append(Int64).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" _Float: ").Append(_Float).Append("\n"); - sb.Append(" _Double: ").Append(_Double).Append("\n"); - sb.Append(" _String: ").Append(_String).Append("\n"); - sb.Append(" _Byte: ").Append(_Byte).Append("\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); - sb.Append(" Date: ").Append(Date).Append("\n"); - sb.Append(" DateTime: ").Append(DateTime).Append("\n"); - sb.Append(" Uuid: ").Append(Uuid).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); +sb.Append(" Int32: ").Append(Int32).Append("\n"); +sb.Append(" Int64: ").Append(Int64).Append("\n"); +sb.Append(" Number: ").Append(Number).Append("\n"); +sb.Append(" _Float: ").Append(_Float).Append("\n"); +sb.Append(" _Double: ").Append(_Double).Append("\n"); +sb.Append(" _String: ").Append(_String).Append("\n"); +sb.Append(" _Byte: ").Append(_Byte).Append("\n"); +sb.Append(" Binary: ").Append(Binary).Append("\n"); +sb.Append(" Date: ").Append(Date).Append("\n"); +sb.Append(" DateTime: ").Append(DateTime).Append("\n"); +sb.Append(" Uuid: ").Append(Uuid).Append("\n"); +sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -329,6 +322,6 @@ namespace IO.Swagger.Model return hash; } } - } + } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index a093c8f2ebfd..c7be212db668 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -47,24 +47,7 @@ -<<<<<<< HEAD - - - - - - - - - - - - - - -======= ->>>>>>> 9b1d43c6f539add1b436ea52f5351125c2da7f3a @@ -85,4 +68,4 @@ IO.Swagger - \ No newline at end of file + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index 65a0da9f0400..b87503528b66 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,18 +1,12 @@  - + + - - - - - - - diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt index 8e1a7e18f36a..fe5b5e6a930c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt +++ b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt @@ -1,11 +1,11 @@ -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Swagger Library.dll -/Volumes/Extra/projects/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Swagger Library.dll.mdb +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Swagger Library.dll +/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Swagger Library.dll.mdb From 9efef02d5f21e67f13c169574f84e45dd4ada911 Mon Sep 17 00:00:00 2001 From: abcsun Date: Sat, 7 May 2016 18:12:28 +0800 Subject: [PATCH 135/170] formate the module.mustache --- .../src/main/resources/php/model.mustache | 36 ++++--- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../SwaggerClient-php/lib/Model/Animal.php | 8 -- .../lib/Model/AnimalFarm.php | 2 - .../lib/Model/ApiResponse.php | 23 +---- .../php/SwaggerClient-php/lib/Model/Cat.php | 9 +- .../SwaggerClient-php/lib/Model/Category.php | 16 +--- .../php/SwaggerClient-php/lib/Model/Dog.php | 9 +- .../SwaggerClient-php/lib/Model/EnumClass.php | 2 - .../SwaggerClient-php/lib/Model/EnumTest.php | 13 +-- .../lib/Model/FormatTest.php | 93 +++---------------- .../lib/Model/Model200Response.php | 9 +- .../lib/Model/ModelReturn.php | 9 +- .../php/SwaggerClient-php/lib/Model/Name.php | 22 +---- .../php/SwaggerClient-php/lib/Model/Order.php | 40 +------- .../php/SwaggerClient-php/lib/Model/Pet.php | 40 +------- .../lib/Model/SpecialModelName.php | 9 +- .../php/SwaggerClient-php/lib/Model/Tag.php | 16 +--- .../php/SwaggerClient-php/lib/Model/User.php | 58 ++---------- 19 files changed, 68 insertions(+), 348 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 34aaa63393ce..d17c76c137e4 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -163,14 +163,18 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple public function list_invalid_properties() { $invalid_properties = array(); - {{#vars}}{{#required}} + {{#vars}} + {{#required}} if ($this->container['{{name}}'] === null) { $invalid_properties[] = "'${{name}}' can't be null"; - }{{/required}} - {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + } + {{/required}} + {{#isEnum}} + $allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); if (!in_array($this->container['{{name}}'], $allowed_values))) { $invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}."; - }{{/isEnum}} + } + {{/isEnum}} {{#hasValidation}} {{#maxLength}} if (strlen($this->container['{{name}}']) > {{maxLength}}) { @@ -196,7 +200,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { $invalid_properties[] = "invalid value for '${{name}}', must be conform to the pattern {{pattern}}."; } - {{/pattern}}{{/hasValidation}}{{/vars}} + {{/pattern}} + {{/hasValidation}} + {{/vars}} return $invalid_properties; } @@ -208,11 +214,13 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function valid() { - {{#vars}}{{#required}} + {{#vars}} + {{#required}} if ($this->container['{{name}}'] === null) { return false; }{{/required}} - {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + {{#isEnum}} + $allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); if (!in_array($this->container['{{name}}'], $allowed_values))) { return false; }{{/isEnum}} @@ -241,7 +249,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { return false; } - {{/pattern}}{{/hasValidation}}{{/vars}} + {{/pattern}} + {{/hasValidation}} + {{/vars}} return true; } @@ -263,11 +273,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function {{setter}}(${{name}}) { - {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + {{#isEnum}} + $allowed_values = array({{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); if (!in_array(${{{name}}}, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}"); - }{{/isEnum}} - + } + {{/isEnum}} {{#hasValidation}} {{#maxLength}} if (strlen(${{name}}) > {{maxLength}}) { @@ -292,7 +303,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple if (!preg_match("{{pattern}}", ${{name}})) { throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{pattern}}.'); } - {{/pattern}}{{/hasValidation}} + {{/pattern}} + {{/hasValidation}} $this->container['{{name}}'] = ${{name}}; return $this; diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 5917dc8a7d9f..6aea5f668666 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-07T07:50:05.452Z +- Build date: 2016-05-07T10:11:34.658Z - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements 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 7c25695056e4..e537ef934140 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -142,12 +142,9 @@ class Animal implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - if ($this->container['class_name'] === null) { $invalid_properties[] = "'$class_name' can't be null"; } - - return $invalid_properties; } @@ -159,11 +156,9 @@ class Animal implements ArrayAccess */ public function valid() { - if ($this->container['class_name'] === null) { return false; } - return true; } @@ -185,9 +180,6 @@ class Animal implements ArrayAccess */ public function setClassName($class_name) { - - - $this->container['class_name'] = $class_name; return $this; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php index 394c146e532b..dc7190652bca 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -130,7 +130,6 @@ class AnimalFarm implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - return $invalid_properties; } @@ -142,7 +141,6 @@ class AnimalFarm implements ArrayAccess */ public function valid() { - return true; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 1f087295322d..0c7e225d120d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -165,13 +165,6 @@ class ApiResponse implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - - - - - return $invalid_properties; } @@ -183,12 +176,11 @@ class ApiResponse implements ArrayAccess */ public function valid() { - - - - + + + return true; } @@ -210,9 +202,6 @@ class ApiResponse implements ArrayAccess */ public function setCode($code) { - - - $this->container['code'] = $code; return $this; @@ -233,9 +222,6 @@ class ApiResponse implements ArrayAccess */ public function setType($type) { - - - $this->container['type'] = $type; return $this; @@ -256,9 +242,6 @@ class ApiResponse implements ArrayAccess */ public function setMessage($message) { - - - $this->container['message'] = $message; return $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 929560e001e0..e40d5e969bfa 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -139,9 +139,6 @@ class Cat extends Animal implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - return $invalid_properties; } @@ -153,8 +150,7 @@ class Cat extends Animal implements ArrayAccess */ public function valid() { - - + return true; } @@ -176,9 +172,6 @@ class Cat extends Animal implements ArrayAccess */ public function setDeclawed($declawed) { - - - $this->container['declawed'] = $declawed; return $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 26d37a15e4a5..99c309f6c7ed 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -152,11 +152,6 @@ class Category implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - - - return $invalid_properties; } @@ -168,10 +163,9 @@ class Category implements ArrayAccess */ public function valid() { - - - + + return true; } @@ -193,9 +187,6 @@ class Category implements ArrayAccess */ public function setId($id) { - - - $this->container['id'] = $id; return $this; @@ -216,9 +207,6 @@ class Category implements ArrayAccess */ public function setName($name) { - - - $this->container['name'] = $name; return $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 7a106519a815..9999bbba51ce 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -139,9 +139,6 @@ class Dog extends Animal implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - return $invalid_properties; } @@ -153,8 +150,7 @@ class Dog extends Animal implements ArrayAccess */ public function valid() { - - + return true; } @@ -176,9 +172,6 @@ class Dog extends Animal implements ArrayAccess */ public function setBreed($breed) { - - - $this->container['breed'] = $breed; return $this; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php index 6996674e02e8..00b4a894af0d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -130,7 +130,6 @@ class EnumClass implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - return $invalid_properties; } @@ -142,7 +141,6 @@ class EnumClass implements ArrayAccess */ public function valid() { - return true; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index dce42791a04d..50d0069dea26 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -204,22 +204,18 @@ class EnumTest implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - $allowed_values = array("UPPER", "lower"); if (!in_array($this->container['enum_string'], $allowed_values))) { $invalid_properties[] = "invalid value for '$enum_string', must be one of #{allowed_values}."; } - $allowed_values = array("1", "-1"); if (!in_array($this->container['enum_integer'], $allowed_values))) { $invalid_properties[] = "invalid value for '$enum_integer', must be one of #{allowed_values}."; } - $allowed_values = array("1.1", "-1.2"); if (!in_array($this->container['enum_number'], $allowed_values))) { $invalid_properties[] = "invalid value for '$enum_number', must be one of #{allowed_values}."; } - return $invalid_properties; } @@ -231,7 +227,7 @@ class EnumTest implements ArrayAccess */ public function valid() { - + $allowed_values = array("UPPER", "lower"); if (!in_array($this->container['enum_string'], $allowed_values))) { return false; @@ -246,7 +242,6 @@ class EnumTest implements ArrayAccess if (!in_array($this->container['enum_number'], $allowed_values))) { return false; } - return true; } @@ -271,8 +266,6 @@ class EnumTest implements ArrayAccess if (!in_array($enum_string, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'enum_string', must be one of 'UPPER', 'lower'"); } - - $this->container['enum_string'] = $enum_string; return $this; @@ -297,8 +290,6 @@ class EnumTest implements ArrayAccess if (!in_array($enum_integer, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'enum_integer', must be one of '1', '-1'"); } - - $this->container['enum_integer'] = $enum_integer; return $this; @@ -323,8 +314,6 @@ class EnumTest implements ArrayAccess if (!in_array($enum_number, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'enum_number', must be one of '1.1', '-1.2'"); } - - $this->container['enum_number'] = $enum_number; return $this; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 7ab03733625e..7a99d0423536 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -295,84 +295,57 @@ class FormatTest implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - if ($this->container['integer'] > 100.0) { $invalid_properties[] = "invalid value for '$integer', must be smaller than or equal to 100.0."; } if ($this->container['integer'] < 10.0) { $invalid_properties[] = "invalid value for '$integer', must be bigger than or equal to 10.0."; } - - if ($this->container['int32'] > 200.0) { $invalid_properties[] = "invalid value for '$int32', must be smaller than or equal to 200.0."; } if ($this->container['int32'] < 20.0) { $invalid_properties[] = "invalid value for '$int32', must be bigger than or equal to 20.0."; } - - - if ($this->container['number'] === null) { $invalid_properties[] = "'$number' can't be null"; } - if ($this->container['number'] > 543.2) { $invalid_properties[] = "invalid value for '$number', must be smaller than or equal to 543.2."; } if ($this->container['number'] < 32.1) { $invalid_properties[] = "invalid value for '$number', must be bigger than or equal to 32.1."; } - - if ($this->container['float'] > 987.6) { $invalid_properties[] = "invalid value for '$float', must be smaller than or equal to 987.6."; } if ($this->container['float'] < 54.3) { $invalid_properties[] = "invalid value for '$float', must be bigger than or equal to 54.3."; } - - if ($this->container['double'] > 123.4) { $invalid_properties[] = "invalid value for '$double', must be smaller than or equal to 123.4."; } if ($this->container['double'] < 67.8) { $invalid_properties[] = "invalid value for '$double', must be bigger than or equal to 67.8."; } - - if (!preg_match("/[a-z]/i", $this->container['string'])) { $invalid_properties[] = "invalid value for '$string', must be conform to the pattern /[a-z]/i."; } - if ($this->container['byte'] === null) { $invalid_properties[] = "'$byte' can't be null"; } - - - - if ($this->container['date'] === null) { $invalid_properties[] = "'$date' can't be null"; } - - - - - - if ($this->container['password'] === null) { $invalid_properties[] = "'$password' can't be null"; } - if (strlen($this->container['password']) > 64) { $invalid_properties[] = "invalid value for '$password', the character length must be smaller than or equal to 64."; } if (strlen($this->container['password']) < 10) { $invalid_properties[] = "invalid value for '$password', the character length must be bigger than or equal to 10."; } - return $invalid_properties; } @@ -384,8 +357,8 @@ class FormatTest implements ArrayAccess */ public function valid() { - - + + if ($this->container['integer'] > 100.0) { return false; } @@ -393,7 +366,7 @@ class FormatTest implements ArrayAccess return false; } - + if ($this->container['int32'] > 200.0) { return false; } @@ -401,12 +374,11 @@ class FormatTest implements ArrayAccess return false; } - if ($this->container['number'] === null) { return false; } - + if ($this->container['number'] > 543.2) { return false; } @@ -414,7 +386,7 @@ class FormatTest implements ArrayAccess return false; } - + if ($this->container['float'] > 987.6) { return false; } @@ -422,7 +394,7 @@ class FormatTest implements ArrayAccess return false; } - + if ($this->container['double'] > 123.4) { return false; } @@ -430,38 +402,34 @@ class FormatTest implements ArrayAccess return false; } - + if (!preg_match("/[a-z]/i", $this->container['string'])) { return false; } - if ($this->container['byte'] === null) { return false; } - - + if ($this->container['date'] === null) { return false; } - - - + + if ($this->container['password'] === null) { return false; } - + if (strlen($this->container['password']) > 64) { return false; } if (strlen($this->container['password']) < 10) { return false; } - return true; } @@ -482,8 +450,6 @@ class FormatTest implements ArrayAccess */ public function setInteger($integer) { - - if ($integer > 100.0) { throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.0.'); @@ -491,7 +457,6 @@ class FormatTest implements ArrayAccess if ($integer < 10.0) { throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.0.'); } - $this->container['integer'] = $integer; return $this; @@ -512,8 +477,6 @@ class FormatTest implements ArrayAccess */ public function setInt32($int32) { - - if ($int32 > 200.0) { throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.0.'); @@ -521,7 +484,6 @@ class FormatTest implements ArrayAccess if ($int32 < 20.0) { throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.0.'); } - $this->container['int32'] = $int32; return $this; @@ -542,9 +504,6 @@ class FormatTest implements ArrayAccess */ public function setInt64($int64) { - - - $this->container['int64'] = $int64; return $this; @@ -565,8 +524,6 @@ class FormatTest implements ArrayAccess */ public function setNumber($number) { - - if ($number > 543.2) { throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be smaller than or equal to 543.2.'); @@ -574,7 +531,6 @@ class FormatTest implements ArrayAccess if ($number < 32.1) { throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.'); } - $this->container['number'] = $number; return $this; @@ -595,8 +551,6 @@ class FormatTest implements ArrayAccess */ public function setFloat($float) { - - if ($float > 987.6) { throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be smaller than or equal to 987.6.'); @@ -604,7 +558,6 @@ class FormatTest implements ArrayAccess if ($float < 54.3) { throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.'); } - $this->container['float'] = $float; return $this; @@ -625,8 +578,6 @@ class FormatTest implements ArrayAccess */ public function setDouble($double) { - - if ($double > 123.4) { throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be smaller than or equal to 123.4.'); @@ -634,7 +585,6 @@ class FormatTest implements ArrayAccess if ($double < 67.8) { throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.'); } - $this->container['double'] = $double; return $this; @@ -655,13 +605,10 @@ class FormatTest implements ArrayAccess */ public function setString($string) { - - if (!preg_match("/[a-z]/i", $string)) { throw new \InvalidArgumentException('invalid value for $string when calling FormatTest., must be conform to the pattern /[a-z]/i.'); } - $this->container['string'] = $string; return $this; @@ -682,9 +629,6 @@ class FormatTest implements ArrayAccess */ public function setByte($byte) { - - - $this->container['byte'] = $byte; return $this; @@ -705,9 +649,6 @@ class FormatTest implements ArrayAccess */ public function setBinary($binary) { - - - $this->container['binary'] = $binary; return $this; @@ -728,9 +669,6 @@ class FormatTest implements ArrayAccess */ public function setDate($date) { - - - $this->container['date'] = $date; return $this; @@ -751,9 +689,6 @@ class FormatTest implements ArrayAccess */ public function setDateTime($date_time) { - - - $this->container['date_time'] = $date_time; return $this; @@ -774,9 +709,6 @@ class FormatTest implements ArrayAccess */ public function setUuid($uuid) { - - - $this->container['uuid'] = $uuid; return $this; @@ -797,15 +729,12 @@ class FormatTest implements ArrayAccess */ public function setPassword($password) { - - if (strlen($password) > 64) { throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be smaller than or equal to 64.'); } if (strlen($password) < 10) { throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.'); } - $this->container['password'] = $password; return $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 263311b9d31d..6884fbaed82e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -139,9 +139,6 @@ class Model200Response implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - return $invalid_properties; } @@ -153,8 +150,7 @@ class Model200Response implements ArrayAccess */ public function valid() { - - + return true; } @@ -176,9 +172,6 @@ class Model200Response implements ArrayAccess */ public function setName($name) { - - - $this->container['name'] = $name; return $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 15298ff50eb0..7f8b7e7296b6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -139,9 +139,6 @@ class ModelReturn implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - return $invalid_properties; } @@ -153,8 +150,7 @@ class ModelReturn implements ArrayAccess */ public function valid() { - - + return true; } @@ -176,9 +172,6 @@ class ModelReturn implements ArrayAccess */ public function setReturn($return) { - - - $this->container['return'] = $return; return $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 53d12898bd76..9420a11796db 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -165,16 +165,9 @@ class Name implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - if ($this->container['name'] === null) { $invalid_properties[] = "'$name' can't be null"; } - - - - - - return $invalid_properties; } @@ -186,15 +179,13 @@ class Name implements ArrayAccess */ public function valid() { - if ($this->container['name'] === null) { return false; } - - - + + return true; } @@ -216,9 +207,6 @@ class Name implements ArrayAccess */ public function setName($name) { - - - $this->container['name'] = $name; return $this; @@ -239,9 +227,6 @@ class Name implements ArrayAccess */ public function setSnakeCase($snake_case) { - - - $this->container['snake_case'] = $snake_case; return $this; @@ -262,9 +247,6 @@ class Name implements ArrayAccess */ public function setProperty($property) { - - - $this->container['property'] = $property; return $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 15638a9e3a3e..e668f6d432b4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -219,22 +219,10 @@ class Order implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - - - - - - - $allowed_values = array("placed", "approved", "delivered"); if (!in_array($this->container['status'], $allowed_values))) { $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; } - - - return $invalid_properties; } @@ -246,21 +234,20 @@ class Order implements ArrayAccess */ public function valid() { - - - - - + + + + + $allowed_values = array("placed", "approved", "delivered"); if (!in_array($this->container['status'], $allowed_values))) { return false; } - return true; } @@ -282,9 +269,6 @@ class Order implements ArrayAccess */ public function setId($id) { - - - $this->container['id'] = $id; return $this; @@ -305,9 +289,6 @@ class Order implements ArrayAccess */ public function setPetId($pet_id) { - - - $this->container['pet_id'] = $pet_id; return $this; @@ -328,9 +309,6 @@ class Order implements ArrayAccess */ public function setQuantity($quantity) { - - - $this->container['quantity'] = $quantity; return $this; @@ -351,9 +329,6 @@ class Order implements ArrayAccess */ public function setShipDate($ship_date) { - - - $this->container['ship_date'] = $ship_date; return $this; @@ -378,8 +353,6 @@ class Order implements ArrayAccess if (!in_array($status, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'placed', 'approved', 'delivered'"); } - - $this->container['status'] = $status; return $this; @@ -400,9 +373,6 @@ class Order implements ArrayAccess */ public function setComplete($complete) { - - - $this->container['complete'] = $complete; return $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 4025707d3690..c949198e6421 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -219,28 +219,16 @@ class Pet implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - - - if ($this->container['name'] === null) { $invalid_properties[] = "'$name' can't be null"; } - - if ($this->container['photo_urls'] === null) { $invalid_properties[] = "'$photo_urls' can't be null"; } - - - - $allowed_values = array("available", "pending", "sold"); if (!in_array($this->container['status'], $allowed_values))) { $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; } - return $invalid_properties; } @@ -252,28 +240,25 @@ class Pet implements ArrayAccess */ public function valid() { - - - + + if ($this->container['name'] === null) { return false; } - if ($this->container['photo_urls'] === null) { return false; } - - + + $allowed_values = array("available", "pending", "sold"); if (!in_array($this->container['status'], $allowed_values))) { return false; } - return true; } @@ -294,9 +279,6 @@ class Pet implements ArrayAccess */ public function setId($id) { - - - $this->container['id'] = $id; return $this; @@ -317,9 +299,6 @@ class Pet implements ArrayAccess */ public function setCategory($category) { - - - $this->container['category'] = $category; return $this; @@ -340,9 +319,6 @@ class Pet implements ArrayAccess */ public function setName($name) { - - - $this->container['name'] = $name; return $this; @@ -363,9 +339,6 @@ class Pet implements ArrayAccess */ public function setPhotoUrls($photo_urls) { - - - $this->container['photo_urls'] = $photo_urls; return $this; @@ -386,9 +359,6 @@ class Pet implements ArrayAccess */ public function setTags($tags) { - - - $this->container['tags'] = $tags; return $this; @@ -413,8 +383,6 @@ class Pet implements ArrayAccess if (!in_array($status, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'"); } - - $this->container['status'] = $status; return $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 680868dbd0b7..0e37ecb8f46a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -139,9 +139,6 @@ class SpecialModelName implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - return $invalid_properties; } @@ -153,8 +150,7 @@ class SpecialModelName implements ArrayAccess */ public function valid() { - - + return true; } @@ -176,9 +172,6 @@ class SpecialModelName implements ArrayAccess */ public function setSpecialPropertyName($special_property_name) { - - - $this->container['special_property_name'] = $special_property_name; return $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 69c853bbef34..d188cc323e4a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -152,11 +152,6 @@ class Tag implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - - - return $invalid_properties; } @@ -168,10 +163,9 @@ class Tag implements ArrayAccess */ public function valid() { - - - + + return true; } @@ -193,9 +187,6 @@ class Tag implements ArrayAccess */ public function setId($id) { - - - $this->container['id'] = $id; return $this; @@ -216,9 +207,6 @@ class Tag implements ArrayAccess */ public function setName($name) { - - - $this->container['name'] = $name; return $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 4ca0b8fb3e1d..58cb418951eb 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -230,23 +230,6 @@ class User implements ArrayAccess public function list_invalid_properties() { $invalid_properties = array(); - - - - - - - - - - - - - - - - - return $invalid_properties; } @@ -258,22 +241,21 @@ class User implements ArrayAccess */ public function valid() { - - - - - - - - - + + + + + + + + return true; } @@ -295,9 +277,6 @@ class User implements ArrayAccess */ public function setId($id) { - - - $this->container['id'] = $id; return $this; @@ -318,9 +297,6 @@ class User implements ArrayAccess */ public function setUsername($username) { - - - $this->container['username'] = $username; return $this; @@ -341,9 +317,6 @@ class User implements ArrayAccess */ public function setFirstName($first_name) { - - - $this->container['first_name'] = $first_name; return $this; @@ -364,9 +337,6 @@ class User implements ArrayAccess */ public function setLastName($last_name) { - - - $this->container['last_name'] = $last_name; return $this; @@ -387,9 +357,6 @@ class User implements ArrayAccess */ public function setEmail($email) { - - - $this->container['email'] = $email; return $this; @@ -410,9 +377,6 @@ class User implements ArrayAccess */ public function setPassword($password) { - - - $this->container['password'] = $password; return $this; @@ -433,9 +397,6 @@ class User implements ArrayAccess */ public function setPhone($phone) { - - - $this->container['phone'] = $phone; return $this; @@ -456,9 +417,6 @@ class User implements ArrayAccess */ public function setUserStatus($user_status) { - - - $this->container['user_status'] = $user_status; return $this; From a71d8d935aa52d1507298af850a1d2b013870f63 Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Sat, 7 May 2016 11:44:51 +0200 Subject: [PATCH 136/170] Use AFHttpSessionManager instead of AFHTTPRequestOperationManager #1981 --- .../resources/objc/ApiClient-body.mustache | 193 +++++++----------- .../resources/objc/ApiClient-header.mustache | 14 +- samples/client/petstore/objc/README.md | 4 +- .../objc/SwaggerClient/SWGApiClient.h | 14 +- .../objc/SwaggerClient/SWGApiClient.m | 193 +++++++----------- samples/client/petstore/objc/git_push.sh | 4 +- 6 files changed, 176 insertions(+), 246 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache index 18b756f78b0e..e87a0a414faf 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache @@ -14,6 +14,30 @@ static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilitySta static void (^reachabilityChangeBlock)(int); +static NSDictionary * {{classPrefix}}__headerFieldsForResponse(NSURLResponse *response) { + if(![response isKindOfClass:[NSHTTPURLResponse class]]) { + return nil; + } + return ((NSHTTPURLResponse*)response).allHeaderFields; +} + +static NSString * {{classPrefix}}__fileNameForResponse(NSURLResponse *response) { + NSDictionary * headers = {{classPrefix}}__headerFieldsForResponse(response); + if(!headers[@"Content-Disposition"]) { + return [NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]]; + } + NSString *pattern = @"filename=['\"]?([^'\"\\s]+)['\"]?"; + NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:pattern + options:NSRegularExpressionCaseInsensitive + error:nil]; + NSString *contentDispositionHeader = headers[@"Content-Disposition"]; + NSTextCheckingResult *match = [regexp firstMatchInString:contentDispositionHeader + options:0 + range:NSMakeRange(0, [contentDispositionHeader length])]; + return [contentDispositionHeader substringWithRange:[match rangeAtIndex:1]]; +} + + @interface {{classPrefix}}ApiClient () @property (readwrite, nonatomic) NSDictionary *HTTPResponseHeaders; @@ -99,14 +123,12 @@ static void (^reachabilityChangeBlock)(int); va_end(args); } -- (void)logResponse:(AFHTTPRequestOperation *)operation - forRequest:(NSURLRequest *)request - error:(NSError*)error { +- (void)logResponse:(NSURLResponse *)response responseObject:(id)responseObject request:(NSURLRequest *)request error:(NSError *)error { NSString *message = [NSString stringWithFormat:@"\n[DEBUG] HTTP request body \n~BEGIN~\n %@\n~END~\n"\ "[DEBUG] HTTP response body \n~BEGIN~\n %@\n~END~\n", [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding], - operation.responseString]; + responseObject]; {{classPrefix}}DebugLog(message); } @@ -222,20 +244,14 @@ static void (^reachabilityChangeBlock)(int); -(Boolean) executeRequestWithId:(NSNumber*) requestId { NSSet* matchingItems = [queuedRequests objectsPassingTest:^BOOL(id obj, BOOL *stop) { - if ([obj intValue] == [requestId intValue]) { - return YES; - } - else { - return NO; - } + return [obj intValue] == [requestId intValue]; }]; if (matchingItems.count == 1) { {{classPrefix}}DebugLog(@"removed request id %@", requestId); [queuedRequests removeObject:requestId]; return YES; - } - else { + } else { return NO; } } @@ -246,7 +262,7 @@ static void (^reachabilityChangeBlock)(int); return reachabilityStatus; } -+(bool) getOfflineState { ++(BOOL) getOfflineState { return offlineState; } @@ -257,29 +273,8 @@ static void (^reachabilityChangeBlock)(int); - (void) configureCacheReachibility { [self.reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { reachabilityStatus = status; - switch (status) { - case AFNetworkReachabilityStatusUnknown: - {{classPrefix}}DebugLog(@"reachability changed to AFNetworkReachabilityStatusUnknown"); - [{{classPrefix}}ApiClient setOfflineState:true]; - break; - - case AFNetworkReachabilityStatusNotReachable: - {{classPrefix}}DebugLog(@"reachability changed to AFNetworkReachabilityStatusNotReachable"); - [{{classPrefix}}ApiClient setOfflineState:true]; - break; - - case AFNetworkReachabilityStatusReachableViaWWAN: - {{classPrefix}}DebugLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWWAN"); - [{{classPrefix}}ApiClient setOfflineState:false]; - break; - - case AFNetworkReachabilityStatusReachableViaWiFi: - {{classPrefix}}DebugLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWiFi"); - [{{classPrefix}}ApiClient setOfflineState:false]; - break; - default: - break; - } + {{classPrefix}}DebugLog(@"reachability changed to %@",AFStringFromNetworkReachabilityStatus(status)); + [{{classPrefix}}ApiClient setOfflineState:status == AFNetworkReachabilityStatusUnknown || status == AFNetworkReachabilityStatusNotReachable]; // call the reachability block, if configured if (reachabilityChangeBlock != nil) { @@ -443,92 +438,60 @@ static void (^reachabilityChangeBlock)(int); - (void) operationWithCompletionBlock: (NSURLRequest *)request requestId: (NSNumber *) requestId completionBlock: (void (^)(id, NSError *))completionBlock { - AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request - success:^(AFHTTPRequestOperation *operation, id response) { - if ([self executeRequestWithId:requestId]) { - [self logResponse:operation forRequest:request error:nil]; - NSDictionary *responseHeaders = [[operation response] allHeaderFields]; - self.HTTPResponseHeaders = responseHeaders; - completionBlock(response, nil); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if ([self executeRequestWithId:requestId]) { - NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; - if (operation.responseObject) { - // Add in the (parsed) response body. - userInfo[{{classPrefix}}ResponseObjectErrorKey] = operation.responseObject; - } - NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; - [self logResponse:nil forRequest:request error:augmentedError]; - - NSDictionary *responseHeaders = [[operation response] allHeaderFields]; - self.HTTPResponseHeaders = responseHeaders; - - completionBlock(nil, augmentedError); - } - }]; - - [self.operationQueue addOperation:op]; + __weak __typeof(self)weakSelf = self; + NSURLSessionDataTask* op = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if (![strongSelf executeRequestWithId:requestId]) { + return; + } + [strongSelf logResponse:response responseObject:responseObject request:request error:error]; + strongSelf.HTTPResponseHeaders = {{classPrefix}}__headerFieldsForResponse(response); + if(!error) { + completionBlock(responseObject, nil); + return; + } + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if (responseObject) { + // Add in the (parsed) response body. + userInfo[{{classPrefix}}ResponseObjectErrorKey] = responseObject; + } + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + completionBlock(nil, augmentedError); + }]; + [op resume]; } - (void) downloadOperationWithCompletionBlock: (NSURLRequest *)request requestId: (NSNumber *) requestId completionBlock: (void (^)(id, NSError *))completionBlock { - AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request - success:^(AFHTTPRequestOperation *operation, id responseObject) { - {{classPrefix}}Configuration *config = [{{classPrefix}}Configuration sharedConfig]; - NSString *directory = nil; - if (config.tempFolderPath) { - directory = config.tempFolderPath; - } - else { - directory = NSTemporaryDirectory(); - } + __weak __typeof(self)weakSelf = self; + NSURLSessionDataTask* op = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if (![strongSelf executeRequestWithId:requestId]) { + return; + } + strongSelf.HTTPResponseHeaders = {{classPrefix}}__headerFieldsForResponse(response); + [strongSelf logResponse:response responseObject:responseObject request:request error:error]; + if(error) { + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if (responseObject) { + userInfo[{{classPrefix}}ResponseObjectErrorKey] = responseObject; + } + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + completionBlock(nil, augmentedError); + } + {{classPrefix}}Configuration *config = [{{classPrefix}}Configuration sharedConfig]; + NSString *directory = config.tempFolderPath ?: NSTemporaryDirectory(); + NSString * filename = {{classPrefix}}__fileNameForResponse(response); - NSDictionary *headers = operation.response.allHeaderFields; - NSString *filename = nil; - if ([headers objectForKey:@"Content-Disposition"]) { + NSString *filepath = [directory stringByAppendingPathComponent:filename]; + NSURL *file = [NSURL fileURLWithPath:filepath]; - NSString *pattern = @"filename=['\"]?([^'\"\\s]+)['\"]?"; - NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:pattern - options:NSRegularExpressionCaseInsensitive - error:nil]; - NSString *contentDispositionHeader = [headers objectForKey:@"Content-Disposition"]; - NSTextCheckingResult *match = [regexp firstMatchInString:contentDispositionHeader - options:0 - range:NSMakeRange(0, [contentDispositionHeader length])]; - filename = [contentDispositionHeader substringWithRange:[match rangeAtIndex:1]]; - } - else { - filename = [NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]]; - } + [responseObject writeToURL:file atomically:YES]; - NSString *filepath = [directory stringByAppendingPathComponent:filename]; - NSURL *file = [NSURL fileURLWithPath:filepath]; - - [operation.responseData writeToURL:file atomically:YES]; - self.HTTPResponseHeaders = headers; - completionBlock(file, nil); - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - - if ([self executeRequestWithId:requestId]) { - NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; - if (operation.responseObject) { - userInfo[{{classPrefix}}ResponseObjectErrorKey] = operation.responseObject; - } - - NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; - - - [self logResponse:nil forRequest:request error:augmentedError]; - - NSDictionary *responseHeaders = [[operation response] allHeaderFields]; - self.HTTPResponseHeaders = responseHeaders; - completionBlock(nil, augmentedError); - } - }]; - - [self.operationQueue addOperation:op]; + completionBlock(file, nil); + }]; + [op resume]; } #pragma mark - Perform Request Methods @@ -653,7 +616,7 @@ static void (^reachabilityChangeBlock)(int); [request setHTTPShouldHandleCookies:NO]; NSNumber* requestId = [{{classPrefix}}ApiClient queueRequest]; - if ([responseType isEqualToString:@"NSURL*"]) { + if ([responseType isEqualToString:@"NSURL*"] || [responseType isEqualToString:@"NSURL"]) { [self downloadOperationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { completionBlock(data, error); }]; diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache index 1cf3db5e5233..59446d6c490e 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache @@ -1,6 +1,6 @@ #import #import -#import +#import #import "{{classPrefix}}JSONResponseSerializer.h" #import "{{classPrefix}}JSONRequestSerializer.h" #import "{{classPrefix}}QueryParamCollection.h" @@ -40,7 +40,7 @@ extern NSInteger const {{classPrefix}}TypeMismatchErrorCode; */ #define {{classPrefix}}DebugLog(format, ...) [{{classPrefix}}ApiClient debugLog:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__] message: format, ##__VA_ARGS__]; -@interface {{classPrefix}}ApiClient : AFHTTPRequestOperationManager +@interface {{classPrefix}}ApiClient : AFHTTPSessionManager @property(nonatomic, assign) NSURLRequestCachePolicy cachePolicy; @property(nonatomic, assign) NSTimeInterval timeoutInterval; @@ -80,7 +80,7 @@ extern NSInteger const {{classPrefix}}TypeMismatchErrorCode; * * @return The client offline state */ -+(bool) getOfflineState; ++(BOOL) getOfflineState; /** * Sets the client reachability, this may be overridden by the reachability manager if reachability changes @@ -188,12 +188,14 @@ extern NSInteger const {{classPrefix}}TypeMismatchErrorCode; /** * Logs request and response * - * @param operation AFHTTPRequestOperation for the HTTP request. + * @param response NSURLResponse for the HTTP request. + * @param responseObject response object of the HTTP request. * @param request The HTTP request. * @param error The error of the HTTP request. */ -- (void)logResponse:(AFHTTPRequestOperation *)operation - forRequest:(NSURLRequest *)request +- (void)logResponse:(NSURLResponse *)response + responseObject:(id)responseObject + request:(NSURLRequest *)request error:(NSError *)error; /** diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index bd0f24851a72..70c2c4c5f496 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-04-25T18:52:19.055+02:00 +- Build date: 2016-05-07T11:41:37.858+02:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements @@ -19,7 +19,7 @@ The SDK requires [**ARC (Automatic Reference Counting)**](http://stackoverflow.c Add the following to the Podfile: ```ruby -pod 'SwaggerClient', :git => 'https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git' +pod 'SwaggerClient', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' ``` To specify a particular branch, append `, :branch => 'branch-name-here'` diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h index 5d40ef2f5f00..0918e653972a 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h @@ -1,6 +1,6 @@ #import #import -#import +#import #import "SWGJSONResponseSerializer.h" #import "SWGJSONRequestSerializer.h" #import "SWGQueryParamCollection.h" @@ -44,7 +44,7 @@ extern NSInteger const SWGTypeMismatchErrorCode; */ #define SWGDebugLog(format, ...) [SWGApiClient debugLog:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__] message: format, ##__VA_ARGS__]; -@interface SWGApiClient : AFHTTPRequestOperationManager +@interface SWGApiClient : AFHTTPSessionManager @property(nonatomic, assign) NSURLRequestCachePolicy cachePolicy; @property(nonatomic, assign) NSTimeInterval timeoutInterval; @@ -84,7 +84,7 @@ extern NSInteger const SWGTypeMismatchErrorCode; * * @return The client offline state */ -+(bool) getOfflineState; ++(BOOL) getOfflineState; /** * Sets the client reachability, this may be overridden by the reachability manager if reachability changes @@ -192,12 +192,14 @@ extern NSInteger const SWGTypeMismatchErrorCode; /** * Logs request and response * - * @param operation AFHTTPRequestOperation for the HTTP request. + * @param response NSURLResponse for the HTTP request. + * @param responseObject response object of the HTTP request. * @param request The HTTP request. * @param error The error of the HTTP request. */ -- (void)logResponse:(AFHTTPRequestOperation *)operation - forRequest:(NSURLRequest *)request +- (void)logResponse:(NSURLResponse *)response + responseObject:(id)responseObject + request:(NSURLRequest *)request error:(NSError *)error; /** diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m index ecdf4aaafb28..6fd3206c7a31 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m @@ -14,6 +14,30 @@ static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilitySta static void (^reachabilityChangeBlock)(int); +static NSDictionary * SWG__headerFieldsForResponse(NSURLResponse *response) { + if(![response isKindOfClass:[NSHTTPURLResponse class]]) { + return nil; + } + return ((NSHTTPURLResponse*)response).allHeaderFields; +} + +static NSString * SWG__fileNameForResponse(NSURLResponse *response) { + NSDictionary * headers = SWG__headerFieldsForResponse(response); + if(!headers[@"Content-Disposition"]) { + return [NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]]; + } + NSString *pattern = @"filename=['\"]?([^'\"\\s]+)['\"]?"; + NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:pattern + options:NSRegularExpressionCaseInsensitive + error:nil]; + NSString *contentDispositionHeader = headers[@"Content-Disposition"]; + NSTextCheckingResult *match = [regexp firstMatchInString:contentDispositionHeader + options:0 + range:NSMakeRange(0, [contentDispositionHeader length])]; + return [contentDispositionHeader substringWithRange:[match rangeAtIndex:1]]; +} + + @interface SWGApiClient () @property (readwrite, nonatomic) NSDictionary *HTTPResponseHeaders; @@ -99,14 +123,12 @@ static void (^reachabilityChangeBlock)(int); va_end(args); } -- (void)logResponse:(AFHTTPRequestOperation *)operation - forRequest:(NSURLRequest *)request - error:(NSError*)error { +- (void)logResponse:(NSURLResponse *)response responseObject:(id)responseObject request:(NSURLRequest *)request error:(NSError *)error { NSString *message = [NSString stringWithFormat:@"\n[DEBUG] HTTP request body \n~BEGIN~\n %@\n~END~\n"\ "[DEBUG] HTTP response body \n~BEGIN~\n %@\n~END~\n", [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding], - operation.responseString]; + responseObject]; SWGDebugLog(message); } @@ -222,20 +244,14 @@ static void (^reachabilityChangeBlock)(int); -(Boolean) executeRequestWithId:(NSNumber*) requestId { NSSet* matchingItems = [queuedRequests objectsPassingTest:^BOOL(id obj, BOOL *stop) { - if ([obj intValue] == [requestId intValue]) { - return YES; - } - else { - return NO; - } + return [obj intValue] == [requestId intValue]; }]; if (matchingItems.count == 1) { SWGDebugLog(@"removed request id %@", requestId); [queuedRequests removeObject:requestId]; return YES; - } - else { + } else { return NO; } } @@ -246,7 +262,7 @@ static void (^reachabilityChangeBlock)(int); return reachabilityStatus; } -+(bool) getOfflineState { ++(BOOL) getOfflineState { return offlineState; } @@ -257,29 +273,8 @@ static void (^reachabilityChangeBlock)(int); - (void) configureCacheReachibility { [self.reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { reachabilityStatus = status; - switch (status) { - case AFNetworkReachabilityStatusUnknown: - SWGDebugLog(@"reachability changed to AFNetworkReachabilityStatusUnknown"); - [SWGApiClient setOfflineState:true]; - break; - - case AFNetworkReachabilityStatusNotReachable: - SWGDebugLog(@"reachability changed to AFNetworkReachabilityStatusNotReachable"); - [SWGApiClient setOfflineState:true]; - break; - - case AFNetworkReachabilityStatusReachableViaWWAN: - SWGDebugLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWWAN"); - [SWGApiClient setOfflineState:false]; - break; - - case AFNetworkReachabilityStatusReachableViaWiFi: - SWGDebugLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWiFi"); - [SWGApiClient setOfflineState:false]; - break; - default: - break; - } + SWGDebugLog(@"reachability changed to %@",AFStringFromNetworkReachabilityStatus(status)); + [SWGApiClient setOfflineState:status == AFNetworkReachabilityStatusUnknown || status == AFNetworkReachabilityStatusNotReachable]; // call the reachability block, if configured if (reachabilityChangeBlock != nil) { @@ -443,92 +438,60 @@ static void (^reachabilityChangeBlock)(int); - (void) operationWithCompletionBlock: (NSURLRequest *)request requestId: (NSNumber *) requestId completionBlock: (void (^)(id, NSError *))completionBlock { - AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request - success:^(AFHTTPRequestOperation *operation, id response) { - if ([self executeRequestWithId:requestId]) { - [self logResponse:operation forRequest:request error:nil]; - NSDictionary *responseHeaders = [[operation response] allHeaderFields]; - self.HTTPResponseHeaders = responseHeaders; - completionBlock(response, nil); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if ([self executeRequestWithId:requestId]) { - NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; - if (operation.responseObject) { - // Add in the (parsed) response body. - userInfo[SWGResponseObjectErrorKey] = operation.responseObject; - } - NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; - [self logResponse:nil forRequest:request error:augmentedError]; - - NSDictionary *responseHeaders = [[operation response] allHeaderFields]; - self.HTTPResponseHeaders = responseHeaders; - - completionBlock(nil, augmentedError); - } - }]; - - [self.operationQueue addOperation:op]; + __weak __typeof(self)weakSelf = self; + NSURLSessionDataTask* op = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if (![strongSelf executeRequestWithId:requestId]) { + return; + } + [strongSelf logResponse:response responseObject:responseObject request:request error:error]; + strongSelf.HTTPResponseHeaders = SWG__headerFieldsForResponse(response); + if(!error) { + completionBlock(responseObject, nil); + return; + } + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if (responseObject) { + // Add in the (parsed) response body. + userInfo[SWGResponseObjectErrorKey] = responseObject; + } + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + completionBlock(nil, augmentedError); + }]; + [op resume]; } - (void) downloadOperationWithCompletionBlock: (NSURLRequest *)request requestId: (NSNumber *) requestId completionBlock: (void (^)(id, NSError *))completionBlock { - AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request - success:^(AFHTTPRequestOperation *operation, id responseObject) { - SWGConfiguration *config = [SWGConfiguration sharedConfig]; - NSString *directory = nil; - if (config.tempFolderPath) { - directory = config.tempFolderPath; - } - else { - directory = NSTemporaryDirectory(); - } + __weak __typeof(self)weakSelf = self; + NSURLSessionDataTask* op = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if (![strongSelf executeRequestWithId:requestId]) { + return; + } + strongSelf.HTTPResponseHeaders = SWG__headerFieldsForResponse(response); + [strongSelf logResponse:response responseObject:responseObject request:request error:error]; + if(error) { + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if (responseObject) { + userInfo[SWGResponseObjectErrorKey] = responseObject; + } + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + completionBlock(nil, augmentedError); + } + SWGConfiguration *config = [SWGConfiguration sharedConfig]; + NSString *directory = config.tempFolderPath ?: NSTemporaryDirectory(); + NSString * filename = SWG__fileNameForResponse(response); - NSDictionary *headers = operation.response.allHeaderFields; - NSString *filename = nil; - if ([headers objectForKey:@"Content-Disposition"]) { + NSString *filepath = [directory stringByAppendingPathComponent:filename]; + NSURL *file = [NSURL fileURLWithPath:filepath]; - NSString *pattern = @"filename=['\"]?([^'\"\\s]+)['\"]?"; - NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:pattern - options:NSRegularExpressionCaseInsensitive - error:nil]; - NSString *contentDispositionHeader = [headers objectForKey:@"Content-Disposition"]; - NSTextCheckingResult *match = [regexp firstMatchInString:contentDispositionHeader - options:0 - range:NSMakeRange(0, [contentDispositionHeader length])]; - filename = [contentDispositionHeader substringWithRange:[match rangeAtIndex:1]]; - } - else { - filename = [NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]]; - } + [responseObject writeToURL:file atomically:YES]; - NSString *filepath = [directory stringByAppendingPathComponent:filename]; - NSURL *file = [NSURL fileURLWithPath:filepath]; - - [operation.responseData writeToURL:file atomically:YES]; - self.HTTPResponseHeaders = headers; - completionBlock(file, nil); - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - - if ([self executeRequestWithId:requestId]) { - NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; - if (operation.responseObject) { - userInfo[SWGResponseObjectErrorKey] = operation.responseObject; - } - - NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; - - - [self logResponse:nil forRequest:request error:augmentedError]; - - NSDictionary *responseHeaders = [[operation response] allHeaderFields]; - self.HTTPResponseHeaders = responseHeaders; - completionBlock(nil, augmentedError); - } - }]; - - [self.operationQueue addOperation:op]; + completionBlock(file, nil); + }]; + [op resume]; } #pragma mark - Perform Request Methods @@ -653,7 +616,7 @@ static void (^reachabilityChangeBlock)(int); [request setHTTPShouldHandleCookies:NO]; NSNumber* requestId = [SWGApiClient queueRequest]; - if ([responseType isEqualToString:@"NSURL*"]) { + if ([responseType isEqualToString:@"NSURL*"] || [responseType isEqualToString:@"NSURL"]) { [self downloadOperationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { completionBlock(data, error); }]; diff --git a/samples/client/petstore/objc/git_push.sh b/samples/client/petstore/objc/git_push.sh index 1a36388db023..ed374619b139 100644 --- a/samples/client/petstore/objc/git_push.sh +++ b/samples/client/petstore/objc/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi From 07b466a29129048fd7d897c8e4b2ca32144a9a3b Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Sat, 7 May 2016 14:06:20 +0200 Subject: [PATCH 137/170] Objective c generator converts map and array properties to proper format using generics --- .../codegen/languages/ObjcClientCodegen.java | 38 ++++++++++++++++--- .../resources/objc/ApiClient-header.mustache | 4 +- .../swagger/codegen/objc/ObjcModelTest.java | 32 ++++++++++++++-- samples/client/petstore/objc/README.md | 2 +- .../objc/SwaggerClient/SWGApiClient.h | 4 +- .../petstore/objc/SwaggerClient/SWGPet.h | 2 +- .../petstore/objc/SwaggerClient/SWGPetApi.h | 4 +- .../petstore/objc/SwaggerClient/SWGPetApi.m | 4 +- .../petstore/objc/SwaggerClient/SWGStoreApi.h | 4 +- .../petstore/objc/SwaggerClient/SWGStoreApi.m | 8 ++-- .../SwaggerClient/SWGViewController.m | 7 +--- .../Tests/DeserializationTest.m | 8 +++- samples/client/petstore/objc/docs/SWGPet.md | 2 +- .../client/petstore/objc/docs/SWGPetApi.md | 12 +++--- .../client/petstore/objc/docs/SWGStoreApi.md | 6 +-- 15 files changed, 97 insertions(+), 40 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 0ecdfb667c9b..2029394bdbd7 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -39,6 +39,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { protected String[] specialWords = {"new", "copy"}; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; + + protected Set advancedMapingTypes = new HashSet(); public ObjcClientCodegen() { super(); @@ -65,6 +67,16 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { defaultIncludes.add("NSDictionary"); defaultIncludes.add("NSMutableArray"); defaultIncludes.add("NSMutableDictionary"); + + advancedMapingTypes.add("NSDictionary"); + advancedMapingTypes.add("NSArray"); + advancedMapingTypes.add("NSMutableArray"); + advancedMapingTypes.add("NSMutableDictionary"); + advancedMapingTypes.add("NSObject"); + advancedMapingTypes.add("NSNumber"); + advancedMapingTypes.add("NSURL"); + advancedMapingTypes.add("NSString"); + advancedMapingTypes.add("NSDate"); languageSpecificPrimitives.clear(); languageSpecificPrimitives.add("NSNumber"); @@ -284,15 +296,20 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { if (innerTypeDeclaration.endsWith("*")) { innerTypeDeclaration = innerTypeDeclaration.substring(0, innerTypeDeclaration.length() - 1); } - + // In this codition, type of property p is array of primitive, - // return container type with pointer, e.g. `NSArray* /* NSString */' - if (languageSpecificPrimitives.contains(innerType)) { - return getSwaggerType(p) + "*" + " /* " + innerTypeDeclaration + " */"; + // return container type with pointer, e.g. `NSArray**' + if (languageSpecificPrimitives.contains(innerTypeDeclaration)) { + return getSwaggerType(p) + "<" + innerTypeDeclaration + "*>*"; } // In this codition, type of property p is array of model, // return container type combine inner type with pointer, e.g. `NSArray*' else { + for (String sd : advancedMapingTypes) { + if(innerTypeDeclaration.startsWith(sd)) { + return getSwaggerType(p) + "<" + innerTypeDeclaration + "*>*"; + } + } return getSwaggerType(p) + "<" + innerTypeDeclaration + ">*"; } } else if (p instanceof MapProperty) { @@ -300,11 +317,20 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { Property inner = mp.getAdditionalProperties(); String innerTypeDeclaration = getTypeDeclaration(inner); - + if (innerTypeDeclaration.endsWith("*")) { innerTypeDeclaration = innerTypeDeclaration.substring(0, innerTypeDeclaration.length() - 1); } - return getSwaggerType(p) + "* /* NSString, " + innerTypeDeclaration + " */"; + if (languageSpecificPrimitives.contains(innerTypeDeclaration)) { + return getSwaggerType(p) + "*"; + } else { + for (String s : advancedMapingTypes) { + if(innerTypeDeclaration.startsWith(s)) { + return getSwaggerType(p) + "*"; + } + } + return getSwaggerType(p) + "*"; + } } else { String swaggerType = getSwaggerType(p); diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache index c7caa7ab11e3..a9f20828acbc 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache @@ -28,7 +28,9 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey; /** * Log debug message macro */ -#define {{classPrefix}}DebugLog(format, ...) [{{classPrefix}}ApiClient debugLog:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__] message: format, ##__VA_ARGS__]; +#ifndef {{classPrefix}}DebugLog + #define {{classPrefix}}DebugLog(format, ...) [{{classPrefix}}ApiClient debugLog:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__] message: format, ##__VA_ARGS__]; +#endif @interface {{classPrefix}}ApiClient : AFHTTPRequestOperationManager diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/objc/ObjcModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/objc/ObjcModelTest.java index fed94aa04f6c..84fb38d1dd3f 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/objc/ObjcModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/objc/ObjcModelTest.java @@ -27,6 +27,31 @@ import java.util.Map; @SuppressWarnings("static-method") public class ObjcModelTest { + @Test(description = "convert a model with a advanced map property") + public void advancedMapPropertyTest() { + final Model model = new ModelImpl() + .description("a sample model") + .property("translations", new MapProperty() + .additionalProperties(new MapProperty().additionalProperties(new StringProperty()))) + .required("id"); + final DefaultCodegen codegen = new ObjcClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "SWGSample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "translations"); + Assert.assertEquals(property1.datatype, "NSDictionary*>*"); + Assert.assertEquals(property1.name, "translations"); + Assert.assertEquals(property1.baseType, "NSDictionary"); + Assert.assertEquals(property1.containerType, "map"); + Assert.assertNull(property1.required); + Assert.assertTrue(property1.isContainer); + } + @Test(description = "convert a simple java model") public void simpleModelTest() { final Model model = new ModelImpl() @@ -108,7 +133,7 @@ public class ObjcModelTest { final CodegenProperty property2 = cm.vars.get(1); Assert.assertEquals(property2.baseName, "urls"); - Assert.assertEquals(property2.datatype, "NSArray* /* NSString */"); + Assert.assertEquals(property2.datatype, "NSArray*"); Assert.assertEquals(property2.name, "urls"); Assert.assertNull(property2.defaultValue); Assert.assertEquals(property2.baseType, "NSArray"); @@ -136,7 +161,7 @@ public class ObjcModelTest { final CodegenProperty property1 = cm.vars.get(0); Assert.assertEquals(property1.baseName, "translations"); - Assert.assertEquals(property1.datatype, "NSDictionary* /* NSString, NSString */"); + Assert.assertEquals(property1.datatype, "NSDictionary*"); Assert.assertEquals(property1.name, "translations"); Assert.assertEquals(property1.baseType, "NSDictionary"); Assert.assertEquals(property1.containerType, "map"); @@ -145,6 +170,7 @@ public class ObjcModelTest { Assert.assertTrue(property1.isPrimitiveType); } + @Test(description = "convert a model with complex property") public void complexPropertyTest() { final Model model = new ModelImpl() @@ -210,7 +236,7 @@ public class ObjcModelTest { final CodegenProperty property1 = cm.vars.get(0); Assert.assertEquals(property1.baseName, "children"); Assert.assertEquals(property1.complexType, "SWGChildren"); - Assert.assertEquals(property1.datatype, "NSDictionary* /* NSString, SWGChildren */"); + Assert.assertEquals(property1.datatype, "NSDictionary*"); Assert.assertEquals(property1.name, "children"); Assert.assertEquals(property1.baseType, "NSDictionary"); Assert.assertEquals(property1.containerType, "map"); diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index a3550545c246..289ffd121c70 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-05-06T12:20:47.112+02:00 +- Build date: 2016-05-06T14:56:38.502+02:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h index 7dea87a3327d..5024566c3f72 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h @@ -32,7 +32,9 @@ extern NSString *const SWGResponseObjectErrorKey; /** * Log debug message macro */ -#define SWGDebugLog(format, ...) [SWGApiClient debugLog:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__] message: format, ##__VA_ARGS__]; +#ifndef SWGDebugLog + #define SWGDebugLog(format, ...) [SWGApiClient debugLog:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__] message: format, ##__VA_ARGS__]; +#endif @interface SWGApiClient : AFHTTPRequestOperationManager diff --git a/samples/client/petstore/objc/SwaggerClient/SWGPet.h b/samples/client/petstore/objc/SwaggerClient/SWGPet.h index 84f10969e5be..2f83af6c4e12 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGPet.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGPet.h @@ -23,7 +23,7 @@ @property(nonatomic) NSString* name; -@property(nonatomic) NSArray* /* NSString */ photoUrls; +@property(nonatomic) NSArray* photoUrls; @property(nonatomic) NSArray* tags; /* pet status in the store [optional] diff --git a/samples/client/petstore/objc/SwaggerClient/SWGPetApi.h b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.h index ef66979613fa..908771588e0e 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGPetApi.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.h @@ -56,7 +56,7 @@ /// /// /// @return NSArray* --(NSNumber*) findPetsByStatusWithStatus: (NSArray* /* NSString */) status +-(NSNumber*) findPetsByStatusWithStatus: (NSArray*) status completionHandler: (void (^)(NSArray* output, NSError* error)) handler; @@ -69,7 +69,7 @@ /// /// /// @return NSArray* --(NSNumber*) findPetsByTagsWithTags: (NSArray* /* NSString */) tags +-(NSNumber*) findPetsByTagsWithTags: (NSArray*) tags completionHandler: (void (^)(NSArray* output, NSError* error)) handler; diff --git a/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m index 872010645422..b3ebc31bf689 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m @@ -217,7 +217,7 @@ static SWGPetApi* singletonAPI = nil; /// /// @returns NSArray* /// --(NSNumber*) findPetsByStatusWithStatus: (NSArray* /* NSString */) status +-(NSNumber*) findPetsByStatusWithStatus: (NSArray*) status completionHandler: (void (^)(NSArray* output, NSError* error)) handler { NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByStatus"]; @@ -284,7 +284,7 @@ static SWGPetApi* singletonAPI = nil; /// /// @returns NSArray* /// --(NSNumber*) findPetsByTagsWithTags: (NSArray* /* NSString */) tags +-(NSNumber*) findPetsByTagsWithTags: (NSArray*) tags completionHandler: (void (^)(NSArray* output, NSError* error)) handler { NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByTags"]; diff --git a/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.h b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.h index 0a7bc70864ac..d86eb23a0467 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.h @@ -39,9 +39,9 @@ /// /// /// -/// @return NSDictionary* /* NSString, NSNumber */ +/// @return NSDictionary* -(NSNumber*) getInventoryWithCompletionHandler: - (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error)) handler; + (void (^)(NSDictionary* output, NSError* error)) handler; /// diff --git a/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m index 84cd3a699d06..336258c3c5ba 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m @@ -141,10 +141,10 @@ static SWGStoreApi* singletonAPI = nil; /// /// Returns pet inventories by status /// Returns a map of status codes to quantities -/// @returns NSDictionary* /* NSString, NSNumber */ +/// @returns NSDictionary* /// -(NSNumber*) getInventoryWithCompletionHandler: - (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error)) handler { + (void (^)(NSDictionary* output, NSError* error)) handler { NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory"]; // remove format in URL if needed @@ -192,9 +192,9 @@ static SWGStoreApi* singletonAPI = nil; authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType - responseType: @"NSDictionary* /* NSString, NSNumber */" + responseType: @"NSDictionary*" completionBlock: ^(id data, NSError *error) { - handler((NSDictionary* /* NSString, NSNumber */)data, error); + handler((NSDictionary*)data, error); } ]; } diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m index 57fd9828e03d..4405438e7ee3 100644 --- a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m @@ -27,16 +27,11 @@ SWGPetApi *api = [[SWGPetApi alloc] init]; NSURL *file = [NSURL fileURLWithPath:@"/Users/geekerzp/tmp/test.jpg"]; - [api uploadFileWithPetId:@2 additionalMetadata:@2 file:file completionHandler:^(NSError *error) { + [api uploadFileWithPetId:@2 additionalMetadata:@"2" file:file completionHandler:^(NSError *error) { NSLog(@"*** error: %@", error); }]; } -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; -} - - (SWGPet*) createPet { SWGPet * pet = [[SWGPet alloc] init]; pet._id = [[NSNumber alloc] initWithLong:[[NSDate date] timeIntervalSince1970]]; diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m index 3284336a64b4..6077ab42981a 100644 --- a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m @@ -138,7 +138,13 @@ XCTAssertTrue([result isKindOfClass:[NSArray class]]); XCTAssertTrue([[result firstObject] isKindOfClass:[SWGPet class]]); - XCTAssertEqualObjects([[result firstObject] _id], @119); + SWGPet*pet = [result firstObject]; + XCTAssertEqualObjects([pet.photoUrls firstObject],@"string"); + XCTAssertTrue([[pet.tags firstObject] isKindOfClass:[SWGTag class]]); + SWGTag* tag = [pet.tags firstObject]; + XCTAssertEqualObjects(tag._id, @0); + XCTAssertEqualObjects(tag.name, @"string"); + XCTAssertEqualObjects(pet._id, @119); } - (void)testDeserializeMapOfModels { diff --git a/samples/client/petstore/objc/docs/SWGPet.md b/samples/client/petstore/objc/docs/SWGPet.md index 6c7286531f9f..c8298c66bf14 100644 --- a/samples/client/petstore/objc/docs/SWGPet.md +++ b/samples/client/petstore/objc/docs/SWGPet.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **_id** | **NSNumber*** | | [optional] **category** | [**SWGCategory***](SWGCategory.md) | | [optional] **name** | **NSString*** | | -**photoUrls** | **NSArray* /* NSString */** | | +**photoUrls** | **NSArray<NSString*>*** | | **tags** | [**NSArray<SWGTag>***](SWGTag.md) | | [optional] **status** | **NSString*** | pet status in the store | [optional] diff --git a/samples/client/petstore/objc/docs/SWGPetApi.md b/samples/client/petstore/objc/docs/SWGPetApi.md index c69e6ce02c80..a07f0cf067c7 100644 --- a/samples/client/petstore/objc/docs/SWGPetApi.md +++ b/samples/client/petstore/objc/docs/SWGPetApi.md @@ -140,7 +140,7 @@ void (empty response body) # **findPetsByStatus** ```objc --(NSNumber*) findPetsByStatusWithStatus: (NSArray* /* NSString */) status +-(NSNumber*) findPetsByStatusWithStatus: (NSArray*) status completionHandler: (void (^)(NSArray* output, NSError* error)) handler; ``` @@ -156,7 +156,7 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -NSArray* /* NSString */ status = @[@"available"]; // Status values that need to be considered for filter (optional) (default to available) +NSArray* status = @[@"available"]; // Status values that need to be considered for filter (optional) (default to available) @try { @@ -184,7 +184,7 @@ NSArray* /* NSString */ status = @[@"available"]; // Status values that need to Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**NSArray* /* NSString */**](NSString*.md)| Status values that need to be considered for filter | [optional] [default to available] + **status** | [**NSArray<NSString*>***](NSString*.md)| Status values that need to be considered for filter | [optional] [default to available] ### Return type @@ -203,7 +203,7 @@ Name | Type | Description | Notes # **findPetsByTags** ```objc --(NSNumber*) findPetsByTagsWithTags: (NSArray* /* NSString */) tags +-(NSNumber*) findPetsByTagsWithTags: (NSArray*) tags completionHandler: (void (^)(NSArray* output, NSError* error)) handler; ``` @@ -219,7 +219,7 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -NSArray* /* NSString */ tags = @[@"tags_example"]; // Tags to filter by (optional) +NSArray* tags = @[@"tags_example"]; // Tags to filter by (optional) @try { @@ -247,7 +247,7 @@ NSArray* /* NSString */ tags = @[@"tags_example"]; // Tags to filter by (optiona Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**NSArray* /* NSString */**](NSString*.md)| Tags to filter by | [optional] + **tags** | [**NSArray<NSString*>***](NSString*.md)| Tags to filter by | [optional] ### Return type diff --git a/samples/client/petstore/objc/docs/SWGStoreApi.md b/samples/client/petstore/objc/docs/SWGStoreApi.md index 7c9b20696d08..29dfde60aa76 100644 --- a/samples/client/petstore/objc/docs/SWGStoreApi.md +++ b/samples/client/petstore/objc/docs/SWGStoreApi.md @@ -68,7 +68,7 @@ No authorization required # **getInventory** ```objc -(NSNumber*) getInventoryWithCompletionHandler: - (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error)) handler; + (void (^)(NSDictionary* output, NSError* error)) handler; ``` Returns pet inventories by status @@ -92,7 +92,7 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; // Returns pet inventories by status [apiInstance getInventoryWithCompletionHandler: - ^(NSDictionary* /* NSString, NSNumber */ output, NSError* error) { + ^(NSDictionary* output, NSError* error) { if (output) { NSLog(@"%@", output); } @@ -113,7 +113,7 @@ This endpoint does not need any parameter. ### Return type -[**NSDictionary* /* NSString, NSNumber */**](NSDictionary.md) +[**NSDictionary***](NSDictionary.md) ### Authorization From 74c233e194ea2c882f46da1b7c5347ae84bbe4c9 Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Sat, 7 May 2016 15:18:10 +0200 Subject: [PATCH 138/170] Sanitizer for separating sanitize and service logic --- .../codegen/languages/ObjcClientCodegen.java | 2 + .../resources/objc/ApiClient-body.mustache | 82 ++----------------- .../resources/objc/ApiClient-header.mustache | 15 +--- .../resources/objc/Sanitizer-body.mustache | 82 +++++++++++++++++++ .../resources/objc/Sanitizer-header.mustache | 29 +++++++ samples/client/petstore/objc/README.md | 2 +- .../objc/SwaggerClient/SWGApiClient.h | 15 +--- .../objc/SwaggerClient/SWGApiClient.m | 82 ++----------------- .../objc/SwaggerClient/SWGSanitizer.h | 29 +++++++ .../objc/SwaggerClient/SWGSanitizer.m | 82 +++++++++++++++++++ .../Tests/SWGApiClientTest.m | 27 +++--- 11 files changed, 258 insertions(+), 189 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/objc/Sanitizer-body.mustache create mode 100644 modules/swagger-codegen/src/main/resources/objc/Sanitizer-header.mustache create mode 100644 samples/client/petstore/objc/SwaggerClient/SWGSanitizer.h create mode 100644 samples/client/petstore/objc/SwaggerClient/SWGSanitizer.m diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 0ecdfb667c9b..745e9e35f00c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -225,6 +225,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("JSONRequestSerializer-header.mustache", swaggerFolder, classPrefix + "JSONRequestSerializer.h")); supportingFiles.add(new SupportingFile("ResponseDeserializer-body.mustache", swaggerFolder, classPrefix + "ResponseDeserializer.m")); supportingFiles.add(new SupportingFile("ResponseDeserializer-header.mustache", swaggerFolder, classPrefix + "ResponseDeserializer.h")); + supportingFiles.add(new SupportingFile("Sanitizer-body.mustache", swaggerFolder, classPrefix + "Sanitizer.m")); + supportingFiles.add(new SupportingFile("Sanitizer-header.mustache", swaggerFolder, classPrefix + "Sanitizer.h")); supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.m", swaggerFolder, "JSONValueTransformer+ISO8601.m")); supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.h", swaggerFolder, "JSONValueTransformer+ISO8601.h")); supportingFiles.add(new SupportingFile("Configuration-body.mustache", swaggerFolder, classPrefix + "Configuration.m")); diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache index a8644bab0304..b0765449b104 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache @@ -30,6 +30,7 @@ static void (^reachabilityChangeBlock)(int); self.responseSerializer = [AFJSONResponseSerializer serializer]; self.securityPolicy = [self customSecurityPolicy]; self.responseDeserializer = [[{{classPrefix}}ResponseDeserializer alloc] init]; + self.sanitizer = [[{{classPrefix}}Sanitizer alloc] init]; // configure reachability [self configureCacheReachibility]; } @@ -418,11 +419,11 @@ static void (^reachabilityChangeBlock)(int); } // sanitize parameters - pathParams = [self sanitizeForSerialization:pathParams]; - queryParams = [self sanitizeForSerialization:queryParams]; - headerParams = [self sanitizeForSerialization:headerParams]; - formParams = [self sanitizeForSerialization:formParams]; - body = [self sanitizeForSerialization:body]; + pathParams = [self.sanitizer sanitizeForSerialization:pathParams]; + queryParams = [self.sanitizer sanitizeForSerialization:queryParams]; + headerParams = [self.sanitizer sanitizeForSerialization:headerParams]; + formParams = [self.sanitizer sanitizeForSerialization:formParams]; + body = [self.sanitizer sanitizeForSerialization:body]; // auth setting [self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings]; @@ -442,12 +443,13 @@ static void (^reachabilityChangeBlock)(int); NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; if (files.count > 0) { + __weak __typeof(self)weakSelf = self; request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:urlString parameters:nil constructingBodyWithBlock:^(id formData) { [formParams enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - NSString *objString = [self parameterToString:obj]; + NSString *objString = [weakSelf.sanitizer parameterToString:obj]; NSData *data = [objString dataUsingEncoding:NSUTF8StringEncoding]; [formData appendPartWithFormData:data name:key]; }]; @@ -609,48 +611,6 @@ static void (^reachabilityChangeBlock)(int); *querys = [NSDictionary dictionaryWithDictionary:querysWithAuth]; } -- (id) sanitizeForSerialization:(id) object { - if (object == nil) { - return nil; - } - else if ([object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[{{classPrefix}}QueryParamCollection class]]) { - return object; - } - else if ([object isKindOfClass:[NSDate class]]) { - return [object ISO8601String]; - } - else if ([object isKindOfClass:[NSArray class]]) { - NSArray *objectArray = object; - NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[objectArray count]]; - [object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if (obj) { - [sanitizedObjs addObject:[self sanitizeForSerialization:obj]]; - } - }]; - return sanitizedObjs; - } - else if ([object isKindOfClass:[NSDictionary class]]) { - NSDictionary *objectDict = object; - NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[objectDict count]]; - [object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - if (obj) { - [sanitizedObjs setValue:[self sanitizeForSerialization:obj] forKey:key]; - } - }]; - return sanitizedObjs; - } - else if ([object isKindOfClass:[{{classPrefix}}Object class]]) { - return [object toDictionary]; - } - else { - NSException *e = [NSException - exceptionWithName:@"InvalidObjectArgumentException" - reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", object] - userInfo:nil]; - @throw e; - } -} - - (AFSecurityPolicy *) customSecurityPolicy { AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; @@ -672,30 +632,4 @@ static void (^reachabilityChangeBlock)(int); return securityPolicy; } -- (NSString *) parameterToString:(id)param { - if ([param isKindOfClass:[NSString class]]) { - return param; - } - else if ([param isKindOfClass:[NSNumber class]]) { - return [param stringValue]; - } - else if ([param isKindOfClass:[NSDate class]]) { - return [param ISO8601String]; - } - else if ([param isKindOfClass:[NSArray class]]) { - NSMutableArray *mutableParam; - [param enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - [mutableParam addObject:[self parameterToString:obj]]; - }]; - return [mutableParam componentsJoinedByString:@","]; - } - else { - NSException *e = [NSException - exceptionWithName:@"InvalidObjectArgumentException" - reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", param] - userInfo:nil]; - @throw e; - } -} - @end diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache index c7caa7ab11e3..5a48c518c298 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache @@ -6,6 +6,7 @@ #import "{{classPrefix}}QueryParamCollection.h" #import "{{classPrefix}}Configuration.h" #import "{{classPrefix}}ResponseDeserializer.h" +#import "{{classPrefix}}Sanitizer.h" /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen @@ -40,6 +41,8 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey; @property(nonatomic, readonly) NSDictionary* HTTPResponseHeaders; @property(nonatomic, strong) id<{{classPrefix}}ResponseDeserializer> responseDeserializer; + +@property(nonatomic, strong) id<{{classPrefix}}Sanitizer> sanitizer; /** * Clears Cache */ @@ -208,13 +211,6 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey; responseType:(NSString *) responseType completionBlock:(void (^)(id, NSError *))completionBlock; -/** - * Sanitize object for request - * - * @param object The query/path/header/form/body param to be sanitized. - */ -- (id) sanitizeForSerialization:(id) object; - /** * Custom security policy * @@ -222,11 +218,6 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey; */ - (AFSecurityPolicy *) customSecurityPolicy; -/** - * Convert parameter to NSString - */ -- (NSString *) parameterToString: (id) param; - /** * Log debug message */ diff --git a/modules/swagger-codegen/src/main/resources/objc/Sanitizer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/Sanitizer-body.mustache new file mode 100644 index 000000000000..74b166d75e9b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/Sanitizer-body.mustache @@ -0,0 +1,82 @@ +#import "{{classPrefix}}Sanitizer.h" +#import "{{classPrefix}}Object.h" +#import "{{classPrefix}}QueryParamCollection.h" +#import + +@interface {{classPrefix}}Sanitizer () + +@end + +@implementation {{classPrefix}}Sanitizer + +- (id) sanitizeForSerialization:(id) object { + if (object == nil) { + return nil; + } + else if ([object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[{{classPrefix}}QueryParamCollection class]]) { + return object; + } + else if ([object isKindOfClass:[NSDate class]]) { + return [object ISO8601String]; + } + else if ([object isKindOfClass:[NSArray class]]) { + NSArray *objectArray = object; + NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[objectArray count]]; + [object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + id sanitizedObj = [self sanitizeForSerialization:obj]; + if (sanitizedObj) { + [sanitizedObjs addObject:sanitizedObj]; + } + }]; + return sanitizedObjs; + } + else if ([object isKindOfClass:[NSDictionary class]]) { + NSDictionary *objectDict = object; + NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[objectDict count]]; + [object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + id sanitizedObj = [self sanitizeForSerialization:obj]; + if (sanitizedObj) { + sanitizedObjs[key] = sanitizedObj; + } + }]; + return sanitizedObjs; + } + else if ([object isKindOfClass:[{{classPrefix}}Object class]]) { + return [object toDictionary]; + } + else { + NSException *e = [NSException + exceptionWithName:@"InvalidObjectArgumentException" + reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", object] + userInfo:nil]; + @throw e; + } +} + +- (NSString *) parameterToString:(id)param { + if ([param isKindOfClass:[NSString class]]) { + return param; + } + else if ([param isKindOfClass:[NSNumber class]]) { + return [param stringValue]; + } + else if ([param isKindOfClass:[NSDate class]]) { + return [param ISO8601String]; + } + else if ([param isKindOfClass:[NSArray class]]) { + NSMutableArray *mutableParam = [NSMutableArray array]; + [param enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + [mutableParam addObject:[self parameterToString:obj]]; + }]; + return [mutableParam componentsJoinedByString:@","]; + } + else { + NSException *e = [NSException + exceptionWithName:@"InvalidObjectArgumentException" + reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", param] + userInfo:nil]; + @throw e; + } +} + +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/Sanitizer-header.mustache b/modules/swagger-codegen/src/main/resources/objc/Sanitizer-header.mustache new file mode 100644 index 000000000000..706a94c1d0e9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/Sanitizer-header.mustache @@ -0,0 +1,29 @@ +#import + +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +@protocol {{classPrefix}}Sanitizer + +/** + * Sanitize object for request + * + * @param object The query/path/header/form/body param to be sanitized. + */ +- (id) sanitizeForSerialization:(id) object; + +/** + * Convert parameter to NSString + */ +- (NSString *) parameterToString: (id) param; + +@end + +@interface {{classPrefix}}Sanitizer : NSObject <{{classPrefix}}Sanitizer> + + + +@end diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index a3550545c246..fb10f607ca49 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-05-06T12:20:47.112+02:00 +- Build date: 2016-05-07T15:16:28.620+02:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h index 7dea87a3327d..87971580cb4a 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h @@ -6,6 +6,7 @@ #import "SWGQueryParamCollection.h" #import "SWGConfiguration.h" #import "SWGResponseDeserializer.h" +#import "SWGSanitizer.h" /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen @@ -44,6 +45,8 @@ extern NSString *const SWGResponseObjectErrorKey; @property(nonatomic, readonly) NSDictionary* HTTPResponseHeaders; @property(nonatomic, strong) id responseDeserializer; + +@property(nonatomic, strong) id sanitizer; /** * Clears Cache */ @@ -212,13 +215,6 @@ extern NSString *const SWGResponseObjectErrorKey; responseType:(NSString *) responseType completionBlock:(void (^)(id, NSError *))completionBlock; -/** - * Sanitize object for request - * - * @param object The query/path/header/form/body param to be sanitized. - */ -- (id) sanitizeForSerialization:(id) object; - /** * Custom security policy * @@ -226,11 +222,6 @@ extern NSString *const SWGResponseObjectErrorKey; */ - (AFSecurityPolicy *) customSecurityPolicy; -/** - * Convert parameter to NSString - */ -- (NSString *) parameterToString: (id) param; - /** * Log debug message */ diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m index 5d5d2019b0f2..da479138feb0 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m @@ -30,6 +30,7 @@ static void (^reachabilityChangeBlock)(int); self.responseSerializer = [AFJSONResponseSerializer serializer]; self.securityPolicy = [self customSecurityPolicy]; self.responseDeserializer = [[SWGResponseDeserializer alloc] init]; + self.sanitizer = [[SWGSanitizer alloc] init]; // configure reachability [self configureCacheReachibility]; } @@ -418,11 +419,11 @@ static void (^reachabilityChangeBlock)(int); } // sanitize parameters - pathParams = [self sanitizeForSerialization:pathParams]; - queryParams = [self sanitizeForSerialization:queryParams]; - headerParams = [self sanitizeForSerialization:headerParams]; - formParams = [self sanitizeForSerialization:formParams]; - body = [self sanitizeForSerialization:body]; + pathParams = [self.sanitizer sanitizeForSerialization:pathParams]; + queryParams = [self.sanitizer sanitizeForSerialization:queryParams]; + headerParams = [self.sanitizer sanitizeForSerialization:headerParams]; + formParams = [self.sanitizer sanitizeForSerialization:formParams]; + body = [self.sanitizer sanitizeForSerialization:body]; // auth setting [self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings]; @@ -442,12 +443,13 @@ static void (^reachabilityChangeBlock)(int); NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; if (files.count > 0) { + __weak __typeof(self)weakSelf = self; request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:urlString parameters:nil constructingBodyWithBlock:^(id formData) { [formParams enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - NSString *objString = [self parameterToString:obj]; + NSString *objString = [weakSelf.sanitizer parameterToString:obj]; NSData *data = [objString dataUsingEncoding:NSUTF8StringEncoding]; [formData appendPartWithFormData:data name:key]; }]; @@ -609,48 +611,6 @@ static void (^reachabilityChangeBlock)(int); *querys = [NSDictionary dictionaryWithDictionary:querysWithAuth]; } -- (id) sanitizeForSerialization:(id) object { - if (object == nil) { - return nil; - } - else if ([object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[SWGQueryParamCollection class]]) { - return object; - } - else if ([object isKindOfClass:[NSDate class]]) { - return [object ISO8601String]; - } - else if ([object isKindOfClass:[NSArray class]]) { - NSArray *objectArray = object; - NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[objectArray count]]; - [object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if (obj) { - [sanitizedObjs addObject:[self sanitizeForSerialization:obj]]; - } - }]; - return sanitizedObjs; - } - else if ([object isKindOfClass:[NSDictionary class]]) { - NSDictionary *objectDict = object; - NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[objectDict count]]; - [object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - if (obj) { - [sanitizedObjs setValue:[self sanitizeForSerialization:obj] forKey:key]; - } - }]; - return sanitizedObjs; - } - else if ([object isKindOfClass:[SWGObject class]]) { - return [object toDictionary]; - } - else { - NSException *e = [NSException - exceptionWithName:@"InvalidObjectArgumentException" - reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", object] - userInfo:nil]; - @throw e; - } -} - - (AFSecurityPolicy *) customSecurityPolicy { AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; @@ -672,30 +632,4 @@ static void (^reachabilityChangeBlock)(int); return securityPolicy; } -- (NSString *) parameterToString:(id)param { - if ([param isKindOfClass:[NSString class]]) { - return param; - } - else if ([param isKindOfClass:[NSNumber class]]) { - return [param stringValue]; - } - else if ([param isKindOfClass:[NSDate class]]) { - return [param ISO8601String]; - } - else if ([param isKindOfClass:[NSArray class]]) { - NSMutableArray *mutableParam; - [param enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - [mutableParam addObject:[self parameterToString:obj]]; - }]; - return [mutableParam componentsJoinedByString:@","]; - } - else { - NSException *e = [NSException - exceptionWithName:@"InvalidObjectArgumentException" - reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", param] - userInfo:nil]; - @throw e; - } -} - @end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGSanitizer.h b/samples/client/petstore/objc/SwaggerClient/SWGSanitizer.h new file mode 100644 index 000000000000..5803999f362b --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClient/SWGSanitizer.h @@ -0,0 +1,29 @@ +#import + +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +@protocol SWGSanitizer + +/** + * Sanitize object for request + * + * @param object The query/path/header/form/body param to be sanitized. + */ +- (id) sanitizeForSerialization:(id) object; + +/** + * Convert parameter to NSString + */ +- (NSString *) parameterToString: (id) param; + +@end + +@interface SWGSanitizer : NSObject + + + +@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGSanitizer.m b/samples/client/petstore/objc/SwaggerClient/SWGSanitizer.m new file mode 100644 index 000000000000..3f1dea7726ea --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClient/SWGSanitizer.m @@ -0,0 +1,82 @@ +#import "SWGSanitizer.h" +#import "SWGObject.h" +#import "SWGQueryParamCollection.h" +#import + +@interface SWGSanitizer () + +@end + +@implementation SWGSanitizer + +- (id) sanitizeForSerialization:(id) object { + if (object == nil) { + return nil; + } + else if ([object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[SWGQueryParamCollection class]]) { + return object; + } + else if ([object isKindOfClass:[NSDate class]]) { + return [object ISO8601String]; + } + else if ([object isKindOfClass:[NSArray class]]) { + NSArray *objectArray = object; + NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[objectArray count]]; + [object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + id sanitizedObj = [self sanitizeForSerialization:obj]; + if (sanitizedObj) { + [sanitizedObjs addObject:sanitizedObj]; + } + }]; + return sanitizedObjs; + } + else if ([object isKindOfClass:[NSDictionary class]]) { + NSDictionary *objectDict = object; + NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[objectDict count]]; + [object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + id sanitizedObj = [self sanitizeForSerialization:obj]; + if (sanitizedObj) { + sanitizedObjs[key] = sanitizedObj; + } + }]; + return sanitizedObjs; + } + else if ([object isKindOfClass:[SWGObject class]]) { + return [object toDictionary]; + } + else { + NSException *e = [NSException + exceptionWithName:@"InvalidObjectArgumentException" + reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", object] + userInfo:nil]; + @throw e; + } +} + +- (NSString *) parameterToString:(id)param { + if ([param isKindOfClass:[NSString class]]) { + return param; + } + else if ([param isKindOfClass:[NSNumber class]]) { + return [param stringValue]; + } + else if ([param isKindOfClass:[NSDate class]]) { + return [param ISO8601String]; + } + else if ([param isKindOfClass:[NSArray class]]) { + NSMutableArray *mutableParam = [NSMutableArray array]; + [param enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + [mutableParam addObject:[self parameterToString:obj]]; + }]; + return [mutableParam componentsJoinedByString:@","]; + } + else { + NSException *e = [NSException + exceptionWithName:@"InvalidObjectArgumentException" + reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", param] + userInfo:nil]; + @throw e; + } +} + +@end diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m index e9f1a46af3ba..ed87d8f9e2df 100644 --- a/samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m @@ -2,11 +2,6 @@ #import #import #import -#import -#import -#import -#import -#import @interface SWGApiClientTest : XCTestCase @@ -109,31 +104,31 @@ // nil data = nil; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, data); // NSString data = @"test string"; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, data); // NSNumber data = @1; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, data); // SWGQueryParamCollection data = [[SWGQueryParamCollection alloc] init]; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, data); // NSDate data = [NSDate dateWithISO8601String:@"1997-07-16T19:20:30.45+01:00"]; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, [data ISO8601String]); data = [NSDate dateWithISO8601String:@"1997-07-16"]; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, [data ISO8601String]); // model @@ -144,23 +139,23 @@ @"status": @"available", @"photoUrls": @[@"http://foo.bar.com/3", @"http://foo.bar.com/4"]}; data = [[SWGPet alloc] initWithDictionary:petDict error:nil]; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, petDict); // NSArray data = @[@1]; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, data); // NSArray of models NSArray *arrayOfPetDict = @[petDict]; - data = [NSArray arrayWithObject:[[SWGPet alloc] initWithDictionary:petDict error:nil]]; - result = [self.apiClient sanitizeForSerialization:data]; + data = @[[[SWGPet alloc] initWithDictionary:petDict error:nil]]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, arrayOfPetDict); // NSDictionary data = @{@"test key": @"test value"}; - result = [self.apiClient sanitizeForSerialization:data]; + result = [self.apiClient.sanitizer sanitizeForSerialization:data]; XCTAssertEqualObjects(result, data); } From 6709a92cbcedbb4e05e87a846a232fc36e954745 Mon Sep 17 00:00:00 2001 From: zhenjun115 Date: Sat, 7 May 2016 23:38:05 +0800 Subject: [PATCH 139/170] remove pom.mustache from android api client using volley HTTP library; --- .../languages/AndroidClientCodegen.java | 2 +- .../android/libraries/volley/pom.mustache | 48 ------------------- .../client/petstore/android/volley/pom.xml | 48 ------------------- 3 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache delete mode 100644 samples/client/petstore/android/volley/pom.xml diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java index 0d021eba9f9c..b5978e118a07 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java @@ -418,7 +418,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi } private void addSupportingFilesForVolley() { - supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); + // supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); // supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle")); supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle")); supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml")); diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache deleted file mode 100644 index 09f55a743a77..000000000000 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache +++ /dev/null @@ -1,48 +0,0 @@ - - - 4.0.0 - io.swagger - volley - 1.0.0 - - - io.swagger - swagger-annotations - ${swagger-annotations-version} - compile - - - org.apache.httpcomponents - httpcore - ${httpcomponents-httpcore-version} - compile - - - org.apache.httpcomponents - httpmime - ${httpcomponents-httpmime-version} - compile - - - com.google.code.gson - gson - ${google-code-gson-version} - compile - - - com.mcxiaoke.volley - library - ${volley-library-version} - aar - compile - - - - 1.5.0 - 4.4.4 - 4.5.2 - 2.3.1 - 1.0.19 - - diff --git a/samples/client/petstore/android/volley/pom.xml b/samples/client/petstore/android/volley/pom.xml deleted file mode 100644 index 09f55a743a77..000000000000 --- a/samples/client/petstore/android/volley/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - 4.0.0 - io.swagger - volley - 1.0.0 - - - io.swagger - swagger-annotations - ${swagger-annotations-version} - compile - - - org.apache.httpcomponents - httpcore - ${httpcomponents-httpcore-version} - compile - - - org.apache.httpcomponents - httpmime - ${httpcomponents-httpmime-version} - compile - - - com.google.code.gson - gson - ${google-code-gson-version} - compile - - - com.mcxiaoke.volley - library - ${volley-library-version} - aar - compile - - - - 1.5.0 - 4.4.4 - 4.5.2 - 2.3.1 - 1.0.19 - - From 46957bb6aa2bda0f1efaabb827736db8394eb1d9 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 8 May 2016 18:48:22 +0800 Subject: [PATCH 140/170] add swagger codegen core team --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/README.md b/README.md index 8eca8ecd53ed..d5ea495c8a0b 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for addit - [Online Generators](#online-generators) - [Guidelines for Contribution](https://github.com/swagger-api/swagger-codegen/wiki/Guidelines-for-Contribution) - [Companies/Projects using Swagger Codegen](#companiesprojects-using-swagger-codegen) + - [Swagger Codegen Core Team](#swagger-codegen-core-team) - [License](#license) @@ -794,6 +795,77 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [Zalando](https://tech.zalando.com) - [ZEEF.com](https://zeef.com/) +# Swagger Codegen Core Team + +Swaagger Codegen core team members are contributors who have been making signficiant contributions (review issues, fix bugs, make enhancements, etc) to the project on a regular basis. To join the core team, please reach out to wing328hk@gmail.com for more information. + +## API Clients +| Langauges | Core Team (join date) | +|:-------------|:-------------| +| ActionScript | | +| C++ | | +| C# | @jimschubert (2016/05/01) | | +| Clojure | | +| Dart | | +| Groovy | | +| Go | @guohuang (2016/05/01) @neilotoole (2016/05/01) | +| Java | @cbornet (2016/05/01) @xhh (2016/05/01) | +| NodeJS/Javascript | | +| ObjC | | +| Perl | @wing328 (2016/05/01) | +| PHP | @arnested (2016/05/01) | +| Python | @scottrw93 (2016/05/01) | +| Ruby | | | +| Scala | | | +| Swift | @jaz-ah (2016/05/01) @Edubits (2016/05/01) | +| TypeScript (Node) | @kristof (2016/05/01) @Vrolijkx (2016/05/01) | +| TypeScript (Angular1) | @kristof (2016/05/01) @Vrolijkx (2016/05/01) | +| TypeScript (Fetch) | | +| TypeScript (Angular2) | @kristof (2016/05/01) @Vrolijkx (2016/05/01) | +## Server Stubs +| Langauges | Core Team (date joined) | +|:------------- |:-------------| +| C# ASP.NET5 | @jimschubert (2016/05/01) | +| Haskell Servant | | +| Java Spring Boot | | +| Java SpringMVC | | +| Java JAX-RS | | +| NodeJS | | +| PHP Lumen | @abcsum (2016/05/01) | +| PHP Silex | | +| PHP Slim | | +| Python Flask | | +| Ruby Sinatra | | | +| Scala Scalatra | | | + +## Template Creator +Here is a list of template creators: + * API Clients: + * Clojure: @xhh + * Dart: @yissachar + * Groovy: @victorgit + * Go: @wing328 + * Java (Retrofit): @0legg + * Java (Retrofi2): @emilianobonassi + * Java (Jersey2): @xhh + * Java (okhttp-gson): @xhh + * Javascript/NodeJS: @jfiala + * Javascript (Closure-annotated Angular) @achew22 + * Perl: @wing328 + * Swift: @tkqubo + * TypeScript (Node): @mhardorf + * TypeScript (Angular1): @mhardorf + * TypeScript (Fetch): @leonyu + * TypeScript (Angular2): @roni-frantchi + * Server Stubs + * C# ASP.NET5: @jimschubert + * Haskell Servant: @algas + * Java Spring Boot: @diyfr + * JAX-RS RestEasy: @chameleon82 + * JAX-RS CXF: @hiveship + * PHP Lumen: @abcsum + * PHP Slim: @jfastnacht + License ------- From fbd6a957990a2d3b940617bffaf1013456d99fac Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Sun, 8 May 2016 12:54:12 +0200 Subject: [PATCH 141/170] [Objc] Generator supports binary and BiteArray and maps data to NSData --- .../codegen/languages/ObjcClientCodegen.java | 17 +++++++++++------ .../objc/ResponseDeserializer-body.mustache | 2 +- samples/client/petstore/objc/README.md | 2 +- .../SwaggerClient/SWGResponseDeserializer.m | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 0ecdfb667c9b..713ee4286a73 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -28,6 +28,9 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { public static final String AUTHOR_EMAIL = "authorEmail"; public static final String GIT_REPO_URL = "gitRepoURL"; public static final String LICENSE = "license"; + + public static final String BinaryDataType = "ObjcClientCodegenBinaryData"; + protected Set foundationClasses = new HashSet(); protected String podName = "SwaggerClient"; protected String podVersion = "1.0.0"; @@ -65,6 +68,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { defaultIncludes.add("NSDictionary"); defaultIncludes.add("NSMutableArray"); defaultIncludes.add("NSMutableDictionary"); + + defaultIncludes.add(BinaryDataType); languageSpecificPrimitives.clear(); languageSpecificPrimitives.add("NSNumber"); @@ -92,10 +97,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { typeMapping.put("List", "NSArray"); typeMapping.put("object", "NSObject"); typeMapping.put("file", "NSURL"); - //TODO binary should be mapped to byte array - // mapped to String as a workaround - typeMapping.put("binary", "NSString"); - typeMapping.put("ByteArray", "NSString"); + typeMapping.put("binary", BinaryDataType); + typeMapping.put("ByteArray", BinaryDataType); // ref: http://www.tutorialspoint.com/objective_c/objective_c_basic_syntax.htm setReservedWordsLowerCase( @@ -280,11 +283,13 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { String innerType = getSwaggerType(inner); String innerTypeDeclaration = getTypeDeclaration(inner); - if (innerTypeDeclaration.endsWith("*")) { innerTypeDeclaration = innerTypeDeclaration.substring(0, innerTypeDeclaration.length() - 1); } - + + if(innerTypeDeclaration.equalsIgnoreCase(BinaryDataType)) { + return "NSData*"; + } // In this codition, type of property p is array of primitive, // return container type with pointer, e.g. `NSArray* /* NSString */' if (languageSpecificPrimitives.contains(innerType)) { diff --git a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache index 27a59e39cdc6..812ed061c04f 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-body.mustache @@ -33,7 +33,7 @@ NSInteger const {{classPrefix}}UnknownResponseObjectErrorCode = 143528; formatter.numberStyle = NSNumberFormatterDecimalStyle; _numberFormatter = formatter; _primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"]; - _basicReturnTypes = @[@"NSObject", @"id"]; + _basicReturnTypes = @[@"NSObject", @"id", @"NSData"]; _arrayOfModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray<(.+)>" options:NSRegularExpressionCaseInsensitive error:nil]; diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index a3550545c246..f4b3f2f2f769 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-05-06T12:20:47.112+02:00 +- Build date: 2016-05-08T12:06:01.121+02:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements diff --git a/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m index fa5be3af3d27..a0efd1d5927f 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGResponseDeserializer.m @@ -33,7 +33,7 @@ NSInteger const SWGUnknownResponseObjectErrorCode = 143528; formatter.numberStyle = NSNumberFormatterDecimalStyle; _numberFormatter = formatter; _primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"]; - _basicReturnTypes = @[@"NSObject", @"id"]; + _basicReturnTypes = @[@"NSObject", @"id", @"NSData"]; _arrayOfModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray<(.+)>" options:NSRegularExpressionCaseInsensitive error:nil]; From dcbc8975a083e7d7ea164c054056cc7e3d9f845b Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 8 May 2016 22:24:52 +0800 Subject: [PATCH 142/170] update core team --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d5ea495c8a0b..4102aca53632 100644 --- a/README.md +++ b/README.md @@ -805,7 +805,7 @@ Swaagger Codegen core team members are contributors who have been making signfic | ActionScript | | | C++ | | | C# | @jimschubert (2016/05/01) | | -| Clojure | | +| Clojure | @xhh (2016/05/01) | | Dart | | | Groovy | | | Go | @guohuang (2016/05/01) @neilotoole (2016/05/01) | @@ -815,8 +815,8 @@ Swaagger Codegen core team members are contributors who have been making signfic | Perl | @wing328 (2016/05/01) | | PHP | @arnested (2016/05/01) | | Python | @scottrw93 (2016/05/01) | -| Ruby | | | -| Scala | | | +| Ruby | @wing328 (2016/05/01) | +| Scala | | | Swift | @jaz-ah (2016/05/01) @Edubits (2016/05/01) | | TypeScript (Node) | @kristof (2016/05/01) @Vrolijkx (2016/05/01) | | TypeScript (Angular1) | @kristof (2016/05/01) @Vrolijkx (2016/05/01) | @@ -828,14 +828,14 @@ Swaagger Codegen core team members are contributors who have been making signfic | C# ASP.NET5 | @jimschubert (2016/05/01) | | Haskell Servant | | | Java Spring Boot | | -| Java SpringMVC | | +| Java SpringMVC | @kolyjjj (2016/05/01) | | Java JAX-RS | | -| NodeJS | | +| NodeJS | @kolyjjj (2016/05/01) | | PHP Lumen | @abcsum (2016/05/01) | | PHP Silex | | | PHP Slim | | | Python Flask | | -| Ruby Sinatra | | | +| Ruby Sinatra | @wing328 (2016/05/01) | | | Scala Scalatra | | | ## Template Creator From d4383ce4c11ff02c375bfe5280ff8663a093e5ac Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 8 May 2016 22:33:52 +0800 Subject: [PATCH 143/170] update core team (js) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4102aca53632..bdd622486282 100644 --- a/README.md +++ b/README.md @@ -810,7 +810,7 @@ Swaagger Codegen core team members are contributors who have been making signfic | Groovy | | | Go | @guohuang (2016/05/01) @neilotoole (2016/05/01) | | Java | @cbornet (2016/05/01) @xhh (2016/05/01) | -| NodeJS/Javascript | | +| NodeJS/Javascript | @xhh (2016/05/01) | | ObjC | | | Perl | @wing328 (2016/05/01) | | PHP | @arnested (2016/05/01) | From 6b6a559aa521b9611ae40525c4f70b8fd806e757 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 8 May 2016 23:24:14 +0800 Subject: [PATCH 144/170] add .net2.0 template creator --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bdd622486282..277bb8e9c0c0 100644 --- a/README.md +++ b/README.md @@ -841,6 +841,7 @@ Swaagger Codegen core team members are contributors who have been making signfic ## Template Creator Here is a list of template creators: * API Clients: + * C# (.NET 2.0): @who * Clojure: @xhh * Dart: @yissachar * Groovy: @victorgit From 20f3850eb2a1db33d27035e61d693581dde6c454 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 9 May 2016 00:30:55 +0800 Subject: [PATCH 145/170] add guideline for becoming a core team member --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 277bb8e9c0c0..9a35eb24ef6e 100644 --- a/README.md +++ b/README.md @@ -797,7 +797,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you # Swagger Codegen Core Team -Swaagger Codegen core team members are contributors who have been making signficiant contributions (review issues, fix bugs, make enhancements, etc) to the project on a regular basis. To join the core team, please reach out to wing328hk@gmail.com for more information. +Swaagger Codegen core team members are contributors who have been making signficiant contributions (review issues, fix bugs, make enhancements, etc) to the project on a regular basis. ## API Clients | Langauges | Core Team (join date) | @@ -867,6 +867,19 @@ Here is a list of template creators: * PHP Lumen: @abcsum * PHP Slim: @jfastnacht +## How to join the core team + +Here are the requirements to become a core team member: +- rank within top 50 in https://github.com/swagger-api/swagger-codegen/graphs/contributors + - to contribute, here are some good [starting points](https://github.com/swagger-api/swagger-codegen/issues?q=is%3Aopen+is%3Aissue+label%3A%22Need+community+contribution%22) +- regular contributions to the project + - about 3 hours per week + - for contribution, it can be addressing issues, reviewing PRs submitted by others, submitting PR to fix bugs or make enhancements, etc + + To join the core team, please reach out to wing328hk@gmail.com (@wing328) for more information. + + To become a Template Creator, simply submit a PR for new API client (e.g. Rust, Elixir) or server stub (e.g. Ruby Grape) generator. + License ------- From cfa2c54c15567733e52ecfeaf43a0dcf553c88b3 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 9 May 2016 00:45:29 +0800 Subject: [PATCH 146/170] removed kristof --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9a35eb24ef6e..bbc611421ca5 100644 --- a/README.md +++ b/README.md @@ -818,10 +818,10 @@ Swaagger Codegen core team members are contributors who have been making signfic | Ruby | @wing328 (2016/05/01) | | Scala | | | Swift | @jaz-ah (2016/05/01) @Edubits (2016/05/01) | -| TypeScript (Node) | @kristof (2016/05/01) @Vrolijkx (2016/05/01) | -| TypeScript (Angular1) | @kristof (2016/05/01) @Vrolijkx (2016/05/01) | +| TypeScript (Node) | @Vrolijkx (2016/05/01) | +| TypeScript (Angular1) | @Vrolijkx (2016/05/01) | | TypeScript (Fetch) | | -| TypeScript (Angular2) | @kristof (2016/05/01) @Vrolijkx (2016/05/01) | +| TypeScript (Angular2) | @Vrolijkx (2016/05/01) | ## Server Stubs | Langauges | Core Team (date joined) | |:------------- |:-------------| From 9e8cbae0ecb14dea0bf11a49fe2174889388fe46 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 9 May 2016 00:46:17 +0800 Subject: [PATCH 147/170] rearrange order for core member list --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bbc611421ca5..541fd2d466d9 100644 --- a/README.md +++ b/README.md @@ -820,8 +820,8 @@ Swaagger Codegen core team members are contributors who have been making signfic | Swift | @jaz-ah (2016/05/01) @Edubits (2016/05/01) | | TypeScript (Node) | @Vrolijkx (2016/05/01) | | TypeScript (Angular1) | @Vrolijkx (2016/05/01) | -| TypeScript (Fetch) | | | TypeScript (Angular2) | @Vrolijkx (2016/05/01) | +| TypeScript (Fetch) | | ## Server Stubs | Langauges | Core Team (date joined) | |:------------- |:-------------| From 25ebd5466de888fa2ac49873466b30792c9f70e9 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Mon, 9 May 2016 01:11:29 +0100 Subject: [PATCH 148/170] Update pattern to support Perl /pattern/modifiers convention --- .../languages/PythonClientCodegen.java | 56 +++++++++++++++++++ .../src/main/resources/python/api.mustache | 2 +- .../src/main/resources/python/model.mustache | 2 +- samples/client/petstore/python/README.md | 2 +- .../python/swagger_client/apis/fake_api.py | 4 +- .../swagger_client/models/format_test.py | 2 +- 6 files changed, 62 insertions(+), 6 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index 1bc95cfdd677..e4bf48e9d5b9 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -3,15 +3,21 @@ package io.swagger.codegen.languages; import io.swagger.codegen.CliOption; import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.CodegenModel; 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; import io.swagger.models.properties.*; import java.io.File; +import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; @@ -21,6 +27,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; + protected Map regexModifiers; + private String testFolder; public PythonClientCodegen() { @@ -87,6 +95,14 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig "assert", "else", "if", "pass", "yield", "break", "except", "import", "print", "class", "exec", "in", "raise", "continue", "finally", "is", "return", "def", "for", "lambda", "try", "self")); + + regexModifiers = new HashMap(); + regexModifiers.put('i', "IGNORECASE"); + regexModifiers.put('l', "LOCALE"); + regexModifiers.put('m', "MULTILINE"); + regexModifiers.put('s', "DOTALL"); + regexModifiers.put('u', "UNICODE"); + regexModifiers.put('x', "VERBOSE"); cliOptions.clear(); cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "python package name (convention: snake_case).") @@ -143,6 +159,46 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig private static String dropDots(String str) { return str.replaceAll("\\.", "_"); } + + @Override + public void postProcessParameter(CodegenParameter parameter){ + postProcessPattern(parameter.pattern, parameter.vendorExtensions); + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + postProcessPattern(property.pattern, property.vendorExtensions); + } + + /* + * The swagger pattern spec follows the Perl convention and style of modifiers. Python + * does not support this in as natural a way so it needs to convert it. See + * https://docs.python.org/2/howto/regex.html#compilation-flags for details. + */ + public void postProcessPattern(String pattern, Map vendorExtensions){ + if(pattern != null) { + int i = pattern.lastIndexOf('/'); + + //Must follow Perl /pattern/modifiers convention + if(pattern.charAt(0) != '/' || i < 2) { + throw new IllegalArgumentException("Pattern must follow the Perl " + + "/pattern/modifiers convention. "+pattern+" is not valid."); + } + + String regex = pattern.substring(1, i).replace("'", "\'"); + List modifiers = new ArrayList(); + + for(char c : pattern.substring(i).toCharArray()) { + if(regexModifiers.containsKey(c)) { + String modifier = regexModifiers.get(c); + modifiers.add(modifier); + } + } + + vendorExtensions.put("x-regex", regex); + vendorExtensions.put("x-modifiers", modifiers); + } + } @Override public CodegenType getTag() { diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index 399c7f584518..94458e3f7244 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -116,7 +116,7 @@ class {{classname}}(object): raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than or equal to `{{minimum}}`") {{/minimum}} {{#pattern}} - if '{{paramName}}' in params and not re.match('{{pattern}}', params['{{paramName}}']): + if '{{paramName}}' in params and not re.search('{{vendorExtensions.x-regex}}', params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{pattern}}`") {{/pattern}} {{/hasValidation}} diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 0cb98a57ef05..e62fa2cbf668 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -103,7 +103,7 @@ class {{classname}}(object): raise ValueError("Invalid value for `{{name}}`, must be a value greater than or equal to `{{minimum}}`") {{/minimum}} {{#pattern}} - if not re.match('{{pattern}}', {{name}}): + if not re.search('{{vendorExtensions.x-regex}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{pattern}}`") {{/pattern}} {{/hasValidation}} diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 990d5e53651a..3cdf50297872 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-06T22:43:12.044+01:00 +- Build date: 2016-05-09T01:08:25.311+01:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/swagger_client/apis/fake_api.py b/samples/client/petstore/python/swagger_client/apis/fake_api.py index ba79874f6c70..5d3903b2d21b 100644 --- a/samples/client/petstore/python/swagger_client/apis/fake_api.py +++ b/samples/client/petstore/python/swagger_client/apis/fake_api.py @@ -112,8 +112,8 @@ class FakeApi(object): raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") if 'double' in params and params['double'] < 67.8: raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") - if 'string' in params and not re.match('[a-z]+', params['string']): - raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `[a-z]+`") + if 'string' in params and not re.search('[a-z]', params['string'], flags=re.IGNORECASE): + raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") if 'integer' in params and params['integer'] > 100.0: raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100.0`") if 'integer' in params and params['integer'] < 10.0: diff --git a/samples/client/petstore/python/swagger_client/models/format_test.py b/samples/client/petstore/python/swagger_client/models/format_test.py index eee1b5c9ef73..7fce3351dd4e 100644 --- a/samples/client/petstore/python/swagger_client/models/format_test.py +++ b/samples/client/petstore/python/swagger_client/models/format_test.py @@ -279,7 +279,7 @@ class FormatTest(object): if not string: raise ValueError("Invalid value for `string`, must not be `None`") - if not re.match('/[a-z]/i', string): + if not re.search('[a-z]', string, flags=re.IGNORECASE): raise ValueError("Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") self._string = string From 4718c34984cc5a8915f8bf6db41ebd98fd001815 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Mon, 9 May 2016 01:25:13 +0100 Subject: [PATCH 149/170] Replace tabs with spaces --- .../languages/PythonClientCodegen.java | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index e4bf48e9d5b9..c1e34b981bb4 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -162,42 +162,42 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig @Override public void postProcessParameter(CodegenParameter parameter){ - postProcessPattern(parameter.pattern, parameter.vendorExtensions); + postProcessPattern(parameter.pattern, parameter.vendorExtensions); } - + @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { - postProcessPattern(property.pattern, property.vendorExtensions); + postProcessPattern(property.pattern, property.vendorExtensions); } - /* - * The swagger pattern spec follows the Perl convention and style of modifiers. Python - * does not support this in as natural a way so it needs to convert it. See - * https://docs.python.org/2/howto/regex.html#compilation-flags for details. - */ + /* + * The swagger pattern spec follows the Perl convention and style of modifiers. Python + * does not support this in as natural a way so it needs to convert it. See + * https://docs.python.org/2/howto/regex.html#compilation-flags for details. + */ public void postProcessPattern(String pattern, Map vendorExtensions){ - if(pattern != null) { - int i = pattern.lastIndexOf('/'); - - //Must follow Perl /pattern/modifiers convention - if(pattern.charAt(0) != '/' || i < 2) { - throw new IllegalArgumentException("Pattern must follow the Perl " - + "/pattern/modifiers convention. "+pattern+" is not valid."); - } + if(pattern != null) { + int i = pattern.lastIndexOf('/'); - String regex = pattern.substring(1, i).replace("'", "\'"); - List modifiers = new ArrayList(); + //Must follow Perl /pattern/modifiers convention + if(pattern.charAt(0) != '/' || i < 2) { + throw new IllegalArgumentException("Pattern must follow the Perl " + + "/pattern/modifiers convention. "+pattern+" is not valid."); + } - for(char c : pattern.substring(i).toCharArray()) { - if(regexModifiers.containsKey(c)) { - String modifier = regexModifiers.get(c); - modifiers.add(modifier); - } - } + String regex = pattern.substring(1, i).replace("'", "\'"); + List modifiers = new ArrayList(); - vendorExtensions.put("x-regex", regex); - vendorExtensions.put("x-modifiers", modifiers); - } + for(char c : pattern.substring(i).toCharArray()) { + if(regexModifiers.containsKey(c)) { + String modifier = regexModifiers.get(c); + modifiers.add(modifier); + } + } + + vendorExtensions.put("x-regex", regex); + vendorExtensions.put("x-modifiers", modifiers); + } } @Override From c039526993893635c16dd4c441bf77ab5c457ee3 Mon Sep 17 00:00:00 2001 From: diyfr Date: Mon, 9 May 2016 08:21:32 +0200 Subject: [PATCH 150/170] Add Springboot documentation --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 1d97c7675d8c..c9eb0d017fe8 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for addit - [Java JAX-RS (Apache CXF 2 / 3)](#java-jax-rs-apache-cxf-2--3) - [Java JAX-RS (Resteasy)](#java-jax-rs-resteasy) - [Java Spring MVC](#java-spring-mvc) + - [Java SpringBoot](#java-springboot) - [Haskell Servant](#haskell-servant) - [ASP.NET 5 Web API](#aspnet-5-web-api) - [To build the codegen library](#to-build-the-codegen-library) @@ -688,6 +689,31 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -o samples/server/petstore/spring-mvc ``` +### Java SpringBoot + +``` +java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ + -i http://petstore.swagger.io/v2/swagger.json \ + -l springboot \ + -o samples/server/petstore/springboot +``` + +You can also set a Json file with basePackage & configPackage properties : +Example : +``` +{ +"basePackage":"io.swagger", +"configPackage":"io.swagger.config" +} +``` +For use it add option ```-c myOptions.json``` to the generation command + +To Use-it : +in the generated folder try ``` mvn package ``` for build jar. +Start your server ``` java -jar target/swagger-springboot-server-1.0.0.jar ``` +SpringBoot listening on default port 8080 + + ### Haskell Servant ``` From f30b32afc4ffd9bb94a8376db737246e7fd28a6a Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 9 May 2016 16:32:49 +0800 Subject: [PATCH 151/170] minor fix to mustache layout --- .../src/main/resources/php/model.mustache | 15 ++--- .../petstore/php/SwaggerClient-php/README.md | 8 +-- .../php/SwaggerClient-php/docs/FakeApi.md | 18 +----- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 12 +--- .../SwaggerClient-php/lib/Model/Animal.php | 6 +- .../lib/Model/AnimalFarm.php | 5 +- .../lib/Model/ApiResponse.php | 11 +--- .../php/SwaggerClient-php/lib/Model/Cat.php | 7 +-- .../SwaggerClient-php/lib/Model/Category.php | 9 +-- .../php/SwaggerClient-php/lib/Model/Dog.php | 7 +-- .../SwaggerClient-php/lib/Model/EnumClass.php | 24 ++++++- .../SwaggerClient-php/lib/Model/EnumTest.php | 62 ++++++++++++++++++- .../lib/Model/FormatTest.php | 27 +------- .../lib/Model/Model200Response.php | 7 +-- .../lib/Model/ModelReturn.php | 7 +-- .../php/SwaggerClient-php/lib/Model/Name.php | 10 +-- .../php/SwaggerClient-php/lib/Model/Order.php | 20 ++---- .../php/SwaggerClient-php/lib/Model/Pet.php | 18 ++---- .../lib/Model/SpecialModelName.php | 7 +-- .../php/SwaggerClient-php/lib/Model/Tag.php | 9 +-- .../php/SwaggerClient-php/lib/Model/User.php | 21 +------ .../lib/Tests/FakeApiTest.php | 6 +- 22 files changed, 132 insertions(+), 184 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index d17c76c137e4..43e90fc6f867 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -171,7 +171,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{/required}} {{#isEnum}} $allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); - if (!in_array($this->container['{{name}}'], $allowed_values))) { + if (!in_array($this->container['{{name}}'], $allowed_values)) { $invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}."; } {{/isEnum}} @@ -207,10 +207,10 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { @@ -218,12 +218,14 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#required}} if ($this->container['{{name}}'] === null) { return false; - }{{/required}} + } + {{/required}} {{#isEnum}} $allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); - if (!in_array($this->container['{{name}}'], $allowed_values))) { + if (!in_array($this->container['{{name}}'], $allowed_values)) { return false; - }{{/isEnum}} + } + {{/isEnum}} {{#hasValidation}} {{#maxLength}} if (strlen($this->container['{{name}}']) > {{maxLength}}) { @@ -255,7 +257,6 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple return true; } - {{#vars}} /** * Gets {{name}} diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index ab81085c3ad2..d781d4d1d316 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-06T16:24:00.420+08:00 +- Build date: 2016-05-09T16:31:19.614+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -87,11 +87,7 @@ 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 -假端點 -偽のエンドポイント -가짜 엔드 포인트 - +*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* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md index 4acf36fa6969..5988dc781b2e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md @@ -4,27 +4,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters -假端點 -偽のエンドポイント -가짜 엔드 포인트 - +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # **testEndpointParameters** > testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password) -Fake endpoint for testing various parameters -假端點 -偽のエンドポイント -가짜 엔드 포인트 - - -Fake endpoint for testing various parameters -假端點 -偽のエンドポイント -가짜 엔드 포인트 +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example ```php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index ee1c6b8b600f..5620c82fdcd5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -93,11 +93,7 @@ class FakeApi /** * testEndpointParameters * - * Fake endpoint for testing various parameters -假端點 -偽のエンドポイント -가짜 엔드 포인트 - + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * @param float $number None (required) * @param double $double None (required) @@ -124,11 +120,7 @@ class FakeApi /** * testEndpointParametersWithHttpInfo * - * Fake endpoint for testing various parameters -假端點 -偽のエンドポイント -가짜 엔드 포인트 - + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * @param float $number None (required) * @param double $double None (required) 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 e537ef934140..c87fe9763549 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -149,21 +149,19 @@ class Animal implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { if ($this->container['class_name'] === null) { return false; } - return true; } - /** * Gets class_name * @return string diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php index dc7190652bca..afd16e0a5c85 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -134,17 +134,16 @@ class AnimalFarm implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { return true; } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 0c7e225d120d..655cb7e4b2ca 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -169,23 +169,16 @@ class ApiResponse implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - - - - - return true; } - /** * Gets code * @return int 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 e40d5e969bfa..31b9f153cd46 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -143,19 +143,16 @@ class Cat extends Animal implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - return true; } - /** * Gets declawed * @return bool 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 99c309f6c7ed..f186c7b740c0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -156,21 +156,16 @@ class Category implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - - - return true; } - /** * Gets id * @return int 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 9999bbba51ce..d14fa50ca195 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -143,19 +143,16 @@ class Dog extends Animal implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - return true; } - /** * Gets breed * @return string diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php index 66f2ba082296..f7d1457c30f6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -119,9 +119,31 @@ class EnumClass implements ArrayAccess if ($data != null) { - } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + return $invalid_properties; + } + + /** + * validate all the properties in the model + * return true if all passed + * + * @return bool True if all properteis are valid + */ + public function valid() + { + return true; + } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index 1f3213e7516e..70e5e5ad9614 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -184,11 +184,64 @@ class EnumTest implements ArrayAccess if ($data != null) { - $this->container['enum_string'] = $data['enum_string']; - $this->container['enum_integer'] = $data['enum_integer']; - $this->container['enum_number'] = $data['enum_number']; + if (isset($data["enum_string"])) { + $this->container['enum_string'] = $data["enum_string"]; + } + if (isset($data["enum_integer"])) { + $this->container['enum_integer'] = $data["enum_integer"]; + } + if (isset($data["enum_number"])) { + $this->container['enum_number'] = $data["enum_number"]; + } } } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + $allowed_values = array("UPPER", "lower"); + if (!in_array($this->container['enum_string'], $allowed_values)) { + $invalid_properties[] = "invalid value for '$enum_string', must be one of #{allowed_values}."; + } + $allowed_values = array("1", "-1"); + if (!in_array($this->container['enum_integer'], $allowed_values)) { + $invalid_properties[] = "invalid value for '$enum_integer', must be one of #{allowed_values}."; + } + $allowed_values = array("1.1", "-1.2"); + if (!in_array($this->container['enum_number'], $allowed_values)) { + $invalid_properties[] = "invalid value for '$enum_number', must be one of #{allowed_values}."; + } + return $invalid_properties; + } + + /** + * validate all the properties in the model + * return true if all passed + * + * @return bool True if all properteis are valid + */ + public function valid() + { + $allowed_values = array("UPPER", "lower"); + if (!in_array($this->container['enum_string'], $allowed_values)) { + return false; + } + $allowed_values = array("1", "-1"); + if (!in_array($this->container['enum_integer'], $allowed_values)) { + return false; + } + $allowed_values = array("1.1", "-1.2"); + if (!in_array($this->container['enum_number'], $allowed_values)) { + return false; + } + return true; + } + /** * Gets enum_string * @return string @@ -210,6 +263,7 @@ class EnumTest implements ArrayAccess throw new \InvalidArgumentException("Invalid value for 'enum_string', must be one of 'UPPER', 'lower'"); } $this->container['enum_string'] = $enum_string; + return $this; } /** @@ -233,6 +287,7 @@ class EnumTest implements ArrayAccess throw new \InvalidArgumentException("Invalid value for 'enum_integer', must be one of '1', '-1'"); } $this->container['enum_integer'] = $enum_integer; + return $this; } /** @@ -256,6 +311,7 @@ class EnumTest implements ArrayAccess throw new \InvalidArgumentException("Invalid value for 'enum_number', must be one of '1.1', '-1.2'"); } $this->container['enum_number'] = $enum_number; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 7a99d0423536..322d7623bf16 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -350,80 +350,58 @@ class FormatTest implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - if ($this->container['integer'] > 100.0) { return false; } if ($this->container['integer'] < 10.0) { return false; } - - if ($this->container['int32'] > 200.0) { return false; } if ($this->container['int32'] < 20.0) { return false; } - - if ($this->container['number'] === null) { return false; } - if ($this->container['number'] > 543.2) { return false; } if ($this->container['number'] < 32.1) { return false; } - - if ($this->container['float'] > 987.6) { return false; } if ($this->container['float'] < 54.3) { return false; } - - if ($this->container['double'] > 123.4) { return false; } if ($this->container['double'] < 67.8) { return false; } - - if (!preg_match("/[a-z]/i", $this->container['string'])) { return false; } if ($this->container['byte'] === null) { return false; } - - - if ($this->container['date'] === null) { return false; } - - - - - if ($this->container['password'] === null) { return false; } - if (strlen($this->container['password']) > 64) { return false; } @@ -433,7 +411,6 @@ class FormatTest implements ArrayAccess return true; } - /** * Gets integer * @return int 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 6884fbaed82e..07dcae58bfa4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -143,19 +143,16 @@ class Model200Response implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - return true; } - /** * Gets name * @return int 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 7f8b7e7296b6..78f2e6dfe99b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -143,19 +143,16 @@ class ModelReturn implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - return true; } - /** * Gets return * @return int 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 9420a11796db..e9f40099d6cb 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -172,25 +172,19 @@ class Name implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { if ($this->container['name'] === null) { return false; } - - - - - return true; } - /** * Gets name * @return int 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 e668f6d432b4..233a6abd1bc5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -220,39 +220,27 @@ class Order implements ArrayAccess { $invalid_properties = array(); $allowed_values = array("placed", "approved", "delivered"); - if (!in_array($this->container['status'], $allowed_values))) { + if (!in_array($this->container['status'], $allowed_values)) { $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; } return $invalid_properties; } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - - - - - - - - $allowed_values = array("placed", "approved", "delivered"); - if (!in_array($this->container['status'], $allowed_values))) { + if (!in_array($this->container['status'], $allowed_values)) { return false; } - - return true; } - /** * Gets id * @return int 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 c949198e6421..2aab87c1ab96 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -226,43 +226,33 @@ class Pet implements ArrayAccess $invalid_properties[] = "'$photo_urls' can't be null"; } $allowed_values = array("available", "pending", "sold"); - if (!in_array($this->container['status'], $allowed_values))) { + if (!in_array($this->container['status'], $allowed_values)) { $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; } return $invalid_properties; } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - - - if ($this->container['name'] === null) { return false; } - if ($this->container['photo_urls'] === null) { return false; } - - - - $allowed_values = array("available", "pending", "sold"); - if (!in_array($this->container['status'], $allowed_values))) { + if (!in_array($this->container['status'], $allowed_values)) { return false; } return true; } - /** * Gets id * @return int 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 0e37ecb8f46a..00f91f201b69 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -143,19 +143,16 @@ class SpecialModelName implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - return true; } - /** * Gets special_property_name * @return int 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 d188cc323e4a..c141024188be 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -156,21 +156,16 @@ class Tag implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - - - return true; } - /** * Gets id * @return int 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 58cb418951eb..9018e342a1d0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -234,33 +234,16 @@ class User implements ArrayAccess } /** - * validate all the parameters in the model + * validate all the properties in the model * return true if all passed * - * @return bool [description] + * @return bool True if all properteis are valid */ public function valid() { - - - - - - - - - - - - - - - - return true; } - /** * Gets id * @return int diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php index 742f571fb723..dc599fbe5d72 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php @@ -67,11 +67,7 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase /** * Test case for testEndpointParameters * - * Fake endpoint for testing various parameters -假端點 -偽のエンドポイント -가짜 엔드 포인트 - + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * */ public function test_testEndpointParameters() { From d3c434e40f363c2c760317892a543714d4145ef8 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 9 May 2016 21:53:01 +0800 Subject: [PATCH 152/170] add mateuszmackowiak to core team --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 471ac3acfea9..c74b517bdb7c 100644 --- a/README.md +++ b/README.md @@ -837,7 +837,7 @@ Swaagger Codegen core team members are contributors who have been making signfic | Go | @guohuang (2016/05/01) @neilotoole (2016/05/01) | | Java | @cbornet (2016/05/01) @xhh (2016/05/01) | | NodeJS/Javascript | @xhh (2016/05/01) | -| ObjC | | +| ObjC | @mateuszmackowiak (2016/05/09) | | Perl | @wing328 (2016/05/01) | | PHP | @arnested (2016/05/01) | | Python | @scottrw93 (2016/05/01) | From b27d8c22c76e48c3e812db2c762b121b6f091bff Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 9 May 2016 23:12:12 +0800 Subject: [PATCH 153/170] fix java import issue due to enum and inner model (array of array of model) --- .../swagger-codegen/src/main/resources/Java/api.mustache | 2 ++ .../src/main/resources/Java/model.mustache | 1 + samples/client/petstore/java/default/docs/FakeApi.md | 6 +++--- .../src/main/java/io/swagger/client/api/FakeApi.java | 8 +++++--- .../src/main/java/io/swagger/client/api/PetApi.java | 4 +++- .../src/main/java/io/swagger/client/api/StoreApi.java | 2 ++ .../src/main/java/io/swagger/client/api/UserApi.java | 2 ++ .../src/main/java/io/swagger/client/model/Animal.java | 1 + .../src/main/java/io/swagger/client/model/AnimalFarm.java | 1 + .../src/main/java/io/swagger/client/model/Cat.java | 1 + .../src/main/java/io/swagger/client/model/Category.java | 1 + .../src/main/java/io/swagger/client/model/Dog.java | 1 + .../src/main/java/io/swagger/client/model/EnumClass.java | 1 + .../src/main/java/io/swagger/client/model/EnumTest.java | 1 + .../src/main/java/io/swagger/client/model/FormatTest.java | 1 + .../java/io/swagger/client/model/Model200Response.java | 1 + .../java/io/swagger/client/model/ModelApiResponse.java | 1 + .../main/java/io/swagger/client/model/ModelReturn.java | 1 + .../src/main/java/io/swagger/client/model/Name.java | 1 + .../src/main/java/io/swagger/client/model/Order.java | 1 + .../src/main/java/io/swagger/client/model/Pet.java | 1 + .../java/io/swagger/client/model/SpecialModelName.java | 1 + .../src/main/java/io/swagger/client/model/Tag.java | 1 + .../src/main/java/io/swagger/client/model/User.java | 1 + 24 files changed, 35 insertions(+), 7 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/api.mustache b/modules/swagger-codegen/src/main/resources/Java/api.mustache index 0487cd8ef982..ee8d3f9e2704 100644 --- a/modules/swagger-codegen/src/main/resources/Java/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/api.mustache @@ -5,11 +5,13 @@ import com.sun.jersey.api.client.GenericType; import {{invokerPackage}}.ApiException; import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.Configuration; +import {{invokerPackage}}.model.*; import {{invokerPackage}}.Pair; {{#imports}}import {{import}}; {{/imports}} + {{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; diff --git a/modules/swagger-codegen/src/main/resources/Java/model.mustache b/modules/swagger-codegen/src/main/resources/Java/model.mustache index 66ba76bcbc59..0ac1d53d2d86 100644 --- a/modules/swagger-codegen/src/main/resources/Java/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/model.mustache @@ -1,5 +1,6 @@ package {{package}}; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; {{#imports}}import {{import}}; {{/imports}} diff --git a/samples/client/petstore/java/default/docs/FakeApi.md b/samples/client/petstore/java/default/docs/FakeApi.md index c1fdd3103218..b4e5f34974a5 100644 --- a/samples/client/petstore/java/default/docs/FakeApi.md +++ b/samples/client/petstore/java/default/docs/FakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # **testEndpointParameters** > testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password) -Fake endpoint for testing various parameters +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example ```java diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java index efa202418d6e..40ee5e2774fc 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java @@ -5,10 +5,12 @@ import com.sun.jersey.api.client.GenericType; import io.swagger.client.ApiException; import io.swagger.client.ApiClient; import io.swagger.client.Configuration; +import io.swagger.client.model.*; import io.swagger.client.Pair; -import java.math.BigDecimal; import java.util.Date; +import java.math.BigDecimal; + import java.util.ArrayList; import java.util.HashMap; @@ -36,8 +38,8 @@ public class FakeApi { } /** - * Fake endpoint for testing various parameters - * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * @param number None (required) * @param _double None (required) * @param string None (required) 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 584c85aaae47..0816f9a2961b 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 @@ -5,11 +5,13 @@ import com.sun.jersey.api.client.GenericType; import io.swagger.client.ApiException; import io.swagger.client.ApiClient; import io.swagger.client.Configuration; +import io.swagger.client.model.*; import io.swagger.client.Pair; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; + import java.util.ArrayList; import java.util.HashMap; 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 59a1a58266eb..4714c3ca2d35 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 @@ -5,10 +5,12 @@ import com.sun.jersey.api.client.GenericType; import io.swagger.client.ApiException; import io.swagger.client.ApiClient; import io.swagger.client.Configuration; +import io.swagger.client.model.*; import io.swagger.client.Pair; import io.swagger.client.model.Order; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; 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 7ab75eabd344..6369d9daa4d8 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 @@ -5,10 +5,12 @@ import com.sun.jersey.api.client.GenericType; import io.swagger.client.ApiException; import io.swagger.client.ApiClient; import io.swagger.client.Configuration; +import io.swagger.client.model.*; import io.swagger.client.Pair; import io.swagger.client.model.User; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java index 559e19848f96..365f0110b78b 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AnimalFarm.java index 9dbd29436ad2..647e3a893e15 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import io.swagger.client.model.Animal; import java.util.ArrayList; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java index 305b4806f4af..21c54aff2046 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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 b97a241ff8c2..c6cb703a89e3 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java index f72a7f046ab6..ed5581058c69 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumClass.java index 716bfbbc85e1..42434e297fff 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumClass.java @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java index 806628ebd569..1c8657fd3ec1 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/EnumTest.java @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java index f10a0749f5e9..c01974880aed 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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 e62ec1f32818..b2809525c7f5 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java index 719f9b676fd8..32fb86dd3238 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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 fa6b2b8b90ce..a076d16f9643 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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 b9953ebac0a7..60b26b556586 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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 00372f26f932..ed5739592a34 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; 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 a3e34c8570f1..da8b76ad024b 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; 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 1a38a0edea98..24e57756cb2f 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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 f76224dd4893..9d3bdd8cb9e9 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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 017a72b2ee56..f23553660deb 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 @@ -1,5 +1,6 @@ package io.swagger.client.model; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; From 477f6f8d4d317064688a91ec6341e7afe472c114 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 9 May 2016 23:17:37 +0800 Subject: [PATCH 154/170] use modelPackage instead to import all models --- modules/swagger-codegen/src/main/resources/Java/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/api.mustache b/modules/swagger-codegen/src/main/resources/Java/api.mustache index ee8d3f9e2704..ad7b9051f053 100644 --- a/modules/swagger-codegen/src/main/resources/Java/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/api.mustache @@ -5,7 +5,7 @@ import com.sun.jersey.api.client.GenericType; import {{invokerPackage}}.ApiException; import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.Configuration; -import {{invokerPackage}}.model.*; +import {{modelPackage}}.*; import {{invokerPackage}}.Pair; {{#imports}}import {{import}}; From 363c40ec5522e0064bd8822a05d66f33ee59eaee Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 00:39:55 +0800 Subject: [PATCH 155/170] update php petstore sample --- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../SwaggerClient-php/lib/Model/Animal.php | 59 ++++--- .../lib/Model/AnimalFarm.php | 11 +- .../lib/Model/ApiResponse.php | 46 ++---- .../php/SwaggerClient-php/lib/Model/Cat.php | 24 +-- .../SwaggerClient-php/lib/Model/Category.php | 35 +--- .../php/SwaggerClient-php/lib/Model/Dog.php | 24 +-- .../SwaggerClient-php/lib/Model/EnumClass.php | 11 +- .../SwaggerClient-php/lib/Model/EnumTest.php | 46 ++---- .../lib/Model/FormatTest.php | 156 ++++-------------- .../lib/Model/Model200Response.php | 24 +-- .../lib/Model/ModelReturn.php | 24 +-- .../php/SwaggerClient-php/lib/Model/Name.php | 46 ++---- .../php/SwaggerClient-php/lib/Model/Order.php | 79 ++------- .../php/SwaggerClient-php/lib/Model/Pet.php | 79 ++------- .../lib/Model/SpecialModelName.php | 24 +-- .../php/SwaggerClient-php/lib/Model/Tag.php | 35 +--- .../php/SwaggerClient-php/lib/Model/User.php | 101 +++--------- .../lib/ObjectSerializer.php | 2 +- 19 files changed, 222 insertions(+), 606 deletions(-) diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index d781d4d1d316..bf4afd1a8f1b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-09T16:31:19.614+08:00 +- Build date: 2016-05-10T00:30:19.190+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements 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 c87fe9763549..9120535bf5a6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Animal Class Doc Comment * @@ -57,9 +58,10 @@ class Animal implements ArrayAccess * @var string[] */ static $swaggerTypes = array( - 'class_name' => 'string' + 'class_name' => 'string', + 'color' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -69,9 +71,10 @@ class Animal implements ArrayAccess * @var string[] */ static $attributeMap = array( - 'class_name' => 'className' + 'class_name' => 'className', + 'color' => 'color' ); - + static function attributeMap() { return self::$attributeMap; } @@ -81,9 +84,10 @@ class Animal implements ArrayAccess * @var string[] */ static $setters = array( - 'class_name' => 'setClassName' + 'class_name' => 'setClassName', + 'color' => 'setColor' ); - + static function setters() { return self::$setters; } @@ -93,7 +97,8 @@ class Animal implements ArrayAccess * @var string[] */ static $getters = array( - 'class_name' => 'getClassName' + 'class_name' => 'getClassName', + 'color' => 'getColor' ); static function getters() { @@ -108,13 +113,7 @@ class Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['class_name'] - * @var string - */ - 'class_name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,16 +121,12 @@ class Animal implements ArrayAccess */ public function __construct(array $data = null) { - + $this->container['class_name'] = isset($data['class_name']) ? $data['class_name'] : null; + $this->container['color'] = isset($data['color']) ? $data['color'] : 'red'; + // Initialize discriminator property with the model name. $discrimintor = array_search('className', self::$attributeMap); $this->container[$discrimintor] = static::$swaggerModelName; - - if ($data != null) { - if (isset($data["class_name"])) { - $this->container['class_name'] = $data["class_name"]; - } - } } /** @@ -162,6 +157,7 @@ class Animal implements ArrayAccess return true; } + /** * Gets class_name * @return string @@ -182,6 +178,27 @@ class Animal implements ArrayAccess return $this; } + + /** + * Gets color + * @return string + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * @param string $color + * @return $this + */ + public function setColor($color) + { + $this->container['color'] = $color; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php index afd16e0a5c85..2ff9da6a4eaf 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * AnimalFarm Class Doc Comment * @@ -59,7 +60,7 @@ class AnimalFarm implements ArrayAccess static $swaggerTypes = array( ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class AnimalFarm implements ArrayAccess static $attributeMap = array( ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class AnimalFarm implements ArrayAccess static $setters = array( ); - + static function setters() { return self::$setters; } @@ -116,10 +117,6 @@ class AnimalFarm implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - } } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 655cb7e4b2ca..8894f835aeaf 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * ApiResponse Class Doc Comment * @@ -61,7 +62,7 @@ class ApiResponse implements ArrayAccess 'type' => 'string', 'message' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class ApiResponse implements ArrayAccess 'type' => 'type', 'message' => 'message' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class ApiResponse implements ArrayAccess 'type' => 'setType', 'message' => 'setMessage' ); - + static function setters() { return self::$setters; } @@ -116,25 +117,7 @@ class ApiResponse implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['code'] - * @var int - */ - 'code' => null, - - /** - * $container['type'] - * @var string - */ - 'type' => null, - - /** - * $container['message'] - * @var string - */ - 'message' => null, - ); + protected $container = array(); /** * Constructor @@ -142,19 +125,9 @@ class ApiResponse implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["code"])) { - $this->container['code'] = $data["code"]; - } - if (isset($data["type"])) { - $this->container['type'] = $data["type"]; - } - if (isset($data["message"])) { - $this->container['message'] = $data["message"]; - } - } + $this->container['code'] = isset($data['code']) ? $data['code'] : null; + $this->container['type'] = isset($data['type']) ? $data['type'] : null; + $this->container['message'] = isset($data['message']) ? $data['message'] : null; } /** @@ -179,6 +152,7 @@ class ApiResponse implements ArrayAccess return true; } + /** * Gets code * @return int @@ -199,6 +173,7 @@ class ApiResponse implements ArrayAccess return $this; } + /** * Gets type * @return string @@ -219,6 +194,7 @@ class ApiResponse implements ArrayAccess return $this; } + /** * Gets message * @return string 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 31b9f153cd46..393f89e5b0fc 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Cat Class Doc Comment * @@ -59,7 +60,7 @@ class Cat extends Animal implements ArrayAccess static $swaggerTypes = array( 'declawed' => 'bool' ); - + static function swaggerTypes() { return self::$swaggerTypes + parent::swaggerTypes(); } @@ -71,7 +72,7 @@ class Cat extends Animal implements ArrayAccess static $attributeMap = array( 'declawed' => 'declawed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +84,7 @@ class Cat extends Animal implements ArrayAccess static $setters = array( 'declawed' => 'setDeclawed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -108,13 +109,7 @@ class Cat extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['declawed'] - * @var bool - */ - 'declawed' => null, - ); + protected $container = array(); /** * Constructor @@ -123,12 +118,8 @@ class Cat extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - - if ($data != null) { - if (isset($data["declawed"])) { - $this->container['declawed'] = $data["declawed"]; - } - } + + $this->container['declawed'] = isset($data['declawed']) ? $data['declawed'] : null; } /** @@ -153,6 +144,7 @@ class Cat extends Animal implements ArrayAccess return true; } + /** * Gets declawed * @return bool 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 f186c7b740c0..1c1a23403789 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Category Class Doc Comment * @@ -60,7 +61,7 @@ class Category implements ArrayAccess 'id' => 'int', 'name' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -73,7 +74,7 @@ class Category implements ArrayAccess 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +87,7 @@ class Category implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -112,19 +113,7 @@ class Category implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -132,16 +121,8 @@ class Category implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["id"])) { - $this->container['id'] = $data["id"]; - } - if (isset($data["name"])) { - $this->container['name'] = $data["name"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } /** @@ -166,6 +147,7 @@ class Category implements ArrayAccess return true; } + /** * Gets id * @return int @@ -186,6 +168,7 @@ class Category implements ArrayAccess return $this; } + /** * Gets name * @return string 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 d14fa50ca195..b79e76a41870 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Dog Class Doc Comment * @@ -59,7 +60,7 @@ class Dog extends Animal implements ArrayAccess static $swaggerTypes = array( 'breed' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes + parent::swaggerTypes(); } @@ -71,7 +72,7 @@ class Dog extends Animal implements ArrayAccess static $attributeMap = array( 'breed' => 'breed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +84,7 @@ class Dog extends Animal implements ArrayAccess static $setters = array( 'breed' => 'setBreed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -108,13 +109,7 @@ class Dog extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['breed'] - * @var string - */ - 'breed' => null, - ); + protected $container = array(); /** * Constructor @@ -123,12 +118,8 @@ class Dog extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - - if ($data != null) { - if (isset($data["breed"])) { - $this->container['breed'] = $data["breed"]; - } - } + + $this->container['breed'] = isset($data['breed']) ? $data['breed'] : null; } /** @@ -153,6 +144,7 @@ class Dog extends Animal implements ArrayAccess return true; } + /** * Gets breed * @return string diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php index f7d1457c30f6..2b6d36c9b66d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * EnumClass Class Doc Comment * @@ -59,7 +60,7 @@ class EnumClass implements ArrayAccess static $swaggerTypes = array( ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class EnumClass implements ArrayAccess static $attributeMap = array( ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class EnumClass implements ArrayAccess static $setters = array( ); - + static function setters() { return self::$setters; } @@ -116,10 +117,6 @@ class EnumClass implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - } } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index 70e5e5ad9614..6e10f45dd8f5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * EnumTest Class Doc Comment * @@ -61,7 +62,7 @@ class EnumTest implements ArrayAccess 'enum_integer' => 'int', 'enum_number' => 'double' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class EnumTest implements ArrayAccess 'enum_integer' => 'enum_integer', 'enum_number' => 'enum_number' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class EnumTest implements ArrayAccess 'enum_integer' => 'setEnumInteger', 'enum_number' => 'setEnumNumber' ); - + static function setters() { return self::$setters; } @@ -155,25 +156,7 @@ class EnumTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['enum_string'] - * @var string - */ - 'enum_string' => null, - - /** - * $container['enum_integer'] - * @var int - */ - 'enum_integer' => null, - - /** - * $container['enum_number'] - * @var double - */ - 'enum_number' => null, - ); + protected $container = array(); /** * Constructor @@ -181,19 +164,9 @@ class EnumTest implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["enum_string"])) { - $this->container['enum_string'] = $data["enum_string"]; - } - if (isset($data["enum_integer"])) { - $this->container['enum_integer'] = $data["enum_integer"]; - } - if (isset($data["enum_number"])) { - $this->container['enum_number'] = $data["enum_number"]; - } - } + $this->container['enum_string'] = isset($data['enum_string']) ? $data['enum_string'] : null; + $this->container['enum_integer'] = isset($data['enum_integer']) ? $data['enum_integer'] : null; + $this->container['enum_number'] = isset($data['enum_number']) ? $data['enum_number'] : null; } /** @@ -242,6 +215,7 @@ class EnumTest implements ArrayAccess return true; } + /** * Gets enum_string * @return string @@ -266,6 +240,7 @@ class EnumTest implements ArrayAccess return $this; } + /** * Gets enum_integer * @return int @@ -290,6 +265,7 @@ class EnumTest implements ArrayAccess return $this; } + /** * Gets enum_number * @return double diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 322d7623bf16..bf674b05102e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * FormatTest Class Doc Comment * @@ -71,7 +72,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'string', 'password' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -95,7 +96,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'uuid', 'password' => 'password' ); - + static function attributeMap() { return self::$attributeMap; } @@ -119,7 +120,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'setUuid', 'password' => 'setPassword' ); - + static function setters() { return self::$setters; } @@ -156,85 +157,7 @@ class FormatTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['integer'] - * @var int - */ - 'integer' => null, - - /** - * $container['int32'] - * @var int - */ - 'int32' => null, - - /** - * $container['int64'] - * @var int - */ - 'int64' => null, - - /** - * $container['number'] - * @var float - */ - 'number' => null, - - /** - * $container['float'] - * @var float - */ - 'float' => null, - - /** - * $container['double'] - * @var double - */ - 'double' => null, - - /** - * $container['string'] - * @var string - */ - 'string' => null, - - /** - * $container['byte'] - * @var string - */ - 'byte' => null, - - /** - * $container['binary'] - * @var string - */ - 'binary' => null, - - /** - * $container['date'] - * @var \DateTime - */ - 'date' => null, - - /** - * $container['date_time'] - * @var \DateTime - */ - 'date_time' => null, - - /** - * $container['uuid'] - * @var string - */ - 'uuid' => null, - - /** - * $container['password'] - * @var string - */ - 'password' => null, - ); + protected $container = array(); /** * Constructor @@ -242,49 +165,19 @@ class FormatTest implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["integer"])) { - $this->container['integer'] = $data["integer"]; - } - if (isset($data["int32"])) { - $this->container['int32'] = $data["int32"]; - } - if (isset($data["int64"])) { - $this->container['int64'] = $data["int64"]; - } - if (isset($data["number"])) { - $this->container['number'] = $data["number"]; - } - if (isset($data["float"])) { - $this->container['float'] = $data["float"]; - } - if (isset($data["double"])) { - $this->container['double'] = $data["double"]; - } - if (isset($data["string"])) { - $this->container['string'] = $data["string"]; - } - if (isset($data["byte"])) { - $this->container['byte'] = $data["byte"]; - } - if (isset($data["binary"])) { - $this->container['binary'] = $data["binary"]; - } - if (isset($data["date"])) { - $this->container['date'] = $data["date"]; - } - if (isset($data["date_time"])) { - $this->container['date_time'] = $data["date_time"]; - } - if (isset($data["uuid"])) { - $this->container['uuid'] = $data["uuid"]; - } - if (isset($data["password"])) { - $this->container['password'] = $data["password"]; - } - } + $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; + $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; + $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; + $this->container['number'] = isset($data['number']) ? $data['number'] : null; + $this->container['float'] = isset($data['float']) ? $data['float'] : null; + $this->container['double'] = isset($data['double']) ? $data['double'] : null; + $this->container['string'] = isset($data['string']) ? $data['string'] : null; + $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; + $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; + $this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; } /** @@ -411,6 +304,7 @@ class FormatTest implements ArrayAccess return true; } + /** * Gets integer * @return int @@ -438,6 +332,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets int32 * @return int @@ -465,6 +360,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets int64 * @return int @@ -485,6 +381,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets number * @return float @@ -512,6 +409,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets float * @return float @@ -539,6 +437,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets double * @return double @@ -566,6 +465,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets string * @return string @@ -590,6 +490,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets byte * @return string @@ -610,6 +511,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets binary * @return string @@ -630,6 +532,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets date * @return \DateTime @@ -650,6 +553,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets date_time * @return \DateTime @@ -670,6 +574,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets uuid * @return string @@ -690,6 +595,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets password * @return string 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 07dcae58bfa4..68eae680dc6a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Model200Response Class Doc Comment * @@ -59,7 +60,7 @@ class Model200Response implements ArrayAccess static $swaggerTypes = array( 'name' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class Model200Response implements ArrayAccess static $attributeMap = array( 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class Model200Response implements ArrayAccess static $setters = array( 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class Model200Response implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['name'] - * @var int - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,13 +117,7 @@ class Model200Response implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["name"])) { - $this->container['name'] = $data["name"]; - } - } + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } /** @@ -153,6 +142,7 @@ class Model200Response implements ArrayAccess return true; } + /** * Gets name * @return int 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 78f2e6dfe99b..7dce6f0029da 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * ModelReturn Class Doc Comment * @@ -59,7 +60,7 @@ class ModelReturn implements ArrayAccess static $swaggerTypes = array( 'return' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class ModelReturn implements ArrayAccess static $attributeMap = array( 'return' => 'return' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class ModelReturn implements ArrayAccess static $setters = array( 'return' => 'setReturn' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class ModelReturn implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['return'] - * @var int - */ - 'return' => null, - ); + protected $container = array(); /** * Constructor @@ -122,13 +117,7 @@ class ModelReturn implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["return"])) { - $this->container['return'] = $data["return"]; - } - } + $this->container['return'] = isset($data['return']) ? $data['return'] : null; } /** @@ -153,6 +142,7 @@ class ModelReturn implements ArrayAccess return true; } + /** * Gets return * @return int 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 e9f40099d6cb..1684be6409a7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Name Class Doc Comment * @@ -61,7 +62,7 @@ class Name implements ArrayAccess 'snake_case' => 'int', 'property' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class Name implements ArrayAccess 'snake_case' => 'snake_case', 'property' => 'property' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class Name implements ArrayAccess 'snake_case' => 'setSnakeCase', 'property' => 'setProperty' ); - + static function setters() { return self::$setters; } @@ -116,25 +117,7 @@ class Name implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['name'] - * @var int - */ - 'name' => null, - - /** - * $container['snake_case'] - * @var int - */ - 'snake_case' => null, - - /** - * $container['property'] - * @var string - */ - 'property' => null, - ); + protected $container = array(); /** * Constructor @@ -142,19 +125,9 @@ class Name implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["name"])) { - $this->container['name'] = $data["name"]; - } - if (isset($data["snake_case"])) { - $this->container['snake_case'] = $data["snake_case"]; - } - if (isset($data["property"])) { - $this->container['property'] = $data["property"]; - } - } + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['snake_case'] = isset($data['snake_case']) ? $data['snake_case'] : null; + $this->container['property'] = isset($data['property']) ? $data['property'] : null; } /** @@ -185,6 +158,7 @@ class Name implements ArrayAccess return true; } + /** * Gets name * @return int @@ -205,6 +179,7 @@ class Name implements ArrayAccess return $this; } + /** * Gets snake_case * @return int @@ -225,6 +200,7 @@ class Name implements ArrayAccess return $this; } + /** * Gets property * @return string 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 233a6abd1bc5..88779ed8c733 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Order Class Doc Comment * @@ -64,7 +65,7 @@ class Order implements ArrayAccess 'status' => 'string', 'complete' => 'bool' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -81,7 +82,7 @@ class Order implements ArrayAccess 'status' => 'status', 'complete' => 'complete' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +99,7 @@ class Order implements ArrayAccess 'status' => 'setStatus', 'complete' => 'setComplete' ); - + static function setters() { return self::$setters; } @@ -143,43 +144,7 @@ class Order implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['pet_id'] - * @var int - */ - 'pet_id' => null, - - /** - * $container['quantity'] - * @var int - */ - 'quantity' => null, - - /** - * $container['ship_date'] - * @var \DateTime - */ - 'ship_date' => null, - - /** - * $container['status'] Order Status - * @var string - */ - 'status' => null, - - /** - * $container['complete'] - * @var bool - */ - 'complete' => false, - ); + protected $container = array(); /** * Constructor @@ -187,28 +152,12 @@ class Order implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["id"])) { - $this->container['id'] = $data["id"]; - } - if (isset($data["pet_id"])) { - $this->container['pet_id'] = $data["pet_id"]; - } - if (isset($data["quantity"])) { - $this->container['quantity'] = $data["quantity"]; - } - if (isset($data["ship_date"])) { - $this->container['ship_date'] = $data["ship_date"]; - } - if (isset($data["status"])) { - $this->container['status'] = $data["status"]; - } - if (isset($data["complete"])) { - $this->container['complete'] = $data["complete"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['pet_id'] = isset($data['pet_id']) ? $data['pet_id'] : null; + $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; + $this->container['ship_date'] = isset($data['ship_date']) ? $data['ship_date'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['complete'] = isset($data['complete']) ? $data['complete'] : false; } /** @@ -241,6 +190,7 @@ class Order implements ArrayAccess return true; } + /** * Gets id * @return int @@ -261,6 +211,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets pet_id * @return int @@ -281,6 +232,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets quantity * @return int @@ -301,6 +253,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets ship_date * @return \DateTime @@ -321,6 +274,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets status * @return string @@ -345,6 +299,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets complete * @return bool 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 2aab87c1ab96..5a65e4325382 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Pet Class Doc Comment * @@ -64,7 +65,7 @@ class Pet implements ArrayAccess 'tags' => '\Swagger\Client\Model\Tag[]', 'status' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -81,7 +82,7 @@ class Pet implements ArrayAccess 'tags' => 'tags', 'status' => 'status' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +99,7 @@ class Pet implements ArrayAccess 'tags' => 'setTags', 'status' => 'setStatus' ); - + static function setters() { return self::$setters; } @@ -143,43 +144,7 @@ class Pet implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['category'] - * @var \Swagger\Client\Model\Category - */ - 'category' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - - /** - * $container['photo_urls'] - * @var string[] - */ - 'photo_urls' => null, - - /** - * $container['tags'] - * @var \Swagger\Client\Model\Tag[] - */ - 'tags' => null, - - /** - * $container['status'] pet status in the store - * @var string - */ - 'status' => null, - ); + protected $container = array(); /** * Constructor @@ -187,28 +152,12 @@ class Pet implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["id"])) { - $this->container['id'] = $data["id"]; - } - if (isset($data["category"])) { - $this->container['category'] = $data["category"]; - } - if (isset($data["name"])) { - $this->container['name'] = $data["name"]; - } - if (isset($data["photo_urls"])) { - $this->container['photo_urls'] = $data["photo_urls"]; - } - if (isset($data["tags"])) { - $this->container['tags'] = $data["tags"]; - } - if (isset($data["status"])) { - $this->container['status'] = $data["status"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['category'] = isset($data['category']) ? $data['category'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['photo_urls'] = isset($data['photo_urls']) ? $data['photo_urls'] : null; + $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; } /** @@ -253,6 +202,7 @@ class Pet implements ArrayAccess return true; } + /** * Gets id * @return int @@ -273,6 +223,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets category * @return \Swagger\Client\Model\Category @@ -293,6 +244,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets name * @return string @@ -313,6 +265,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets photo_urls * @return string[] @@ -333,6 +286,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets tags * @return \Swagger\Client\Model\Tag[] @@ -353,6 +307,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets status * @return string 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 00f91f201b69..25ebecd55a0f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * SpecialModelName Class Doc Comment * @@ -59,7 +60,7 @@ class SpecialModelName implements ArrayAccess static $swaggerTypes = array( 'special_property_name' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class SpecialModelName implements ArrayAccess static $attributeMap = array( 'special_property_name' => '$special[property.name]' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class SpecialModelName implements ArrayAccess static $setters = array( 'special_property_name' => 'setSpecialPropertyName' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class SpecialModelName implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['special_property_name'] - * @var int - */ - 'special_property_name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,13 +117,7 @@ class SpecialModelName implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["special_property_name"])) { - $this->container['special_property_name'] = $data["special_property_name"]; - } - } + $this->container['special_property_name'] = isset($data['special_property_name']) ? $data['special_property_name'] : null; } /** @@ -153,6 +142,7 @@ class SpecialModelName implements ArrayAccess return true; } + /** * Gets special_property_name * @return int 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 c141024188be..a2132ca7e5ca 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Tag Class Doc Comment * @@ -60,7 +61,7 @@ class Tag implements ArrayAccess 'id' => 'int', 'name' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -73,7 +74,7 @@ class Tag implements ArrayAccess 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +87,7 @@ class Tag implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -112,19 +113,7 @@ class Tag implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -132,16 +121,8 @@ class Tag implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["id"])) { - $this->container['id'] = $data["id"]; - } - if (isset($data["name"])) { - $this->container['name'] = $data["name"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } /** @@ -166,6 +147,7 @@ class Tag implements ArrayAccess return true; } + /** * Gets id * @return int @@ -186,6 +168,7 @@ class Tag implements ArrayAccess return $this; } + /** * Gets name * @return string 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 9018e342a1d0..a97727f0a8f8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * User Class Doc Comment * @@ -66,7 +67,7 @@ class User implements ArrayAccess 'phone' => 'string', 'user_status' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -85,7 +86,7 @@ class User implements ArrayAccess 'phone' => 'phone', 'user_status' => 'userStatus' ); - + static function attributeMap() { return self::$attributeMap; } @@ -104,7 +105,7 @@ class User implements ArrayAccess 'phone' => 'setPhone', 'user_status' => 'setUserStatus' ); - + static function setters() { return self::$setters; } @@ -136,55 +137,7 @@ class User implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['username'] - * @var string - */ - 'username' => null, - - /** - * $container['first_name'] - * @var string - */ - 'first_name' => null, - - /** - * $container['last_name'] - * @var string - */ - 'last_name' => null, - - /** - * $container['email'] - * @var string - */ - 'email' => null, - - /** - * $container['password'] - * @var string - */ - 'password' => null, - - /** - * $container['phone'] - * @var string - */ - 'phone' => null, - - /** - * $container['user_status'] User Status - * @var int - */ - 'user_status' => null, - ); + protected $container = array(); /** * Constructor @@ -192,34 +145,14 @@ class User implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["id"])) { - $this->container['id'] = $data["id"]; - } - if (isset($data["username"])) { - $this->container['username'] = $data["username"]; - } - if (isset($data["first_name"])) { - $this->container['first_name'] = $data["first_name"]; - } - if (isset($data["last_name"])) { - $this->container['last_name'] = $data["last_name"]; - } - if (isset($data["email"])) { - $this->container['email'] = $data["email"]; - } - if (isset($data["password"])) { - $this->container['password'] = $data["password"]; - } - if (isset($data["phone"])) { - $this->container['phone'] = $data["phone"]; - } - if (isset($data["user_status"])) { - $this->container['user_status'] = $data["user_status"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['username'] = isset($data['username']) ? $data['username'] : null; + $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; + $this->container['last_name'] = isset($data['last_name']) ? $data['last_name'] : null; + $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['phone'] = isset($data['phone']) ? $data['phone'] : null; + $this->container['user_status'] = isset($data['user_status']) ? $data['user_status'] : null; } /** @@ -244,6 +177,7 @@ class User implements ArrayAccess return true; } + /** * Gets id * @return int @@ -264,6 +198,7 @@ class User implements ArrayAccess return $this; } + /** * Gets username * @return string @@ -284,6 +219,7 @@ class User implements ArrayAccess return $this; } + /** * Gets first_name * @return string @@ -304,6 +240,7 @@ class User implements ArrayAccess return $this; } + /** * Gets last_name * @return string @@ -324,6 +261,7 @@ class User implements ArrayAccess return $this; } + /** * Gets email * @return string @@ -344,6 +282,7 @@ class User implements ArrayAccess return $this; } + /** * Gets password * @return string @@ -364,6 +303,7 @@ class User implements ArrayAccess return $this; } + /** * Gets phone * @return string @@ -384,6 +324,7 @@ class User implements ArrayAccess return $this; } + /** * Gets user_status * @return int diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index ac63c18fbd5d..3adaa899f5f8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -256,7 +256,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { + } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { From 449d6b7d5f2ed8bf626085244bd711a5ace36d84 Mon Sep 17 00:00:00 2001 From: Mikolaj Przybysz Date: Mon, 9 May 2016 19:03:49 +0200 Subject: [PATCH 156/170] issue-2743 fixing docs path and composer autoloader-dev --- .../java/io/swagger/codegen/languages/PhpClientCodegen.java | 5 ++++- .../swagger-codegen/src/main/resources/php/composer.mustache | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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 9ad33e1d18aa..6539d49d1bba 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -41,7 +41,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { protected String modelDirName = "Model"; protected String variableNamingConvention= "snake_case"; protected String apiDocPath = docsBasePath + "/" + apiDirName; - protected String modelDocPath = docsBasePath + "docs/" + modelDirName; + protected String modelDocPath = docsBasePath + "/" + modelDirName; public PhpClientCodegen() { super(); @@ -233,6 +233,9 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); + // make test path available in mustache template + additionalProperties.put("testBasePath", testBasePath); + supportingFiles.add(new SupportingFile("configuration.mustache", toPackagePath(invokerPackage, srcBasePath), "Configuration.php")); supportingFiles.add(new SupportingFile("ApiClient.mustache", toPackagePath(invokerPackage, srcBasePath), "ApiClient.php")); supportingFiles.add(new SupportingFile("ApiException.mustache", toPackagePath(invokerPackage, srcBasePath), "ApiException.php")); diff --git a/modules/swagger-codegen/src/main/resources/php/composer.mustache b/modules/swagger-codegen/src/main/resources/php/composer.mustache index 510303ac2484..062a3ddc6cc2 100644 --- a/modules/swagger-codegen/src/main/resources/php/composer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/composer.mustache @@ -31,6 +31,6 @@ "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } }, "autoload-dev": { - "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } + "psr-4": { "{{escapedInvokerPackage}}\\" : "{{testBasePath}}/" } } } From 3185606124afdd878aae16e34560b01ead8d4141 Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Mon, 9 May 2016 16:37:36 -0400 Subject: [PATCH 157/170] Update typings Expose type definition Add readme --- .../TypeScriptFetchClientCodegen.java | 7 ++- .../main/resources/TypeScript-Fetch/README.md | 44 +++++++++++++++++++ .../TypeScript-Fetch/package.json.mustache | 5 ++- .../TypeScript-Fetch/tsconfig.json.mustache | 2 + .../TypeScript-Fetch/typings.json.mustache | 2 +- 5 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java index 5bc848a7c78a..c817162401e2 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java @@ -24,11 +24,10 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege @Override public void processOpts() { super.processOpts(); - final String defaultFolder = apiPackage().replace('.', File.separatorChar); - - supportingFiles.add(new SupportingFile("api.mustache", null, "api.ts")); + supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - supportingFiles.add(new SupportingFile("assign.ts", defaultFolder, "assign.ts")); + supportingFiles.add(new SupportingFile("assign.ts", "", "assign.ts")); + supportingFiles.add(new SupportingFile("README.md", "", "README.md")); supportingFiles.add(new SupportingFile("package.json.mustache", "", "package.json")); supportingFiles.add(new SupportingFile("typings.json.mustache", "", "typings.json")); supportingFiles.add(new SupportingFile("tsconfig.json.mustache", "", "tsconfig.json")); diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md new file mode 100644 index 000000000000..8ec43e764975 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md @@ -0,0 +1,44 @@ +# TypeScript-Fetch + +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The codegen Node module can be used in the following environments: + +* Node.JS +* Webpack +* Browserify + +It is usable in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `typings` in `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Installation ### + +`swagger-codegen` does not generate JavaScript directly. The codegen Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile. The self-compile is normally run automatically via the `npm` `postinstall` script of `npm install`. + +CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` may skip `postinstall` script if the user is `root`. You would need to manually invoke `npm install` or `npm run postinstall` for the codegen module if that's the case. + +#### NPM repository ### +If you remove `"private": true` from `package.json`, you may publish the module to NPM. In which case, you would be able to install the module as any other NPM module. + +It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). + +#### NPM install local file ### +You should be able to directly install the module using `npm install file:///codegen_path`. + +NOTES: If you do `npm install file:///codegen_path --save` NPM might convert your path to relative path, maybe have adverse affect. `npm install` and `npm shrinkwrap` may misbehave if the installation path is not absolute. + +#### direct copy/symlink ### +You may also simply copy or symlink the codegen into a directly under your project. The syntax of the usage would differ if you take this route. (See below) + +### Usage ### +With ES6 module syntax, the following syntaxes are supported: +``` +import * as localName from 'npmName'; +import {operationId} from 'npmName'; + +import * as localName from './symlinkDir'; +import {operationId} from './symlinkDir'; +``` +With CommonJS, the following syntaxes are supported: +``` +import localName = require('npmName'); + +import localName = require('./symlinkDir')'; +``` \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache index 7e94923c1428..e6379434b801 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache @@ -2,8 +2,9 @@ "name": "{{#npmName}}{{{npmName}}}{{/npmName}}{{^npmName}}typescript-fetch-api{{/npmName}}", "version": "{{#npmVersion}}{{{npmVersion}}}{{/npmVersion}}{{^npmVersion}}0.0.0{{/npmVersion}}", "private": true, - "main": "dist/api.js", - "browser": "dist/api.js", + "main": "./dist/api.js", + "browser": "./dist/api.js", + "typings": "./dist/api.d.ts", "dependencies": { "isomorphic-fetch": "^2.2.1" }, diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache index 457b7f53db8d..06a057d7a49f 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache @@ -1,11 +1,13 @@ { "compilerOptions": { + "declaration": true, "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", "module": "commonjs", "noImplicitAny": true, "outDir": "dist" }, "exclude": [ + "dist", "node_modules", "typings/browser", "typings/main", diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache index 1d1b679de8c1..38baf589fb93 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache @@ -4,6 +4,6 @@ "ambientDependencies": { {{^supportsES6}} "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", {{/supportsES6}} "node": "registry:dt/node#4.0.0+20160423143914", - "isomorphic-fetch": "github:leonyu/DefinitelyTyped/isomorphic-fetch/isomorphic-fetch.d.ts#isomorphic-fetch-fix-module" + "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" } } From e17710fc72bbf864f3d187858b0c0d61432c1669 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 10:38:16 +0800 Subject: [PATCH 158/170] add pagerduty --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c74b517bdb7c..e73d2debbce6 100644 --- a/README.md +++ b/README.md @@ -807,6 +807,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [nViso](http://www.nviso.ch/) - [Okiok](https://www.okiok.com) - [OSDN](https://osdn.jp) +- [PagerDuty](https://www.pagerduty.com) - [Pepipost](https://www.pepipost.com) - [Pixoneye](http://www.pixoneye.com/) - [PostAffiliatePro](https://www.postaffiliatepro.com/) From d54877b5d375e8234f010beed871b6ab14614708 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 14:18:06 +0800 Subject: [PATCH 159/170] add ruby spec for configuration, api client, replace should with expect --- .../io/swagger/codegen/DefaultGenerator.java | 11 +- .../codegen/languages/RubyClientCodegen.java | 9 +- .../resources/ruby/api_client_spec.mustache | 273 ++++++++++++++++++ .../src/main/resources/ruby/api_test.mustache | 8 +- .../ruby/configuration_spec.mustache | 25 ++ .../main/resources/ruby/model_test.mustache | 8 +- .../src/main/resources/ruby/rspec.mustache | 2 + .../main/resources/ruby/spec_helper.mustache | 99 +++++++ samples/client/petstore/ruby/.rspec | 2 + samples/client/petstore/ruby/README.md | 2 +- .../ruby/spec/models/animal_farm_spec.rb | 40 +++ .../ruby/spec/models/enum_class_spec.rb | 40 +++ .../ruby/spec/models/enum_test_spec.rb | 58 ++++ .../petstore/ruby/spec/models/pet_spec.rb | 10 + .../client/petstore/ruby/spec/spec_helper.rb | 158 +++++----- 15 files changed, 660 insertions(+), 85 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/ruby/api_client_spec.mustache create mode 100644 modules/swagger-codegen/src/main/resources/ruby/configuration_spec.mustache create mode 100644 modules/swagger-codegen/src/main/resources/ruby/rspec.mustache create mode 100644 modules/swagger-codegen/src/main/resources/ruby/spec_helper.mustache create mode 100644 samples/client/petstore/ruby/.rspec create mode 100644 samples/client/petstore/ruby/spec/models/animal_farm_spec.rb create mode 100644 samples/client/petstore/ruby/spec/models/enum_class_spec.rb create mode 100644 samples/client/petstore/ruby/spec/models/enum_test_spec.rb diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index b5a920004c83..8be354df1ee7 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -286,8 +286,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { for (String templateName : config.modelTestTemplateFiles().keySet()) { String suffix = config.modelTestTemplateFiles().get(templateName); String filename = config.modelTestFileFolder() + File.separator + config.toModelTestFilename(name) + suffix; - if (!config.shouldOverwrite(filename)) { - LOGGER.info("Skipped overwriting " + filename); + // do not overwrite test file that already exists + if (new File(filename).exists()) { + LOGGER.info("File exists. Skipped overwriting " + filename); continue; } String templateFile = getFullTemplateFile(config, templateName); @@ -419,11 +420,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { // to generate api test files for (String templateName : config.apiTestTemplateFiles().keySet()) { String filename = config.apiTestFilename(templateName, tag); - if (!config.shouldOverwrite(filename) && new File(filename).exists()) { - LOGGER.info("Skipped overwriting " + filename); + // do not overwrite test file that already exists + if (new File(filename).exists()) { + LOGGER.info("File exists. Skipped overwriting " + filename); continue; } - String templateFile = getFullTemplateFile(config, templateName); String template = readTemplate(templateFile); Template tmpl = Mustache.compiler() diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java index aeb8e524e9db..14244b5661de 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java @@ -224,6 +224,10 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + writeOptional(outputFolder, new SupportingFile("rspec.mustache", "", ".rspec")); + writeOptional(outputFolder, new SupportingFile("spec_helper.mustache", specFolder, "spec_helper.rb")); + writeOptional(outputFolder, new SupportingFile("configuration_spec.mustache", specFolder, "configuration_spec.rb")); + writeOptional(outputFolder, new SupportingFile("api_client_spec.mustache", specFolder, "api_client_spec.rb")); } @Override @@ -644,10 +648,11 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { this.gemAuthorEmail = gemAuthorEmail; } - @Override public boolean shouldOverwrite(String filename) { // skip spec file as the file might have been updated with new test cases - return super.shouldOverwrite(filename) && !filename.endsWith("_spec.rb"); + return !(skipOverwrite && new File(filename).exists()); + // + //return super.shouldOverwrite(filename) && !filename.endsWith("_spec.rb"); } } diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_client_spec.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_client_spec.mustache new file mode 100644 index 000000000000..1ed497da21e1 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/ruby/api_client_spec.mustache @@ -0,0 +1,273 @@ +require 'spec_helper' + +describe {{moduleName}}::ApiClient do + context 'initialization' do + context 'URL stuff' do + context 'host' do + it 'removes http from host' do + {{moduleName}}.configure { |c| c.host = 'http://example.com' } + expect({{moduleName}}::Configuration.default.host).to eq('example.com') + end + + it 'removes https from host' do + {{moduleName}}.configure { |c| c.host = 'https://wookiee.com' } + expect({{moduleName}}::ApiClient.default.config.host).to eq('wookiee.com') + end + + it 'removes trailing path from host' do + {{moduleName}}.configure { |c| c.host = 'hobo.com/v4' } + expect({{moduleName}}::Configuration.default.host).to eq('hobo.com') + end + end + + context 'base_path' do + it "prepends a slash to base_path" do + {{moduleName}}.configure { |c| c.base_path = 'v4/dog' } + expect({{moduleName}}::Configuration.default.base_path).to eq('/v4/dog') + end + + it "doesn't prepend a slash if one is already there" do + {{moduleName}}.configure { |c| c.base_path = '/v4/dog' } + expect({{moduleName}}::Configuration.default.base_path).to eq('/v4/dog') + end + + it "ends up as a blank string if nil" do + {{moduleName}}.configure { |c| c.base_path = nil } + expect({{moduleName}}::Configuration.default.base_path).to eq('') + end + end + end + end + + describe "#update_params_for_auth!" do + it "sets header api-key parameter with prefix" do + {{moduleName}}.configure do |c| + c.api_key_prefix['api_key'] = 'PREFIX' + c.api_key['api_key'] = 'special-key' + end + + api_client = {{moduleName}}::ApiClient.new + + config2 = {{moduleName}}::Configuration.new do |c| + c.api_key_prefix['api_key'] = 'PREFIX2' + c.api_key['api_key'] = 'special-key2' + end + api_client2 = {{moduleName}}::ApiClient.new(config2) + + auth_names = ['api_key', 'unknown'] + + header_params = {} + query_params = {} + api_client.update_params_for_auth! header_params, query_params, auth_names + expect(header_params).to eq({'api_key' => 'PREFIX special-key'}) + expect(query_params).to eq({}) + + header_params = {} + query_params = {} + api_client2.update_params_for_auth! header_params, query_params, auth_names + expect(header_params).to eq({'api_key' => 'PREFIX2 special-key2'}) + expect(query_params).to eq({}) + end + + it "sets header api-key parameter without prefix" do + {{moduleName}}.configure do |c| + c.api_key_prefix['api_key'] = nil + c.api_key['api_key'] = 'special-key' + end + + api_client = {{moduleName}}::ApiClient.new + + header_params = {} + query_params = {} + auth_names = ['api_key', 'unknown'] + api_client.update_params_for_auth! header_params, query_params, auth_names + expect(header_params).to eq({'api_key' => 'special-key'}) + expect(query_params).to eq({}) + end + end + + describe "timeout in #build_request" do + let(:config) { {{moduleName}}::Configuration.new } + let(:api_client) { {{moduleName}}::ApiClient.new(config) } + + it "defaults to 0" do + expect({{moduleName}}::Configuration.default.timeout).to eq(0) + expect(config.timeout).to eq(0) + + request = api_client.build_request(:get, '/test') + expect(request.options[:timeout]).to eq(0) + end + + it "can be customized" do + config.timeout = 100 + request = api_client.build_request(:get, '/test') + expect(request.options[:timeout]).to eq(100) + end + end + + describe "#deserialize" do + it "handles Array" do + api_client = {{moduleName}}::ApiClient.new + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: '[12, 34]') + data = api_client.deserialize(response, 'Array') + expect(data).to be_instance_of(Array) + expect(data).to eq([12, 34]) + end + + it "handles Array>" do + api_client = {{moduleName}}::ApiClient.new + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: '[[12, 34], [56]]') + data = api_client.deserialize(response, 'Array>') + expect(data).to be_instance_of(Array) + expect(data).to eq([[12, 34], [56]]) + end + + it "handles Hash" do + api_client = {{moduleName}}::ApiClient.new + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: '{"message": "Hello"}') + data = api_client.deserialize(response, 'Hash') + expect(data).to be_instance_of(Hash) + expect(data).to eq({:message => 'Hello'}) + end + + it "handles Hash" do + api_client = {{moduleName}}::ApiClient.new + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: '{"pet": {"id": 1}}') + data = api_client.deserialize(response, 'Hash') + expect(data).to be_instance_of(Hash) + expect(data.keys).to eq([:pet]) + + pet = data[:pet] + expect(pet).to be_instance_of({{moduleName}}::Pet) + expect(pet.id).to eq(1) + end + + it "handles Hash>" do + api_client = {{moduleName}}::ApiClient.new + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: '{"data": {"pet": {"id": 1}}}') + result = api_client.deserialize(response, 'Hash>') + expect(result).to be_instance_of(Hash) + expect(result.keys).to match_array([:data]) + + data = result[:data] + expect(data).to be_instance_of(Hash) + expect(data.keys).to match_array([:pet]) + + pet = data[:pet] + expect(pet).to be_instance_of({{moduleName}}::Pet) + expect(pet.id).to eq(1) + end + end + + describe "#object_to_hash" do + it "ignores nils and includes empty arrays" do + api_client = {{moduleName}}::ApiClient.new + pet = {{moduleName}}::Pet.new + pet.id = 1 + pet.name = '' + pet.status = nil + pet.photo_urls = nil + pet.tags = [] + expected = {id: 1, name: '', tags: []} + expect(api_client.object_to_hash(pet)).to eq(expected) + end + end + + describe "#build_collection_param" do + let(:param) { ['aa', 'bb', 'cc'] } + let(:api_client) { {{moduleName}}::ApiClient.new } + + it "works for csv" do + expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc') + end + + it "works for ssv" do + expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc') + end + + it "works for tsv" do + expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc") + end + + it "works for pipes" do + expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc') + end + + it "works for multi" do + expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc']) + end + + it "fails for invalid collection format" do + expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID') + end + end + + describe "#json_mime?" do + let(:api_client) { {{moduleName}}::ApiClient.new } + + it "works" do + expect(api_client.json_mime?(nil)).to eq false + expect(api_client.json_mime?('')).to eq false + + expect(api_client.json_mime?('application/json')).to eq true + expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true + expect(api_client.json_mime?('APPLICATION/JSON')).to eq true + + expect(api_client.json_mime?('application/xml')).to eq false + expect(api_client.json_mime?('text/plain')).to eq false + expect(api_client.json_mime?('application/jsonp')).to eq false + end + end + + describe "#select_header_accept" do + let(:api_client) { {{moduleName}}::ApiClient.new } + + it "works" do + expect(api_client.select_header_accept(nil)).to be_nil + expect(api_client.select_header_accept([])).to be_nil + + expect(api_client.select_header_accept(['application/json'])).to eq('application/json') + expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + + expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml') + end + end + + describe "#select_header_content_type" do + let(:api_client) { {{moduleName}}::ApiClient.new } + + it "works" do + expect(api_client.select_header_content_type(nil)).to eq('application/json') + expect(api_client.select_header_content_type([])).to eq('application/json') + + expect(api_client.select_header_content_type(['application/json'])).to eq('application/json') + expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain') + end + end + + describe "#sanitize_filename" do + let(:api_client) { {{moduleName}}::ApiClient.new } + + it "works" do + expect(api_client.sanitize_filename('sun')).to eq('sun') + expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif') + end + end +end diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_test.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_test.mustache index 7e95c2d6446d..d28f29e0c3ad 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_test.mustache @@ -20,7 +20,7 @@ require 'json' describe 'test an instance of {{classname}}' do it 'should create an instact of {{classname}}' do - @instance.should be_a({{moduleName}}::{{classname}}) + expect(@instance).to be_instance_of({{moduleName}}::{{classname}}) end end @@ -34,11 +34,7 @@ require 'json' {{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}] describe '{{operationId}} test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/modules/swagger-codegen/src/main/resources/ruby/configuration_spec.mustache b/modules/swagger-codegen/src/main/resources/ruby/configuration_spec.mustache new file mode 100644 index 000000000000..4c23a067175a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/ruby/configuration_spec.mustache @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe {{moduleName}}::Configuration do + let(:config) { {{moduleName}}::Configuration.default } + + before(:each) do + {{moduleName}}.configure do |c| + c.host = 'petstore.swagger.io' + c.base_path = 'v2' + end + end + + describe '#base_url' do + it 'should have the default value' do + expect(config.base_url).to eq('http://petstore.swagger.io/v2') + end + + it 'should remove trailing slashes' do + [nil, '', '/', '//'].each do |base_path| + config.base_path = base_path + expect(config.base_url).to eq('http://petstore.swagger.io') + end + end + end +end diff --git a/modules/swagger-codegen/src/main/resources/ruby/model_test.mustache b/modules/swagger-codegen/src/main/resources/ruby/model_test.mustache index f5204447975f..305a10d6467b 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/model_test.mustache @@ -21,17 +21,13 @@ require 'date' describe 'test an instance of {{classname}}' do it 'should create an instact of {{classname}}' do - @instance.should be_a({{moduleName}}::{{classname}}) + expect(@instance).to be_instance_of({{moduleName}}::{{classname}}) end end {{#vars}} describe 'test attribute "{{{name}}}"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/modules/swagger-codegen/src/main/resources/ruby/rspec.mustache b/modules/swagger-codegen/src/main/resources/ruby/rspec.mustache new file mode 100644 index 000000000000..83e16f804474 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/ruby/rspec.mustache @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/modules/swagger-codegen/src/main/resources/ruby/spec_helper.mustache b/modules/swagger-codegen/src/main/resources/ruby/spec_helper.mustache new file mode 100644 index 000000000000..bc4187c33782 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/ruby/spec_helper.mustache @@ -0,0 +1,99 @@ +# load the gem +require '{{{gemName}}}' + +# The following was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end diff --git a/samples/client/petstore/ruby/.rspec b/samples/client/petstore/ruby/.rspec new file mode 100644 index 000000000000..83e16f804474 --- /dev/null +++ b/samples/client/petstore/ruby/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 4f573b6f04a5..58fad311c434 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-06T16:33:11.754+08:00 +- Build date: 2016-05-10T14:06:27.504+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation diff --git a/samples/client/petstore/ruby/spec/models/animal_farm_spec.rb b/samples/client/petstore/ruby/spec/models/animal_farm_spec.rb new file mode 100644 index 000000000000..016b86fd8af0 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/animal_farm_spec.rb @@ -0,0 +1,40 @@ +=begin +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::AnimalFarm +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'AnimalFarm' do + before do + # run before each test + @instance = Petstore::AnimalFarm.new + end + + after do + # run after each test + end + + describe 'test an instance of AnimalFarm' do + it 'should create an instact of AnimalFarm' do + expect(@instance).to be_instance_of(Petstore::AnimalFarm) + end + end +end + diff --git a/samples/client/petstore/ruby/spec/models/enum_class_spec.rb b/samples/client/petstore/ruby/spec/models/enum_class_spec.rb new file mode 100644 index 000000000000..b8610d74a1b2 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/enum_class_spec.rb @@ -0,0 +1,40 @@ +=begin +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::EnumClass +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'EnumClass' do + before do + # run before each test + @instance = Petstore::EnumClass.new + end + + after do + # run after each test + end + + describe 'test an instance of EnumClass' do + it 'should create an instact of EnumClass' do + expect(@instance).to be_instance_of(Petstore::EnumClass) + end + end +end + diff --git a/samples/client/petstore/ruby/spec/models/enum_test_spec.rb b/samples/client/petstore/ruby/spec/models/enum_test_spec.rb new file mode 100644 index 000000000000..91941d8a50d0 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/enum_test_spec.rb @@ -0,0 +1,58 @@ +=begin +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::EnumTest +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'EnumTest' do + before do + # run before each test + @instance = Petstore::EnumTest.new + end + + after do + # run after each test + end + + describe 'test an instance of EnumTest' do + it 'should create an instact of EnumTest' do + expect(@instance).to be_instance_of(Petstore::EnumTest) + end + end + describe 'test attribute "enum_string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "enum_integer"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "enum_number"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/samples/client/petstore/ruby/spec/models/pet_spec.rb b/samples/client/petstore/ruby/spec/models/pet_spec.rb index 96ced2cd3664..baf3cdf008dc 100644 --- a/samples/client/petstore/ruby/spec/models/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/models/pet_spec.rb @@ -25,10 +25,20 @@ describe 'Pet' do before do # run before each test @instance = Petstore::Pet.new + + @pet_api = Petstore::PetApi.new(API_CLIENT) + @pet_id = prepare_pet(@pet_api) end after do # run after each test + # remove the testing pet + begin + @pet_api.delete_pet(@pet_id) + rescue Petstore::ApiError => e + # ignore ApiError 404 (Not Found) + raise e if e.code != 404 + end end describe 'test an instance of Pet' do diff --git a/samples/client/petstore/ruby/spec/spec_helper.rb b/samples/client/petstore/ruby/spec/spec_helper.rb index 50702c439b7a..0bba600ba45b 100644 --- a/samples/client/petstore/ruby/spec/spec_helper.rb +++ b/samples/client/petstore/ruby/spec/spec_helper.rb @@ -1,71 +1,99 @@ -require 'rubygems' -require 'bundler/setup' -require 'petstore' -require 'vcr' -require 'typhoeus' -require 'json' -require 'yaml' -require 'rspec' - +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| - # some (optional) config here - config.expect_with :rspec do |c| - c.syntax = :should + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true end - config.mock_with :rspec do |c| - c.syntax = :should + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true end + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end end +require 'SwaggerClient' -WebMock.allow_net_connect! if defined? WebMock - -def help - puts "\nOh noes! You gotta stuff your swagger credentials in ~/.swagger.yml like so:\n\n" - puts "api_key: '12345abcdefg'" - puts "username: 'fumanchu'" - puts "password: 'kalamazoo'\n\n" - exit -end - -# no longer reading credentials (not used) from file (20150413) -# Parse ~/.swagger.yml for user credentials -#begin -# CREDENTIALS = YAML::load_file(File.join(ENV['HOME'], ".swagger.yml")).symbolize_keys -#rescue -# help -#end - -API_CLIENT = Petstore::ApiClient.new(Petstore::Configuration.new) - -def random_id - rand(1000000) + 20000 -end - -# create a random pet, return its id -def prepare_pet(pet_api) - pet_id = random_id - category = Petstore::Category.new('id' => 20002, 'name' => 'category test') - tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test') - pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url', - 'category' => category, 'tags' => [tag], 'status' => 'pending') - pet_api.add_pet(pet) - return pet_id -end - -# create a random order, return its id -def prepare_store(store_api) - order_id = 5 - order = Petstore::Order.new("id" => order_id, - "petId" => 123, - "quantity" => 789, - "shipDate" => "2015-04-06T23:42:01.678Z", - "status" => "placed", - "complete" => false) - store_api.place_order(order) - return order_id -end - -# A random string to tack onto stuff to ensure we're not seeing -# data from a previous test run -RAND = ("a".."z").to_a.sample(8).join From 31daa2b092c2fe025414ae6f755a97a8fd8441c0 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 14:56:14 +0800 Subject: [PATCH 160/170] update ruby test files --- .../codegen/languages/RubyClientCodegen.java | 2 + .../resources/ruby/base_object_spec.mustache | 109 ++++++++++++++++++ samples/client/petstore/ruby/README.md | 2 +- .../petstore/ruby/spec/api/fake_api_spec.rb | 12 +- .../petstore/ruby/spec/api/pet_api_spec.rb | 50 ++------ .../petstore/ruby/spec/api/store_api_spec.rb | 28 +---- .../petstore/ruby/spec/api/user_api_spec.rb | 52 ++------- .../petstore/ruby/spec/base_object_spec.rb | 49 ++++---- .../petstore/ruby/spec/models/animal_spec.rb | 8 +- .../ruby/spec/models/api_response_spec.rb | 20 +--- .../petstore/ruby/spec/models/cat_spec.rb | 14 +-- .../ruby/spec/models/category_spec.rb | 14 +-- .../petstore/ruby/spec/models/dog_spec.rb | 18 +-- .../ruby/spec/models/format_test_spec.rb | 80 +++---------- .../spec/models/inline_response_200_spec.rb | 100 ---------------- .../spec/models/model_200_response_spec.rb | 8 +- .../ruby/spec/models/model_return_spec.rb | 8 +- .../petstore/ruby/spec/models/name_spec.rb | 20 +--- .../petstore/ruby/spec/models/order_spec.rb | 38 ++---- .../petstore/ruby/spec/models/pet_spec.rb | 48 ++------ .../spec/models/special_model_name_spec.rb | 8 +- .../petstore/ruby/spec/models/tag_spec.rb | 14 +-- .../petstore/ruby/spec/models/user_spec.rb | 50 ++------ samples/client/petstore/ruby/spec/pet_spec.rb | 10 -- samples/client/petstore/ruby/spec/spec.opts | 4 - .../client/petstore/ruby/spec/spec_helper.rb | 52 ++++++++- 26 files changed, 283 insertions(+), 535 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/ruby/base_object_spec.mustache delete mode 100644 samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb delete mode 100644 samples/client/petstore/ruby/spec/spec.opts diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java index 14244b5661de..6655a28f1d50 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java @@ -228,6 +228,8 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { writeOptional(outputFolder, new SupportingFile("spec_helper.mustache", specFolder, "spec_helper.rb")); writeOptional(outputFolder, new SupportingFile("configuration_spec.mustache", specFolder, "configuration_spec.rb")); writeOptional(outputFolder, new SupportingFile("api_client_spec.mustache", specFolder, "api_client_spec.rb")); + // not including base object test as the moment as not all API has model + //writeOptional(outputFolder, new SupportingFile("base_object_spec.mustache", specFolder, "base_object_spec.rb")); } @Override diff --git a/modules/swagger-codegen/src/main/resources/ruby/base_object_spec.mustache b/modules/swagger-codegen/src/main/resources/ruby/base_object_spec.mustache new file mode 100644 index 000000000000..7376cd1e84d5 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/ruby/base_object_spec.mustache @@ -0,0 +1,109 @@ +require 'spec_helper' + +class ArrayMapObject < Petstore::Category + attr_accessor :int_arr, :pet_arr, :int_map, :pet_map, :int_arr_map, :pet_arr_map, :boolean_true_arr, :boolean_false_arr + + def self.attribute_map + { + :int_arr => :int_arr, + :pet_arr => :pet_arr, + :int_map => :int_map, + :pet_map => :pet_map, + :int_arr_map => :int_arr_map, + :pet_arr_map => :pet_arr_map, + :boolean_true_arr => :boolean_true_arr, + :boolean_false_arr => :boolean_false_arr, + } + end + + def self.swagger_types + { + :int_arr => :'Array', + :pet_arr => :'Array', + :int_map => :'Hash', + :pet_map => :'Hash', + :int_arr_map => :'Hash>', + :pet_arr_map => :'Hash>', + :boolean_true_arr => :'Array', + :boolean_false_arr => :'Array', + } + end +end + +describe 'BaseObject' do + describe 'boolean values' do + let(:obj) { Petstore::Cat.new({declawed: false}) } + + it 'should have values set' do + expect(obj.declawed).not_to be_nil + expect(obj.declawed).to eq(false) + end + end + + describe 'array and map properties' do + let(:obj) { ArrayMapObject.new } + + let(:data) do + {int_arr: [123, 456], + pet_arr: [{name: 'Kitty'}], + int_map: {'int' => 123}, + pet_map: {'pet' => {name: 'Kitty'}}, + int_arr_map: {'int_arr' => [123, 456]}, + pet_arr_map: {'pet_arr' => [{name: 'Kitty'}]}, + boolean_true_arr: [true, "true", "TruE", 1, "y", "yes", "1", "t", "T"], + boolean_false_arr: [false, "", 0, "0", "f", nil, "null"], + } + end + + it 'works for #build_from_hash' do + obj.build_from_hash(data) + + expect(obj.int_arr).to match_array([123, 456]) + + expect(obj.pet_arr).to be_instance_of(Array) + expect(obj.pet_arr).to be_instance_of(1) + + pet = obj.pet_arr.first + expect(pet).to be_instance_of(Petstore::Pet) + expect(pet.name).to eq('Kitty') + + expect(obj.int_map).to be_instance_of(Hash) + expect(obj.int_map).to eq({'int' => 123}) + + expect(obj.pet_map).to be_instance_of(Hash) + pet = obj.pet_map['pet'] + expect(pet).to be_instance_of(Petstore::Pet) + expect(pet.name).to eq('Kitty') + + expect(obj.int_arr_map).to be_instance_of(Hash) + arr = obj.int_arr_map['int_arr'] + expect(arr).to match_array([123, 456]) + + expect(obj.pet_arr_map).to be_instance_of(Hash) + arr = obj.pet_arr_map['pet_arr'] + expect(arr).to be_instance_of(Array) + expect(arr.size).to eq(1) + pet = arr.first + expect(pet).to be_instance_of(Petstore::Pet) + expect(pet.name).to eq('Kitty') + + expect(obj.boolean_true_arr).to be_instance_of(Array) + obj.boolean_true_arr.each do |b| + expect(b).to eq(true) + end + + expect(obj.boolean_false_arr).to be_instance_of(Array) + obj.boolean_false_arr.each do |b| + expect(b).to eq(false) + end + end + + it 'works for #to_hash' do + obj.build_from_hash(data) + expect_data = data.dup + expect_data[:boolean_true_arr].map! {true} + expect_data[:boolean_false_arr].map! {false} + expect(obj.to_hash).to eq(expect_data) + end + end +end diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 58fad311c434..cdecd2e6cca9 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-10T14:06:27.504+08:00 +- Build date: 2016-05-10T14:47:49.265+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation diff --git a/samples/client/petstore/ruby/spec/api/fake_api_spec.rb b/samples/client/petstore/ruby/spec/api/fake_api_spec.rb index 84929b8115c2..a30c9d9c7a7d 100644 --- a/samples/client/petstore/ruby/spec/api/fake_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/fake_api_spec.rb @@ -32,13 +32,13 @@ describe 'FakeApi' do describe 'test an instance of FakeApi' do it 'should create an instact of FakeApi' do - @instance.should be_a(Petstore::FakeApi) + expect(@instance).to be_instance_of(Petstore::FakeApi) end end # unit tests for test_endpoint_parameters - # Fake endpoint for testing various parameters - # Fake endpoint for testing various parameters + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # @param number None # @param double None # @param string None @@ -55,11 +55,7 @@ describe 'FakeApi' do # @return [nil] describe 'test_endpoint_parameters test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/api/pet_api_spec.rb b/samples/client/petstore/ruby/spec/api/pet_api_spec.rb index e903362291b6..72a6e8209c59 100644 --- a/samples/client/petstore/ruby/spec/api/pet_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/pet_api_spec.rb @@ -32,7 +32,7 @@ describe 'PetApi' do describe 'test an instance of PetApi' do it 'should create an instact of PetApi' do - @instance.should be_a(Petstore::PetApi) + expect(@instance).to be_instance_of(Petstore::PetApi) end end @@ -44,11 +44,7 @@ describe 'PetApi' do # @return [nil] describe 'add_pet test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -61,11 +57,7 @@ describe 'PetApi' do # @return [nil] describe 'delete_pet test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -77,11 +69,7 @@ describe 'PetApi' do # @return [Array] describe 'find_pets_by_status test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -93,11 +81,7 @@ describe 'PetApi' do # @return [Array] describe 'find_pets_by_tags test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -109,11 +93,7 @@ describe 'PetApi' do # @return [Pet] describe 'get_pet_by_id test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -125,11 +105,7 @@ describe 'PetApi' do # @return [nil] describe 'update_pet test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -143,11 +119,7 @@ describe 'PetApi' do # @return [nil] describe 'update_pet_with_form test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -161,11 +133,7 @@ describe 'PetApi' do # @return [ApiResponse] describe 'upload_file test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/api/store_api_spec.rb b/samples/client/petstore/ruby/spec/api/store_api_spec.rb index 015d1d8e39d4..428c9c5f2821 100644 --- a/samples/client/petstore/ruby/spec/api/store_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/store_api_spec.rb @@ -32,7 +32,7 @@ describe 'StoreApi' do describe 'test an instance of StoreApi' do it 'should create an instact of StoreApi' do - @instance.should be_a(Petstore::StoreApi) + expect(@instance).to be_instance_of(Petstore::StoreApi) end end @@ -44,11 +44,7 @@ describe 'StoreApi' do # @return [nil] describe 'delete_order test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -59,27 +55,19 @@ describe 'StoreApi' do # @return [Hash] describe 'get_inventory test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for get_order_by_id # 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 order_id ID of pet that needs to be fetched # @param [Hash] opts the optional parameters # @return [Order] describe 'get_order_by_id test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -91,11 +79,7 @@ describe 'StoreApi' do # @return [Order] describe 'place_order test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/api/user_api_spec.rb b/samples/client/petstore/ruby/spec/api/user_api_spec.rb index 272980a6db02..37194b3c1580 100644 --- a/samples/client/petstore/ruby/spec/api/user_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/user_api_spec.rb @@ -32,7 +32,7 @@ describe 'UserApi' do describe 'test an instance of UserApi' do it 'should create an instact of UserApi' do - @instance.should be_a(Petstore::UserApi) + expect(@instance).to be_instance_of(Petstore::UserApi) end end @@ -44,11 +44,7 @@ describe 'UserApi' do # @return [nil] describe 'create_user test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -60,11 +56,7 @@ describe 'UserApi' do # @return [nil] describe 'create_users_with_array_input test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -76,11 +68,7 @@ describe 'UserApi' do # @return [nil] describe 'create_users_with_list_input test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -92,27 +80,19 @@ describe 'UserApi' do # @return [nil] describe 'delete_user test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for get_user_by_name # Get user by user name # - # @param username The name that needs to be fetched. Use user1 for testing. + # @param username The name that needs to be fetched. Use user1 for testing. # @param [Hash] opts the optional parameters # @return [User] describe 'get_user_by_name test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -125,11 +105,7 @@ describe 'UserApi' do # @return [String] describe 'login_user test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -140,11 +116,7 @@ describe 'UserApi' do # @return [nil] describe 'logout_user test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end @@ -157,11 +129,7 @@ describe 'UserApi' do # @return [nil] describe 'update_user test' do it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/base_object_spec.rb b/samples/client/petstore/ruby/spec/base_object_spec.rb index a315d52276b7..5b84351f7b8a 100644 --- a/samples/client/petstore/ruby/spec/base_object_spec.rb +++ b/samples/client/petstore/ruby/spec/base_object_spec.rb @@ -35,8 +35,8 @@ describe 'BaseObject' do let(:obj) { Petstore::Cat.new({declawed: false}) } it 'should have values set' do - obj.declawed.should_not eq nil - obj.declawed.should eq false + expect(obj.declawed).not_to be_nil + expect(obj.declawed).to eq(false) end end @@ -58,42 +58,43 @@ describe 'BaseObject' do it 'works for #build_from_hash' do obj.build_from_hash(data) - obj.int_arr.should == [123, 456] + expect(obj.int_arr).to match_array([123, 456]) + + expect(obj.pet_arr).to be_instance_of(Array) + expect(obj.pet_arr.size).to eq(1) - obj.pet_arr.should be_a(Array) - obj.pet_arr.size.should == 1 pet = obj.pet_arr.first - pet.should be_a(Petstore::Pet) - pet.name.should == 'Kitty' + expect(pet).to be_instance_of(Petstore::Pet) + expect(pet.name).to eq('Kitty') - obj.int_map.should be_a(Hash) - obj.int_map.should == {'int' => 123} + expect(obj.int_map).to be_instance_of(Hash) + expect(obj.int_map).to eq({'int' => 123}) - obj.pet_map.should be_a(Hash) + expect(obj.pet_map).to be_instance_of(Hash) pet = obj.pet_map['pet'] - pet.should be_a(Petstore::Pet) - pet.name.should == 'Kitty' + expect(pet).to be_instance_of(Petstore::Pet) + expect(pet.name).to eq('Kitty') - obj.int_arr_map.should be_a(Hash) + expect(obj.int_arr_map).to be_instance_of(Hash) arr = obj.int_arr_map['int_arr'] - arr.should == [123, 456] + expect(arr).to match_array([123, 456]) - obj.pet_arr_map.should be_a(Hash) + expect(obj.pet_arr_map).to be_instance_of(Hash) arr = obj.pet_arr_map['pet_arr'] - arr.should be_a(Array) - arr.size.should == 1 + expect(arr).to be_instance_of(Array) + expect(arr.size).to eq(1) pet = arr.first - pet.should be_a(Petstore::Pet) - pet.name.should == 'Kitty' + expect(pet).to be_instance_of(Petstore::Pet) + expect(pet.name).to eq('Kitty') - obj.boolean_true_arr.should be_a(Array) + expect(obj.boolean_true_arr).to be_instance_of(Array) obj.boolean_true_arr.each do |b| - b.should eq true + expect(b).to eq(true) end - obj.boolean_false_arr.should be_a(Array) + expect(obj.boolean_false_arr).to be_instance_of(Array) obj.boolean_false_arr.each do |b| - b.should eq false + expect(b).to eq(false) end end @@ -102,7 +103,7 @@ describe 'BaseObject' do expect_data = data.dup expect_data[:boolean_true_arr].map! {true} expect_data[:boolean_false_arr].map! {false} - obj.to_hash.should == expect_data + expect(obj.to_hash).to eq(expect_data) end end end diff --git a/samples/client/petstore/ruby/spec/models/animal_spec.rb b/samples/client/petstore/ruby/spec/models/animal_spec.rb index e35b12411bee..3f98b0f7b846 100644 --- a/samples/client/petstore/ruby/spec/models/animal_spec.rb +++ b/samples/client/petstore/ruby/spec/models/animal_spec.rb @@ -33,16 +33,12 @@ describe 'Animal' do describe 'test an instance of Animal' do it 'should create an instact of Animal' do - @instance.should be_a(Petstore::Animal) + expect(@instance).to be_instance_of(Petstore::Animal) end end describe 'test attribute "class_name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/api_response_spec.rb b/samples/client/petstore/ruby/spec/models/api_response_spec.rb index 279d8cb0aa5e..67b0cbe1a03d 100644 --- a/samples/client/petstore/ruby/spec/models/api_response_spec.rb +++ b/samples/client/petstore/ruby/spec/models/api_response_spec.rb @@ -33,36 +33,24 @@ describe 'ApiResponse' do describe 'test an instance of ApiResponse' do it 'should create an instact of ApiResponse' do - @instance.should be_a(Petstore::ApiResponse) + expect(@instance).to be_instance_of(Petstore::ApiResponse) end end describe 'test attribute "code"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "type"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "message"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/cat_spec.rb b/samples/client/petstore/ruby/spec/models/cat_spec.rb index e9b20d57eb03..97ae668ea3b1 100644 --- a/samples/client/petstore/ruby/spec/models/cat_spec.rb +++ b/samples/client/petstore/ruby/spec/models/cat_spec.rb @@ -33,26 +33,18 @@ describe 'Cat' do describe 'test an instance of Cat' do it 'should create an instact of Cat' do - @instance.should be_a(Petstore::Cat) + expect(@instance).to be_instance_of(Petstore::Cat) end end describe 'test attribute "class_name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "declawed"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/category_spec.rb b/samples/client/petstore/ruby/spec/models/category_spec.rb index 0e7001053f7a..1481358afdc8 100644 --- a/samples/client/petstore/ruby/spec/models/category_spec.rb +++ b/samples/client/petstore/ruby/spec/models/category_spec.rb @@ -33,26 +33,18 @@ describe 'Category' do describe 'test an instance of Category' do it 'should create an instact of Category' do - @instance.should be_a(Petstore::Category) + expect(@instance).to be_instance_of(Petstore::Category) end end describe 'test attribute "id"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/dog_spec.rb b/samples/client/petstore/ruby/spec/models/dog_spec.rb index b319d72b80aa..e3eb4be12fcc 100644 --- a/samples/client/petstore/ruby/spec/models/dog_spec.rb +++ b/samples/client/petstore/ruby/spec/models/dog_spec.rb @@ -33,26 +33,18 @@ describe 'Dog' do describe 'test an instance of Dog' do it 'should create an instact of Dog' do - @instance.should be_a(Petstore::Dog) + expect(@instance).to be_instance_of(Petstore::Dog) end end - describe 'test attribute "breed"' do + describe 'test attribute "class_name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end - describe 'test attribute "class_name"' do + describe 'test attribute "breed"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/format_test_spec.rb b/samples/client/petstore/ruby/spec/models/format_test_spec.rb index 50b2980d17bf..e7a81fe537cd 100644 --- a/samples/client/petstore/ruby/spec/models/format_test_spec.rb +++ b/samples/client/petstore/ruby/spec/models/format_test_spec.rb @@ -33,136 +33,84 @@ describe 'FormatTest' do describe 'test an instance of FormatTest' do it 'should create an instact of FormatTest' do - @instance.should be_a(Petstore::FormatTest) + expect(@instance).to be_instance_of(Petstore::FormatTest) end end describe 'test attribute "integer"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "int32"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "int64"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "number"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "float"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "double"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "string"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "byte"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "binary"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "date"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "date_time"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "uuid"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "password"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb deleted file mode 100644 index 36a4da3baaa9..000000000000 --- a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb +++ /dev/null @@ -1,100 +0,0 @@ -=begin -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git - -License: Apache 2.0 -http://www.apache.org/licenses/LICENSE-2.0.html - -Terms of Service: http://swagger.io/terms/ - -=end - -require 'spec_helper' -require 'json' -require 'date' - -# Unit tests for Petstore::InlineResponse200 -# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) -# Please update as you see appropriate -describe 'InlineResponse200', pending: "Original spec does not have InlineResponse200 and we'll renable this after updating Petstore server" do - before do - # run before each test - @instance = Petstore::InlineResponse200.new - end - - after do - # run after each test - end - - describe 'test an instance of InlineResponse200' do - it 'should create an instact of InlineResponse200' do - @instance.should be_a(Petstore::InlineResponse200) - end - end - describe 'test attribute "tags"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - describe 'test attribute "id"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - describe 'test attribute "category"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - describe 'test attribute "status"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - describe 'test attribute "name"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - describe 'test attribute "photo_urls"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - -end - diff --git a/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb b/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb index 88045611d9ce..8b8879105d00 100644 --- a/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb @@ -33,16 +33,12 @@ describe 'Model200Response' do describe 'test an instance of Model200Response' do it 'should create an instact of Model200Response' do - @instance.should be_a(Petstore::Model200Response) + expect(@instance).to be_instance_of(Petstore::Model200Response) end end describe 'test attribute "name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/model_return_spec.rb b/samples/client/petstore/ruby/spec/models/model_return_spec.rb index 7b6f3a571c4a..5a80c97542b2 100644 --- a/samples/client/petstore/ruby/spec/models/model_return_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_return_spec.rb @@ -33,16 +33,12 @@ describe 'ModelReturn' do describe 'test an instance of ModelReturn' do it 'should create an instact of ModelReturn' do - @instance.should be_a(Petstore::ModelReturn) + expect(@instance).to be_instance_of(Petstore::ModelReturn) end end describe 'test attribute "_return"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/name_spec.rb b/samples/client/petstore/ruby/spec/models/name_spec.rb index e4942b173b9f..03a9c69ece11 100644 --- a/samples/client/petstore/ruby/spec/models/name_spec.rb +++ b/samples/client/petstore/ruby/spec/models/name_spec.rb @@ -33,36 +33,24 @@ describe 'Name' do describe 'test an instance of Name' do it 'should create an instact of Name' do - @instance.should be_a(Petstore::Name) + expect(@instance).to be_instance_of(Petstore::Name) end end describe 'test attribute "name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "snake_case"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "property"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/order_spec.rb b/samples/client/petstore/ruby/spec/models/order_spec.rb index 420cfea059cd..73bd5c082fda 100644 --- a/samples/client/petstore/ruby/spec/models/order_spec.rb +++ b/samples/client/petstore/ruby/spec/models/order_spec.rb @@ -33,66 +33,42 @@ describe 'Order' do describe 'test an instance of Order' do it 'should create an instact of Order' do - @instance.should be_a(Petstore::Order) + expect(@instance).to be_instance_of(Petstore::Order) end end describe 'test attribute "id"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "pet_id"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "quantity"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "ship_date"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "status"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "complete"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/pet_spec.rb b/samples/client/petstore/ruby/spec/models/pet_spec.rb index baf3cdf008dc..9911ced1366d 100644 --- a/samples/client/petstore/ruby/spec/models/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/models/pet_spec.rb @@ -25,84 +25,50 @@ describe 'Pet' do before do # run before each test @instance = Petstore::Pet.new - - @pet_api = Petstore::PetApi.new(API_CLIENT) - @pet_id = prepare_pet(@pet_api) end after do # run after each test - # remove the testing pet - begin - @pet_api.delete_pet(@pet_id) - rescue Petstore::ApiError => e - # ignore ApiError 404 (Not Found) - raise e if e.code != 404 - end end describe 'test an instance of Pet' do it 'should create an instact of Pet' do - @instance.should be_a(Petstore::Pet) + expect(@instance).to be_instance_of(Petstore::Pet) end end describe 'test attribute "id"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "category"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "photo_urls"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "tags"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "status"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb b/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb index aa32e3fc7b29..cd93568e8f98 100644 --- a/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb +++ b/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb @@ -33,16 +33,12 @@ describe 'SpecialModelName' do describe 'test an instance of SpecialModelName' do it 'should create an instact of SpecialModelName' do - @instance.should be_a(Petstore::SpecialModelName) + expect(@instance).to be_instance_of(Petstore::SpecialModelName) end end describe 'test attribute "special_property_name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/tag_spec.rb b/samples/client/petstore/ruby/spec/models/tag_spec.rb index 55778d8fd674..68b77e026b1f 100644 --- a/samples/client/petstore/ruby/spec/models/tag_spec.rb +++ b/samples/client/petstore/ruby/spec/models/tag_spec.rb @@ -33,26 +33,18 @@ describe 'Tag' do describe 'test an instance of Tag' do it 'should create an instact of Tag' do - @instance.should be_a(Petstore::Tag) + expect(@instance).to be_instance_of(Petstore::Tag) end end describe 'test attribute "id"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/models/user_spec.rb b/samples/client/petstore/ruby/spec/models/user_spec.rb index a6b872e834cf..fc510605b5c0 100644 --- a/samples/client/petstore/ruby/spec/models/user_spec.rb +++ b/samples/client/petstore/ruby/spec/models/user_spec.rb @@ -33,86 +33,54 @@ describe 'User' do describe 'test an instance of User' do it 'should create an instact of User' do - @instance.should be_a(Petstore::User) + expect(@instance).to be_instance_of(Petstore::User) end end describe 'test attribute "id"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "username"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "first_name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "last_name"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "email"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "password"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "phone"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "user_status"' do it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end diff --git a/samples/client/petstore/ruby/spec/pet_spec.rb b/samples/client/petstore/ruby/spec/pet_spec.rb index b05b21633531..737eee56d078 100644 --- a/samples/client/petstore/ruby/spec/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/pet_spec.rb @@ -1,16 +1,6 @@ require 'spec_helper' require 'json' -def serialize_json(o) - API_CLIENT.object_to_http_body(o) -end - -def deserialize_json(s, type) - headers = {'Content-Type' => 'application/json'} - response = double('response', headers: headers, body: s) - API_CLIENT.deserialize(response, type) -end - describe "Pet" do before do @pet_api = Petstore::PetApi.new(API_CLIENT) diff --git a/samples/client/petstore/ruby/spec/spec.opts b/samples/client/petstore/ruby/spec/spec.opts deleted file mode 100644 index 391705bf8b0e..000000000000 --- a/samples/client/petstore/ruby/spec/spec.opts +++ /dev/null @@ -1,4 +0,0 @@ ---colour ---format progress ---loadby mtime ---reverse diff --git a/samples/client/petstore/ruby/spec/spec_helper.rb b/samples/client/petstore/ruby/spec/spec_helper.rb index 0bba600ba45b..11794c9ebcfe 100644 --- a/samples/client/petstore/ruby/spec/spec_helper.rb +++ b/samples/client/petstore/ruby/spec/spec_helper.rb @@ -1,4 +1,7 @@ -# This file was generated by the `rspec --init` command. Conventionally, all +# load the gem +require 'petstore' + +# The following was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require it in any @@ -95,5 +98,50 @@ RSpec.configure do |config| =end end -require 'SwaggerClient' +# API client (shared between all the test cases) +API_CLIENT = Petstore::ApiClient.new(Petstore::Configuration.new) +# randomly generate an ID +def random_id + rand(1000000) + 20000 +end + +# create a random pet, return its id +def prepare_pet(pet_api) + pet_id = random_id + category = Petstore::Category.new('id' => 20002, 'name' => 'category test') + tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test') + pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url', + 'category' => category, 'tags' => [tag], 'status' => 'pending') + pet_api.add_pet(pet) + return pet_id +end + +# create a random order, return its id +def prepare_store(store_api) + order_id = 5 + order = Petstore::Order.new("id" => order_id, + "petId" => 123, + "quantity" => 789, + "shipDate" => "2015-04-06T23:42:01.678Z", + "status" => "placed", + "complete" => false) + store_api.place_order(order) + return order_id +end + +# A random string to tack onto stuff to ensure we're not seeing +# data from a previous test run +RAND = ("a".."z").to_a.sample(8).join + +# helper method to serialize object to json string +def serialize_json(o) + API_CLIENT.object_to_http_body(o) +end + +# helper method to deserialize json string back to object +def deserialize_json(s, type) + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: s) + API_CLIENT.deserialize(response, type) +end From 1b36083afd704891ae4e1984d6b14216260c9dad Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 17:40:21 +0800 Subject: [PATCH 161/170] fix #2795 --- .../resources/csharp/modelGeneric.mustache | 2 +- ...ith-fake-endpoints-models-for-testing.yaml | 3 +++ .../csharp/SwaggerClient/IO.Swagger.sln | 10 +++---- .../petstore/csharp/SwaggerClient/README.md | 6 ++--- .../csharp/SwaggerClient/docs/Animal.md | 1 + .../petstore/csharp/SwaggerClient/docs/Cat.md | 1 + .../petstore/csharp/SwaggerClient/docs/Dog.md | 1 + .../csharp/SwaggerClient/docs/FakeApi.md | 8 +++--- .../csharp/SwaggerClient/docs/Name.md | 1 + .../IO.Swagger.Test/IO.Swagger.Test.csproj | 2 +- .../src/IO.Swagger/Api/FakeApi.cs | 24 ++++++++--------- .../src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/Model/Animal.cs | 26 ++++++++++++++++++- .../SwaggerClient/src/IO.Swagger/Model/Cat.cs | 26 ++++++++++++++++++- .../SwaggerClient/src/IO.Swagger/Model/Dog.cs | 26 ++++++++++++++++++- .../src/IO.Swagger/Model/Name.cs | 13 ++++++++++ 16 files changed, 122 insertions(+), 30 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index 6c5da5e4f56b..4d4061a29fd4 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -32,7 +32,7 @@ /// {{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}. {{/isReadOnly}} {{/vars}} - public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{#hasMore}}, {{/hasMore}}{{/isReadOnly}}{{/vars}}) + public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}}) { {{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null) if ({{name}} == null) diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 54f061483ad3..526738a2efe9 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -818,6 +818,9 @@ definitions: format: int32 property: type: string + 123Number: + type: integer + readOnly: true xml: name: Name 200_response: diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 72e6e04d1211..3c26ad6be492 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{AC0D0300-7030-473F-B672-17C40187815A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{AC0D0300-7030-473F-B672-17C40187815A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{AC0D0300-7030-473F-B672-17C40187815A}.Debug|Any CPU.Build.0 = Debug|Any CPU -{AC0D0300-7030-473F-B672-17C40187815A}.Release|Any CPU.ActiveCfg = Release|Any CPU -{AC0D0300-7030-473F-B672-17C40187815A}.Release|Any CPU.Build.0 = Release|Any CPU +{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}.Debug|Any CPU.Build.0 = Debug|Any CPU +{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}.Release|Any CPU.ActiveCfg = Release|Any CPU +{C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index 1f7e9f634e03..c546b834c182 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-05-07T17:39:09.181+08:00 +- Build date: 2016-05-10T17:39:13.582+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -69,7 +69,7 @@ namespace Example try { - // Fake endpoint for testing various parameters + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } catch (Exception e) @@ -87,7 +87,7 @@ 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 +*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* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md b/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md index 46eb96c05f42..f461176159c7 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Animal.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/Cat.md b/samples/client/petstore/csharp/SwaggerClient/docs/Cat.md index e0034d4ab5d0..a88425f4307c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Cat.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Cat.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool?** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/Dog.md b/samples/client/petstore/csharp/SwaggerClient/docs/Dog.md index 0acf4182d942..c3ee6d927b42 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Dog.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Dog.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md index ae9fd8c3d36d..65b04a12ccb0 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md @@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters +[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # **TestEndpointParameters** > void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) -Fake endpoint for testing various parameters +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example ```csharp @@ -45,7 +45,7 @@ namespace Example try { - // Fake endpoint for testing various parameters + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } catch (Exception e) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/Name.md b/samples/client/petstore/csharp/SwaggerClient/docs/Name.md index 6cb961b6fcf9..678132c8e4e8 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/Name.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Name.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes **_Name** | **int?** | | **SnakeCase** | **int?** | | [optional] **Property** | **string** | | [optional] +**_123Number** | **int?** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index de3b57cfe78f..743b0b978532 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -65,7 +65,7 @@ - {AC0D0300-7030-473F-B672-17C40187815A} + {C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index 1c92dc3bbda7..8b9fe2e52c87 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -14,10 +14,10 @@ namespace IO.Swagger.Api { #region Synchronous Operations /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -36,10 +36,10 @@ namespace IO.Swagger.Api void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -59,10 +59,10 @@ namespace IO.Swagger.Api #endregion Synchronous Operations #region Asynchronous Operations /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -81,10 +81,10 @@ namespace IO.Swagger.Api System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// - /// Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -192,7 +192,7 @@ namespace IO.Swagger.Api } /// - /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -214,7 +214,7 @@ namespace IO.Swagger.Api } /// - /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -303,7 +303,7 @@ namespace IO.Swagger.Api } /// - /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None @@ -326,7 +326,7 @@ namespace IO.Swagger.Api } /// - /// Fake endpoint for testing various parameters Fake endpoint for testing various parameters + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Thrown when fails to make API call /// None diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 5d9a64329c1e..ad86456eceaa 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {AC0D0300-7030-473F-B672-17C40187815A} + {C075FB79-0DDE-43E3-9FA5-E239EE9B9B5A} Library Properties Swagger Library diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs index f5b9a3efee0f..87a17aa4fae4 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs @@ -21,7 +21,8 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// /// ClassName (required). - public Animal(string ClassName = null) + /// Color (default to "red"). + public Animal(string ClassName = null, string Color = null) { // to ensure "ClassName" is required (not null) if (ClassName == null) @@ -34,6 +35,16 @@ namespace IO.Swagger.Model } + // use default value if no "Color" provided + if (Color == null) + { + this.Color = "red"; + } + else + { + this.Color = Color; + } + } /// @@ -42,6 +53,11 @@ namespace IO.Swagger.Model [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } /// + /// Gets or Sets Color + /// + [DataMember(Name="color", EmitDefaultValue=false)] + public string Color { get; set; } + /// /// Returns the string presentation of the object /// /// String presentation of the object @@ -50,6 +66,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Animal {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); +sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -90,6 +107,11 @@ namespace IO.Swagger.Model this.ClassName == other.ClassName || this.ClassName != null && this.ClassName.Equals(other.ClassName) + ) && + ( + this.Color == other.Color || + this.Color != null && + this.Color.Equals(other.Color) ); } @@ -106,6 +128,8 @@ namespace IO.Swagger.Model // Suitable nullity checks etc, of course :) if (this.ClassName != null) hash = hash * 59 + this.ClassName.GetHashCode(); + if (this.Color != null) + hash = hash * 59 + this.Color.GetHashCode(); return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs index 74bd81aee05f..fee880c5d823 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs @@ -21,8 +21,9 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// /// ClassName (required). + /// Color (default to "red"). /// Declawed. - public Cat(string ClassName = null, bool? Declawed = null) + public Cat(string ClassName = null, string Color = null, bool? Declawed = null) { // to ensure "ClassName" is required (not null) if (ClassName == null) @@ -35,6 +36,16 @@ namespace IO.Swagger.Model } + // use default value if no "Color" provided + if (Color == null) + { + this.Color = "red"; + } + else + { + this.Color = Color; + } + this.Declawed = Declawed; } @@ -45,6 +56,11 @@ namespace IO.Swagger.Model [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } /// + /// Gets or Sets Color + /// + [DataMember(Name="color", EmitDefaultValue=false)] + public string Color { get; set; } + /// /// Gets or Sets Declawed /// [DataMember(Name="declawed", EmitDefaultValue=false)] @@ -58,6 +74,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Cat {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); +sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -100,6 +117,11 @@ sb.Append(" Declawed: ").Append(Declawed).Append("\n"); this.ClassName != null && this.ClassName.Equals(other.ClassName) ) && + ( + this.Color == other.Color || + this.Color != null && + this.Color.Equals(other.Color) + ) && ( this.Declawed == other.Declawed || this.Declawed != null && @@ -120,6 +142,8 @@ sb.Append(" Declawed: ").Append(Declawed).Append("\n"); // Suitable nullity checks etc, of course :) if (this.ClassName != null) hash = hash * 59 + this.ClassName.GetHashCode(); + if (this.Color != null) + hash = hash * 59 + this.Color.GetHashCode(); if (this.Declawed != null) hash = hash * 59 + this.Declawed.GetHashCode(); return hash; diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs index 6ab8c9ad69f1..fb65e3e0c99e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs @@ -21,8 +21,9 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// /// ClassName (required). + /// Color (default to "red"). /// Breed. - public Dog(string ClassName = null, string Breed = null) + public Dog(string ClassName = null, string Color = null, string Breed = null) { // to ensure "ClassName" is required (not null) if (ClassName == null) @@ -35,6 +36,16 @@ namespace IO.Swagger.Model } + // use default value if no "Color" provided + if (Color == null) + { + this.Color = "red"; + } + else + { + this.Color = Color; + } + this.Breed = Breed; } @@ -45,6 +56,11 @@ namespace IO.Swagger.Model [DataMember(Name="className", EmitDefaultValue=false)] public string ClassName { get; set; } /// + /// Gets or Sets Color + /// + [DataMember(Name="color", EmitDefaultValue=false)] + public string Color { get; set; } + /// /// Gets or Sets Breed /// [DataMember(Name="breed", EmitDefaultValue=false)] @@ -58,6 +74,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Dog {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); +sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -100,6 +117,11 @@ sb.Append(" Breed: ").Append(Breed).Append("\n"); this.ClassName != null && this.ClassName.Equals(other.ClassName) ) && + ( + this.Color == other.Color || + this.Color != null && + this.Color.Equals(other.Color) + ) && ( this.Breed == other.Breed || this.Breed != null && @@ -120,6 +142,8 @@ sb.Append(" Breed: ").Append(Breed).Append("\n"); // Suitable nullity checks etc, of course :) if (this.ClassName != null) hash = hash * 59 + this.ClassName.GetHashCode(); + if (this.Color != null) + hash = hash * 59 + this.Color.GetHashCode(); if (this.Breed != null) hash = hash * 59 + this.Breed.GetHashCode(); return hash; diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs index b0e819fec201..25273ffb97ba 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs @@ -55,6 +55,11 @@ namespace IO.Swagger.Model [DataMember(Name="property", EmitDefaultValue=false)] public string Property { get; set; } /// + /// Gets or Sets _123Number + /// + [DataMember(Name="123Number", EmitDefaultValue=false)] + public int? _123Number { get; private set; } + /// /// Returns the string presentation of the object /// /// String presentation of the object @@ -65,6 +70,7 @@ namespace IO.Swagger.Model sb.Append(" _Name: ").Append(_Name).Append("\n"); sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); sb.Append(" Property: ").Append(Property).Append("\n"); +sb.Append(" _123Number: ").Append(_123Number).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -115,6 +121,11 @@ sb.Append(" Property: ").Append(Property).Append("\n"); this.Property == other.Property || this.Property != null && this.Property.Equals(other.Property) + ) && + ( + this._123Number == other._123Number || + this._123Number != null && + this._123Number.Equals(other._123Number) ); } @@ -135,6 +146,8 @@ sb.Append(" Property: ").Append(Property).Append("\n"); hash = hash * 59 + this.SnakeCase.GetHashCode(); if (this.Property != null) hash = hash * 59 + this.Property.GetHashCode(); + if (this._123Number != null) + hash = hash * 59 + this._123Number.GetHashCode(); return hash; } } From cd6f5877ac7ebb08624bf5bac877ed704ac8666c Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 18:01:17 +0800 Subject: [PATCH 162/170] add bin/typescript-fetch-petstore-all.sh --- .gitignore | 10 + bin/typescript-fetch-petstore-all.sh | 5 + .../typescript-fetch/default-es6/README.md | 44 + .../typescript-fetch/default-es6/api.ts | 855 ++++++++++++++++++ .../typescript-fetch/default-es6/assign.ts | 18 + .../typescript-fetch/default-es6/git_push.sh | 52 ++ .../typescript-fetch/default-es6/package.json | 18 + .../default-es6/tsconfig.json | 16 + .../typescript-fetch/default-es6/typings.json | 8 + .../typescript-fetch/default/README.md | 44 + .../petstore/typescript-fetch/default/api.ts | 855 ++++++++++++++++++ .../typescript-fetch/default/assign.ts | 18 + .../typescript-fetch/default/git_push.sh | 52 ++ .../typescript-fetch/default/package.json | 18 + .../typescript-fetch/default/tsconfig.json | 16 + .../typescript-fetch/default/typings.json | 9 + .../with-package-metadata/README.md | 44 + .../with-package-metadata/api.ts | 855 ++++++++++++++++++ .../with-package-metadata/assign.ts | 18 + .../with-package-metadata/git_push.sh | 52 ++ .../with-package-metadata/package.json | 18 + .../with-package-metadata/tsconfig.json | 16 + .../with-package-metadata/typings.json | 9 + 23 files changed, 3050 insertions(+) create mode 100755 bin/typescript-fetch-petstore-all.sh create mode 100644 samples/client/petstore/typescript-fetch/default-es6/README.md create mode 100644 samples/client/petstore/typescript-fetch/default-es6/api.ts create mode 100644 samples/client/petstore/typescript-fetch/default-es6/assign.ts create mode 100644 samples/client/petstore/typescript-fetch/default-es6/git_push.sh create mode 100644 samples/client/petstore/typescript-fetch/default-es6/package.json create mode 100644 samples/client/petstore/typescript-fetch/default-es6/tsconfig.json create mode 100644 samples/client/petstore/typescript-fetch/default-es6/typings.json create mode 100644 samples/client/petstore/typescript-fetch/default/README.md create mode 100644 samples/client/petstore/typescript-fetch/default/api.ts create mode 100644 samples/client/petstore/typescript-fetch/default/assign.ts create mode 100644 samples/client/petstore/typescript-fetch/default/git_push.sh create mode 100644 samples/client/petstore/typescript-fetch/default/package.json create mode 100644 samples/client/petstore/typescript-fetch/default/tsconfig.json create mode 100644 samples/client/petstore/typescript-fetch/default/typings.json create mode 100644 samples/client/petstore/typescript-fetch/with-package-metadata/README.md create mode 100644 samples/client/petstore/typescript-fetch/with-package-metadata/api.ts create mode 100644 samples/client/petstore/typescript-fetch/with-package-metadata/assign.ts create mode 100644 samples/client/petstore/typescript-fetch/with-package-metadata/git_push.sh create mode 100644 samples/client/petstore/typescript-fetch/with-package-metadata/package.json create mode 100644 samples/client/petstore/typescript-fetch/with-package-metadata/tsconfig.json create mode 100644 samples/client/petstore/typescript-fetch/with-package-metadata/typings.json diff --git a/.gitignore b/.gitignore index 3c008800db13..2e1d1355309d 100644 --- a/.gitignore +++ b/.gitignore @@ -116,3 +116,13 @@ samples/client/petstore/python/.venv/ # ts samples/client/petstore/typescript-node/npm/node_modules +samples/client/petstore/typescript-fetch/with-package-metadata/node_modules +samples/client/petstore/typescript-fetch/with-package-metadata/dist +samples/client/petstore/typescript-fetch/with-package-metadata/typings +samples/client/petstore/typescript-fetch/default/node_modules +samples/client/petstore/typescript-fetch/default/dist +samples/client/petstore/typescript-fetch/default/typings +samples/client/petstore/typescript-fetch/default-es6/node_modules +samples/client/petstore/typescript-fetch/default-es6/dist +samples/client/petstore/typescript-fetch/default-es6/typings + diff --git a/bin/typescript-fetch-petstore-all.sh b/bin/typescript-fetch-petstore-all.sh new file mode 100755 index 000000000000..d39c16d88030 --- /dev/null +++ b/bin/typescript-fetch-petstore-all.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +./bin/typescript-fetch-petstore-target-es6.sh +./bin/typescript-fetch-petstore-target-with-package-metadata.sh +./bin/typescript-fetch-petstore.sh diff --git a/samples/client/petstore/typescript-fetch/default-es6/README.md b/samples/client/petstore/typescript-fetch/default-es6/README.md new file mode 100644 index 000000000000..8ec43e764975 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default-es6/README.md @@ -0,0 +1,44 @@ +# TypeScript-Fetch + +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The codegen Node module can be used in the following environments: + +* Node.JS +* Webpack +* Browserify + +It is usable in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `typings` in `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Installation ### + +`swagger-codegen` does not generate JavaScript directly. The codegen Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile. The self-compile is normally run automatically via the `npm` `postinstall` script of `npm install`. + +CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` may skip `postinstall` script if the user is `root`. You would need to manually invoke `npm install` or `npm run postinstall` for the codegen module if that's the case. + +#### NPM repository ### +If you remove `"private": true` from `package.json`, you may publish the module to NPM. In which case, you would be able to install the module as any other NPM module. + +It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). + +#### NPM install local file ### +You should be able to directly install the module using `npm install file:///codegen_path`. + +NOTES: If you do `npm install file:///codegen_path --save` NPM might convert your path to relative path, maybe have adverse affect. `npm install` and `npm shrinkwrap` may misbehave if the installation path is not absolute. + +#### direct copy/symlink ### +You may also simply copy or symlink the codegen into a directly under your project. The syntax of the usage would differ if you take this route. (See below) + +### Usage ### +With ES6 module syntax, the following syntaxes are supported: +``` +import * as localName from 'npmName'; +import {operationId} from 'npmName'; + +import * as localName from './symlinkDir'; +import {operationId} from './symlinkDir'; +``` +With CommonJS, the following syntaxes are supported: +``` +import localName = require('npmName'); + +import localName = require('./symlinkDir')'; +``` \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/default-es6/api.ts b/samples/client/petstore/typescript-fetch/default-es6/api.ts new file mode 100644 index 000000000000..3d075fc28093 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default-es6/api.ts @@ -0,0 +1,855 @@ +import * as querystring from 'querystring'; +import * as fetch from 'isomorphic-fetch'; +import {assign} from './assign'; + + +export interface Category { + "id"?: number; + "name"?: string; +} + +export interface Order { + "id"?: number; + "petId"?: number; + "quantity"?: number; + "shipDate"?: Date; + + /** + * Order Status + */ + "status"?: Order.StatusEnum; + "complete"?: boolean; +} + +export namespace Order { + +export type StatusEnum = 'placed' | 'approved' | 'delivered'; +} +export interface Pet { + "id"?: number; + "category"?: Category; + "name": string; + "photoUrls": Array; + "tags"?: Array; + + /** + * pet status in the store + */ + "status"?: Pet.StatusEnum; +} + +export namespace Pet { + +export type StatusEnum = 'available' | 'pending' | 'sold'; +} +export interface Tag { + "id"?: number; + "name"?: string; +} + +export interface User { + "id"?: number; + "username"?: string; + "firstName"?: string; + "lastName"?: string; + "email"?: string; + "password"?: string; + "phone"?: string; + + /** + * User Status + */ + "userStatus"?: number; +} + + +//export namespace { + 'use strict'; + + export class PetApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + */ + public addPet (params: { body?: Pet; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet (params: { petId: number; apiKey?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling deletePet'); + } + headerParams['api_key'] = params.apiKey; + + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus (params: { status?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise> { + const localVarPath = this.basePath + '/pet/findByStatus'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.status !== undefined) { + queryParameters['status'] = params.status; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Finds Pets by tags + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + */ + public findPetsByTags (params: { tags?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise> { + const localVarPath = this.basePath + '/pet/findByTags'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.tags !== undefined) { + queryParameters['tags'] = params.tags; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * 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 + */ + public getPetById (params: { petId: number; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling getPetById'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + */ + public updatePet (params: { body?: Pet; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'PUT', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithForm (params: { petId: string; name?: string; status?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling updatePetWithForm'); + } + formParams['name'] = params.name; + + formParams['status'] = params.status; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: querystring.stringify(formParams), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile (params: { petId: number; additionalMetadata?: string; file?: any; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling uploadFile'); + } + formParams['additionalMetadata'] = params.additionalMetadata; + + formParams['file'] = params.file; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: querystring.stringify(formParams), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} +//export namespace { + 'use strict'; + + export class StoreApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder (params: { orderId: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(params.orderId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'orderId' is set + if (params.orderId == null) { + throw new Error('Missing required parameter orderId when calling deleteOrder'); + } + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + public getInventory (params: { }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{ [key: string]: number; }> { + const localVarPath = this.basePath + '/store/inventory'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Find purchase order by ID + * 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 + */ + public getOrderById (params: { orderId: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(params.orderId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'orderId' is set + if (params.orderId == null) { + throw new Error('Missing required parameter orderId when calling getOrderById'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + */ + public placeOrder (params: { body?: Order; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/store/order'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} +//export namespace { + 'use strict'; + + export class UserApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + */ + public createUser (params: { body?: User; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithArrayInput (params: { body?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/createWithArray'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithListInput (params: { body?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/createWithList'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + */ + public deleteUser (params: { username: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling deleteUser'); + } + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (params: { username: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling getUserByName'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser (params: { username?: string; password?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/user/login'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.username !== undefined) { + queryParameters['username'] = params.username; + } + + if (params.password !== undefined) { + queryParameters['password'] = params.password; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Logs out current logged in user session + * + */ + public logoutUser (params: { }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/logout'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param body Updated user object + */ + public updateUser (params: { username: string; body?: User; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling updateUser'); + } + let fetchParams = { + method: 'PUT', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} diff --git a/samples/client/petstore/typescript-fetch/default-es6/assign.ts b/samples/client/petstore/typescript-fetch/default-es6/assign.ts new file mode 100644 index 000000000000..233551441479 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default-es6/assign.ts @@ -0,0 +1,18 @@ +export function assign (target: any, ...args: any[]) { + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + for (let source of args) { + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; +}; \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/default-es6/git_push.sh b/samples/client/petstore/typescript-fetch/default-es6/git_push.sh new file mode 100644 index 000000000000..ed374619b139 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default-es6/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/typescript-fetch/default-es6/package.json b/samples/client/petstore/typescript-fetch/default-es6/package.json new file mode 100644 index 000000000000..84cf629d9311 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default-es6/package.json @@ -0,0 +1,18 @@ +{ + "name": "typescript-fetch-api", + "version": "0.0.0", + "private": true, + "main": "./dist/api.js", + "browser": "./dist/api.js", + "typings": "./dist/api.d.ts", + "dependencies": { + "isomorphic-fetch": "^2.2.1" + }, + "scripts" : { + "install" : "typings install && tsc" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/default-es6/tsconfig.json b/samples/client/petstore/typescript-fetch/default-es6/tsconfig.json new file mode 100644 index 000000000000..9d5f166e764d --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default-es6/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "es6", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist" + }, + "exclude": [ + "dist", + "node_modules", + "typings/browser", + "typings/main", + "typings/main.d.ts" + ] +} diff --git a/samples/client/petstore/typescript-fetch/default-es6/typings.json b/samples/client/petstore/typescript-fetch/default-es6/typings.json new file mode 100644 index 000000000000..3ce24427fc6a --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default-es6/typings.json @@ -0,0 +1,8 @@ +{ + "version": false, + "dependencies": {}, + "ambientDependencies": { + "node": "registry:dt/node#4.0.0+20160423143914", + "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" + } +} diff --git a/samples/client/petstore/typescript-fetch/default/README.md b/samples/client/petstore/typescript-fetch/default/README.md new file mode 100644 index 000000000000..8ec43e764975 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default/README.md @@ -0,0 +1,44 @@ +# TypeScript-Fetch + +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The codegen Node module can be used in the following environments: + +* Node.JS +* Webpack +* Browserify + +It is usable in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `typings` in `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Installation ### + +`swagger-codegen` does not generate JavaScript directly. The codegen Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile. The self-compile is normally run automatically via the `npm` `postinstall` script of `npm install`. + +CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` may skip `postinstall` script if the user is `root`. You would need to manually invoke `npm install` or `npm run postinstall` for the codegen module if that's the case. + +#### NPM repository ### +If you remove `"private": true` from `package.json`, you may publish the module to NPM. In which case, you would be able to install the module as any other NPM module. + +It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). + +#### NPM install local file ### +You should be able to directly install the module using `npm install file:///codegen_path`. + +NOTES: If you do `npm install file:///codegen_path --save` NPM might convert your path to relative path, maybe have adverse affect. `npm install` and `npm shrinkwrap` may misbehave if the installation path is not absolute. + +#### direct copy/symlink ### +You may also simply copy or symlink the codegen into a directly under your project. The syntax of the usage would differ if you take this route. (See below) + +### Usage ### +With ES6 module syntax, the following syntaxes are supported: +``` +import * as localName from 'npmName'; +import {operationId} from 'npmName'; + +import * as localName from './symlinkDir'; +import {operationId} from './symlinkDir'; +``` +With CommonJS, the following syntaxes are supported: +``` +import localName = require('npmName'); + +import localName = require('./symlinkDir')'; +``` \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/default/api.ts b/samples/client/petstore/typescript-fetch/default/api.ts new file mode 100644 index 000000000000..3d075fc28093 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default/api.ts @@ -0,0 +1,855 @@ +import * as querystring from 'querystring'; +import * as fetch from 'isomorphic-fetch'; +import {assign} from './assign'; + + +export interface Category { + "id"?: number; + "name"?: string; +} + +export interface Order { + "id"?: number; + "petId"?: number; + "quantity"?: number; + "shipDate"?: Date; + + /** + * Order Status + */ + "status"?: Order.StatusEnum; + "complete"?: boolean; +} + +export namespace Order { + +export type StatusEnum = 'placed' | 'approved' | 'delivered'; +} +export interface Pet { + "id"?: number; + "category"?: Category; + "name": string; + "photoUrls": Array; + "tags"?: Array; + + /** + * pet status in the store + */ + "status"?: Pet.StatusEnum; +} + +export namespace Pet { + +export type StatusEnum = 'available' | 'pending' | 'sold'; +} +export interface Tag { + "id"?: number; + "name"?: string; +} + +export interface User { + "id"?: number; + "username"?: string; + "firstName"?: string; + "lastName"?: string; + "email"?: string; + "password"?: string; + "phone"?: string; + + /** + * User Status + */ + "userStatus"?: number; +} + + +//export namespace { + 'use strict'; + + export class PetApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + */ + public addPet (params: { body?: Pet; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet (params: { petId: number; apiKey?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling deletePet'); + } + headerParams['api_key'] = params.apiKey; + + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus (params: { status?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise> { + const localVarPath = this.basePath + '/pet/findByStatus'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.status !== undefined) { + queryParameters['status'] = params.status; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Finds Pets by tags + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + */ + public findPetsByTags (params: { tags?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise> { + const localVarPath = this.basePath + '/pet/findByTags'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.tags !== undefined) { + queryParameters['tags'] = params.tags; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * 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 + */ + public getPetById (params: { petId: number; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling getPetById'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + */ + public updatePet (params: { body?: Pet; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'PUT', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithForm (params: { petId: string; name?: string; status?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling updatePetWithForm'); + } + formParams['name'] = params.name; + + formParams['status'] = params.status; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: querystring.stringify(formParams), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile (params: { petId: number; additionalMetadata?: string; file?: any; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling uploadFile'); + } + formParams['additionalMetadata'] = params.additionalMetadata; + + formParams['file'] = params.file; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: querystring.stringify(formParams), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} +//export namespace { + 'use strict'; + + export class StoreApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder (params: { orderId: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(params.orderId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'orderId' is set + if (params.orderId == null) { + throw new Error('Missing required parameter orderId when calling deleteOrder'); + } + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + public getInventory (params: { }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{ [key: string]: number; }> { + const localVarPath = this.basePath + '/store/inventory'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Find purchase order by ID + * 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 + */ + public getOrderById (params: { orderId: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(params.orderId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'orderId' is set + if (params.orderId == null) { + throw new Error('Missing required parameter orderId when calling getOrderById'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + */ + public placeOrder (params: { body?: Order; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/store/order'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} +//export namespace { + 'use strict'; + + export class UserApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + */ + public createUser (params: { body?: User; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithArrayInput (params: { body?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/createWithArray'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithListInput (params: { body?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/createWithList'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + */ + public deleteUser (params: { username: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling deleteUser'); + } + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (params: { username: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling getUserByName'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser (params: { username?: string; password?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/user/login'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.username !== undefined) { + queryParameters['username'] = params.username; + } + + if (params.password !== undefined) { + queryParameters['password'] = params.password; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Logs out current logged in user session + * + */ + public logoutUser (params: { }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/logout'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param body Updated user object + */ + public updateUser (params: { username: string; body?: User; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling updateUser'); + } + let fetchParams = { + method: 'PUT', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} diff --git a/samples/client/petstore/typescript-fetch/default/assign.ts b/samples/client/petstore/typescript-fetch/default/assign.ts new file mode 100644 index 000000000000..233551441479 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default/assign.ts @@ -0,0 +1,18 @@ +export function assign (target: any, ...args: any[]) { + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + for (let source of args) { + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; +}; \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/default/git_push.sh b/samples/client/petstore/typescript-fetch/default/git_push.sh new file mode 100644 index 000000000000..ed374619b139 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/typescript-fetch/default/package.json b/samples/client/petstore/typescript-fetch/default/package.json new file mode 100644 index 000000000000..84cf629d9311 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default/package.json @@ -0,0 +1,18 @@ +{ + "name": "typescript-fetch-api", + "version": "0.0.0", + "private": true, + "main": "./dist/api.js", + "browser": "./dist/api.js", + "typings": "./dist/api.d.ts", + "dependencies": { + "isomorphic-fetch": "^2.2.1" + }, + "scripts" : { + "install" : "typings install && tsc" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/default/tsconfig.json b/samples/client/petstore/typescript-fetch/default/tsconfig.json new file mode 100644 index 000000000000..18db23e2f5f1 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist" + }, + "exclude": [ + "dist", + "node_modules", + "typings/browser", + "typings/main", + "typings/main.d.ts" + ] +} diff --git a/samples/client/petstore/typescript-fetch/default/typings.json b/samples/client/petstore/typescript-fetch/default/typings.json new file mode 100644 index 000000000000..eeca5afde97d --- /dev/null +++ b/samples/client/petstore/typescript-fetch/default/typings.json @@ -0,0 +1,9 @@ +{ + "version": false, + "dependencies": {}, + "ambientDependencies": { + "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", + "node": "registry:dt/node#4.0.0+20160423143914", + "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" + } +} diff --git a/samples/client/petstore/typescript-fetch/with-package-metadata/README.md b/samples/client/petstore/typescript-fetch/with-package-metadata/README.md new file mode 100644 index 000000000000..8ec43e764975 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/with-package-metadata/README.md @@ -0,0 +1,44 @@ +# TypeScript-Fetch + +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The codegen Node module can be used in the following environments: + +* Node.JS +* Webpack +* Browserify + +It is usable in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `typings` in `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Installation ### + +`swagger-codegen` does not generate JavaScript directly. The codegen Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile. The self-compile is normally run automatically via the `npm` `postinstall` script of `npm install`. + +CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` may skip `postinstall` script if the user is `root`. You would need to manually invoke `npm install` or `npm run postinstall` for the codegen module if that's the case. + +#### NPM repository ### +If you remove `"private": true` from `package.json`, you may publish the module to NPM. In which case, you would be able to install the module as any other NPM module. + +It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). + +#### NPM install local file ### +You should be able to directly install the module using `npm install file:///codegen_path`. + +NOTES: If you do `npm install file:///codegen_path --save` NPM might convert your path to relative path, maybe have adverse affect. `npm install` and `npm shrinkwrap` may misbehave if the installation path is not absolute. + +#### direct copy/symlink ### +You may also simply copy or symlink the codegen into a directly under your project. The syntax of the usage would differ if you take this route. (See below) + +### Usage ### +With ES6 module syntax, the following syntaxes are supported: +``` +import * as localName from 'npmName'; +import {operationId} from 'npmName'; + +import * as localName from './symlinkDir'; +import {operationId} from './symlinkDir'; +``` +With CommonJS, the following syntaxes are supported: +``` +import localName = require('npmName'); + +import localName = require('./symlinkDir')'; +``` \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/with-package-metadata/api.ts b/samples/client/petstore/typescript-fetch/with-package-metadata/api.ts new file mode 100644 index 000000000000..3d075fc28093 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/with-package-metadata/api.ts @@ -0,0 +1,855 @@ +import * as querystring from 'querystring'; +import * as fetch from 'isomorphic-fetch'; +import {assign} from './assign'; + + +export interface Category { + "id"?: number; + "name"?: string; +} + +export interface Order { + "id"?: number; + "petId"?: number; + "quantity"?: number; + "shipDate"?: Date; + + /** + * Order Status + */ + "status"?: Order.StatusEnum; + "complete"?: boolean; +} + +export namespace Order { + +export type StatusEnum = 'placed' | 'approved' | 'delivered'; +} +export interface Pet { + "id"?: number; + "category"?: Category; + "name": string; + "photoUrls": Array; + "tags"?: Array; + + /** + * pet status in the store + */ + "status"?: Pet.StatusEnum; +} + +export namespace Pet { + +export type StatusEnum = 'available' | 'pending' | 'sold'; +} +export interface Tag { + "id"?: number; + "name"?: string; +} + +export interface User { + "id"?: number; + "username"?: string; + "firstName"?: string; + "lastName"?: string; + "email"?: string; + "password"?: string; + "phone"?: string; + + /** + * User Status + */ + "userStatus"?: number; +} + + +//export namespace { + 'use strict'; + + export class PetApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + */ + public addPet (params: { body?: Pet; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet (params: { petId: number; apiKey?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling deletePet'); + } + headerParams['api_key'] = params.apiKey; + + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus (params: { status?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise> { + const localVarPath = this.basePath + '/pet/findByStatus'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.status !== undefined) { + queryParameters['status'] = params.status; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Finds Pets by tags + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + */ + public findPetsByTags (params: { tags?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise> { + const localVarPath = this.basePath + '/pet/findByTags'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.tags !== undefined) { + queryParameters['tags'] = params.tags; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * 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 + */ + public getPetById (params: { petId: number; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling getPetById'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + */ + public updatePet (params: { body?: Pet; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'PUT', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithForm (params: { petId: string; name?: string; status?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling updatePetWithForm'); + } + formParams['name'] = params.name; + + formParams['status'] = params.status; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: querystring.stringify(formParams), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile (params: { petId: number; additionalMetadata?: string; file?: any; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(params.petId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let formParams: any = {}; + headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; + + // verify required parameter 'petId' is set + if (params.petId == null) { + throw new Error('Missing required parameter petId when calling uploadFile'); + } + formParams['additionalMetadata'] = params.additionalMetadata; + + formParams['file'] = params.file; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: querystring.stringify(formParams), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} +//export namespace { + 'use strict'; + + export class StoreApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder (params: { orderId: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(params.orderId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'orderId' is set + if (params.orderId == null) { + throw new Error('Missing required parameter orderId when calling deleteOrder'); + } + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + public getInventory (params: { }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{ [key: string]: number; }> { + const localVarPath = this.basePath + '/store/inventory'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Find purchase order by ID + * 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 + */ + public getOrderById (params: { orderId: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(params.orderId)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'orderId' is set + if (params.orderId == null) { + throw new Error('Missing required parameter orderId when calling getOrderById'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + */ + public placeOrder (params: { body?: Order; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/store/order'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} +//export namespace { + 'use strict'; + + export class UserApi { + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; + + constructor(basePath?: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + */ + public createUser (params: { body?: User; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithArrayInput (params: { body?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/createWithArray'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithListInput (params: { body?: Array; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/createWithList'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + let fetchParams = { + method: 'POST', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + */ + public deleteUser (params: { username: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling deleteUser'); + } + let fetchParams = { + method: 'DELETE', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (params: { username: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling getUserByName'); + } + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser (params: { username?: string; password?: string; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise { + const localVarPath = this.basePath + '/user/login'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + if (params.username !== undefined) { + queryParameters['username'] = params.username; + } + + if (params.password !== undefined) { + queryParameters['password'] = params.password; + } + + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Logs out current logged in user session + * + */ + public logoutUser (params: { }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/logout'; + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + let fetchParams = { + method: 'GET', + headers: headerParams, + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param body Updated user object + */ + public updateUser (params: { username: string; body?: User; }, extraQueryParams?: any, extraFetchParams?: any ) : Promise<{}> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(params.username)); + + let queryParameters: any = assign({}, extraQueryParams); + let headerParams: any = assign({}, this.defaultHeaders); + headerParams['Content-Type'] = 'application/json'; + + // verify required parameter 'username' is set + if (params.username == null) { + throw new Error('Missing required parameter username when calling updateUser'); + } + let fetchParams = { + method: 'PUT', + headers: headerParams, + body: JSON.stringify(params.body), + + }; + + if (extraFetchParams) { + fetchParams = assign(fetchParams, extraFetchParams); + } + + let localVarPathWithQueryParameters = localVarPath + (localVarPath.indexOf('?') !== -1 ? '&' : '?') + querystring.stringify(queryParameters); + + return fetch(localVarPathWithQueryParameters, fetchParams).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + let error = new Error(response.statusText); + (error as any).response = response; + throw error; + } + }); + } + } +//} diff --git a/samples/client/petstore/typescript-fetch/with-package-metadata/assign.ts b/samples/client/petstore/typescript-fetch/with-package-metadata/assign.ts new file mode 100644 index 000000000000..233551441479 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/with-package-metadata/assign.ts @@ -0,0 +1,18 @@ +export function assign (target: any, ...args: any[]) { + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + for (let source of args) { + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; +}; \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/with-package-metadata/git_push.sh b/samples/client/petstore/typescript-fetch/with-package-metadata/git_push.sh new file mode 100644 index 000000000000..ed374619b139 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/with-package-metadata/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/typescript-fetch/with-package-metadata/package.json b/samples/client/petstore/typescript-fetch/with-package-metadata/package.json new file mode 100644 index 000000000000..ab2a67c51d09 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/with-package-metadata/package.json @@ -0,0 +1,18 @@ +{ + "name": "@swagger/typescript-fetch-petstore", + "version": "0.0.1", + "private": true, + "main": "./dist/api.js", + "browser": "./dist/api.js", + "typings": "./dist/api.d.ts", + "dependencies": { + "isomorphic-fetch": "^2.2.1" + }, + "scripts" : { + "install" : "typings install && tsc" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/with-package-metadata/tsconfig.json b/samples/client/petstore/typescript-fetch/with-package-metadata/tsconfig.json new file mode 100644 index 000000000000..18db23e2f5f1 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/with-package-metadata/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist" + }, + "exclude": [ + "dist", + "node_modules", + "typings/browser", + "typings/main", + "typings/main.d.ts" + ] +} diff --git a/samples/client/petstore/typescript-fetch/with-package-metadata/typings.json b/samples/client/petstore/typescript-fetch/with-package-metadata/typings.json new file mode 100644 index 000000000000..eeca5afde97d --- /dev/null +++ b/samples/client/petstore/typescript-fetch/with-package-metadata/typings.json @@ -0,0 +1,9 @@ +{ + "version": false, + "dependencies": {}, + "ambientDependencies": { + "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", + "node": "registry:dt/node#4.0.0+20160423143914", + "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" + } +} From 0f97386b0bd6f9d06953f6ee4914c73f18ec671a Mon Sep 17 00:00:00 2001 From: Newell Zhu Date: Tue, 10 May 2016 22:16:25 +0800 Subject: [PATCH 163/170] fix typo --- bin/all-petstore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/all-petstore.sh b/bin/all-petstore.sh index 2bb63f6d573f..849af6b5d4ad 100755 --- a/bin/all-petstore.sh +++ b/bin/all-petstore.sh @@ -29,7 +29,7 @@ cd $APP_DIR ./bin/java-petstore-jersey2.sh ./bin/java-petstore-okhttp-gson.sh ./bin/java-petstore-retrofit.sh -+./bin/java-petstore-retrofit2.sh +./bin/java-petstore-retrofit2.sh ./bin/jaxrs-petstore-server.sh ./bin/nodejs-petstore-server.sh ./bin/objc-petstore.sh From 1cb1b0351c82591aca860cac3cddaef3d01915ff Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 22:38:21 +0800 Subject: [PATCH 164/170] update php sample --- .../petstore/php/SwaggerClient-php/README.md | 78 +++++++++---------- .../php/SwaggerClient-php/composer.json | 3 + .../docs/{ => Api}/FakeApi.md | 0 .../docs/{ => Api}/PetApi.md | 0 .../docs/{ => Api}/StoreApi.md | 0 .../docs/{ => Api}/UserApi.md | 0 .../docs/{ => Model}/Animal.md | 0 .../docs/{ => Model}/AnimalFarm.md | 0 .../docs/{ => Model}/ApiResponse.md | 0 .../SwaggerClient-php/docs/{ => Model}/Cat.md | 0 .../docs/{ => Model}/Category.md | 0 .../SwaggerClient-php/docs/{ => Model}/Dog.md | 0 .../docs/{ => Model}/EnumClass.md | 0 .../docs/{ => Model}/EnumTest.md | 0 .../docs/{ => Model}/FormatTest.md | 0 .../docs/{ => Model}/Model200Response.md | 0 .../docs/{ => Model}/ModelReturn.md | 0 .../docs/{ => Model}/Name.md | 1 + .../docs/{ => Model}/Order.md | 0 .../SwaggerClient-php/docs/{ => Model}/Pet.md | 0 .../docs/{ => Model}/SpecialModelName.md | 0 .../SwaggerClient-php/docs/{ => Model}/Tag.md | 0 .../docs/{ => Model}/User.md | 0 .../php/SwaggerClient-php/lib/Model/Name.php | 34 +++++++- .../{lib/Tests => test/Api}/FakeApiTest.php | 0 .../{lib/Tests => test/Api}/PetApiTest.php | 0 .../{lib/Tests => test/Api}/StoreApiTest.php | 0 .../{lib/Tests => test/Api}/UserApiTest.php | 0 .../Tests => test/Model}/AnimalFarmTest.php | 0 .../{lib/Tests => test/Model}/AnimalTest.php | 0 .../Tests => test/Model}/ApiResponseTest.php | 0 .../{lib/Tests => test/Model}/CatTest.php | 0 .../Tests => test/Model}/CategoryTest.php | 0 .../{lib/Tests => test/Model}/DogTest.php | 0 .../Tests => test/Model}/EnumClassTest.php | 0 .../Tests => test/Model}/EnumTestTest.php | 0 .../Tests => test/Model}/FormatTestTest.php | 0 .../Model}/Model200ResponseTest.php | 0 .../Tests => test/Model}/ModelReturnTest.php | 0 .../{lib/Tests => test/Model}/NameTest.php | 0 .../{lib/Tests => test/Model}/OrderTest.php | 0 .../{lib/Tests => test/Model}/PetTest.php | 0 .../Model}/SpecialModelNameTest.php | 0 .../{lib/Tests => test/Model}/TagTest.php | 0 .../{lib/Tests => test/Model}/UserTest.php | 0 45 files changed, 73 insertions(+), 43 deletions(-) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Api}/FakeApi.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Api}/PetApi.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Api}/StoreApi.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Api}/UserApi.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Animal.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/AnimalFarm.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/ApiResponse.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Cat.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Category.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Dog.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/EnumClass.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/EnumTest.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/FormatTest.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Model200Response.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/ModelReturn.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Name.md (90%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Order.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Pet.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/SpecialModelName.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/Tag.md (100%) rename samples/client/petstore/php/SwaggerClient-php/docs/{ => Model}/User.md (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Api}/FakeApiTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Api}/PetApiTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Api}/StoreApiTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Api}/UserApiTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/AnimalFarmTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/AnimalTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/ApiResponseTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/CatTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/CategoryTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/DogTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/EnumClassTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/EnumTestTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/FormatTestTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/Model200ResponseTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/ModelReturnTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/NameTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/OrderTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/PetTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/SpecialModelNameTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/TagTest.php (100%) rename samples/client/petstore/php/SwaggerClient-php/{lib/Tests => test/Model}/UserTest.php (100%) diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index bf4afd1a8f1b..fe09a19fa932 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-10T00:30:19.190+08:00 +- Build date: 2016-05-10T22:37:00.768+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -87,48 +87,48 @@ 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* | [**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* | [**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* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*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 -*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user +*FakeApi* | [**testEndpointParameters**](docs/ApiFakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*PetApi* | [**addPet**](docs/ApiPetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/ApiPetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/ApiPetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/ApiPetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/ApiPetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/ApiPetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/ApiPetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/ApiPetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/ApiStoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/ApiStoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/ApiStoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/ApiStoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/ApiUserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/ApiUserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/ApiUserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/ApiUserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/ApiUserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/ApiUserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/ApiUserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/ApiUserApi.md#updateuser) | **PUT** /user/{username} | Updated user ## Documentation For Models - - [Animal](docs/Animal.md) - - [AnimalFarm](docs/AnimalFarm.md) - - [ApiResponse](docs/ApiResponse.md) - - [Cat](docs/Cat.md) - - [Category](docs/Category.md) - - [Dog](docs/Dog.md) - - [EnumClass](docs/EnumClass.md) - - [EnumTest](docs/EnumTest.md) - - [FormatTest](docs/FormatTest.md) - - [Model200Response](docs/Model200Response.md) - - [ModelReturn](docs/ModelReturn.md) - - [Name](docs/Name.md) - - [Order](docs/Order.md) - - [Pet](docs/Pet.md) - - [SpecialModelName](docs/SpecialModelName.md) - - [Tag](docs/Tag.md) - - [User](docs/User.md) + - [Animal](docs/ModelAnimal.md) + - [AnimalFarm](docs/ModelAnimalFarm.md) + - [ApiResponse](docs/ModelApiResponse.md) + - [Cat](docs/ModelCat.md) + - [Category](docs/ModelCategory.md) + - [Dog](docs/ModelDog.md) + - [EnumClass](docs/ModelEnumClass.md) + - [EnumTest](docs/ModelEnumTest.md) + - [FormatTest](docs/ModelFormatTest.md) + - [Model200Response](docs/ModelModel200Response.md) + - [ModelReturn](docs/ModelModelReturn.md) + - [Name](docs/ModelName.md) + - [Order](docs/ModelOrder.md) + - [Pet](docs/ModelPet.md) + - [SpecialModelName](docs/ModelSpecialModelName.md) + - [Tag](docs/ModelTag.md) + - [User](docs/ModelUser.md) ## Documentation For Authorization diff --git a/samples/client/petstore/php/SwaggerClient-php/composer.json b/samples/client/petstore/php/SwaggerClient-php/composer.json index 3822037d7504..da3fdabfbb01 100644 --- a/samples/client/petstore/php/SwaggerClient-php/composer.json +++ b/samples/client/petstore/php/SwaggerClient-php/composer.json @@ -29,5 +29,8 @@ }, "autoload": { "psr-4": { "Swagger\\Client\\" : "lib/" } + }, + "autoload-dev": { + "psr-4": { "Swagger\\Client\\" : "test/" } } } diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/PetApi.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Api/PetApi.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/UserApi.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Api/UserApi.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Animal.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/Animal.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Animal.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/AnimalFarm.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/AnimalFarm.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/AnimalFarm.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/AnimalFarm.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/ApiResponse.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/ApiResponse.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/ApiResponse.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/ApiResponse.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Cat.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Cat.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/Cat.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Cat.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Category.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Category.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/Category.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Category.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Dog.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Dog.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/Dog.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Dog.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/EnumClass.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/EnumClass.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/EnumTest.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/EnumTest.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/FormatTest.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/FormatTest.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Model200Response.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Model200Response.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/Model200Response.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Model200Response.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/ModelReturn.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/ModelReturn.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Name.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Name.md similarity index 90% rename from samples/client/petstore/php/SwaggerClient-php/docs/Name.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Name.md index 5f31a2cc7fd9..4565647e1ef6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Name.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Name.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes **name** | **int** | | **snake_case** | **int** | | [optional] **property** | **string** | | [optional] +**_123_number** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Order.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/Order.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Order.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Pet.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Pet.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/Pet.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Pet.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/SpecialModelName.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/SpecialModelName.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Tag.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/Tag.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/Tag.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/Tag.md diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/User.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/User.md similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/docs/User.md rename to samples/client/petstore/php/SwaggerClient-php/docs/Model/User.md 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 1684be6409a7..b77f3d78d0c2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -60,7 +60,8 @@ class Name implements ArrayAccess static $swaggerTypes = array( 'name' => 'int', 'snake_case' => 'int', - 'property' => 'string' + 'property' => 'string', + '_123_number' => 'int' ); static function swaggerTypes() { @@ -74,7 +75,8 @@ class Name implements ArrayAccess static $attributeMap = array( 'name' => 'name', 'snake_case' => 'snake_case', - 'property' => 'property' + 'property' => 'property', + '_123_number' => '123Number' ); static function attributeMap() { @@ -88,7 +90,8 @@ class Name implements ArrayAccess static $setters = array( 'name' => 'setName', 'snake_case' => 'setSnakeCase', - 'property' => 'setProperty' + 'property' => 'setProperty', + '_123_number' => 'set123Number' ); static function setters() { @@ -102,7 +105,8 @@ class Name implements ArrayAccess static $getters = array( 'name' => 'getName', 'snake_case' => 'getSnakeCase', - 'property' => 'getProperty' + 'property' => 'getProperty', + '_123_number' => 'get123Number' ); static function getters() { @@ -128,6 +132,7 @@ class Name implements ArrayAccess $this->container['name'] = isset($data['name']) ? $data['name'] : null; $this->container['snake_case'] = isset($data['snake_case']) ? $data['snake_case'] : null; $this->container['property'] = isset($data['property']) ? $data['property'] : null; + $this->container['_123_number'] = isset($data['_123_number']) ? $data['_123_number'] : null; } /** @@ -221,6 +226,27 @@ class Name implements ArrayAccess return $this; } + + /** + * Gets _123_number + * @return int + */ + public function get123Number() + { + return $this->container['_123_number']; + } + + /** + * Sets _123_number + * @param int $_123_number + * @return $this + */ + public function set123Number($_123_number) + { + $this->container['_123_number'] = $_123_number; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Api/FakeApiTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Api/FakeApiTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Api/PetApiTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Api/PetApiTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Api/StoreApiTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Api/StoreApiTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Api/UserApiTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Api/UserApiTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalFarmTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/AnimalFarmTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalFarmTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/AnimalFarmTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/AnimalTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/AnimalTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/AnimalTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/ApiResponseTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/ApiResponseTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/ApiResponseTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/ApiResponseTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/CatTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/CatTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/CatTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/CatTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/CategoryTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/CategoryTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/CategoryTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/CategoryTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/DogTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/DogTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/DogTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/DogTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/EnumClassTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/EnumClassTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumTestTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/EnumTestTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumTestTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/EnumTestTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FormatTestTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/FormatTestTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/FormatTestTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/FormatTestTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/Model200ResponseTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/Model200ResponseTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/Model200ResponseTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/Model200ResponseTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/ModelReturnTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/ModelReturnTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/ModelReturnTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/ModelReturnTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/NameTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/NameTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/NameTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/NameTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/OrderTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/OrderTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/OrderTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/OrderTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/PetTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/PetTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/SpecialModelNameTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/SpecialModelNameTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/SpecialModelNameTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/SpecialModelNameTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/TagTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/TagTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/TagTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/TagTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/UserTest.php similarity index 100% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserTest.php rename to samples/client/petstore/php/SwaggerClient-php/test/Model/UserTest.php From 745e1aba32752f1a1566b80776f050fc7b61089e Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 11 May 2016 00:03:14 +0800 Subject: [PATCH 165/170] fix broken links in php doc --- .../src/main/resources/php/README.mustache | 4 ++-- .../src/main/resources/php/api_doc.mustache | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/README.mustache b/modules/swagger-codegen/src/main/resources/php/README.mustache index 39f64dc86e53..3049d013ca56 100644 --- a/modules/swagger-codegen/src/main/resources/php/README.mustache +++ b/modules/swagger-codegen/src/main/resources/php/README.mustache @@ -94,12 +94,12 @@ All URIs are relative to *{{basePath}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ## Documentation For Models -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md) {{/model}}{{/models}} ## Documentation For Authorization diff --git a/modules/swagger-codegen/src/main/resources/php/api_doc.mustache b/modules/swagger-codegen/src/main/resources/php/api_doc.mustache index baa8461f86f8..4cf01aa510be 100644 --- a/modules/swagger-codegen/src/main/resources/php/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api_doc.mustache @@ -50,23 +50,23 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} {{/allParams}} ### Return type -{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**](../Model/{{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} ### Authorization -{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} ### HTTP request headers - **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) {{/operation}} {{/operations}} From 9df91a08cd6ba8c71d01b72c6c6ca144fe0c8349 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 11 May 2016 11:27:37 +0800 Subject: [PATCH 166/170] add cchafer (author of Akka Scala) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e73d2debbce6..bce750740c78 100644 --- a/README.md +++ b/README.md @@ -868,6 +868,7 @@ Swaagger Codegen core team members are contributors who have been making signfic ## Template Creator Here is a list of template creators: * API Clients: + * Akka-Scala: @cchafer * C# (.NET 2.0): @who * Clojure: @xhh * Dart: @yissachar From ee15ef3579d1d27c522a2211d00722bb1b6ceed3 Mon Sep 17 00:00:00 2001 From: zhenjun115 Date: Wed, 11 May 2016 13:05:54 +0800 Subject: [PATCH 167/170] a new pom.mustache for android api client using volley HTTP library; --- .../languages/AndroidClientCodegen.java | 2 +- .../android/libraries/volley/pom.mustache | 48 +++++++++++++++++++ .../client/petstore/android/volley/pom.xml | 48 +++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache create mode 100644 samples/client/petstore/android/volley/pom.xml diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java index b5978e118a07..0d021eba9f9c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java @@ -418,7 +418,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi } private void addSupportingFilesForVolley() { - // supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); + supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); // supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle")); supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle")); supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml")); diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache new file mode 100644 index 000000000000..4036bb32afbc --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/pom.mustache @@ -0,0 +1,48 @@ + + + 4.0.0 + {{groupId}} + {{artifactId}} + {{artifactVersion}} + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + org.apache.httpcomponents + httpcore + ${httpcomponents-httpcore-version} + + + org.apache.httpcomponents + httpmime + ${httpcomponents-httpmime-version} + + + com.google.code.gson + gson + ${google-code-gson-version} + + + com.mcxiaoke.volley + library + ${volley-library-version} + + + com.google.android + android + ${android-platform-version} + + + + 1.5.0 + 4.4.4 + 4.5.2 + 2.3.1 + 1.0.19 + 4.1.1.4 + + diff --git a/samples/client/petstore/android/volley/pom.xml b/samples/client/petstore/android/volley/pom.xml new file mode 100644 index 000000000000..98572662fb27 --- /dev/null +++ b/samples/client/petstore/android/volley/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + io.swagger + swagger-petstore-android-volley + 1.0.0 + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + org.apache.httpcomponents + httpcore + ${httpcomponents-httpcore-version} + + + org.apache.httpcomponents + httpmime + ${httpcomponents-httpmime-version} + + + com.google.code.gson + gson + ${google-code-gson-version} + + + com.mcxiaoke.volley + library + ${volley-library-version} + + + com.google.android + android + ${android-platform-version} + + + + 1.5.0 + 4.4.4 + 4.5.2 + 2.3.1 + 1.0.19 + 4.1.1.4 + + From 3c117d5857799b888b632869d5ebc9673c380aac Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 11 May 2016 15:44:06 +0800 Subject: [PATCH 168/170] refactor special mapping to defualt codegen --- bin/haskell-servant-petstore.sh | 2 +- .../io/swagger/codegen/DefaultCodegen.java | 29 +++++++ .../languages/HaskellServantCodegen.java | 21 ----- .../server/petstore/haskell-servant/README.md | 82 +++++++++++++++++-- .../petstore/haskell-servant/stack.yaml | 37 ++------- .../haskell-servant/swagger-petstore.cabal | 33 ++++++++ 6 files changed, 146 insertions(+), 58 deletions(-) create mode 100644 samples/server/petstore/haskell-servant/swagger-petstore.cabal diff --git a/bin/haskell-servant-petstore.sh b/bin/haskell-servant-petstore.sh index 7032a6af26c8..0095e2ccc7c2 100755 --- a/bin/haskell-servant-petstore.sh +++ b/bin/haskell-servant-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/haskell-servant -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l haskell-servant -o samples/server/petstore/haskell-servant" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/haskell-servant -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l haskell -o samples/server/petstore/haskell-servant" java $JAVA_OPTS -jar $executable $ags 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 f350339127bf..e0301a2383df 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 @@ -55,6 +55,10 @@ public class DefaultCodegen { protected Boolean ensureUniqueParams = true; protected String gitUserId, gitRepoId, releaseNote; protected String httpUserAgent; + // How to encode special characters like $ + // They are translated to words like "Dollar" and prefixed with ' + // Then translated back during JSON encoding and decoding + protected Map specialCharReplacements = new HashMap(); public List cliOptions() { return cliOptions; @@ -728,6 +732,31 @@ public class DefaultCodegen { CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString())); cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants .ENSURE_UNIQUE_PARAMS_DESC).defaultValue(Boolean.TRUE.toString())); + + // initalize special character mapping + initalizeSpecialCharacterMapping(); + } + + /** + * Initalize special character mapping + */ + protected void initalizeSpecialCharacterMapping() { + // Initialize special characters + specialCharReplacements.put('$', "Dollar"); + specialCharReplacements.put('^', "Caret"); + specialCharReplacements.put('|', "Pipe"); + specialCharReplacements.put('=', "Equal"); + specialCharReplacements.put('*', "Star"); + specialCharReplacements.put('-', "Dash"); + specialCharReplacements.put('&', "Ampersand"); + specialCharReplacements.put('%', "Percent"); + specialCharReplacements.put('#', "Hash"); + specialCharReplacements.put('@', "At"); + specialCharReplacements.put('!', "Exclamation"); + specialCharReplacements.put('+', "Plus"); + specialCharReplacements.put(':', "Colon"); + specialCharReplacements.put('>', "GreaterThan"); + specialCharReplacements.put('<', "LessThan"); } /** diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java index a78bb441c487..37cd2f836614 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java @@ -18,12 +18,6 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf protected String sourceFolder = "src"; protected String apiVersion = "0.0.1"; - - // How to encode special characters like $ - // They are translated to words like "Dollar" and prefixed with ' - // Then translated back during JSON encoding and decoding - private Map specialCharReplacements = new HashMap(); - /** * Configures the type of generator. * @@ -57,21 +51,6 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf public HaskellServantCodegen() { super(); - // Initialize special characters - specialCharReplacements.put('$', "Dollar"); - specialCharReplacements.put('^', "Caret"); - specialCharReplacements.put('|', "Pipe"); - specialCharReplacements.put('=', "Equal"); - specialCharReplacements.put('*', "Star"); - specialCharReplacements.put('-', "Dash"); - specialCharReplacements.put('&', "Ampersand"); - specialCharReplacements.put('%', "Percent"); - specialCharReplacements.put('#', "Hash"); - specialCharReplacements.put('@', "At"); - specialCharReplacements.put('!', "Exclamation"); - specialCharReplacements.put('+', "Plus"); - - // set the output folder here outputFolder = "generated-code/haskell-servant"; diff --git a/samples/server/petstore/haskell-servant/README.md b/samples/server/petstore/haskell-servant/README.md index c8f4b4bbb9db..a99fc8935be9 100644 --- a/samples/server/petstore/haskell-servant/README.md +++ b/samples/server/petstore/haskell-servant/README.md @@ -1,7 +1,79 @@ -# Generated Servant Codes +# Auto-Generated Swagger Bindings to `SwaggerPetstore` -## How to use +The library in `lib` provides auto-generated-from-Swagger bindings to the SwaggerPetstore API. -0. Install haskell-stack -1. stack build -2. stack exec client +## Installation + +Installation follows the standard approach to installing Stack-based projects. + +1. Install the [Haskell `stack` tool](http://docs.haskellstack.org/en/stable/README). +2. Run `stack install` to install this package. + +## Main Interface + +The main interface to this library is in the `SwaggerPetstore.API` module, which exports the SwaggerPetstoreBackend type. The SwaggerPetstoreBackend +type can be used to create and define servers and clients for the API. + +## Creating a Client + +A client can be created via the `createSwaggerPetstoreClient` function, which, if provided with a hostname and a port, will generate +a client that can be used to access the API if it is being served at that hostname / port combination. For example, if +`localhost:8080` is serving the SwaggerPetstore API, you can write: + +```haskell +{-# LANGUAGE RecordWildCards #-} + +import SwaggerPetstore.API + +main :: IO () +main = do + SwaggerPetstoreBackend{..} <- createSwaggerPetstoreClient (ServerConfig "localhost" 8080) + -- Any SwaggerPetstore API call can go here. + return () +``` + +## Creating a Server + +In order to create a server, you must use the `runSwaggerPetstoreServer` function. However, you unlike the client, in which case you *got* a `SwaggerPetstoreBackend` +from the library, you must instead *provide* a `SwaggerPetstoreBackend`. For example, if you have defined handler functions for all the +functions in `SwaggerPetstore.Handlers`, you can write: + +```haskell +{-# LANGUAGE RecordWildCards #-} + +import SwaggerPetstore.API + +-- A module you wrote yourself, containing all handlers needed for the SwaggerPetstoreBackend type. +import SwaggerPetstore.Handlers + +-- Run a SwaggerPetstore server on localhost:8080 +main :: IO () +main = do + let server = SwaggerPetstoreBackend{..} + runSwaggerPetstoreServer (ServerConfig "localhost" 8080) server +``` + +You could use `optparse-applicative` or a similar library to read the host and port from command-line arguments: +``` +{-# LANGUAGE RecordWildCards #-} + +module Main (main) where + +import SwaggerPetstore.API (runSwaggerPetstoreServer, SwaggerPetstoreBackend(..), ServerConfig(..)) + +import Control.Applicative ((<$>), (<*>)) +import Options.Applicative (execParser, option, str, auto, long, metavar, help) + +main :: IO () +main = do + config <- parseArguments + runSwaggerPetstoreServer config SwaggerPetstoreBackend{} + +-- | Parse host and port from the command line arguments. +parseArguments :: IO ServerConfig +parseArguments = + execParser $ + ServerConfig + <$> option str (long "host" <> metavar "HOST" <> help "Host to serve on") + <*> option auto (long "port" <> metavar "PORT" <> help "Port to serve on") +``` diff --git a/samples/server/petstore/haskell-servant/stack.yaml b/samples/server/petstore/haskell-servant/stack.yaml index 00448df3e959..bed581391ca1 100644 --- a/samples/server/petstore/haskell-servant/stack.yaml +++ b/samples/server/petstore/haskell-servant/stack.yaml @@ -1,33 +1,8 @@ -# For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md - -# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) -resolver: lts-3.17 - -# Local packages, usually specified by relative directory name +resolver: lts-5.11 +extra-deps: +- servant-0.6 +- servant-client-0.6 +- servant-server-0.6 +- http-api-data-0.2.2 packages: - '.' - -# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) -extra-deps: -- servant-mock-0.4.4.6 - -# Override default flag values for local packages and extra-deps -flags: {} - -# Extra package databases containing global packages -extra-package-dbs: [] - -# Control whether we use the GHC we find on the path -# system-ghc: true - -# Require a specific version of stack, using version ranges -# require-stack-version: -any # Default -# require-stack-version: >= 0.1.10.0 - -# Override the architecture used by stack, especially useful on Windows -# arch: i386 -# arch: x86_64 - -# Extra directories used by stack for building -# extra-include-dirs: [/path/to/dir] -# extra-lib-dirs: [/path/to/dir] diff --git a/samples/server/petstore/haskell-servant/swagger-petstore.cabal b/samples/server/petstore/haskell-servant/swagger-petstore.cabal new file mode 100644 index 000000000000..4351d73c0d55 --- /dev/null +++ b/samples/server/petstore/haskell-servant/swagger-petstore.cabal @@ -0,0 +1,33 @@ +name: swagger-petstore +version: 0.1.0.0 +synopsis: Auto-generated API bindings for swagger-petstore +description: Please see README.md +homepage: https://github.com/swagger-api/swagger-codegen#readme +author: Author Name Here +maintainer: author.name@email.com +copyright: YEAR - AUTHOR +category: Web +build-type: Simple +cabal-version: >=1.10 + +library + hs-source-dirs: lib + exposed-modules: SwaggerPetstore.API + , SwaggerPetstore.Types + ghc-options: -Wall + build-depends: base + , aeson + , text + , containers + , network-uri + , servant + , http-api-data + , servant-client + , servant-server + , servant + , warp + , transformers + , mtl + , http-client + , http-types + default-language: Haskell2010 From 2784db0604842a3141043e9fa922b637cb446e34 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 11 May 2016 16:14:03 +0800 Subject: [PATCH 169/170] fix escpaing " and \ --- .../io/swagger/codegen/DefaultCodegen.java | 6 +++++- ...ith-fake-endpoints-models-for-testing.yaml | 2 +- samples/client/petstore/ruby/README.md | 4 ++-- samples/client/petstore/ruby/docs/Animal.md | 1 + samples/client/petstore/ruby/docs/Cat.md | 1 + samples/client/petstore/ruby/docs/Dog.md | 1 + samples/client/petstore/ruby/docs/Name.md | 1 + samples/client/petstore/ruby/lib/petstore.rb | 2 +- .../ruby/lib/petstore/api/fake_api.rb | 2 +- .../petstore/ruby/lib/petstore/api/pet_api.rb | 2 +- .../ruby/lib/petstore/api/store_api.rb | 2 +- .../ruby/lib/petstore/api/user_api.rb | 2 +- .../petstore/ruby/lib/petstore/api_client.rb | 2 +- .../petstore/ruby/lib/petstore/api_error.rb | 2 +- .../ruby/lib/petstore/models/animal.rb | 21 ++++++++++++++----- .../ruby/lib/petstore/models/animal_farm.rb | 2 +- .../ruby/lib/petstore/models/api_response.rb | 2 +- .../petstore/ruby/lib/petstore/models/cat.rb | 15 +++++++++++-- .../ruby/lib/petstore/models/category.rb | 2 +- .../petstore/ruby/lib/petstore/models/dog.rb | 15 +++++++++++-- .../ruby/lib/petstore/models/enum_class.rb | 2 +- .../ruby/lib/petstore/models/enum_test.rb | 2 +- .../ruby/lib/petstore/models/format_test.rb | 2 +- .../lib/petstore/models/model_200_response.rb | 2 +- .../ruby/lib/petstore/models/model_return.rb | 2 +- .../petstore/ruby/lib/petstore/models/name.rb | 19 ++++++++++++----- .../ruby/lib/petstore/models/order.rb | 2 +- .../petstore/ruby/lib/petstore/models/pet.rb | 2 +- .../lib/petstore/models/special_model_name.rb | 2 +- .../petstore/ruby/lib/petstore/models/tag.rb | 2 +- .../petstore/ruby/lib/petstore/models/user.rb | 2 +- .../petstore/ruby/lib/petstore/version.rb | 2 +- samples/client/petstore/ruby/petstore.gemspec | 2 +- 33 files changed, 90 insertions(+), 40 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index e0301a2383df..89c6554d828f 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 @@ -329,7 +329,11 @@ public class DefaultCodegen { @SuppressWarnings("static-method") public String escapeText(String input) { if (input != null) { - return StringEscapeUtils.unescapeJava(StringEscapeUtils.escapeJava(input).replace("\\/", "/")).replaceAll("[\\t\\n\\r]"," "); + // remove \t, \n, \r + // repalce \ with \\ + // repalce " with \" + // outter unescape to retain the original multi-byte characters + return StringEscapeUtils.unescapeJava(StringEscapeUtils.escapeJava(input).replace("\\/", "/")).replaceAll("[\\t\\n\\r]"," ").replace("\\", "\\\\").replace("\"", "\\\""); } return input; } diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 526738a2efe9..b9fa750d38ad 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1,6 +1,6 @@ swagger: '2.0' info: - description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.' + description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \ ' version: 1.0.0 title: Swagger Petstore termsOfService: 'http://swagger.io/terms/' diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index cdecd2e6cca9..7aa7d19b003f 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -2,13 +2,13 @@ Petstore - the Ruby gem for the Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ This SDK 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-10T14:47:49.265+08:00 +- Build date: 2016-05-11T16:13:11.464+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation diff --git a/samples/client/petstore/ruby/docs/Animal.md b/samples/client/petstore/ruby/docs/Animal.md index 0e262c787262..5ff8837de153 100644 --- a/samples/client/petstore/ruby/docs/Animal.md +++ b/samples/client/petstore/ruby/docs/Animal.md @@ -4,5 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **String** | | +**color** | **String** | | [optional] [default to "red"] diff --git a/samples/client/petstore/ruby/docs/Cat.md b/samples/client/petstore/ruby/docs/Cat.md index 6b7dfb710df4..5c13d986ece7 100644 --- a/samples/client/petstore/ruby/docs/Cat.md +++ b/samples/client/petstore/ruby/docs/Cat.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **String** | | +**color** | **String** | | [optional] [default to "red"] **declawed** | **BOOLEAN** | | [optional] diff --git a/samples/client/petstore/ruby/docs/Dog.md b/samples/client/petstore/ruby/docs/Dog.md index 7af6f549d5df..9224ad05310f 100644 --- a/samples/client/petstore/ruby/docs/Dog.md +++ b/samples/client/petstore/ruby/docs/Dog.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **String** | | +**color** | **String** | | [optional] [default to "red"] **breed** | **String** | | [optional] diff --git a/samples/client/petstore/ruby/docs/Name.md b/samples/client/petstore/ruby/docs/Name.md index 4858862c725c..1ae49f8ee1be 100644 --- a/samples/client/petstore/ruby/docs/Name.md +++ b/samples/client/petstore/ruby/docs/Name.md @@ -6,5 +6,6 @@ Name | Type | Description | Notes **name** | **Integer** | | **snake_case** | **Integer** | | [optional] **property** | **String** | | [optional] +**_123_number** | **Integer** | | [optional] diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index 1ca35820523a..ce77b3d21b6e 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index 68f6fea9d2be..e7e6e45c2622 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index 7e4121d5120f..2d7a12dfd2a9 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index 04c7f2701d8a..2ef8b526c692 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index 469c950934a3..bdecfa87ec2d 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index ed1c501d71a6..1723abbac423 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/api_error.rb b/samples/client/petstore/ruby/lib/petstore/api_error.rb index e4c233b2e98b..95b1fc6cdb77 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_error.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_error.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index 5612f227d097..d23fe94a7339 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -20,17 +20,21 @@ module Petstore class Animal attr_accessor :class_name + attr_accessor :color + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'class_name' => :'className' + :'class_name' => :'className', + :'color' => :'color' } end # Attribute type mapping. def self.swagger_types { - :'class_name' => :'String' + :'class_name' => :'String', + :'color' => :'String' } end @@ -46,6 +50,12 @@ module Petstore self.class_name = attributes[:'className'] end + if attributes.has_key?(:'color') + self.color = attributes[:'color'] + else + self.color = "red" + end + end # Show invalid properties with the reasons. Usually used together with valid? @@ -69,7 +79,8 @@ module Petstore def ==(o) return true if self.equal?(o) self.class == o.class && - class_name == o.class_name + class_name == o.class_name && + color == o.color end # @see the `==` method @@ -81,7 +92,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [class_name].hash + [class_name, color].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb b/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb index 62ca66ce38be..f4f2f6ba6a03 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb index 79da573e9413..3893b8428791 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/client/petstore/ruby/lib/petstore/models/cat.rb index 12f17b85553e..653b9b506f74 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/cat.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -20,12 +20,15 @@ module Petstore class Cat attr_accessor :class_name + attr_accessor :color + attr_accessor :declawed # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'class_name' => :'className', + :'color' => :'color', :'declawed' => :'declawed' } end @@ -34,6 +37,7 @@ module Petstore def self.swagger_types { :'class_name' => :'String', + :'color' => :'String', :'declawed' => :'BOOLEAN' } end @@ -50,6 +54,12 @@ module Petstore self.class_name = attributes[:'className'] end + if attributes.has_key?(:'color') + self.color = attributes[:'color'] + else + self.color = "red" + end + if attributes.has_key?(:'declawed') self.declawed = attributes[:'declawed'] end @@ -78,6 +88,7 @@ module Petstore return true if self.equal?(o) self.class == o.class && class_name == o.class_name && + color == o.color && declawed == o.declawed end @@ -90,7 +101,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [class_name, declawed].hash + [class_name, color, declawed].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/category.rb b/samples/client/petstore/ruby/lib/petstore/models/category.rb index c4879d65bb4b..5aced3c55c74 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/category.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/client/petstore/ruby/lib/petstore/models/dog.rb index 90d213dbf45e..b08d82d49f8b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/dog.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -20,12 +20,15 @@ module Petstore class Dog attr_accessor :class_name + attr_accessor :color + attr_accessor :breed # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'class_name' => :'className', + :'color' => :'color', :'breed' => :'breed' } end @@ -34,6 +37,7 @@ module Petstore def self.swagger_types { :'class_name' => :'String', + :'color' => :'String', :'breed' => :'String' } end @@ -50,6 +54,12 @@ module Petstore self.class_name = attributes[:'className'] end + if attributes.has_key?(:'color') + self.color = attributes[:'color'] + else + self.color = "red" + end + if attributes.has_key?(:'breed') self.breed = attributes[:'breed'] end @@ -78,6 +88,7 @@ module Petstore return true if self.equal?(o) self.class == o.class && class_name == o.class_name && + color == o.color && breed == o.breed end @@ -90,7 +101,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [class_name, breed].hash + [class_name, color, breed].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb index 4dc0bb6c16b7..30c570708c37 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb index 3f045b3490e2..618c6336d58d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index 946e00015552..9952352f9fd0 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb b/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb index 7a2473fb8b90..c7bcf594aca6 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb index 0361451b290d..1a18970eebe4 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/name.rb b/samples/client/petstore/ruby/lib/petstore/models/name.rb index d5e3ef4adb80..0b4d3835d0ef 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/name.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -25,12 +25,15 @@ module Petstore attr_accessor :property + attr_accessor :_123_number + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'name' => :'name', :'snake_case' => :'snake_case', - :'property' => :'property' + :'property' => :'property', + :'_123_number' => :'123Number' } end @@ -39,7 +42,8 @@ module Petstore { :'name' => :'Integer', :'snake_case' => :'Integer', - :'property' => :'String' + :'property' => :'String', + :'_123_number' => :'Integer' } end @@ -63,6 +67,10 @@ module Petstore self.property = attributes[:'property'] end + if attributes.has_key?(:'123Number') + self._123_number = attributes[:'123Number'] + end + end # Show invalid properties with the reasons. Usually used together with valid? @@ -88,7 +96,8 @@ module Petstore self.class == o.class && name == o.name && snake_case == o.snake_case && - property == o.property + property == o.property && + _123_number == o._123_number end # @see the `==` method @@ -100,7 +109,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [name, snake_case, property].hash + [name, snake_case, property, _123_number].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/order.rb b/samples/client/petstore/ruby/lib/petstore/models/order.rb index 6c021e50ec7a..e03977106185 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/order.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/client/petstore/ruby/lib/petstore/models/pet.rb index ba4d466df21c..0f484cd0c436 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/pet.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb index 853d1e496001..781cf39ad0c6 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/tag.rb b/samples/client/petstore/ruby/lib/petstore/models/tag.rb index d6d49068e374..b40ad1046f1a 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/tag.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/user.rb b/samples/client/petstore/ruby/lib/petstore/models/user.rb index f0c39b741d55..8bdc816bd0ec 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/user.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/version.rb b/samples/client/petstore/ruby/lib/petstore/version.rb index e28b737d97cb..e5c868d3d094 100644 --- a/samples/client/petstore/ruby/lib/petstore/version.rb +++ b/samples/client/petstore/ruby/lib/petstore/version.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/petstore.gemspec b/samples/client/petstore/ruby/petstore.gemspec index 08b733a09213..66258d1ff5c4 100644 --- a/samples/client/petstore/ruby/petstore.gemspec +++ b/samples/client/petstore/ruby/petstore.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.email = ["apiteam@swagger.io"] s.homepage = "https://github.com/swagger-api/swagger-codegen" s.summary = "Swagger Petstore Ruby Gem" - s.description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose." + s.description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ " s.license = "Apache 2.0" s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' From dfe7e33fa5df2c1f694e4bf7717d39644aef03a7 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 11 May 2016 16:34:30 +0800 Subject: [PATCH 170/170] update mapping to use minus for - --- .../src/main/java/io/swagger/codegen/DefaultCodegen.java | 2 +- .../io/swagger/codegen/languages/HaskellServantCodegen.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 89c6554d828f..5d71a347df05 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 @@ -751,7 +751,7 @@ public class DefaultCodegen { specialCharReplacements.put('|', "Pipe"); specialCharReplacements.put('=', "Equal"); specialCharReplacements.put('*', "Star"); - specialCharReplacements.put('-', "Dash"); + specialCharReplacements.put('-', "Minus"); specialCharReplacements.put('&', "Ampersand"); specialCharReplacements.put('%', "Percent"); specialCharReplacements.put('#', "Hash"); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java index 37cd2f836614..324ca56e70b4 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java @@ -51,6 +51,9 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf public HaskellServantCodegen() { super(); + // override the mapping for "-" (Minus) to keep the original mapping in Haskell + specialCharReplacements.put('-', "Dash"); + // set the output folder here outputFolder = "generated-code/haskell-servant";