From 14ceb4bf84bc228f57fa3c05479d62e7fa9aee98 Mon Sep 17 00:00:00 2001 From: demonfiddler Date: Fri, 25 Mar 2016 16:36:06 +0000 Subject: [PATCH 001/114] 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/114] 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/114] 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 4ad7ea655693bdd1875adfcbd38b8ae5c65165b4 Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Sun, 24 Apr 2016 11:21:31 +0200 Subject: [PATCH 004/114] Updating sample and scripts --- bin/all-petstore.sh | 1 + bin/typescript-angular2-petstore-with-npm.sh | 2 +- bin/typescript-angular2-petstore.sh | 2 +- bin/windows/typescript-angular2-with-npm.bat | 10 +++++++ bin/windows/typescript-angular2.bat | 2 +- .../default}/api/PetApi.ts | 0 .../default}/api/StoreApi.ts | 0 .../default}/api/UserApi.ts | 0 .../default}/api/api.ts | 0 .../default}/index.ts | 0 .../default}/model/Category.ts | 0 .../default}/model/Order.ts | 0 .../default}/model/Pet.ts | 0 .../default}/model/Tag.ts | 0 .../default}/model/User.ts | 0 .../default}/model/models.ts | 0 .../npm}/README.md | 4 +-- .../{ => npm}/api/PetApi.ts | 0 .../{ => npm}/api/StoreApi.ts | 0 .../{ => npm}/api/UserApi.ts | 0 .../typescript-angular2/{ => npm}/api/api.ts | 0 .../typescript-angular2/{ => npm}/index.ts | 0 .../{ => npm}/model/Category.ts | 0 .../{ => npm}/model/Order.ts | 0 .../{ => npm}/model/Pet.ts | 0 .../{ => npm}/model/Tag.ts | 0 .../{ => npm}/model/User.ts | 0 .../{ => npm}/model/models.ts | 0 .../npm}/package.json | 2 +- .../npm}/tsconfig.json | 0 .../npm}/typings.json | 0 .../SwaggerServer/lib/models/ApiResponse.php | 18 ------------ .../SwaggerServer/lib/models/Category.php | 16 ----------- .../slim/SwaggerServer/lib/models/Order.php | 24 ---------------- .../slim/SwaggerServer/lib/models/Pet.php | 24 ---------------- .../slim/SwaggerServer/lib/models/Tag.php | 16 ----------- .../slim/SwaggerServer/lib/models/User.php | 28 ------------------- 37 files changed, 17 insertions(+), 132 deletions(-) create mode 100644 bin/windows/typescript-angular2-with-npm.bat rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/api/PetApi.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/api/StoreApi.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/api/UserApi.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/api/api.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/index.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/model/Category.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/model/Order.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/model/Pet.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/model/Tag.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/model/User.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/default}/model/models.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/npm}/README.md (84%) rename samples/client/petstore/typescript-angular2/{ => npm}/api/PetApi.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/api/StoreApi.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/api/UserApi.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/api/api.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/index.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/model/Category.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/model/Order.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/model/Pet.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/model/Tag.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/model/User.ts (100%) rename samples/client/petstore/typescript-angular2/{ => npm}/model/models.ts (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/npm}/package.json (94%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/npm}/tsconfig.json (100%) rename samples/client/petstore/{typescript-angular2-with-npm => typescript-angular2/npm}/typings.json (100%) delete mode 100644 samples/server/petstore/slim/SwaggerServer/lib/models/ApiResponse.php delete mode 100644 samples/server/petstore/slim/SwaggerServer/lib/models/Category.php delete mode 100644 samples/server/petstore/slim/SwaggerServer/lib/models/Order.php delete mode 100644 samples/server/petstore/slim/SwaggerServer/lib/models/Pet.php delete mode 100644 samples/server/petstore/slim/SwaggerServer/lib/models/Tag.php delete mode 100644 samples/server/petstore/slim/SwaggerServer/lib/models/User.php diff --git a/bin/all-petstore.sh b/bin/all-petstore.sh index af322af4820e..2bb63f6d573f 100755 --- a/bin/all-petstore.sh +++ b/bin/all-petstore.sh @@ -49,5 +49,6 @@ cd $APP_DIR ./bin/tizen-petstore.sh ./bin/typescript-angular-petstore.sh ./bin/typescript-angular2-petstore.sh +./bin/typescript-angular2-petstore-with-npm.sh ./bin/typescript-node-petstore.sh ./bin/lumen-petstore-server.sh \ No newline at end of file diff --git a/bin/typescript-angular2-petstore-with-npm.sh b/bin/typescript-angular2-petstore-with-npm.sh index 9e455715b01d..6f13f3bfb32d 100755 --- a/bin/typescript-angular2-petstore-with-npm.sh +++ b/bin/typescript-angular2-petstore-with-npm.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-angular2 -c bin/typescript-angular2-petstore-with-npm.json -o samples/client/petstore/typescript-angular2-with-npm" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular2 -c bin/typescript-angular2-petstore-with-npm.json -o samples/client/petstore/typescript-angular2/npm" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular2-petstore.sh b/bin/typescript-angular2-petstore.sh index 4ad341f64f8f..f26dd0f668f2 100755 --- a/bin/typescript-angular2-petstore.sh +++ b/bin/typescript-angular2-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-angular2 -o samples/client/petstore/typescript-angular2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular2 -o samples/client/petstore/typescript-angular2/default" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/typescript-angular2-with-npm.bat b/bin/windows/typescript-angular2-with-npm.bat new file mode 100644 index 000000000000..34866ca1faa8 --- /dev/null +++ b/bin/windows/typescript-angular2-with-npm.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-angular -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-angular2 -o samples\client\petstore\typescript-angular2\npm + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular2.bat b/bin/windows/typescript-angular2.bat index 7657d184fd15..ce2f0e0dc8c8 100755 --- a/bin/windows/typescript-angular2.bat +++ b/bin/windows/typescript-angular2.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\typescript-angular -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-angular2 -o samples\client\petstore\typescript-angular +set ags=generate -t modules\swagger-codegen\src\main\resources\typescript-angular -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-angular2 -o samples\client\petstore\typescript-angular2\default java %JAVA_OPTS% -jar %executable% %ags% diff --git a/samples/client/petstore/typescript-angular2-with-npm/api/PetApi.ts b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/api/PetApi.ts rename to samples/client/petstore/typescript-angular2/default/api/PetApi.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/api/StoreApi.ts rename to samples/client/petstore/typescript-angular2/default/api/StoreApi.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/api/UserApi.ts b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/api/UserApi.ts rename to samples/client/petstore/typescript-angular2/default/api/UserApi.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/api/api.ts b/samples/client/petstore/typescript-angular2/default/api/api.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/api/api.ts rename to samples/client/petstore/typescript-angular2/default/api/api.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/index.ts b/samples/client/petstore/typescript-angular2/default/index.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/index.ts rename to samples/client/petstore/typescript-angular2/default/index.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/model/Category.ts b/samples/client/petstore/typescript-angular2/default/model/Category.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/model/Category.ts rename to samples/client/petstore/typescript-angular2/default/model/Category.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/model/Order.ts b/samples/client/petstore/typescript-angular2/default/model/Order.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/model/Order.ts rename to samples/client/petstore/typescript-angular2/default/model/Order.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/model/Pet.ts b/samples/client/petstore/typescript-angular2/default/model/Pet.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/model/Pet.ts rename to samples/client/petstore/typescript-angular2/default/model/Pet.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/model/Tag.ts b/samples/client/petstore/typescript-angular2/default/model/Tag.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/model/Tag.ts rename to samples/client/petstore/typescript-angular2/default/model/Tag.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/model/User.ts b/samples/client/petstore/typescript-angular2/default/model/User.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/model/User.ts rename to samples/client/petstore/typescript-angular2/default/model/User.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/model/models.ts b/samples/client/petstore/typescript-angular2/default/model/models.ts similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/model/models.ts rename to samples/client/petstore/typescript-angular2/default/model/models.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md similarity index 84% rename from samples/client/petstore/typescript-angular2-with-npm/README.md rename to samples/client/petstore/typescript-angular2/npm/README.md index 5c393dc49065..7fc18e940b3a 100644 --- a/samples/client/petstore/typescript-angular2-with-npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604211551 +## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604241113 ### Building @@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's. _published:_ ``` -npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604211551 --save +npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604241113 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/api/PetApi.ts b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/api/PetApi.ts rename to samples/client/petstore/typescript-angular2/npm/api/PetApi.ts diff --git a/samples/client/petstore/typescript-angular2/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/api/StoreApi.ts rename to samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts diff --git a/samples/client/petstore/typescript-angular2/api/UserApi.ts b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/api/UserApi.ts rename to samples/client/petstore/typescript-angular2/npm/api/UserApi.ts diff --git a/samples/client/petstore/typescript-angular2/api/api.ts b/samples/client/petstore/typescript-angular2/npm/api/api.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/api/api.ts rename to samples/client/petstore/typescript-angular2/npm/api/api.ts diff --git a/samples/client/petstore/typescript-angular2/index.ts b/samples/client/petstore/typescript-angular2/npm/index.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/index.ts rename to samples/client/petstore/typescript-angular2/npm/index.ts diff --git a/samples/client/petstore/typescript-angular2/model/Category.ts b/samples/client/petstore/typescript-angular2/npm/model/Category.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/model/Category.ts rename to samples/client/petstore/typescript-angular2/npm/model/Category.ts diff --git a/samples/client/petstore/typescript-angular2/model/Order.ts b/samples/client/petstore/typescript-angular2/npm/model/Order.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/model/Order.ts rename to samples/client/petstore/typescript-angular2/npm/model/Order.ts diff --git a/samples/client/petstore/typescript-angular2/model/Pet.ts b/samples/client/petstore/typescript-angular2/npm/model/Pet.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/model/Pet.ts rename to samples/client/petstore/typescript-angular2/npm/model/Pet.ts diff --git a/samples/client/petstore/typescript-angular2/model/Tag.ts b/samples/client/petstore/typescript-angular2/npm/model/Tag.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/model/Tag.ts rename to samples/client/petstore/typescript-angular2/npm/model/Tag.ts diff --git a/samples/client/petstore/typescript-angular2/model/User.ts b/samples/client/petstore/typescript-angular2/npm/model/User.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/model/User.ts rename to samples/client/petstore/typescript-angular2/npm/model/User.ts diff --git a/samples/client/petstore/typescript-angular2/model/models.ts b/samples/client/petstore/typescript-angular2/npm/model/models.ts similarity index 100% rename from samples/client/petstore/typescript-angular2/model/models.ts rename to samples/client/petstore/typescript-angular2/npm/model/models.ts diff --git a/samples/client/petstore/typescript-angular2-with-npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json similarity index 94% rename from samples/client/petstore/typescript-angular2-with-npm/package.json rename to samples/client/petstore/typescript-angular2/npm/package.json index f88c08d4df0b..0f4c2b3200a2 100644 --- a/samples/client/petstore/typescript-angular2-with-npm/package.json +++ b/samples/client/petstore/typescript-angular2/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201604211551", + "version": "0.0.1-SNAPSHOT.201604241113", "description": "swagger client for @swagger/angular2-typescript-petstore", "keywords": [ "swagger-client" diff --git a/samples/client/petstore/typescript-angular2-with-npm/tsconfig.json b/samples/client/petstore/typescript-angular2/npm/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/tsconfig.json rename to samples/client/petstore/typescript-angular2/npm/tsconfig.json diff --git a/samples/client/petstore/typescript-angular2-with-npm/typings.json b/samples/client/petstore/typescript-angular2/npm/typings.json similarity index 100% rename from samples/client/petstore/typescript-angular2-with-npm/typings.json rename to samples/client/petstore/typescript-angular2/npm/typings.json diff --git a/samples/server/petstore/slim/SwaggerServer/lib/models/ApiResponse.php b/samples/server/petstore/slim/SwaggerServer/lib/models/ApiResponse.php deleted file mode 100644 index 25779f3fc346..000000000000 --- a/samples/server/petstore/slim/SwaggerServer/lib/models/ApiResponse.php +++ /dev/null @@ -1,18 +0,0 @@ - Date: Mon, 25 Apr 2016 08:08:19 +0200 Subject: [PATCH 005/114] start adding packaging info to nodejs client. --- bin/typescript-angular2-petstore-with-npm.sh | 2 +- bin/typescript-node-petstore-with-npm.sh | 31 ++ ...-npm.json => typescript-petstore-npm.json} | 0 .../TypeScriptAngularClientCodegen.java | 2 +- .../TypeScriptNodeClientCodegen.java | 75 +++- .../typescript-angular2/package.mustache | 2 +- .../typescript-angular2/typings.mustache | 2 +- .../typescript-node/package.mustache | 22 + .../typescript-node/tsconfig.mustache | 14 + .../typescript-node/typings.mustache | 5 + .../typescript-angular2/npm/README.md | 4 +- .../typescript-angular2/npm/package.json | 4 +- .../typescript-angular2/npm/typings.json | 2 +- .../petstore/typescript-node/.gitignore | 3 - .../client/petstore/typescript-node/README.md | 22 - .../client/petstore/typescript-node/api.ts | 423 +----------------- .../client/petstore/typescript-node/client.ts | 59 --- .../petstore/typescript-node/package.json | 21 - .../petstore/typescript-node/sample.png | Bin 95 -> 0 bytes .../petstore/typescript-node/tsconfig.json | 13 - .../client/petstore/typescript-node/tsd.json | 21 - 21 files changed, 159 insertions(+), 568 deletions(-) create mode 100755 bin/typescript-node-petstore-with-npm.sh rename bin/{typescript-angular2-petstore-with-npm.json => typescript-petstore-npm.json} (100%) 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 delete mode 100644 samples/client/petstore/typescript-node/.gitignore delete mode 100644 samples/client/petstore/typescript-node/README.md delete mode 100644 samples/client/petstore/typescript-node/client.ts delete mode 100644 samples/client/petstore/typescript-node/package.json delete mode 100644 samples/client/petstore/typescript-node/sample.png delete mode 100644 samples/client/petstore/typescript-node/tsconfig.json delete mode 100644 samples/client/petstore/typescript-node/tsd.json diff --git a/bin/typescript-angular2-petstore-with-npm.sh b/bin/typescript-angular2-petstore-with-npm.sh index 6f13f3bfb32d..305a3e0b39de 100755 --- a/bin/typescript-angular2-petstore-with-npm.sh +++ b/bin/typescript-angular2-petstore-with-npm.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-angular2 -c bin/typescript-angular2-petstore-with-npm.json -o samples/client/petstore/typescript-angular2/npm" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular2 -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular2/npm" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-node-petstore-with-npm.sh b/bin/typescript-node-petstore-with-npm.sh new file mode 100755 index 000000000000..f4e8426fd56c --- /dev/null +++ b/bin/typescript-node-petstore-with-npm.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-node -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-node-with-npm" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular2-petstore-with-npm.json b/bin/typescript-petstore-npm.json similarity index 100% rename from bin/typescript-angular2-petstore-with-npm.json rename to bin/typescript-petstore-npm.json diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java index 670805efafdb..242293fc258c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java @@ -30,7 +30,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode outputFolder = "generated-code/typescript-angular"; modelTemplateFiles.put("model.mustache", ".ts"); apiTemplateFiles.put("api.mustache", ".ts"); - embeddedTemplateDir = templateDir = "TypeScript-Angular"; + embeddedTemplateDir = templateDir = "typescript-angular"; apiPackage = "API.Client"; modelPackage = "API.Client"; } 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 e590a60b3231..aff1fcb0e9bc 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 @@ -1,8 +1,26 @@ package io.swagger.codegen.languages; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; + import io.swagger.codegen.SupportingFile; public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen { + private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class); + private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); + + public static final String NPM_NAME = "npmName"; + public static final String NPM_VERSION = "npmVersion"; + public static final String NPM_REPOSITORY = "npmRepository"; + public static final String SNAPSHOT = "snapshot"; + + protected String npmName = null; + protected String npmVersion = "1.0.0"; + protected String npmRepository = null; @Override public String getName() { @@ -14,18 +32,71 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen return "Generates a TypeScript nodejs client library."; } - @Override + @Override public void processOpts() { 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)) { + addNpmPackageGeneration(); + } + } + + private void addNpmPackageGeneration() { + if(additionalProperties.containsKey(NPM_NAME)) { + this.setNpmName(additionalProperties.get(NPM_NAME).toString()); + } + + if (additionalProperties.containsKey(NPM_VERSION)) { + this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString()); + } + + if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) { + this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date())); + } + additionalProperties.put(NPM_VERSION, npmVersion); + + if (additionalProperties.containsKey(NPM_REPOSITORY)) { + this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString()); + } + + //Files for building our lib + supportingFiles.add(new SupportingFile("package.mustache", getPackageRootDirectory(), "package.json")); + supportingFiles.add(new SupportingFile("typings.mustache", getPackageRootDirectory(), "typings.json")); + supportingFiles.add(new SupportingFile("tsconfig.mustache", getPackageRootDirectory(), "tsconfig.json")); + } + + private String getPackageRootDirectory() { + String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); + return indexPackage.replace('.', File.separatorChar); } public TypeScriptNodeClientCodegen() { super(); outputFolder = "generated-code/typescript-node"; - embeddedTemplateDir = templateDir = "TypeScript-node"; + embeddedTemplateDir = templateDir = "typescript-node"; } + public void setNpmName(String npmName) { + this.npmName = npmName; + } + + public void setNpmVersion(String npmVersion) { + this.npmVersion = npmVersion; + } + + public String getNpmVersion() { + return npmVersion; + } + + public String getNpmRepository() { + return npmRepository; + } + + public void setNpmRepository(String npmRepository) { + this.npmRepository = npmRepository; + } } diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache index 18b375097c12..a472df51414a 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache @@ -2,6 +2,7 @@ "name": "{{npmName}}", "version": "{{npmVersion}}", "description": "swagger client for {{npmName}}", + "author": "Kristof Vrolijkx", "keywords": [ "swagger-client" ], @@ -31,5 +32,4 @@ "registry":"{{npmRepository}}" } {{/npmRepository}} - } diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/typings.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/typings.mustache index 32530eeb63dd..0848dcffe31e 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/typings.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/typings.mustache @@ -2,4 +2,4 @@ "ambientDependencies": { "core-js": "registry:dt/core-js#0.0.0+20160317120654" } -} +} \ No newline at end of file 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..410f23922422 --- /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": "Mads M. Tandrup", + "license": "Apache 2.0", + "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..9ae24570382a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": true, + "suppressImplicitAnyIndexErrors": true, + "target": "ES5" + }, + "files": [ + "api.ts", + "client.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..0848dcffe31e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache @@ -0,0 +1,5 @@ +{ + "ambientDependencies": { + "core-js": "registry:dt/core-js#0.0.0+20160317120654" + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index 7fc18e940b3a..f362d0329cce 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604241113 +## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604242228 ### Building @@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's. _published:_ ``` -npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604241113 --save +npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604242228 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json index 0f4c2b3200a2..01f8db7c5a01 100644 --- a/samples/client/petstore/typescript-angular2/npm/package.json +++ b/samples/client/petstore/typescript-angular2/npm/package.json @@ -1,7 +1,8 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201604241113", + "version": "0.0.1-SNAPSHOT.201604242228", "description": "swagger client for @swagger/angular2-typescript-petstore", + "author": "Kristof Vrolijkx", "keywords": [ "swagger-client" ], @@ -30,5 +31,4 @@ "publishConfig":{ "registry":"https://skimdb.npmjs.com/registry" } - } diff --git a/samples/client/petstore/typescript-angular2/npm/typings.json b/samples/client/petstore/typescript-angular2/npm/typings.json index 32530eeb63dd..0848dcffe31e 100644 --- a/samples/client/petstore/typescript-angular2/npm/typings.json +++ b/samples/client/petstore/typescript-angular2/npm/typings.json @@ -2,4 +2,4 @@ "ambientDependencies": { "core-js": "registry:dt/core-js#0.0.0+20160317120654" } -} +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/.gitignore b/samples/client/petstore/typescript-node/.gitignore deleted file mode 100644 index 5c06ad7bc24c..000000000000 --- a/samples/client/petstore/typescript-node/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/node_modules -/typings -/*.js diff --git a/samples/client/petstore/typescript-node/README.md b/samples/client/petstore/typescript-node/README.md deleted file mode 100644 index 02d993a5de9e..000000000000 --- a/samples/client/petstore/typescript-node/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# SwaggerClient - -Sample of TypeScript Node.js petstore client - -## Testing the generated code - -``` -npm install -npm test -``` - -This will compile the code and run a small test application that will do some simple test calls to the Swagger Petstore API. - -To clean the workspace run: -``` -npm run clean -``` - - -## Author - -mads@maetzke-tandrup.dk, Swagger-Codegen community diff --git a/samples/client/petstore/typescript-node/api.ts b/samples/client/petstore/typescript-node/api.ts index 1e314a3fc649..10aa9d5125c2 100644 --- a/samples/client/petstore/typescript-node/api.ts +++ b/samples/client/petstore/typescript-node/api.ts @@ -8,78 +8,11 @@ import http = require('http'); /* tslint:disable:no-unused-variable */ -export class Animal { - "className": string; -} - -export class Cat extends Animal { - "declawed": boolean; -} - export class Category { "id": number; "name": string; } -export class Dog extends Animal { - "breed": string; -} - -export class FormatTest { - "integer": number; - "int32": number; - "int64": number; - "number": number; - "float": number; - "double": number; - "string": string; - "byte": string; - "binary": string; - "date": Date; - "dateTime": string; -} - -export class InlineResponse200 { - "tags": Array; - "id": number; - "category": any; - /** - * pet status in the store - */ - "status": InlineResponse200.StatusEnum; - "name": string; - "photoUrls": Array; -} - -export namespace InlineResponse200 { - export enum StatusEnum { - available = 'available', - pending = 'pending', - sold = 'sold' - } -} -/** -* Model for testing model name starting with number -*/ -export class Model200Response { - "name": number; -} - -/** -* Model for testing reserved words -*/ -export class ModelReturn { - "return": number; -} - -/** -* Model for testing model name same as property name -*/ -export class Name { - "name": number; - "snakeCase": number; -} - export class Order { "id": number; "petId": number; @@ -118,10 +51,6 @@ export namespace Pet { sold = 'sold' } } -export class SpecialModelName { - "$Special[propertyName]": number; -} - export class Tag { "id": number; "name": string; @@ -191,11 +120,7 @@ class VoidAuth implements Authentication { } export enum PetApiApiKeys { - test_api_key_header, api_key, - test_api_client_secret, - test_api_client_id, - test_api_key_query, } export class PetApi { @@ -204,21 +129,13 @@ export class PetApi { protected authentications = { 'default': new VoidAuth(), - 'test_api_key_header': new ApiKeyAuth('header', 'test_api_key_header'), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'test_http_basic': new HttpBasicAuth(), - 'test_api_client_secret': new ApiKeyAuth('header', 'x-test_api_client_secret'), - 'test_api_client_id': new ApiKeyAuth('header', 'x-test_api_client_id'), - 'test_api_key_query': new ApiKeyAuth('query', 'test_api_key_query'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } constructor(basePath?: string); - constructor(username: string, password: string, basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { - this.username = basePathOrUsername; - this.password = password if (basePath) { this.basePath = basePath; } @@ -233,14 +150,6 @@ export class PetApi { this.authentications[PetApiApiKeys[key]].apiKey = value; } - set username(username: string) { - this.authentications.test_http_basic.username = username; - } - - set password(password: string) { - this.authentications.test_http_basic.password = password; - } - set accessToken(token: string) { this.authentications.petstore_auth.accessToken = token; } @@ -264,57 +173,6 @@ export class PetApi { let formParams: any = {}; - let useFormData = false; - - let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); - - let requestOptions: request.Options = { - 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, (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; - } - /** - * 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) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet?testing_byte_array=true'; - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - let useFormData = false; let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); @@ -415,8 +273,8 @@ export class PetApi { } /** * 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) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/pet/findByStatus'; @@ -551,126 +409,10 @@ export class PetApi { 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, (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; - } - /** - * 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) : Promise<{ response: http.ClientResponse; body: InlineResponse200; }> { - const localVarPath = this.basePath + '/pet/{petId}?response=inline_arbitrary_object' - .replace('{' + 'petId' + '}', String(petId)); - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // 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 getPetByIdInObject.'); - } - - let useFormData = false; - - let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: InlineResponse200; }>(); - - let requestOptions: request.Options = { - 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, (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; - } - /** - * 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) : Promise<{ response: http.ClientResponse; body: string; }> { - const localVarPath = this.basePath + '/pet/{petId}?testing_byte_array=true' - .replace('{' + 'petId' + '}', String(petId)); - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // 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 petPetIdtestingByteArraytrueGet.'); - } - - 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.api_key.applyToRequest(requestOptions); - - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { @@ -881,11 +623,7 @@ export class PetApi { } } export enum StoreApiApiKeys { - test_api_key_header, api_key, - test_api_client_secret, - test_api_client_id, - test_api_key_query, } export class StoreApi { @@ -894,21 +632,13 @@ export class StoreApi { protected authentications = { 'default': new VoidAuth(), - 'test_api_key_header': new ApiKeyAuth('header', 'test_api_key_header'), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'test_http_basic': new HttpBasicAuth(), - 'test_api_client_secret': new ApiKeyAuth('header', 'x-test_api_client_secret'), - 'test_api_client_id': new ApiKeyAuth('header', 'x-test_api_client_id'), - 'test_api_key_query': new ApiKeyAuth('query', 'test_api_key_query'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } constructor(basePath?: string); - constructor(username: string, password: string, basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { - this.username = basePathOrUsername; - this.password = password if (basePath) { this.basePath = basePath; } @@ -923,14 +653,6 @@ export class StoreApi { this.authentications[StoreApiApiKeys[key]].apiKey = value; } - set username(username: string) { - this.authentications.test_http_basic.username = username; - } - - set password(password: string) { - this.authentications.test_http_basic.password = password; - } - set accessToken(token: string) { this.authentications.petstore_auth.accessToken = token; } @@ -996,62 +718,6 @@ export class StoreApi { return localVarDeferred.promise; } - /** - * 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) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/store/findByStatus'; - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - if (status !== undefined) { - queryParameters['status'] = status; - } - - 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.test_api_client_id.applyToRequest(requestOptions); - - this.authentications.test_api_client_secret.applyToRequest(requestOptions); - - 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; - } /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -1101,55 +767,6 @@ export class StoreApi { return localVarDeferred.promise; } - /** - * 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 () : Promise<{ response: http.ClientResponse; body: any; }> { - const localVarPath = this.basePath + '/store/inventory?response=arbitrary_object'; - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - 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.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, (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 @@ -1180,10 +797,6 @@ export class StoreApi { json: true, } - this.authentications.test_api_key_header.applyToRequest(requestOptions); - - this.authentications.test_api_key_query.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { @@ -1233,10 +846,6 @@ export class StoreApi { body: body, } - this.authentications.test_api_client_id.applyToRequest(requestOptions); - - this.authentications.test_api_client_secret.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { @@ -1263,11 +872,7 @@ export class StoreApi { } } export enum UserApiApiKeys { - test_api_key_header, api_key, - test_api_client_secret, - test_api_client_id, - test_api_key_query, } export class UserApi { @@ -1276,21 +881,13 @@ export class UserApi { protected authentications = { 'default': new VoidAuth(), - 'test_api_key_header': new ApiKeyAuth('header', 'test_api_key_header'), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'test_http_basic': new HttpBasicAuth(), - 'test_api_client_secret': new ApiKeyAuth('header', 'x-test_api_client_secret'), - 'test_api_client_id': new ApiKeyAuth('header', 'x-test_api_client_id'), - 'test_api_key_query': new ApiKeyAuth('query', 'test_api_key_query'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } constructor(basePath?: string); - constructor(username: string, password: string, basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { - this.username = basePathOrUsername; - this.password = password if (basePath) { this.basePath = basePath; } @@ -1305,14 +902,6 @@ export class UserApi { this.authentications[UserApiApiKeys[key]].apiKey = value; } - set username(username: string) { - this.authentications.test_http_basic.username = username; - } - - set password(password: string) { - this.authentications.test_http_basic.password = password; - } - set accessToken(token: string) { this.authentications.petstore_auth.accessToken = token; } @@ -1501,8 +1090,6 @@ export class UserApi { json: true, } - this.authentications.test_http_basic.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { diff --git a/samples/client/petstore/typescript-node/client.ts b/samples/client/petstore/typescript-node/client.ts deleted file mode 100644 index 51a7f687e09f..000000000000 --- a/samples/client/petstore/typescript-node/client.ts +++ /dev/null @@ -1,59 +0,0 @@ -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); - }); diff --git a/samples/client/petstore/typescript-node/package.json b/samples/client/petstore/typescript-node/package.json deleted file mode 100644 index ee598dcc6c22..000000000000 --- a/samples/client/petstore/typescript-node/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "petstore-typescript-node-sample", - "version": "1.0.0", - "description": "Sample of generated TypeScript petstore client", - "main": "api.js", - "scripts": { - "postinstall": "tsd reinstall --overwrite", - "test": "tsc && node client.js", - "clean": "rm -Rf node_modules/ typings/ *.js" - }, - "author": "Mads M. Tandrup", - "license": "Apache 2.0", - "dependencies": { - "bluebird": "^2.9.34", - "request": "^2.60.0" - }, - "devDependencies": { - "tsd": "^0.6.3", - "typescript": "^1.5.3" - } -} diff --git a/samples/client/petstore/typescript-node/sample.png b/samples/client/petstore/typescript-node/sample.png deleted file mode 100644 index c5916f289705642eec4975cf51458b9afeefe46c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?juK#@*VoWXSL2@NQe!*uh mnS}iXa=1KQ978JRBqsscYz)k1<~1vTECx?kKbLh*2~7ZT-W2Wt diff --git a/samples/client/petstore/typescript-node/tsconfig.json b/samples/client/petstore/typescript-node/tsconfig.json deleted file mode 100644 index 7c4f5847040c..000000000000 --- a/samples/client/petstore/typescript-node/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "noImplicitAny": true, - "suppressImplicitAnyIndexErrors": true, - "target": "ES5" - }, - "files": [ - "api.ts", - "client.ts", - "typings/tsd.d.ts" - ] -} diff --git a/samples/client/petstore/typescript-node/tsd.json b/samples/client/petstore/typescript-node/tsd.json deleted file mode 100644 index 89e4861f9491..000000000000 --- a/samples/client/petstore/typescript-node/tsd.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "v4", - "repo": "borisyankov/DefinitelyTyped", - "ref": "master", - "path": "typings", - "bundle": "typings/tsd.d.ts", - "installed": { - "bluebird/bluebird.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 c91f23c2ca4f6925149ba7c0f94c6007fd51d37c Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Mon, 25 Apr 2016 23:00:48 +0200 Subject: [PATCH 006/114] adding extra nodeClientOptions --- .../TypeScriptNodeClientCodegen.java | 33 ++++++++++++------- ...peScriptAngular2ClientOptionsProvider.java | 4 +-- .../TypeScriptNodeClientOptionsProvider.java | 14 ++++++-- 3 files changed, 35 insertions(+), 16 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 aff1fcb0e9bc..3950c1a7ff32 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 @@ -7,7 +7,9 @@ import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; +import io.swagger.codegen.CliOption; import io.swagger.codegen.SupportingFile; +import io.swagger.models.properties.BooleanProperty; public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class); @@ -22,15 +24,17 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen protected String npmVersion = "1.0.0"; protected String npmRepository = null; - @Override - public String getName() { - return "typescript-node"; + public TypeScriptNodeClientCodegen() { + super(); + outputFolder = "generated-code/typescript-node"; + embeddedTemplateDir = templateDir = "typescript-node"; + + 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")); + this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); + this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); } - @Override - public String getHelp() { - return "Generates a TypeScript nodejs client library."; - } @Override public void processOpts() { @@ -73,13 +77,18 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); return indexPackage.replace('.', File.separatorChar); } - - public TypeScriptNodeClientCodegen() { - super(); - outputFolder = "generated-code/typescript-node"; - embeddedTemplateDir = templateDir = "typescript-node"; + + @Override + public String getName() { + return "typescript-node"; } + @Override + public String getHelp() { + return "Generates a TypeScript nodejs client library."; + } + + public void setNpmName(String npmName) { this.npmName = npmName; } 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 a72d6b568c18..f0bca356d6f5 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 @@ -10,8 +10,8 @@ import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; public class TypeScriptAngular2ClientOptionsProvider 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"; - public static final String NMP_NAME = "npmName"; + private static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; + private static final String NMP_NAME = "npmName"; private static final String NMP_VERSION = "1.1.2"; private static final String NPM_REPOSITORY = "https://registry.npmjs.org"; 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 01966ff71690..bfbd3528e87a 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 @@ -1,16 +1,22 @@ package io.swagger.codegen.options; -import io.swagger.codegen.CodegenConstants; - import com.google.common.collect.ImmutableMap; import java.util.Map; +import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; + + public class TypeScriptNodeClientOptionsProvider 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"; + private static final String NMP_NAME = "npmName"; + private static final String NMP_VERSION = "1.1.2"; + private static final String NPM_REPOSITORY = "https://registry.npmjs.org"; + @Override public String getLanguage() { return "typescript-node"; @@ -22,6 +28,10 @@ public class TypeScriptNodeClientOptionsProvider 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(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME) + .put(TypeScriptAngular2ClientCodegen.NPM_VERSION, NMP_VERSION) + .put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) + .put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) .build(); } From a3701cd81cd893850d316cd995fb725c0f9ea7e8 Mon Sep 17 00:00:00 2001 From: Silvio Heuberger Date: Thu, 31 Mar 2016 14:26:14 +0200 Subject: [PATCH 007/114] Update retrofit2 and retrofit2rx to use retrofit 2.0.1 --- .../swagger/codegen/languages/JavaClientCodegen.java | 2 +- .../Java/libraries/retrofit2/build.gradle.mustache | 5 ++--- .../resources/Java/libraries/retrofit2/pom.mustache | 10 +++------- 3 files changed, 6 insertions(+), 11 deletions(-) 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 9fe2b6fc370a..2bd79dbf015e 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 @@ -110,7 +110,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.6"); supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1"); supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1 (Retrofit 1.9.0)"); - supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 2.5.0. JSON processing: Gson 2.4 (Retrofit 2.0.0-beta4). Enable the RxJava adapter using '-DuseRxJava=true'."); + supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 2.5.0. JSON processing: Gson 2.4 (Retrofit 2.0.1). Enable the RxJava adapter using '-DuseRxJava=true'. (RxJava 1.1.2)"); CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); library.setDefault(DEFAULT_LIBRARY); diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index 1be055c1fff3..3f07e9df1776 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -94,9 +94,8 @@ if(hasProperty('target') && target == 'android') { } ext { - oltu_version = "1.0.1" - retrofit_version = "2.0.0-beta4" - gson_version = "2.6.2" + oltu_version = "1.0.0" + retrofit_version = "2.0.1" swagger_annotations_version = "1.5.8" junit_version = "4.12" {{#useRxJava}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache index 11bbae5797aa..d120e7255c61 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -122,11 +122,6 @@ converter-scalars ${retrofit-version} - - com.squareup.retrofit2 - converter-gson - ${retrofit-version} - org.apache.oltu.oauth2 org.apache.oltu.oauth2.client @@ -153,8 +148,9 @@ 1.5.8 - 2.0.0-beta4{{#useRxJava}} - 1.1.3{{/useRxJava}} + 2.0.1 + {{#useRxJava}}1.1.3{{/useRxJava}} + 3.0.1 1.0.1 1.0.0 4.12 From 4b3dad7fb0c0bace15a0c039b8130bcc8f7668c3 Mon Sep 17 00:00:00 2001 From: Silvio Heuberger Date: Fri, 1 Apr 2016 11:00:50 +0200 Subject: [PATCH 008/114] Fix pom.mustache of retrofit2 client lib --- .../src/main/resources/Java/libraries/retrofit2/pom.mustache | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache index d120e7255c61..e33d026aaf5c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -112,6 +112,11 @@ swagger-annotations ${swagger-core-version} + + com.squareup.retrofit2 + converter-gson + ${retrofit-version} + com.squareup.retrofit2 retrofit From 21b39e24afd56fabec4591ee7e574d9f3de4a8f9 Mon Sep 17 00:00:00 2001 From: Silvio Heuberger Date: Wed, 27 Apr 2016 10:01:20 +0200 Subject: [PATCH 009/114] Update libraries to the newest stable version --- .../resources/Java/libraries/retrofit2/build.gradle.mustache | 4 ++-- .../src/main/resources/Java/libraries/retrofit2/pom.mustache | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index 3f07e9df1776..e56e682cfcd2 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -94,8 +94,8 @@ if(hasProperty('target') && target == 'android') { } ext { - oltu_version = "1.0.0" - retrofit_version = "2.0.1" + oltu_version = "1.0.1" + retrofit_version = "2.0.2" swagger_annotations_version = "1.5.8" junit_version = "4.12" {{#useRxJava}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache index e33d026aaf5c..30f6a71d285c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -153,9 +153,9 @@ 1.5.8 - 2.0.1 + 2.0.2 {{#useRxJava}}1.1.3{{/useRxJava}} - 3.0.1 + 3.2.0 1.0.1 1.0.0 4.12 From 39c08b2cfc38312fccb8c4f7ebca21fc5c015acc Mon Sep 17 00:00:00 2001 From: Silvio Heuberger Date: Wed, 27 Apr 2016 10:03:45 +0200 Subject: [PATCH 010/114] Regenrate samples after updating the libraries in pom and build.gradle mustache --- .../petstore/java/retrofit2/build.gradle | 3 +- .../client/petstore/java/retrofit2/hello.txt | 1 - .../client/petstore/java/retrofit2/pom.xml | 17 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 43 +++ .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/model/FormatTest.java | 16 +- .../src/test/java/io/swagger/TestUtils.java | 17 -- .../io/swagger/petstore/test/PetApiTest.java | 190 ------------- .../swagger/petstore/test/StoreApiTest.java | 74 ----- .../io/swagger/petstore/test/UserApiTest.java | 86 ------ .../petstore/java/retrofit2rx/build.gradle | 9 +- .../client/petstore/java/retrofit2rx/pom.xml | 24 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 43 +++ .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/model/FormatTest.java | 16 +- .../io/swagger/petstore/test/PetApiTest.java | 255 ------------------ .../petstore/test/SkeletonSubscriber.java | 30 --- .../swagger/petstore/test/StoreApiTest.java | 96 ------- .../io/swagger/petstore/test/UserApiTest.java | 108 -------- 21 files changed, 142 insertions(+), 894 deletions(-) delete mode 100644 samples/client/petstore/java/retrofit2/hello.txt create mode 100644 samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java delete mode 100644 samples/client/petstore/java/retrofit2/src/test/java/io/swagger/TestUtils.java delete mode 100644 samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/PetApiTest.java delete mode 100644 samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/StoreApiTest.java delete mode 100644 samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/UserApiTest.java create mode 100644 samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java delete mode 100644 samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/PetApiTest.java delete mode 100644 samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/SkeletonSubscriber.java delete mode 100644 samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/StoreApiTest.java delete mode 100644 samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/UserApiTest.java diff --git a/samples/client/petstore/java/retrofit2/build.gradle b/samples/client/petstore/java/retrofit2/build.gradle index fb29db0475cf..6b96656a4a8b 100644 --- a/samples/client/petstore/java/retrofit2/build.gradle +++ b/samples/client/petstore/java/retrofit2/build.gradle @@ -95,8 +95,7 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" - retrofit_version = "2.0.0-beta4" - gson_version = "2.6.2" + retrofit_version = "2.0.2" swagger_annotations_version = "1.5.8" junit_version = "4.12" diff --git a/samples/client/petstore/java/retrofit2/hello.txt b/samples/client/petstore/java/retrofit2/hello.txt deleted file mode 100644 index 6769dd60bdf5..000000000000 --- a/samples/client/petstore/java/retrofit2/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index c9ec80dacf42..05774ac38340 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -100,8 +100,7 @@ maven-compiler-plugin 2.3.2 - - 1.7 + 1.7 1.7 @@ -113,6 +112,11 @@ swagger-annotations ${swagger-core-version} + + com.squareup.retrofit2 + converter-gson + ${retrofit-version} + com.squareup.retrofit2 retrofit @@ -123,11 +127,6 @@ converter-scalars ${retrofit-version} - - com.squareup.retrofit2 - converter-gson - ${retrofit-version} - org.apache.oltu.oauth2 org.apache.oltu.oauth2.client @@ -144,7 +143,9 @@ 1.5.8 - 2.0.0-beta4 + 2.0.2 + + 3.2.0 1.0.1 1.0.0 4.12 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 c56ed86683af..f5e5cea41514 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-22T23:08:50.551+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T10:03:24.454+02: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/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java new file mode 100644 index 000000000000..dc732e67ae73 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -0,0 +1,43 @@ +package io.swagger.client.api; + +import io.swagger.client.CollectionFormats.*; + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; + +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 + * 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 Call + */ + + @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 + ); + +} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java index dd39a864f06a..ec9d67a74497 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/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 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/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 29d17bbdfe70..40d1ca0ecea9 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 @@ -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/retrofit2/src/test/java/io/swagger/TestUtils.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/TestUtils.java deleted file mode 100644 index 7ddf142426eb..000000000000 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/TestUtils.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.swagger; - -import java.util.Random; -import java.util.concurrent.atomic.AtomicLong; - -public class TestUtils { - private static final AtomicLong atomicId = createAtomicId(); - - public static long nextId() { - return atomicId.getAndIncrement(); - } - - private static AtomicLong createAtomicId() { - int baseId = new Random(System.currentTimeMillis()).nextInt(1000000) + 20000; - return new AtomicLong((long) baseId); - } -} diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/PetApiTest.java deleted file mode 100644 index ac8abefb216a..000000000000 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ /dev/null @@ -1,190 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.ApiClient; -import io.swagger.client.CollectionFormats.*; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.junit.*; - -import retrofit2.Response; - -import okhttp3.MediaType; -import okhttp3.RequestBody; - -import static org.junit.Assert.*; - -public class PetApiTest { - PetApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(PetApi.class); - } - - @Test - public void testCreateAndGetPet() throws Exception { - Pet pet = createRandomPet(); - Response rp2 = api.addPet(pet).execute(); - - Response rp = api.getPetById(pet.getId()).execute(); - Pet fetched = rp.body(); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testUpdatePet() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet).execute(); - - Pet fetched = api.getPetById(pet.getId()).execute().body(); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testFindPetsByStatus() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - api.updatePet(pet).execute(); - - List pets = api.findPetsByStatus(new CSVParams("available")).execute().body(); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - } - - @Test - public void testFindPetsByTags() throws Exception { - Pet pet = createRandomPet(); - pet.setName("monster"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - List tags = new ArrayList(); - Tag tag1 = new Tag(); - tag1.setName("friendly"); - tags.add(tag1); - pet.setTags(tags); - - api.updatePet(pet).execute(); - - List pets = api.findPetsByTags(new CSVParams("friendly")).execute().body(); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - assertTrue(found); - } - - @Test - public void testUpdatePetWithForm() throws Exception { - Pet pet = createRandomPet(); - pet.setName("frank"); - api.addPet(pet).execute(); - - Pet fetched = api.getPetById(pet.getId()).execute().body(); - - api.updatePetWithForm(fetched.getId(), "furt", null).execute(); - Pet updated = api.getPetById(fetched.getId()).execute().body(); - - assertEquals(updated.getName(), "furt"); - } - - @Test - public void testDeletePet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet).execute(); - - Pet fetched = api.getPetById(pet.getId()).execute().body(); - api.deletePet(fetched.getId(), null).execute(); - - assertFalse(api.getPetById(fetched.getId()).execute().isSuccess()); - } - - @Test - public void testUploadFile() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet).execute(); - - File file = new File("hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("Hello world!"); - writer.close(); - - api.uploadFile(pet.getId(), null, RequestBody.create(MediaType.parse("text/plain"), file)).execute(); - } - - @Test - public void testEqualsAndHashCode() { - Pet pet1 = new Pet(); - Pet pet2 = new Pet(); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - - pet2.setName("really-happy"); - pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertFalse(pet1.equals(pet2)); - assertFalse(pet2.equals(pet1)); - assertFalse(pet1.hashCode() == (pet2.hashCode())); - assertTrue(pet2.equals(pet2)); - assertTrue(pet2.hashCode() == pet2.hashCode()); - - pet1.setName("really-happy"); - pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); - pet.setPhotoUrls(photos); - - return pet; - } -} diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/StoreApiTest.java deleted file mode 100644 index 249d5dc48281..000000000000 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ /dev/null @@ -1,74 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.ApiClient; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import java.lang.reflect.Field; -import java.util.Map; - -import org.junit.*; - -import retrofit2.Response; -import static org.junit.Assert.*; - -public class StoreApiTest { - StoreApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(StoreApi.class); - } - - @Test - public void testGetInventory() throws Exception { - Map inventory = api.getInventory().execute().body(); - assertTrue(inventory.keySet().size() > 0); - } - - @Test - public void testPlaceOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order).execute(); - - Order fetched = api.getOrderById(order.getId()).execute().body(); - assertEquals(order.getId(), fetched.getId()); - assertEquals(order.getPetId(), fetched.getPetId()); - assertEquals(order.getQuantity(), fetched.getQuantity()); - } - - @Test - public void testDeleteOrder() throws Exception { - Order order = createOrder(); - Response aa = api.placeOrder(order).execute(); - - Order fetched = api.getOrderById(order.getId()).execute().body(); - assertEquals(fetched.getId(), order.getId()); - - api.deleteOrder(String.valueOf(order.getId())).execute(); - - api.getOrderById(order.getId()).execute(); - //also in retrofit 1 should return an error but don't, check server api impl. - } - - private Order createOrder() { - Order order = new Order(); - order.setPetId(new Long(200)); - order.setQuantity(new Integer(13)); - order.setShipDate(new java.util.Date()); - order.setStatus(Order.StatusEnum.PLACED); - order.setComplete(true); - - try { - Field idField = Order.class.getDeclaredField("id"); - idField.setAccessible(true); - idField.set(order, TestUtils.nextId()); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return order; - } -} diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/UserApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/UserApiTest.java deleted file mode 100644 index 6c35c94383ab..000000000000 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/UserApiTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.ApiClient; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - - -import java.util.Arrays; - -import org.junit.*; -import static org.junit.Assert.*; - -public class UserApiTest { - UserApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(UserApi.class); - } - - @Test - public void testCreateUser() throws Exception { - User user = createUser(); - - api.createUser(user).execute(); - - User fetched = api.getUserByName(user.getUsername()).execute().body(); - assertEquals(user.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithArray() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})).execute(); - - User fetched = api.getUserByName(user1.getUsername()).execute().body(); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithList() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})).execute(); - - User fetched = api.getUserByName(user1.getUsername()).execute().body(); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testLoginUser() throws Exception { - User user = createUser(); - api.createUser(user).execute(); - - String token = api.loginUser(user.getUsername(), user.getPassword()).execute().body(); - assertTrue(token.startsWith("logged in user session:")); - } - - @Test - public void logoutUser() throws Exception { - api.logoutUser().execute(); - } - - private User createUser() { - User user = new User(); - user.setId(TestUtils.nextId()); - user.setUsername("fred"); - user.setFirstName("Fred"); - user.setLastName("Meyer"); - user.setEmail("fred@fredmeyer.com"); - user.setPassword("xxXXxx"); - user.setPhone("408-867-5309"); - user.setUserStatus(123); - - return user; - } -} diff --git a/samples/client/petstore/java/retrofit2rx/build.gradle b/samples/client/petstore/java/retrofit2rx/build.gradle index 123bae25560b..cbd0119e24b5 100644 --- a/samples/client/petstore/java/retrofit2rx/build.gradle +++ b/samples/client/petstore/java/retrofit2rx/build.gradle @@ -94,12 +94,11 @@ if(hasProperty('target') && target == 'android') { } ext { - oltu_version = "1.0.0" - retrofit_version = "2.0.0-beta4" - gson_version = "2.4" - swagger_annotations_version = "1.5.0" + oltu_version = "1.0.1" + retrofit_version = "2.0.2" + swagger_annotations_version = "1.5.8" junit_version = "4.12" - rx_java_version = "1.0.16" + rx_java_version = "1.1.3" } diff --git a/samples/client/petstore/java/retrofit2rx/pom.xml b/samples/client/petstore/java/retrofit2rx/pom.xml index b2cf99495787..79d826c3a41f 100644 --- a/samples/client/petstore/java/retrofit2rx/pom.xml +++ b/samples/client/petstore/java/retrofit2rx/pom.xml @@ -100,8 +100,7 @@ maven-compiler-plugin 2.3.2 - - 1.7 + 1.7 1.7 @@ -111,7 +110,12 @@ io.swagger swagger-annotations - ${swagger-annotations-version} + ${swagger-core-version} + + + com.squareup.retrofit2 + converter-gson + ${retrofit-version} com.squareup.retrofit2 @@ -123,11 +127,6 @@ converter-scalars ${retrofit-version} - - com.squareup.retrofit2 - converter-gson - ${retrofit-version} - org.apache.oltu.oauth2 org.apache.oltu.oauth2.client @@ -153,10 +152,11 @@ - 1.5.0 - 2.0.0-beta4 - 1.0.16 - 1.0.0 + 1.5.8 + 2.0.2 + 1.1.3 + 3.2.0 + 1.0.1 1.0.0 4.12 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 9b9c01b35b27..cee81411e96a 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-22T23:10:58.658+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T10:03:29.641+02: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 new file mode 100644 index 000000000000..beaa9833892a --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java @@ -0,0 +1,43 @@ +package io.swagger.client.api; + +import io.swagger.client.CollectionFormats.*; + +import rx.Observable; + +import retrofit2.http.*; + +import okhttp3.RequestBody; + +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 + * 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 Call + */ + + @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 + ); + +} 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 304ea7a29a8b..4a2e64b726e3 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 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/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 29d17bbdfe70..40d1ca0ecea9 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 @@ -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/retrofit2rx/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/PetApiTest.java deleted file mode 100644 index e506ec00e9af..000000000000 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ /dev/null @@ -1,255 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.client.ApiClient; -import io.swagger.client.CollectionFormats.*; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.junit.*; - -import okhttp3.MediaType; -import okhttp3.RequestBody; - -import static org.junit.Assert.*; - -public class PetApiTest { - PetApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(PetApi.class); - } - - @Test - public void testCreateAndGetPet() throws Exception { - final Pet pet = createRandomPet(); - api.addPet(pet).subscribe(new SkeletonSubscriber() { - @Override - public void onCompleted() { - api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(Pet fetched) { - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - }); - - } - }); - - } - - @Test - public void testUpdatePet() throws Exception { - final Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet).subscribe(new SkeletonSubscriber() { - @Override - public void onCompleted() { - api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(Pet fetched) { - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - }); - - } - }); - - } - - @Test - public void testFindPetsByStatus() throws Exception { - final Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - api.updatePet(pet).subscribe(new SkeletonSubscriber() { - @Override - public void onCompleted() { - api.findPetsByStatus(new CSVParams("available")).subscribe(new SkeletonSubscriber>() { - @Override - public void onNext(List pets) { - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - } - }); - - } - }); - - } - - @Test - public void testFindPetsByTags() throws Exception { - final Pet pet = createRandomPet(); - pet.setName("monster"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - List tags = new ArrayList(); - Tag tag1 = new Tag(); - tag1.setName("friendly"); - tags.add(tag1); - pet.setTags(tags); - - api.updatePet(pet).subscribe(new SkeletonSubscriber() { - @Override - public void onCompleted() { - api.findPetsByTags(new CSVParams("friendly")).subscribe(new SkeletonSubscriber>() { - @Override - public void onNext(List pets) { - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - assertTrue(found); - } - }); - - } - }); - - } - - @Test - public void testUpdatePetWithForm() throws Exception { - final Pet pet = createRandomPet(); - pet.setName("frank"); - api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError()); - api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(final Pet fetched) { - api.updatePetWithForm(fetched.getId(), "furt", null) - .subscribe(new SkeletonSubscriber() { - @Override - public void onCompleted() { - api.getPetById(fetched.getId()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(Pet updated) { - assertEquals(updated.getName(), "furt"); - } - }); - - } - }); - } - }); - - - } - - @Test - public void testDeletePet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError()); - - api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(Pet fetched) { - - api.deletePet(fetched.getId(), null).subscribe(SkeletonSubscriber.failTestOnError()); - api.getPetById(fetched.getId()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(Pet deletedPet) { - fail("Should not have found deleted pet."); - } - - @Override - public void onError(Throwable e) { - // expected, because the pet has been deleted. - } - }); - } - }); - } - - @Test - public void testUploadFile() throws Exception { - File file = File.createTempFile("test", "hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - - writer.write("Hello world!"); - writer.close(); - - Pet pet = createRandomPet(); - api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError()); - - RequestBody body = RequestBody.create(MediaType.parse("text/plain"), file); - api.uploadFile(pet.getId(), "a test file", body).subscribe(new SkeletonSubscriber() { - @Override - public void onError(Throwable e) { - // this also yields a 400 for other tests, so I guess it's okay... - } - }); - } - - @Test - public void testEqualsAndHashCode() { - Pet pet1 = new Pet(); - Pet pet2 = new Pet(); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - - pet2.setName("really-happy"); - pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertFalse(pet1.equals(pet2)); - assertFalse(pet2.equals(pet1)); - assertFalse(pet1.hashCode() == (pet2.hashCode())); - assertTrue(pet2.equals(pet2)); - assertTrue(pet2.hashCode() == pet2.hashCode()); - - pet1.setName("really-happy"); - pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(System.currentTimeMillis()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); - pet.setPhotoUrls(photos); - - return pet; - } -} diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/SkeletonSubscriber.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/SkeletonSubscriber.java deleted file mode 100644 index 5d34a1e5d5d6..000000000000 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/SkeletonSubscriber.java +++ /dev/null @@ -1,30 +0,0 @@ -package io.swagger.petstore.test; - -import junit.framework.TestFailure; -import rx.Subscriber; - -/** - * Skeleton subscriber for tests that will fail when onError() is called unexpectedly. - */ -public abstract class SkeletonSubscriber extends Subscriber { - - public static SkeletonSubscriber failTestOnError() { - return new SkeletonSubscriber() { - }; - } - - @Override - public void onCompleted() { - // space for rent - } - - @Override - public void onNext(T t) { - // space for rent - } - - @Override - public void onError(Throwable e) { - throw new RuntimeException("Subscriber onError() called with unhandled exception!", e); - } -} diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/StoreApiTest.java deleted file mode 100644 index f5a34eab2002..000000000000 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.client.ApiClient; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import java.lang.reflect.Field; -import java.util.Map; - -import org.junit.*; - -import retrofit2.Response; - -import static org.junit.Assert.*; - -public class StoreApiTest { - StoreApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(StoreApi.class); - } - - @Test - public void testGetInventory() throws Exception { - api.getInventory().subscribe(new SkeletonSubscriber>() { - @Override - public void onNext(Map inventory) { - assertTrue(inventory.keySet().size() > 0); - } - }); - - } - - @Test - public void testPlaceOrder() throws Exception { - final Order order = createOrder(); - api.placeOrder(order).subscribe(SkeletonSubscriber.failTestOnError()); - api.getOrderById(order.getId()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(Order fetched) { - assertEquals(order.getId(), fetched.getId()); - assertEquals(order.getPetId(), fetched.getPetId()); - assertEquals(order.getQuantity(), fetched.getQuantity()); - } - }); - } - - @Test - public void testDeleteOrder() throws Exception { - final Order order = createOrder(); - api.placeOrder(order).subscribe(SkeletonSubscriber.failTestOnError()); - - api.getOrderById(order.getId()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(Order fetched) { - assertEquals(fetched.getId(), order.getId()); - } - }); - - - api.deleteOrder(String.valueOf(order.getId())).subscribe(SkeletonSubscriber.failTestOnError()); - api.getOrderById(order.getId()) - .subscribe(new SkeletonSubscriber() { - @Override - public void onNext(Order order) { - throw new RuntimeException("Should not have found deleted order."); - } - - @Override - public void onError(Throwable e) { - // should not find deleted order. - } - } - ); - } - - private Order createOrder() { - Order order = new Order(); - order.setPetId(new Long(200)); - order.setQuantity(new Integer(13)); - order.setShipDate(new java.util.Date()); - order.setStatus(Order.StatusEnum.PLACED); - order.setComplete(true); - - try { - Field idField = Order.class.getDeclaredField("id"); - idField.setAccessible(true); - idField.set(order, System.currentTimeMillis()); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return order; - } -} diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/UserApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/UserApiTest.java deleted file mode 100644 index 59e238b457b6..000000000000 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/UserApiTest.java +++ /dev/null @@ -1,108 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.client.ApiClient; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - - -import java.util.Arrays; - -import org.junit.*; - -import static org.junit.Assert.*; - -/** - * NOTE: This serves as a sample and test case for the generator, which is why this is java-7 code. - * Much looks much nicer with no anonymous classes. - */ -public class UserApiTest { - UserApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(UserApi.class); - } - - @Test - public void testCreateUser() throws Exception { - final User user = createUser(); - - api.createUser(user).subscribe(new SkeletonSubscriber() { - @Override - public void onCompleted() { - api.getUserByName(user.getUsername()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(User fetched) { - assertEquals(user.getId(), fetched.getId()); - } - }); - } - }); - } - - @Test - public void testCreateUsersWithArray() throws Exception { - final User user1 = createUser(); - user1.setUsername("abc123"); - User user2 = createUser(); - user2.setUsername("123abc"); - - api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})).subscribe(SkeletonSubscriber.failTestOnError()); - - api.getUserByName(user1.getUsername()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(User fetched) { - assertEquals(user1.getId(), fetched.getId()); - } - }); - } - - @Test - public void testCreateUsersWithList() throws Exception { - final User user1 = createUser(); - user1.setUsername("abc123"); - User user2 = createUser(); - user2.setUsername("123abc"); - - api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})).subscribe(SkeletonSubscriber.failTestOnError()); - - api.getUserByName(user1.getUsername()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(User fetched) { - assertEquals(user1.getId(), fetched.getId()); - } - }); - } - - @Test - public void testLoginUser() throws Exception { - User user = createUser(); - api.createUser(user); - - api.loginUser(user.getUsername(), user.getPassword()).subscribe(new SkeletonSubscriber() { - @Override - public void onNext(String token) { - assertTrue(token.startsWith("logged in user session:")); - } - }); - } - - @Test - public void logoutUser() throws Exception { - api.logoutUser(); - } - - private User createUser() { - User user = new User(); - user.setId(System.currentTimeMillis()); - user.setUsername("fred"); - user.setFirstName("Fred"); - user.setLastName("Meyer"); - user.setEmail("fred@fredmeyer.com"); - user.setPassword("xxXXxx"); - user.setPhone("408-867-5309"); - user.setUserStatus(123); - - return user; - } -} \ No newline at end of file From 4d3f82e70140ce764a382b8e3194421a49619b00 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 27 Apr 2016 16:09:53 +0800 Subject: [PATCH 011/114] renmae toJSONSchemaPattern to toRegularExpression --- .../src/main/java/io/swagger/codegen/DefaultCodegen.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 69e56e579358..114009967331 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 @@ -328,12 +328,12 @@ public class DefaultCodegen { } /** - * Return the JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33) + * Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33) * * @param pattern the pattern (regular expression) * @return properly-escaped pattern */ - public String toJSONSchemaPattern(String pattern) { + public String toRegularExpression(String pattern) { return escapeText(pattern); } @@ -1125,7 +1125,7 @@ public class DefaultCodegen { StringProperty sp = (StringProperty) p; property.maxLength = sp.getMaxLength(); property.minLength = sp.getMinLength(); - property.pattern = toJSONSchemaPattern(sp.getPattern()); + property.pattern = toRegularExpression(sp.getPattern()); // check if any validation rule defined if (property.pattern != null || property.minLength != null || property.maxLength != null) @@ -1828,7 +1828,7 @@ public class DefaultCodegen { p.exclusiveMinimum = qp.isExclusiveMinimum(); p.maxLength = qp.getMaxLength(); p.minLength = qp.getMinLength(); - p.pattern = toJSONSchemaPattern(qp.getPattern()); + p.pattern = toRegularExpression(qp.getPattern()); p.maxItems = qp.getMaxItems(); p.minItems = qp.getMinItems(); p.uniqueItems = qp.isUniqueItems(); From 8753faf2a592eb56b39ee68fa757639a721a1374 Mon Sep 17 00:00:00 2001 From: Neil O'Toole Date: Wed, 27 Apr 2016 09:19:23 +0100 Subject: [PATCH 012/114] issue #2717 - go code won't compile due to not respecting packageName var --- .../swagger-codegen/src/main/resources/go/api_response.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2a34a8cf35ac..9f81de76d624 100644 --- a/modules/swagger-codegen/src/main/resources/go/api_response.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api_response.mustache @@ -1,4 +1,4 @@ -package swagger +package {{packageName}} import ( "net/http" From 87c6566bd0dadd2ff684a27d2ff8c906f723860a Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 27 Apr 2016 17:37:44 +0800 Subject: [PATCH 013/114] mapped uuid to str in python --- .../languages/PythonClientCodegen.java | 4 ++- ...ith-fake-endpoints-models-for-testing.yaml | 4 +++ samples/client/petstore/python/README.md | 27 ++++++++++++------- .../client/petstore/python/docs/FormatTest.md | 7 ++--- .../python/swagger_client/__init__.py | 1 + .../python/swagger_client/apis/__init__.py | 1 + .../swagger_client/models/format_test.py | 25 +++++++++++++++++ 7 files changed, 56 insertions(+), 13 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 a1e3d6f93563..7cb4dc703db2 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 @@ -58,10 +58,12 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig typeMapping.put("DateTime", "datetime"); typeMapping.put("object", "object"); typeMapping.put("file", "file"); - //TODO binary should be mapped to byte array + // TODO binary should be mapped to byte array // mapped to String as a workaround typeMapping.put("binary", "str"); typeMapping.put("ByteArray", "str"); + // map uuid to string for the time being + typeMapping.put("UUID", "str"); // from https://docs.python.org/release/2.5.4/ref/keywords.html setReservedWordsLowerCase( 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 29996c16b722..4160e59cc48a 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 @@ -590,6 +590,7 @@ paths: in: formData description: None - name: number + type: number maximum: 543.2 minimum: 32.1 in: formData @@ -890,6 +891,9 @@ definitions: dateTime: type: string format: date-time + uuid: + type: string + format: uuid password: type: string format: password diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 79eef5803264..851c5458cb16 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-20T22:11:45.927+08:00 +- Build date: 2016-04-27T17:36:32.266+08:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -50,18 +50,26 @@ import time import swagger_client from swagger_client.rest import ApiException from pprint import pprint - -# Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi -body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store +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: - # Add a new pet to the store - api_instance.add_pet(body) + # 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 PetApi->add_pet: %s\n" % e + print "Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e ``` @@ -71,6 +79,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/python/docs/FormatTest.md b/samples/client/petstore/python/docs/FormatTest.md index 4182a4470860..3e489e863fa0 100644 --- a/samples/client/petstore/python/docs/FormatTest.md +++ b/samples/client/petstore/python/docs/FormatTest.md @@ -10,11 +10,12 @@ Name | Type | Description | Notes **float** | **float** | | [optional] **double** | **float** | | [optional] **string** | **str** | | [optional] -**byte** | **str** | | [optional] +**byte** | **str** | | **binary** | **str** | | [optional] -**date** | **date** | | [optional] +**date** | **date** | | **date_time** | **datetime** | | [optional] -**password** | **str** | | [optional] +**uuid** | **str** | | [optional] +**password** | **str** | | [[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/python/swagger_client/__init__.py b/samples/client/petstore/python/swagger_client/__init__.py index 2169ecd37e79..783f8b9713ad 100644 --- a/samples/client/petstore/python/swagger_client/__init__.py +++ b/samples/client/petstore/python/swagger_client/__init__.py @@ -17,6 +17,7 @@ from .models.tag import Tag from .models.user import User # import apis into sdk package +from .apis.fake_api import FakeApi from .apis.pet_api import PetApi from .apis.store_api import StoreApi from .apis.user_api import UserApi diff --git a/samples/client/petstore/python/swagger_client/apis/__init__.py b/samples/client/petstore/python/swagger_client/apis/__init__.py index a3a12ea9ac1a..ddde8c164bf4 100644 --- a/samples/client/petstore/python/swagger_client/apis/__init__.py +++ b/samples/client/petstore/python/swagger_client/apis/__init__.py @@ -1,6 +1,7 @@ from __future__ import absolute_import # import apis into api package +from .fake_api import FakeApi from .pet_api import PetApi from .store_api import StoreApi from .user_api import UserApi 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 8654d79bc3c6..28f348edf047 100644 --- a/samples/client/petstore/python/swagger_client/models/format_test.py +++ b/samples/client/petstore/python/swagger_client/models/format_test.py @@ -48,6 +48,7 @@ class FormatTest(object): 'binary': 'str', 'date': 'date', 'date_time': 'datetime', + 'uuid': 'str', 'password': 'str' } @@ -63,6 +64,7 @@ class FormatTest(object): 'binary': 'binary', 'date': 'date', 'date_time': 'dateTime', + 'uuid': 'uuid', 'password': 'password' } @@ -77,6 +79,7 @@ class FormatTest(object): self._binary = None self._date = None self._date_time = None + self._uuid = None self._password = None @property @@ -321,6 +324,28 @@ class FormatTest(object): """ self._date_time = date_time + @property + def uuid(self): + """ + Gets the uuid of this FormatTest. + + + :return: The uuid of this FormatTest. + :rtype: str + """ + return self._uuid + + @uuid.setter + def uuid(self, uuid): + """ + Sets the uuid of this FormatTest. + + + :param uuid: The uuid of this FormatTest. + :type: str + """ + self._uuid = uuid + @property def password(self): """ From c503396a4270c9f0c72557165381d57c0eed873d Mon Sep 17 00:00:00 2001 From: diyfr Date: Wed, 27 Apr 2016 11:39:30 +0200 Subject: [PATCH 014/114] 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 015/114] 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 74fb6175b608ba6a50cf5f076c4c9354277691fa Mon Sep 17 00:00:00 2001 From: Fabien Da Silva Date: Wed, 27 Apr 2016 13:25:33 +0200 Subject: [PATCH 016/114] Fix typo introduced while fixing #2116 --- modules/swagger-codegen/src/main/resources/swift/model.mustache | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/swift/model.mustache b/modules/swagger-codegen/src/main/resources/swift/model.mustache index 9c1787e5bcd6..96c4d2ff6837 100644 --- a/modules/swagger-codegen/src/main/resources/swift/model.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/model.mustache @@ -34,11 +34,9 @@ public class {{classname}}: JSONEncodable { {{/unwrapRequired}} {{#unwrapRequired}} public init({{#requiredVars}}{{^-first}}, {{/-first}}{{name}}: {{#isEnum}}{{datatypeWithEnum}}!{{/isEnum}}{{^isEnum}}{{datatype}}!{{/isEnum}}{{/requiredVars}}) { - {{#vars}} {{#requiredVars}} self.{{name}} = {{name}} {{/requiredVars}} - {{/vars}} } {{/unwrapRequired}} 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 017/114] [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 018/114] [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 019/114] [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 020/114] [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 021/114] 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 022/114] 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 fbbcdab439900fdf202522fde2cd8ba0606d8b74 Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Wed, 27 Apr 2016 23:11:39 +0200 Subject: [PATCH 023/114] fixing generation of incorrect package, typings and tsconfig --- .../typescript-node/package.mustache | 2 +- .../typescript-node/tsconfig.mustache | 14 +- .../typescript-node/typings.mustache | 11 +- .../petstore/typescript-node-with-npm/api.js | 1185 +++++++++++++++ .../typescript-node-with-npm/api.js.map | 1 + .../petstore/typescript-node-with-npm/api.ts | 1331 +++++++++++++++++ .../typescript-node-with-npm/git_push.sh | 52 + .../typescript-node-with-npm/package.json | 22 + .../typescript-node-with-npm/tsconfig.json | 18 + .../typescript-node-with-npm/typings.json | 10 + 10 files changed, 2637 insertions(+), 9 deletions(-) create mode 100644 samples/client/petstore/typescript-node-with-npm/api.js create mode 100644 samples/client/petstore/typescript-node-with-npm/api.js.map create mode 100644 samples/client/petstore/typescript-node-with-npm/api.ts create mode 100644 samples/client/petstore/typescript-node-with-npm/git_push.sh create mode 100644 samples/client/petstore/typescript-node-with-npm/package.json create mode 100644 samples/client/petstore/typescript-node-with-npm/tsconfig.json create mode 100644 samples/client/petstore/typescript-node-with-npm/typings.json diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache index 410f23922422..29a9b60bbaee 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache @@ -14,7 +14,7 @@ }, "devDependencies": { "typescript": "^1.8.10", - "typings": "^0.8.1", + "typings": "^0.8.1" }{{#npmRepository}}, "publishConfig":{ "registry":"{{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 index 9ae24570382a..2dd166566e97 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-node/tsconfig.mustache @@ -1,13 +1,17 @@ { "compilerOptions": { - "module": "commonjs", - "noImplicitAny": true, - "suppressImplicitAnyIndexErrors": true, - "target": "ES5" + "module": "commonjs", + "noImplicitAny": false, + "suppressImplicitAnyIndexErrors": true, + "target": "ES5", + "moduleResolution": "node", + "removeComments": true, + "sourceMap": true, + "noLib": false, + "declaration": true }, "files": [ "api.ts", - "client.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 index 0848dcffe31e..76c4cc8e6af3 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-node/typings.mustache @@ -1,5 +1,10 @@ { - "ambientDependencies": { - "core-js": "registry:dt/core-js#0.0.0+20160317120654" - } + "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 diff --git a/samples/client/petstore/typescript-node-with-npm/api.js b/samples/client/petstore/typescript-node-with-npm/api.js new file mode 100644 index 000000000000..9d7f94556f3b --- /dev/null +++ b/samples/client/petstore/typescript-node-with-npm/api.js @@ -0,0 +1,1185 @@ +"use strict"; +var request = require('request'); +var promise = require('bluebird'); +// =============================================== +// 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["placed"] = 'placed'] = "placed"; + StatusEnum[StatusEnum["approved"] = 'approved'] = "approved"; + StatusEnum[StatusEnum["delivered"] = 'delivered'] = "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["available"] = 'available'] = "available"; + StatusEnum[StatusEnum["pending"] = 'pending'] = "pending"; + StatusEnum[StatusEnum["sold"] = 'sold'] = "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; +}()); +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; +}()); +var OAuth = (function () { + function OAuth() { + } + OAuth.prototype.applyToRequest = function (requestOptions) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + }; + return OAuth; +}()); +var VoidAuth = (function () { + function VoidAuth() { + } + VoidAuth.prototype.applyToRequest = function (requestOptions) { + // Do nothing + }; + return 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 = 'http://petstore.swagger.io/v2'; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key') + }; + 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.petstore_auth.applyToRequest(requestOptions); + 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; + }; + /** + * 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 = 'http://petstore.swagger.io/v2'; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key') + }; + 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 = 'http://petstore.swagger.io/v2'; + this.defaultHeaders = {}; + this.authentications = { + 'default': new VoidAuth(), + 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key') + }; + 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; +//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/samples/client/petstore/typescript-node-with-npm/api.js.map b/samples/client/petstore/typescript-node-with-npm/api.js.map new file mode 100644 index 000000000000..1a73cf1e8cd9 --- /dev/null +++ b/samples/client/petstore/typescript-node-with-npm/api.js.map @@ -0,0 +1 @@ +{"version":3,"file":"api.js","sourceRoot":"","sources":["api.ts"],"names":[],"mappings":";AAAA,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AACpC,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAGrC,kDAAkD;AAClD,kDAAkD;AAClD,kDAAkD;AAElD,uCAAuC;AAEvC;IAAA;IAGA,CAAC;IAAD,eAAC;AAAD,CAAC,AAHD,IAGC;AAHY,gBAAQ,WAGpB,CAAA;AAED;IAAA;IAUA,CAAC;IAAD,YAAC;AAAD,CAAC,AAVD,IAUC;AAVY,aAAK,QAUjB,CAAA;AAED,IAAiB,KAAK,CAMrB;AAND,WAAiB,KAAK,EAAC,CAAC;IACpB,WAAY,UAAU;QAClB,kCAAe,QAAQ,YAAA,CAAA;QACvB,oCAAiB,UAAU,cAAA,CAAA;QAC3B,qCAAkB,WAAW,eAAA,CAAA;IACjC,CAAC,EAJW,gBAAU,KAAV,gBAAU,QAIrB;IAJD,IAAY,UAAU,GAAV,gBAIX,CAAA;AACL,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB;AACD;IAAA;IAUA,CAAC;IAAD,UAAC;AAAD,CAAC,AAVD,IAUC;AAVY,WAAG,MAUf,CAAA;AAED,IAAiB,GAAG,CAMnB;AAND,WAAiB,GAAG,EAAC,CAAC;IAClB,WAAY,UAAU;QAClB,qCAAkB,WAAW,eAAA,CAAA;QAC7B,mCAAgB,SAAS,aAAA,CAAA;QACzB,gCAAa,MAAM,UAAA,CAAA;IACvB,CAAC,EAJW,cAAU,KAAV,cAAU,QAIrB;IAJD,IAAY,UAAU,GAAV,cAIX,CAAA;AACL,CAAC,EANgB,GAAG,GAAH,WAAG,KAAH,WAAG,QAMnB;AACD;IAAA;IAGA,CAAC;IAAD,UAAC;AAAD,CAAC,AAHD,IAGC;AAHY,WAAG,MAGf,CAAA;AAED;IAAA;IAYA,CAAC;IAAD,WAAC;AAAD,CAAC,AAZD,IAYC;AAZY,YAAI,OAYhB,CAAA;AAUD;IAAA;IAQA,CAAC;IALG,sCAAc,GAAd,UAAe,cAA+B;QAC1C,cAAc,CAAC,IAAI,GAAG;YAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACnD,CAAA;IACL,CAAC;IACL,oBAAC;AAAD,CAAC,AARD,IAQC;AAED;IAGI,oBAAoB,QAAgB,EAAU,SAAiB;QAA3C,aAAQ,GAAR,QAAQ,CAAQ;QAAU,cAAS,GAAT,SAAS,CAAQ;IAC/D,CAAC;IAED,mCAAc,GAAd,UAAe,cAA+B;QAC1C,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC;YACrB,cAAc,CAAC,EAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3D,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC;YACnC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACzD,CAAC;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AAbD,IAaC;AAED;IAAA;IAMA,CAAC;IAHG,8BAAc,GAAd,UAAe,cAA+B;QAC1C,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;IAC3E,CAAC;IACL,YAAC;AAAD,CAAC,AAND,IAMC;AAED;IAAA;IAMA,CAAC;IAHG,iCAAc,GAAd,UAAe,cAA+B;QAC1C,aAAa;IACjB,CAAC;IACL,eAAC;AAAD,CAAC,AAND,IAMC;AAED,WAAY,aAAa;IACrB,uDAAO,CAAA;AACX,CAAC,EAFW,qBAAa,KAAb,qBAAa,QAExB;AAFD,IAAY,aAAa,GAAb,qBAEX,CAAA;AAED;IAWI,gBAAY,kBAA0B,EAAE,QAAiB,EAAE,QAAiB;QAVlE,aAAQ,GAAG,+BAA+B,CAAC;QAC3C,mBAAc,GAAS,EAAE,CAAC;QAE1B,oBAAe,GAAG;YACxB,SAAS,EAAkB,IAAI,QAAQ,EAAE;YACzC,eAAe,EAAE,IAAI,KAAK,EAAE;YAC5B,SAAS,EAAE,IAAI,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SACjD,CAAA;QAIG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACX,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAA;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAEM,0BAAS,GAAhB,UAAiB,GAAkB,EAAE,KAAa;QAC9C,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;IAC5D,CAAC;IAED,sBAAI,+BAAW;aAAf,UAAgB,KAAa;YACzB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3D,CAAC;;;OAAA;IACO,0BAAS,GAAjB,UAAyB,IAAQ,EAAE,IAAQ;QACvC,GAAG,CAAA,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAA,CAAC;YACjB,EAAE,CAAA,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,MAAM,CAAQ,IAAI,CAAC;IACvB,CAAC;IACD;;;;OAIG;IACI,uBAAM,GAAb,UAAe,IAAU;QACrB,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC5C,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;OAKG;IACI,0BAAS,GAAhB,UAAkB,KAAa,EAAE,MAAe;QAC5C,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc;aAC9C,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,6DAA6D;QAC7D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;QAC9F,CAAC;QAED,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;QAEjC,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,QAAQ;YAChB,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,iCAAgB,GAAvB,UAAyB,MAAsB;QAC3C,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC;QACzD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,EAAE,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC;YACvB,eAAe,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;QACvC,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAyD,CAAC;QAE9F,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,+BAAc,GAArB,UAAuB,IAAoB;QACvC,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC;QACvD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;YACrB,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACnC,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAyD,CAAC;QAE9F,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,2BAAU,GAAjB,UAAmB,KAAa;QAC5B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc;aAC9C,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,6DAA6D;QAC7D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;QAC/F,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAkD,CAAC;QAEvF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,0BAAS,GAAhB,UAAkB,IAAU;QACxB,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC5C,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;;OAMG;IACI,kCAAiB,GAAxB,UAA0B,KAAa,EAAE,IAAa,EAAE,MAAe;QACnE,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc;aAC9C,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,6DAA6D;QAC7D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;QACtG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;YACrB,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAC9B,CAAC;QAED,EAAE,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC;YACvB,UAAU,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;QAClC,CAAC;QAED,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;;OAMG;IACI,2BAAU,GAAjB,UAAmB,KAAa,EAAE,kBAA2B,EAAE,IAAU;QACrE,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,0BAA0B;aAC1D,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,6DAA6D;QAC7D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;QAC/F,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,EAAE,CAAC,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC;YACnC,UAAU,CAAC,oBAAoB,CAAC,GAAG,kBAAkB,CAAC;QAC1D,CAAC;QAED,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;YACrB,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAC9B,CAAC;QACD,WAAW,GAAG,IAAI,CAAC;QAEnB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACL,aAAC;AAAD,CAAC,AAlfD,IAkfC;AAlfY,cAAM,SAkflB,CAAA;AACD,WAAY,eAAe;IACvB,2DAAO,CAAA;AACX,CAAC,EAFW,uBAAe,KAAf,uBAAe,QAE1B;AAFD,IAAY,eAAe,GAAf,uBAEX,CAAA;AAED;IAWI,kBAAY,kBAA0B,EAAE,QAAiB,EAAE,QAAiB;QAVlE,aAAQ,GAAG,+BAA+B,CAAC;QAC3C,mBAAc,GAAS,EAAE,CAAC;QAE1B,oBAAe,GAAG;YACxB,SAAS,EAAkB,IAAI,QAAQ,EAAE;YACzC,eAAe,EAAE,IAAI,KAAK,EAAE;YAC5B,SAAS,EAAE,IAAI,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SACjD,CAAA;QAIG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACX,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAA;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAEM,4BAAS,GAAhB,UAAiB,GAAoB,EAAE,KAAa;QAChD,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;IAC9D,CAAC;IAED,sBAAI,iCAAW;aAAf,UAAgB,KAAa;YACzB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3D,CAAC;;;OAAA;IACO,4BAAS,GAAjB,UAAyB,IAAQ,EAAE,IAAQ;QACvC,GAAG,CAAA,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAA,CAAC;YACjB,EAAE,CAAA,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,MAAM,CAAQ,IAAI,CAAC;IACvB,CAAC;IACD;;;;OAIG;IACI,8BAAW,GAAlB,UAAoB,OAAe;QAC/B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,wBAAwB;aACxD,OAAO,CAAC,GAAG,GAAG,SAAS,GAAG,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACrD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,+DAA+D;QAC/D,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAClG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,QAAQ;YAChB,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;OAGG;IACI,+BAAY,GAAnB;QACI,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAC;QACxD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAyE,CAAC;QAE9G,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,+BAAY,GAAnB,UAAqB,OAAe;QAChC,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,wBAAwB;aACxD,OAAO,CAAC,GAAG,GAAG,SAAS,GAAG,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACrD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,+DAA+D;QAC/D,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;QACnG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAoD,CAAC;QAEzF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,6BAAU,GAAjB,UAAmB,IAAY;QAC3B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC;QACpD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAoD,CAAC;QAEzF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACL,eAAC;AAAD,CAAC,AApPD,IAoPC;AApPY,gBAAQ,WAoPpB,CAAA;AACD,WAAY,cAAc;IACtB,yDAAO,CAAA;AACX,CAAC,EAFW,sBAAc,KAAd,sBAAc,QAEzB;AAFD,IAAY,cAAc,GAAd,sBAEX,CAAA;AAED;IAWI,iBAAY,kBAA0B,EAAE,QAAiB,EAAE,QAAiB;QAVlE,aAAQ,GAAG,+BAA+B,CAAC;QAC3C,mBAAc,GAAS,EAAE,CAAC;QAE1B,oBAAe,GAAG;YACxB,SAAS,EAAkB,IAAI,QAAQ,EAAE;YACzC,eAAe,EAAE,IAAI,KAAK,EAAE;YAC5B,SAAS,EAAE,IAAI,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SACjD,CAAA;QAIG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACX,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAA;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAEM,2BAAS,GAAhB,UAAiB,GAAmB,EAAE,KAAa;QAC/C,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;IAC7D,CAAC;IAED,sBAAI,gCAAW;aAAf,UAAgB,KAAa;YACzB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3D,CAAC;;;OAAA;IACO,2BAAS,GAAjB,UAAyB,IAAQ,EAAE,IAAQ;QACvC,GAAG,CAAA,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAA,CAAC;YACjB,EAAE,CAAA,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,MAAM,CAAQ,IAAI,CAAC;IACvB,CAAC;IACD;;;;OAIG;IACI,4BAAU,GAAjB,UAAmB,IAAW;QAC1B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC7C,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,2CAAyB,GAAhC,UAAkC,IAAkB;QAChD,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,uBAAuB,CAAC;QAC7D,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,0CAAwB,GAA/B,UAAiC,IAAkB;QAC/C,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,sBAAsB,CAAC;QAC5D,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,4BAAU,GAAjB,UAAmB,QAAgB;QAC/B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB;aAClD,OAAO,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,gEAAgE;QAChE,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAClG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,QAAQ;YAChB,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,+BAAa,GAApB,UAAsB,QAAgB;QAClC,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB;aAClD,OAAO,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,gEAAgE;QAChE,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;QACrG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;OAKG;IACI,2BAAS,GAAhB,UAAkB,QAAiB,EAAE,QAAiB;QAClD,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC;QACnD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,EAAE,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YACzB,eAAe,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;QAC3C,CAAC;QAED,EAAE,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YACzB,eAAe,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;QAC3C,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAqD,CAAC;QAE1F,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;OAGG;IACI,4BAAU,GAAjB;QACI,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC;QACpD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;OAKG;IACI,4BAAU,GAAjB,UAAmB,QAAgB,EAAE,IAAW;QAC5C,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB;aAClD,OAAO,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,gEAAgE;QAChE,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAClG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACL,cAAC;AAAD,CAAC,AArcD,IAqcC;AArcY,eAAO,UAqcnB,CAAA"} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node-with-npm/api.ts b/samples/client/petstore/typescript-node-with-npm/api.ts new file mode 100644 index 000000000000..10aa9d5125c2 --- /dev/null +++ b/samples/client/petstore/typescript-node-with-npm/api.ts @@ -0,0 +1,1331 @@ +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 */ + +export class Category { + "id": number; + "name": string; +} + +export class Order { + "id": number; + "petId": number; + "quantity": number; + "shipDate": Date; + /** + * Order Status + */ + "status": Order.StatusEnum; + "complete": boolean; +} + +export namespace Order { + export enum StatusEnum { + placed = 'placed', + approved = 'approved', + delivered = 'delivered' + } +} +export class Pet { + "id": number; + "category": Category; + "name": string; + "photoUrls": Array; + "tags": Array; + /** + * pet status in the store + */ + "status": Pet.StatusEnum; +} + +export namespace Pet { + export enum StatusEnum { + available = 'available', + pending = 'pending', + sold = 'sold' + } +} +export class Tag { + "id": number; + "name": string; +} + +export class User { + "id": number; + "username": string; + "firstName": string; + "lastName": string; + "email": string; + "password": string; + "phone": string; + /** + * User Status + */ + "userStatus": number; +} + + +interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: request.Options): void; +} + +class HttpBasicAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: request.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +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; + } + } +} + +class OAuth implements Authentication { + public accessToken: string; + + applyToRequest(requestOptions: request.Options): void { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } +} + +class VoidAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: request.Options): void { + // Do nothing + } +} + +export enum PetApiApiKeys { + api_key, +} + +export class PetApi { + protected basePath = 'http://petstore.swagger.io/v2'; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: PetApiApiKeys, value: string) { + this.authentications[PetApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T1, objB: T2) { + for(let 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 + */ + public addPet (body?: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + let useFormData = false; + + let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); + + let requestOptions: request.Options = { + 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, (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 + */ + public deletePet (petId: number, apiKey?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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; + + 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); + + 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; + } + /** + * 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 (status?: Array) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/pet/findByStatus'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + if (status !== undefined) { + queryParameters['status'] = status; + } + + 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); + + 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; + } + /** + * 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 (tags?: Array) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/pet/findByTags'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + if (tags !== undefined) { + queryParameters['tags'] = tags; + } + + 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); + + 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; + } + /** + * 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 (petId: number) : Promise<{ response: http.ClientResponse; body: Pet; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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.'); + } + + 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.petstore_auth.applyToRequest(requestOptions); + + 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, (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 + */ + public updatePet (body?: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + let useFormData = false; + + let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); + + let requestOptions: request.Options = { + 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, (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 + */ + public updatePetWithForm (petId: string, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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.'); + } + + let useFormData = false; + + if (name !== undefined) { + formParams['name'] = name; + } + + if (status !== undefined) { + formParams['status'] = status; + } + + 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); + + 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; + } + /** + * 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 (petId: number, additionalMetadata?: string, file?: any) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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.'); + } + + let useFormData = false; + + if (additionalMetadata !== undefined) { + formParams['additionalMetadata'] = additionalMetadata; + } + + if (file !== undefined) { + formParams['file'] = file; + } + 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); + + 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; + } +} +export enum StoreApiApiKeys { + api_key, +} + +export class StoreApi { + protected basePath = 'http://petstore.swagger.io/v2'; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: StoreApiApiKeys, value: string) { + this.authentications[StoreApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T1, objB: T2) { + for(let 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 + */ + public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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.'); + } + + 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); + + 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; + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + public getInventory () : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> { + const localVarPath = this.basePath + '/store/inventory'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + 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); + + 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; + } + /** + * 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 (orderId: string) : Promise<{ response: http.ClientResponse; body: Order; }> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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.'); + } + + 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); + + 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; + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + */ + public placeOrder (body?: Order) : Promise<{ response: http.ClientResponse; body: Order; }> { + const localVarPath = this.basePath + '/store/order'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + let useFormData = false; + + let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>(); + + let requestOptions: request.Options = { + 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, (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; + } +} +export enum UserApiApiKeys { + api_key, +} + +export class UserApi { + protected basePath = 'http://petstore.swagger.io/v2'; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: UserApiApiKeys, value: string) { + this.authentications[UserApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T1, objB: T2) { + for(let 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 + */ + public createUser (body?: User) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + let useFormData = false; + + let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); + + let requestOptions: request.Options = { + 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, (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 + */ + public createUsersWithArrayInput (body?: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/createWithArray'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + let useFormData = false; + + let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); + + let requestOptions: request.Options = { + 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, (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 + */ + public createUsersWithListInput (body?: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/createWithList'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + let useFormData = false; + + let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); + + let requestOptions: request.Options = { + 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, (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 + */ + public deleteUser (username: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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.'); + } + + 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); + + 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; + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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.'); + } + + 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); + + 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; + } + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser (username?: string, password?: string) : Promise<{ response: http.ClientResponse; body: string; }> { + const localVarPath = this.basePath + '/user/login'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + if (username !== undefined) { + queryParameters['username'] = username; + } + + if (password !== undefined) { + queryParameters['password'] = password; + } + + 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); + + 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; + } + /** + * Logs out current logged in user session + * + */ + public logoutUser () : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/logout'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + 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); + + 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; + } + /** + * 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 (username: string, body?: User) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let formParams: any = {}; + + + // 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.'); + } + + let useFormData = false; + + let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>(); + + let requestOptions: request.Options = { + 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, (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; + } +} diff --git a/samples/client/petstore/typescript-node-with-npm/git_push.sh b/samples/client/petstore/typescript-node-with-npm/git_push.sh new file mode 100644 index 000000000000..1a36388db023 --- /dev/null +++ b/samples/client/petstore/typescript-node-with-npm/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="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="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="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-node-with-npm/package.json b/samples/client/petstore/typescript-node-with-npm/package.json new file mode 100644 index 000000000000..01213e7e2127 --- /dev/null +++ b/samples/client/petstore/typescript-node-with-npm/package.json @@ -0,0 +1,22 @@ +{ + "name": "@swagger/angular2-typescript-petstore", + "version": "0.0.1-SNAPSHOT.201604272308", + "description": "NodeJS client for @swagger/angular2-typescript-petstore", + "main": "api.js", + "scripts": { + "build": "typings install && tsc" + }, + "author": "Mads M. Tandrup", + "license": "Apache 2.0", + "dependencies": { + "bluebird": "^3.3.5", + "request": "^2.72.0" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + }, + "publishConfig":{ + "registry":"https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-node-with-npm/tsconfig.json b/samples/client/petstore/typescript-node-with-npm/tsconfig.json new file mode 100644 index 000000000000..2dd166566e97 --- /dev/null +++ b/samples/client/petstore/typescript-node-with-npm/tsconfig.json @@ -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/samples/client/petstore/typescript-node-with-npm/typings.json b/samples/client/petstore/typescript-node-with-npm/typings.json new file mode 100644 index 000000000000..76c4cc8e6af3 --- /dev/null +++ b/samples/client/petstore/typescript-node-with-npm/typings.json @@ -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 2f8a8c05e076b2fd63d34b2dcaaf3d9e146cebb0 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 27 Apr 2016 14:29:05 -0700 Subject: [PATCH 024/114] 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 025/114] 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 026/114] 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 8caa8abfc16f611f7d7303b7536dc90feaffd202 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 27 Apr 2016 22:43:08 -0700 Subject: [PATCH 027/114] 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 028/114] 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 8a330e9dad09146e3cfd2f8daf45124af0945959 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Thu, 28 Apr 2016 06:16:43 +0000 Subject: [PATCH 029/114] Improve type checking for closure-angular Closure angular now has more accurate type checking enabled. --- .../Javascript-Closure-Angular/api.mustache | 10 +- .../API/Client/PetApi.js | 214 ++++++++++-------- .../API/Client/StoreApi.js | 176 +++++++------- .../API/Client/UserApi.js | 208 +++++++++-------- 4 files changed, 324 insertions(+), 284 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Javascript-Closure-Angular/api.mustache b/modules/swagger-codegen/src/main/resources/Javascript-Closure-Angular/api.mustache index 957add6753ef..35604bf73dfa 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript-Closure-Angular/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript-Closure-Angular/api.mustache @@ -47,8 +47,8 @@ goog.require('{{import}}'); /** @private {!angular.$http} */ this.http_ = $http; - /** @private {!Object} */ - this.httpParamSerializer_ = $injector.get('$httpParamSerializer'); + /** @package {!Object} */ + this.httpParamSerializer = $injector.get('$httpParamSerializer'); } {{package}}.{{classname}}.$inject = ['$http', '$httpParamSerializer', '$injector']; {{#operation}} @@ -69,7 +69,7 @@ goog.require('{{import}}'); var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); {{#hasFormParams}} /** @type {!Object} */ var formParams = {}; @@ -108,7 +108,7 @@ goog.require('{{import}}'); json: {{#hasFormParams}}false{{/hasFormParams}}{{^hasFormParams}}true{{/hasFormParams}}, {{#bodyParam}}data: {{^required}}opt_{{/required}}{{paramName}}, {{/bodyParam}} - {{#hasFormParams}}data: this.httpParamSerializer_(formParams), + {{#hasFormParams}}data: this.httpParamSerializer(formParams), {{/hasFormParams}} params: queryParameters, headers: headerParams @@ -118,7 +118,7 @@ goog.require('{{import}}'); httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } {{/operation}} {{/operations}} diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/PetApi.js b/samples/client/petstore/javascript-closure-angular/API/Client/PetApi.js index 5cf1c6d751d9..39a22ebcdbe3 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/PetApi.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/PetApi.js @@ -3,9 +3,9 @@ * Do not edit this file by hand or your changes will be lost next time it is * generated. * - * 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. + * 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. * Version: 1.0.0 - * Generated at: 2016-04-16T18:02:07.029+08:00 + * Generated at: 2016-04-28T06:15:51.482Z * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen */ /** @@ -40,11 +40,50 @@ API.Client.PetApi = function($http, $httpParamSerializer, $injector) { /** @private {!angular.$http} */ this.http_ = $http; - /** @private {!Object} */ - this.httpParamSerializer_ = $injector.get('$httpParamSerializer'); + /** @package {!Object} */ + this.httpParamSerializer = $injector.get('$httpParamSerializer'); } API.Client.PetApi.$inject = ['$http', '$httpParamSerializer', '$injector']; +/** + * Update an existing pet + * + * @param {!Pet} body Pet object that needs to be added to the store + * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. + * @return {!angular.$q.Promise} + */ +API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParams) { + /** @const {string} */ + var path = this.basePath_ + '/pet'; + + /** @type {!Object} */ + var queryParameters = {}; + + /** @type {!Object} */ + var headerParams = angular.extend({}, this.defaultHeaders_); + // verify required parameter 'body' is set + if (!body) { + throw new Error('Missing required parameter body when calling updatePet'); + } + /** @type {!Object} */ + var httpRequestParams = { + method: 'PUT', + url: path, + json: true, + data: body, + + + params: queryParameters, + headers: headerParams + }; + + if (opt_extraHttpRequestParams) { + httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); + } + + return (/** @type {?} */ (this.http_))(httpRequestParams); +} + /** * Add a new pet to the store * @@ -60,7 +99,7 @@ API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams) var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'body' is set if (!body) { throw new Error('Missing required parameter body when calling addPet'); @@ -71,7 +110,9 @@ API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams) url: path, json: true, data: body, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -79,47 +120,7 @@ API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams) httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); -} - -/** - * Deletes a pet - * - * @param {!number} petId Pet id to delete - * @param {!string=} opt_apiKey - * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. - * @return {!angular.$q.Promise} - */ -API.Client.PetApi.prototype.deletePet = function(petId, opt_apiKey, opt_extraHttpRequestParams) { - /** @const {string} */ - var path = this.basePath_ + '/pet/{petId}' - .replace('{' + 'petId' + '}', String(petId)); - - /** @type {!Object} */ - var queryParameters = {}; - - /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling deletePet'); - } - headerParams['api_key'] = opt_apiKey; - - /** @type {!Object} */ - var httpRequestParams = { - method: 'DELETE', - url: path, - json: true, - params: queryParameters, - headers: headerParams - }; - - if (opt_extraHttpRequestParams) { - httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); - } - - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -137,7 +138,7 @@ API.Client.PetApi.prototype.findPetsByStatus = function(status, opt_extraHttpReq var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'status' is set if (!status) { throw new Error('Missing required parameter status when calling findPetsByStatus'); @@ -151,7 +152,9 @@ API.Client.PetApi.prototype.findPetsByStatus = function(status, opt_extraHttpReq method: 'GET', url: path, json: true, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -159,7 +162,7 @@ API.Client.PetApi.prototype.findPetsByStatus = function(status, opt_extraHttpReq httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -177,7 +180,7 @@ API.Client.PetApi.prototype.findPetsByTags = function(tags, opt_extraHttpRequest var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'tags' is set if (!tags) { throw new Error('Missing required parameter tags when calling findPetsByTags'); @@ -191,7 +194,9 @@ API.Client.PetApi.prototype.findPetsByTags = function(tags, opt_extraHttpRequest method: 'GET', url: path, json: true, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -199,7 +204,7 @@ API.Client.PetApi.prototype.findPetsByTags = function(tags, opt_extraHttpRequest httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -218,7 +223,7 @@ API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestPar var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'petId' is set if (!petId) { throw new Error('Missing required parameter petId when calling getPetById'); @@ -228,7 +233,9 @@ API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestPar method: 'GET', url: path, json: true, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -236,44 +243,7 @@ API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestPar httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); -} - -/** - * Update an existing pet - * - * @param {!Pet} body Pet object that needs to be added to the store - * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. - * @return {!angular.$q.Promise} - */ -API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParams) { - /** @const {string} */ - var path = this.basePath_ + '/pet'; - - /** @type {!Object} */ - var queryParameters = {}; - - /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); - // verify required parameter 'body' is set - if (!body) { - throw new Error('Missing required parameter body when calling updatePet'); - } - /** @type {!Object} */ - var httpRequestParams = { - method: 'PUT', - url: path, - json: true, - data: body, - params: queryParameters, - headers: headerParams - }; - - if (opt_extraHttpRequestParams) { - httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); - } - - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -294,7 +264,7 @@ API.Client.PetApi.prototype.updatePetWithForm = function(petId, opt_name, opt_st var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); /** @type {!Object} */ var formParams = {}; @@ -313,7 +283,9 @@ API.Client.PetApi.prototype.updatePetWithForm = function(petId, opt_name, opt_st method: 'POST', url: path, json: false, - data: this.httpParamSerializer_(formParams), + + data: this.httpParamSerializer(formParams), + params: queryParameters, headers: headerParams }; @@ -322,7 +294,49 @@ API.Client.PetApi.prototype.updatePetWithForm = function(petId, opt_name, opt_st httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); +} + +/** + * Deletes a pet + * + * @param {!number} petId Pet id to delete + * @param {!string=} opt_apiKey + * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. + * @return {!angular.$q.Promise} + */ +API.Client.PetApi.prototype.deletePet = function(petId, opt_apiKey, opt_extraHttpRequestParams) { + /** @const {string} */ + var path = this.basePath_ + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + + /** @type {!Object} */ + var queryParameters = {}; + + /** @type {!Object} */ + var headerParams = angular.extend({}, this.defaultHeaders_); + // verify required parameter 'petId' is set + if (!petId) { + throw new Error('Missing required parameter petId when calling deletePet'); + } + headerParams['api_key'] = opt_apiKey; + + /** @type {!Object} */ + var httpRequestParams = { + method: 'DELETE', + url: path, + json: true, + + + params: queryParameters, + headers: headerParams + }; + + if (opt_extraHttpRequestParams) { + httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); + } + + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -343,7 +357,7 @@ API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata, var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); /** @type {!Object} */ var formParams = {}; @@ -362,7 +376,9 @@ API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata, method: 'POST', url: path, json: false, - data: this.httpParamSerializer_(formParams), + + data: this.httpParamSerializer(formParams), + params: queryParameters, headers: headerParams }; @@ -371,5 +387,5 @@ API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata, httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/StoreApi.js b/samples/client/petstore/javascript-closure-angular/API/Client/StoreApi.js index e6c1216099a8..9e18eceefcc0 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/StoreApi.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/StoreApi.js @@ -3,9 +3,9 @@ * Do not edit this file by hand or your changes will be lost next time it is * generated. * - * 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. + * 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. * Version: 1.0.0 - * Generated at: 2016-04-16T18:02:07.029+08:00 + * Generated at: 2016-04-28T06:15:51.482Z * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen */ /** @@ -39,48 +39,11 @@ API.Client.StoreApi = function($http, $httpParamSerializer, $injector) { /** @private {!angular.$http} */ this.http_ = $http; - /** @private {!Object} */ - this.httpParamSerializer_ = $injector.get('$httpParamSerializer'); + /** @package {!Object} */ + this.httpParamSerializer = $injector.get('$httpParamSerializer'); } API.Client.StoreApi.$inject = ['$http', '$httpParamSerializer', '$injector']; -/** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param {!string} orderId ID of the order that needs to be deleted - * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. - * @return {!angular.$q.Promise} - */ -API.Client.StoreApi.prototype.deleteOrder = function(orderId, opt_extraHttpRequestParams) { - /** @const {string} */ - var path = this.basePath_ + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', String(orderId)); - - /** @type {!Object} */ - var queryParameters = {}; - - /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); - // verify required parameter 'orderId' is set - if (!orderId) { - throw new Error('Missing required parameter orderId when calling deleteOrder'); - } - /** @type {!Object} */ - var httpRequestParams = { - method: 'DELETE', - url: path, - json: true, - params: queryParameters, - headers: headerParams - }; - - if (opt_extraHttpRequestParams) { - httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); - } - - return this.http_(httpRequestParams); -} - /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -95,13 +58,15 @@ API.Client.StoreApi.prototype.getInventory = function(opt_extraHttpRequestParams var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); /** @type {!Object} */ var httpRequestParams = { method: 'GET', url: path, json: true, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -109,44 +74,7 @@ API.Client.StoreApi.prototype.getInventory = function(opt_extraHttpRequestParams httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); -} - -/** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param {!number} orderId ID of pet that needs to be fetched - * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. - * @return {!angular.$q.Promise} - */ -API.Client.StoreApi.prototype.getOrderById = function(orderId, opt_extraHttpRequestParams) { - /** @const {string} */ - var path = this.basePath_ + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', String(orderId)); - - /** @type {!Object} */ - var queryParameters = {}; - - /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); - // verify required parameter 'orderId' is set - if (!orderId) { - throw new Error('Missing required parameter orderId when calling getOrderById'); - } - /** @type {!Object} */ - var httpRequestParams = { - method: 'GET', - url: path, - json: true, - params: queryParameters, - headers: headerParams - }; - - if (opt_extraHttpRequestParams) { - httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); - } - - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -164,7 +92,7 @@ API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestPa var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'body' is set if (!body) { throw new Error('Missing required parameter body when calling placeOrder'); @@ -175,7 +103,9 @@ API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestPa url: path, json: true, data: body, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -183,5 +113,83 @@ API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestPa httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); +} + +/** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param {!number} orderId ID of pet that needs to be fetched + * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. + * @return {!angular.$q.Promise} + */ +API.Client.StoreApi.prototype.getOrderById = function(orderId, opt_extraHttpRequestParams) { + /** @const {string} */ + var path = this.basePath_ + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + + /** @type {!Object} */ + var queryParameters = {}; + + /** @type {!Object} */ + var headerParams = angular.extend({}, this.defaultHeaders_); + // verify required parameter 'orderId' is set + if (!orderId) { + throw new Error('Missing required parameter orderId when calling getOrderById'); + } + /** @type {!Object} */ + var httpRequestParams = { + method: 'GET', + url: path, + json: true, + + + params: queryParameters, + headers: headerParams + }; + + if (opt_extraHttpRequestParams) { + httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); + } + + return (/** @type {?} */ (this.http_))(httpRequestParams); +} + +/** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param {!string} orderId ID of the order that needs to be deleted + * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. + * @return {!angular.$q.Promise} + */ +API.Client.StoreApi.prototype.deleteOrder = function(orderId, opt_extraHttpRequestParams) { + /** @const {string} */ + var path = this.basePath_ + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + + /** @type {!Object} */ + var queryParameters = {}; + + /** @type {!Object} */ + var headerParams = angular.extend({}, this.defaultHeaders_); + // verify required parameter 'orderId' is set + if (!orderId) { + throw new Error('Missing required parameter orderId when calling deleteOrder'); + } + /** @type {!Object} */ + var httpRequestParams = { + method: 'DELETE', + url: path, + json: true, + + + params: queryParameters, + headers: headerParams + }; + + if (opt_extraHttpRequestParams) { + httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); + } + + return (/** @type {?} */ (this.http_))(httpRequestParams); } diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/UserApi.js b/samples/client/petstore/javascript-closure-angular/API/Client/UserApi.js index 97b524c9d8a7..733f7d65f5a4 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/UserApi.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/UserApi.js @@ -3,9 +3,9 @@ * Do not edit this file by hand or your changes will be lost next time it is * generated. * - * 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. + * 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. * Version: 1.0.0 - * Generated at: 2016-04-16T18:02:07.029+08:00 + * Generated at: 2016-04-28T06:15:51.482Z * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen */ /** @@ -39,8 +39,8 @@ API.Client.UserApi = function($http, $httpParamSerializer, $injector) { /** @private {!angular.$http} */ this.http_ = $http; - /** @private {!Object} */ - this.httpParamSerializer_ = $injector.get('$httpParamSerializer'); + /** @package {!Object} */ + this.httpParamSerializer = $injector.get('$httpParamSerializer'); } API.Client.UserApi.$inject = ['$http', '$httpParamSerializer', '$injector']; @@ -59,7 +59,7 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'body' is set if (!body) { throw new Error('Missing required parameter body when calling createUser'); @@ -70,7 +70,9 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar url: path, json: true, data: body, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -78,7 +80,7 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -96,7 +98,7 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'body' is set if (!body) { throw new Error('Missing required parameter body when calling createUsersWithArrayInput'); @@ -107,7 +109,9 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr url: path, json: true, data: body, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -115,7 +119,7 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -133,7 +137,7 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'body' is set if (!body) { throw new Error('Missing required parameter body when calling createUsersWithListInput'); @@ -144,7 +148,9 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra url: path, json: true, data: body, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -152,81 +158,7 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); -} - -/** - * Delete user - * This can only be done by the logged in user. - * @param {!string} username The name that needs to be deleted - * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. - * @return {!angular.$q.Promise} - */ -API.Client.UserApi.prototype.deleteUser = function(username, opt_extraHttpRequestParams) { - /** @const {string} */ - var path = this.basePath_ + '/user/{username}' - .replace('{' + 'username' + '}', String(username)); - - /** @type {!Object} */ - var queryParameters = {}; - - /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); - // verify required parameter 'username' is set - if (!username) { - throw new Error('Missing required parameter username when calling deleteUser'); - } - /** @type {!Object} */ - var httpRequestParams = { - method: 'DELETE', - url: path, - json: true, - params: queryParameters, - headers: headerParams - }; - - if (opt_extraHttpRequestParams) { - httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); - } - - return this.http_(httpRequestParams); -} - -/** - * Get user by user name - * - * @param {!string} username The name that needs to be fetched. Use user1 for testing. - * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. - * @return {!angular.$q.Promise} - */ -API.Client.UserApi.prototype.getUserByName = function(username, opt_extraHttpRequestParams) { - /** @const {string} */ - var path = this.basePath_ + '/user/{username}' - .replace('{' + 'username' + '}', String(username)); - - /** @type {!Object} */ - var queryParameters = {}; - - /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); - // verify required parameter 'username' is set - if (!username) { - throw new Error('Missing required parameter username when calling getUserByName'); - } - /** @type {!Object} */ - var httpRequestParams = { - method: 'GET', - url: path, - json: true, - params: queryParameters, - headers: headerParams - }; - - if (opt_extraHttpRequestParams) { - httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); - } - - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -245,7 +177,7 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'username' is set if (!username) { throw new Error('Missing required parameter username when calling loginUser'); @@ -267,7 +199,9 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH method: 'GET', url: path, json: true, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -275,7 +209,7 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -292,13 +226,15 @@ API.Client.UserApi.prototype.logoutUser = function(opt_extraHttpRequestParams) { var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); /** @type {!Object} */ var httpRequestParams = { method: 'GET', url: path, json: true, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -306,7 +242,46 @@ API.Client.UserApi.prototype.logoutUser = function(opt_extraHttpRequestParams) { httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); +} + +/** + * Get user by user name + * + * @param {!string} username The name that needs to be fetched. Use user1 for testing. + * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. + * @return {!angular.$q.Promise} + */ +API.Client.UserApi.prototype.getUserByName = function(username, opt_extraHttpRequestParams) { + /** @const {string} */ + var path = this.basePath_ + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + + /** @type {!Object} */ + var queryParameters = {}; + + /** @type {!Object} */ + var headerParams = angular.extend({}, this.defaultHeaders_); + // verify required parameter 'username' is set + if (!username) { + throw new Error('Missing required parameter username when calling getUserByName'); + } + /** @type {!Object} */ + var httpRequestParams = { + method: 'GET', + url: path, + json: true, + + + params: queryParameters, + headers: headerParams + }; + + if (opt_extraHttpRequestParams) { + httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); + } + + return (/** @type {?} */ (this.http_))(httpRequestParams); } /** @@ -326,7 +301,7 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp var queryParameters = {}; /** @type {!Object} */ - var headerParams = angular.extend({}, this.defaultHeaders); + var headerParams = angular.extend({}, this.defaultHeaders_); // verify required parameter 'username' is set if (!username) { throw new Error('Missing required parameter username when calling updateUser'); @@ -341,7 +316,9 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp url: path, json: true, data: body, - params: queryParameters, + + + params: queryParameters, headers: headerParams }; @@ -349,5 +326,44 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); } - return this.http_(httpRequestParams); + return (/** @type {?} */ (this.http_))(httpRequestParams); +} + +/** + * Delete user + * This can only be done by the logged in user. + * @param {!string} username The name that needs to be deleted + * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. + * @return {!angular.$q.Promise} + */ +API.Client.UserApi.prototype.deleteUser = function(username, opt_extraHttpRequestParams) { + /** @const {string} */ + var path = this.basePath_ + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + + /** @type {!Object} */ + var queryParameters = {}; + + /** @type {!Object} */ + var headerParams = angular.extend({}, this.defaultHeaders_); + // verify required parameter 'username' is set + if (!username) { + throw new Error('Missing required parameter username when calling deleteUser'); + } + /** @type {!Object} */ + var httpRequestParams = { + method: 'DELETE', + url: path, + json: true, + + + params: queryParameters, + headers: headerParams + }; + + if (opt_extraHttpRequestParams) { + httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams); + } + + return (/** @type {?} */ (this.http_))(httpRequestParams); } From 2d0a5210db0985383c62ad9384f035645fb4124a Mon Sep 17 00:00:00 2001 From: diyfr Date: Thu, 28 Apr 2016 10:17:44 +0200 Subject: [PATCH 030/114] 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 031/114] 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 032/114] 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 033/114] 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 034/114] 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 035/114] 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 036/114] 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 db7a56a16f9dbe84197a5250e2106d848dd3eb55 Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Thu, 28 Apr 2016 21:54:48 +0200 Subject: [PATCH 037/114] fixing sample and typscript compile. --- bin/typescript-node-petstore-with-npm.sh | 2 +- bin/typescript-node-petstore.sh | 2 +- bin/windows/typescript-angular2-with-npm.bat | 2 +- bin/windows/typescript-node-with-npm.bat | 10 + bin/windows/typescript-node.bat | 2 +- .../resources/TypeScript-node/api.mustache | 10 +- .../petstore/typescript-node-with-npm/api.js | 1185 ----------------- .../typescript-node-with-npm/api.js.map | 1 - .../default}/api.ts | 10 +- .../default}/git_push.sh | 0 .../petstore/typescript-node/{ => npm}/api.ts | 10 +- .../typescript-node/{ => npm}/git_push.sh | 0 .../npm}/package.json | 2 +- .../npm}/tsconfig.json | 0 .../npm}/typings.json | 0 15 files changed, 30 insertions(+), 1206 deletions(-) create mode 100755 bin/windows/typescript-node-with-npm.bat delete mode 100644 samples/client/petstore/typescript-node-with-npm/api.js delete mode 100644 samples/client/petstore/typescript-node-with-npm/api.js.map rename samples/client/petstore/{typescript-node-with-npm => typescript-node/default}/api.ts (99%) rename samples/client/petstore/{typescript-node-with-npm => typescript-node/default}/git_push.sh (100%) rename samples/client/petstore/typescript-node/{ => npm}/api.ts (99%) rename samples/client/petstore/typescript-node/{ => npm}/git_push.sh (100%) rename samples/client/petstore/{typescript-node-with-npm => typescript-node/npm}/package.json (92%) rename samples/client/petstore/{typescript-node-with-npm => typescript-node/npm}/tsconfig.json (100%) rename samples/client/petstore/{typescript-node-with-npm => typescript-node/npm}/typings.json (100%) diff --git a/bin/typescript-node-petstore-with-npm.sh b/bin/typescript-node-petstore-with-npm.sh index f4e8426fd56c..e369be758e7b 100755 --- a/bin/typescript-node-petstore-with-npm.sh +++ b/bin/typescript-node-petstore-with-npm.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-node -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-node-with-npm" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-node -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-node/npm" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-node-petstore.sh b/bin/typescript-node-petstore.sh index 53c5a6f8d828..c9d16d961133 100755 --- a/bin/typescript-node-petstore.sh +++ b/bin/typescript-node-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-node -o samples/client/petstore/typescript-node" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-node -o samples/client/petstore/typescript-node/default" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/typescript-angular2-with-npm.bat b/bin/windows/typescript-angular2-with-npm.bat index 34866ca1faa8..dcbd6df81554 100644 --- a/bin/windows/typescript-angular2-with-npm.bat +++ b/bin/windows/typescript-angular2-with-npm.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\typescript-angular -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-angular2 -o samples\client\petstore\typescript-angular2\npm +set ags=generate -t modules\swagger-codegen\src\main\resources\typescript-angular -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -c bin/typescript-petstore-npm.json -l typescript-angular2 -o samples\client\petstore\typescript-angular2\npm java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-node-with-npm.bat b/bin/windows/typescript-node-with-npm.bat new file mode 100755 index 000000000000..a433181fde97 --- /dev/null +++ b/bin/windows/typescript-node-with-npm.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-node -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -c bin/typescript-petstore-npm.json -l typescript-node -o samples\client\petstore\typescript-node\npm + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-node.bat b/bin/windows/typescript-node.bat index b6d47abd1af0..53f8b34e8430 100755 --- a/bin/windows/typescript-node.bat +++ b/bin/windows/typescript-node.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\typescript-node -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-node -o samples\client\petstore\typescript-node +set ags=generate -t modules\swagger-codegen\src\main\resources\typescript-node -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l typescript-node -o samples\client\petstore\typescript-node\default java %JAVA_OPTS% -jar %executable% %ags% 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 bf6b76d6b41b..25e152a9e344 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache @@ -40,14 +40,14 @@ export namespace {{classname}} { {{/model}} {{/models}} -interface Authentication { +export interface Authentication { /** * Apply authentication settings to header and query params. */ applyToRequest(requestOptions: request.Options): void; } -class HttpBasicAuth implements Authentication { +export class HttpBasicAuth implements Authentication { public username: string; public password: string; applyToRequest(requestOptions: request.Options): void { @@ -57,7 +57,7 @@ class HttpBasicAuth implements Authentication { } } -class ApiKeyAuth implements Authentication { +export class ApiKeyAuth implements Authentication { public apiKey: string; constructor(private location: string, private paramName: string) { @@ -72,7 +72,7 @@ class ApiKeyAuth implements Authentication { } } -class OAuth implements Authentication { +export class OAuth implements Authentication { public accessToken: string; applyToRequest(requestOptions: request.Options): void { @@ -80,7 +80,7 @@ class OAuth implements Authentication { } } -class VoidAuth implements Authentication { +export class VoidAuth implements Authentication { public username: string; public password: string; applyToRequest(requestOptions: request.Options): void { diff --git a/samples/client/petstore/typescript-node-with-npm/api.js b/samples/client/petstore/typescript-node-with-npm/api.js deleted file mode 100644 index 9d7f94556f3b..000000000000 --- a/samples/client/petstore/typescript-node-with-npm/api.js +++ /dev/null @@ -1,1185 +0,0 @@ -"use strict"; -var request = require('request'); -var promise = require('bluebird'); -// =============================================== -// 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["placed"] = 'placed'] = "placed"; - StatusEnum[StatusEnum["approved"] = 'approved'] = "approved"; - StatusEnum[StatusEnum["delivered"] = 'delivered'] = "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["available"] = 'available'] = "available"; - StatusEnum[StatusEnum["pending"] = 'pending'] = "pending"; - StatusEnum[StatusEnum["sold"] = 'sold'] = "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; -}()); -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; -}()); -var OAuth = (function () { - function OAuth() { - } - OAuth.prototype.applyToRequest = function (requestOptions) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - }; - return OAuth; -}()); -var VoidAuth = (function () { - function VoidAuth() { - } - VoidAuth.prototype.applyToRequest = function (requestOptions) { - // Do nothing - }; - return 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 = 'http://petstore.swagger.io/v2'; - this.defaultHeaders = {}; - this.authentications = { - 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key') - }; - 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.petstore_auth.applyToRequest(requestOptions); - 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; - }; - /** - * 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 = 'http://petstore.swagger.io/v2'; - this.defaultHeaders = {}; - this.authentications = { - 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key') - }; - 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 = 'http://petstore.swagger.io/v2'; - this.defaultHeaders = {}; - this.authentications = { - 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key') - }; - 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; -//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/samples/client/petstore/typescript-node-with-npm/api.js.map b/samples/client/petstore/typescript-node-with-npm/api.js.map deleted file mode 100644 index 1a73cf1e8cd9..000000000000 --- a/samples/client/petstore/typescript-node-with-npm/api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"api.js","sourceRoot":"","sources":["api.ts"],"names":[],"mappings":";AAAA,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AACpC,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAGrC,kDAAkD;AAClD,kDAAkD;AAClD,kDAAkD;AAElD,uCAAuC;AAEvC;IAAA;IAGA,CAAC;IAAD,eAAC;AAAD,CAAC,AAHD,IAGC;AAHY,gBAAQ,WAGpB,CAAA;AAED;IAAA;IAUA,CAAC;IAAD,YAAC;AAAD,CAAC,AAVD,IAUC;AAVY,aAAK,QAUjB,CAAA;AAED,IAAiB,KAAK,CAMrB;AAND,WAAiB,KAAK,EAAC,CAAC;IACpB,WAAY,UAAU;QAClB,kCAAe,QAAQ,YAAA,CAAA;QACvB,oCAAiB,UAAU,cAAA,CAAA;QAC3B,qCAAkB,WAAW,eAAA,CAAA;IACjC,CAAC,EAJW,gBAAU,KAAV,gBAAU,QAIrB;IAJD,IAAY,UAAU,GAAV,gBAIX,CAAA;AACL,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB;AACD;IAAA;IAUA,CAAC;IAAD,UAAC;AAAD,CAAC,AAVD,IAUC;AAVY,WAAG,MAUf,CAAA;AAED,IAAiB,GAAG,CAMnB;AAND,WAAiB,GAAG,EAAC,CAAC;IAClB,WAAY,UAAU;QAClB,qCAAkB,WAAW,eAAA,CAAA;QAC7B,mCAAgB,SAAS,aAAA,CAAA;QACzB,gCAAa,MAAM,UAAA,CAAA;IACvB,CAAC,EAJW,cAAU,KAAV,cAAU,QAIrB;IAJD,IAAY,UAAU,GAAV,cAIX,CAAA;AACL,CAAC,EANgB,GAAG,GAAH,WAAG,KAAH,WAAG,QAMnB;AACD;IAAA;IAGA,CAAC;IAAD,UAAC;AAAD,CAAC,AAHD,IAGC;AAHY,WAAG,MAGf,CAAA;AAED;IAAA;IAYA,CAAC;IAAD,WAAC;AAAD,CAAC,AAZD,IAYC;AAZY,YAAI,OAYhB,CAAA;AAUD;IAAA;IAQA,CAAC;IALG,sCAAc,GAAd,UAAe,cAA+B;QAC1C,cAAc,CAAC,IAAI,GAAG;YAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACnD,CAAA;IACL,CAAC;IACL,oBAAC;AAAD,CAAC,AARD,IAQC;AAED;IAGI,oBAAoB,QAAgB,EAAU,SAAiB;QAA3C,aAAQ,GAAR,QAAQ,CAAQ;QAAU,cAAS,GAAT,SAAS,CAAQ;IAC/D,CAAC;IAED,mCAAc,GAAd,UAAe,cAA+B;QAC1C,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC;YACrB,cAAc,CAAC,EAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3D,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC;YACnC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACzD,CAAC;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AAbD,IAaC;AAED;IAAA;IAMA,CAAC;IAHG,8BAAc,GAAd,UAAe,cAA+B;QAC1C,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;IAC3E,CAAC;IACL,YAAC;AAAD,CAAC,AAND,IAMC;AAED;IAAA;IAMA,CAAC;IAHG,iCAAc,GAAd,UAAe,cAA+B;QAC1C,aAAa;IACjB,CAAC;IACL,eAAC;AAAD,CAAC,AAND,IAMC;AAED,WAAY,aAAa;IACrB,uDAAO,CAAA;AACX,CAAC,EAFW,qBAAa,KAAb,qBAAa,QAExB;AAFD,IAAY,aAAa,GAAb,qBAEX,CAAA;AAED;IAWI,gBAAY,kBAA0B,EAAE,QAAiB,EAAE,QAAiB;QAVlE,aAAQ,GAAG,+BAA+B,CAAC;QAC3C,mBAAc,GAAS,EAAE,CAAC;QAE1B,oBAAe,GAAG;YACxB,SAAS,EAAkB,IAAI,QAAQ,EAAE;YACzC,eAAe,EAAE,IAAI,KAAK,EAAE;YAC5B,SAAS,EAAE,IAAI,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SACjD,CAAA;QAIG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACX,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAA;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAEM,0BAAS,GAAhB,UAAiB,GAAkB,EAAE,KAAa;QAC9C,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;IAC5D,CAAC;IAED,sBAAI,+BAAW;aAAf,UAAgB,KAAa;YACzB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3D,CAAC;;;OAAA;IACO,0BAAS,GAAjB,UAAyB,IAAQ,EAAE,IAAQ;QACvC,GAAG,CAAA,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAA,CAAC;YACjB,EAAE,CAAA,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,MAAM,CAAQ,IAAI,CAAC;IACvB,CAAC;IACD;;;;OAIG;IACI,uBAAM,GAAb,UAAe,IAAU;QACrB,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC5C,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;OAKG;IACI,0BAAS,GAAhB,UAAkB,KAAa,EAAE,MAAe;QAC5C,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc;aAC9C,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,6DAA6D;QAC7D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;QAC9F,CAAC;QAED,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;QAEjC,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,QAAQ;YAChB,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,iCAAgB,GAAvB,UAAyB,MAAsB;QAC3C,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC;QACzD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,EAAE,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC;YACvB,eAAe,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;QACvC,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAyD,CAAC;QAE9F,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,+BAAc,GAArB,UAAuB,IAAoB;QACvC,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC;QACvD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;YACrB,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACnC,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAyD,CAAC;QAE9F,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,2BAAU,GAAjB,UAAmB,KAAa;QAC5B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc;aAC9C,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,6DAA6D;QAC7D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;QAC/F,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAkD,CAAC;QAEvF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,0BAAS,GAAhB,UAAkB,IAAU;QACxB,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC5C,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;;OAMG;IACI,kCAAiB,GAAxB,UAA0B,KAAa,EAAE,IAAa,EAAE,MAAe;QACnE,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc;aAC9C,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,6DAA6D;QAC7D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;QACtG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;YACrB,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAC9B,CAAC;QAED,EAAE,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC;YACvB,UAAU,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;QAClC,CAAC;QAED,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;;OAMG;IACI,2BAAU,GAAjB,UAAmB,KAAa,EAAE,kBAA2B,EAAE,IAAU;QACrE,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,0BAA0B;aAC1D,OAAO,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,6DAA6D;QAC7D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;QAC/F,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,EAAE,CAAC,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC;YACnC,UAAU,CAAC,oBAAoB,CAAC,GAAG,kBAAkB,CAAC;QAC1D,CAAC;QAED,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;YACrB,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAC9B,CAAC;QACD,WAAW,GAAG,IAAI,CAAC;QAEnB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACL,aAAC;AAAD,CAAC,AAlfD,IAkfC;AAlfY,cAAM,SAkflB,CAAA;AACD,WAAY,eAAe;IACvB,2DAAO,CAAA;AACX,CAAC,EAFW,uBAAe,KAAf,uBAAe,QAE1B;AAFD,IAAY,eAAe,GAAf,uBAEX,CAAA;AAED;IAWI,kBAAY,kBAA0B,EAAE,QAAiB,EAAE,QAAiB;QAVlE,aAAQ,GAAG,+BAA+B,CAAC;QAC3C,mBAAc,GAAS,EAAE,CAAC;QAE1B,oBAAe,GAAG;YACxB,SAAS,EAAkB,IAAI,QAAQ,EAAE;YACzC,eAAe,EAAE,IAAI,KAAK,EAAE;YAC5B,SAAS,EAAE,IAAI,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SACjD,CAAA;QAIG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACX,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAA;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAEM,4BAAS,GAAhB,UAAiB,GAAoB,EAAE,KAAa;QAChD,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;IAC9D,CAAC;IAED,sBAAI,iCAAW;aAAf,UAAgB,KAAa;YACzB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3D,CAAC;;;OAAA;IACO,4BAAS,GAAjB,UAAyB,IAAQ,EAAE,IAAQ;QACvC,GAAG,CAAA,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAA,CAAC;YACjB,EAAE,CAAA,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,MAAM,CAAQ,IAAI,CAAC;IACvB,CAAC;IACD;;;;OAIG;IACI,8BAAW,GAAlB,UAAoB,OAAe;QAC/B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,wBAAwB;aACxD,OAAO,CAAC,GAAG,GAAG,SAAS,GAAG,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACrD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,+DAA+D;QAC/D,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAClG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,QAAQ;YAChB,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;OAGG;IACI,+BAAY,GAAnB;QACI,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAC;QACxD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAyE,CAAC;QAE9G,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,+BAAY,GAAnB,UAAqB,OAAe;QAChC,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,wBAAwB;aACxD,OAAO,CAAC,GAAG,GAAG,SAAS,GAAG,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACrD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,+DAA+D;QAC/D,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;QACnG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAoD,CAAC;QAEzF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,6BAAU,GAAjB,UAAmB,IAAY;QAC3B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC;QACpD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAoD,CAAC;QAEzF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACL,eAAC;AAAD,CAAC,AApPD,IAoPC;AApPY,gBAAQ,WAoPpB,CAAA;AACD,WAAY,cAAc;IACtB,yDAAO,CAAA;AACX,CAAC,EAFW,sBAAc,KAAd,sBAAc,QAEzB;AAFD,IAAY,cAAc,GAAd,sBAEX,CAAA;AAED;IAWI,iBAAY,kBAA0B,EAAE,QAAiB,EAAE,QAAiB;QAVlE,aAAQ,GAAG,+BAA+B,CAAC;QAC3C,mBAAc,GAAS,EAAE,CAAC;QAE1B,oBAAe,GAAG;YACxB,SAAS,EAAkB,IAAI,QAAQ,EAAE;YACzC,eAAe,EAAE,IAAI,KAAK,EAAE;YAC5B,SAAS,EAAE,IAAI,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SACjD,CAAA;QAIG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACX,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAA;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAEM,2BAAS,GAAhB,UAAiB,GAAmB,EAAE,KAAa;QAC/C,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;IAC7D,CAAC;IAED,sBAAI,gCAAW;aAAf,UAAgB,KAAa;YACzB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3D,CAAC;;;OAAA;IACO,2BAAS,GAAjB,UAAyB,IAAQ,EAAE,IAAQ;QACvC,GAAG,CAAA,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAA,CAAC;YACjB,EAAE,CAAA,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,MAAM,CAAQ,IAAI,CAAC;IACvB,CAAC;IACD;;;;OAIG;IACI,4BAAU,GAAjB,UAAmB,IAAW;QAC1B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC7C,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,2CAAyB,GAAhC,UAAkC,IAAkB;QAChD,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,uBAAuB,CAAC;QAC7D,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,0CAAwB,GAA/B,UAAiC,IAAkB;QAC/C,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,sBAAsB,CAAC;QAC5D,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,4BAAU,GAAjB,UAAmB,QAAgB;QAC/B,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB;aAClD,OAAO,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,gEAAgE;QAChE,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAClG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,QAAQ;YAChB,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACI,+BAAa,GAApB,UAAsB,QAAgB;QAClC,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB;aAClD,OAAO,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,gEAAgE;QAChE,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;QACrG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;OAKG;IACI,2BAAS,GAAhB,UAAkB,QAAiB,EAAE,QAAiB;QAClD,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC;QACnD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,EAAE,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YACzB,eAAe,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;QAC3C,CAAC;QAED,EAAE,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YACzB,eAAe,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;QAC3C,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAqD,CAAC;QAE1F,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;OAGG;IACI,4BAAU,GAAjB;QACI,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC;QACpD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACD;;;;;OAKG;IACI,4BAAU,GAAjB,UAAmB,QAAgB,EAAE,IAAW;QAC5C,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB;aAClD,OAAO,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,YAAY,GAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,IAAI,UAAU,GAAQ,EAAE,CAAC;QAGzB,gEAAgE;QAChE,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAClG,CAAC;QAED,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,IAAI,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAmD,CAAC;QAExF,IAAI,cAAc,GAAoB;YAClC,MAAM,EAAE,KAAK;YACb,EAAE,EAAE,eAAe;YACnB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAA;QAED,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAE5D,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBACR,cAAe,CAAC,QAAQ,GAAG,UAAU,CAAC;YAChD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,cAAc,CAAC,IAAI,GAAG,UAAU,CAAC;YACrC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;YAC1C,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC;oBAC3D,gBAAgB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjE,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC;IACpC,CAAC;IACL,cAAC;AAAD,CAAC,AArcD,IAqcC;AArcY,eAAO,UAqcnB,CAAA"} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node-with-npm/api.ts b/samples/client/petstore/typescript-node/default/api.ts similarity index 99% rename from samples/client/petstore/typescript-node-with-npm/api.ts rename to samples/client/petstore/typescript-node/default/api.ts index 10aa9d5125c2..3e25b5e718c0 100644 --- a/samples/client/petstore/typescript-node-with-npm/api.ts +++ b/samples/client/petstore/typescript-node/default/api.ts @@ -71,14 +71,14 @@ export class User { } -interface Authentication { +export interface Authentication { /** * Apply authentication settings to header and query params. */ applyToRequest(requestOptions: request.Options): void; } -class HttpBasicAuth implements Authentication { +export class HttpBasicAuth implements Authentication { public username: string; public password: string; applyToRequest(requestOptions: request.Options): void { @@ -88,7 +88,7 @@ class HttpBasicAuth implements Authentication { } } -class ApiKeyAuth implements Authentication { +export class ApiKeyAuth implements Authentication { public apiKey: string; constructor(private location: string, private paramName: string) { @@ -103,7 +103,7 @@ class ApiKeyAuth implements Authentication { } } -class OAuth implements Authentication { +export class OAuth implements Authentication { public accessToken: string; applyToRequest(requestOptions: request.Options): void { @@ -111,7 +111,7 @@ class OAuth implements Authentication { } } -class VoidAuth implements Authentication { +export class VoidAuth implements Authentication { public username: string; public password: string; applyToRequest(requestOptions: request.Options): void { diff --git a/samples/client/petstore/typescript-node-with-npm/git_push.sh b/samples/client/petstore/typescript-node/default/git_push.sh similarity index 100% rename from samples/client/petstore/typescript-node-with-npm/git_push.sh rename to samples/client/petstore/typescript-node/default/git_push.sh diff --git a/samples/client/petstore/typescript-node/api.ts b/samples/client/petstore/typescript-node/npm/api.ts similarity index 99% rename from samples/client/petstore/typescript-node/api.ts rename to samples/client/petstore/typescript-node/npm/api.ts index 10aa9d5125c2..3e25b5e718c0 100644 --- a/samples/client/petstore/typescript-node/api.ts +++ b/samples/client/petstore/typescript-node/npm/api.ts @@ -71,14 +71,14 @@ export class User { } -interface Authentication { +export interface Authentication { /** * Apply authentication settings to header and query params. */ applyToRequest(requestOptions: request.Options): void; } -class HttpBasicAuth implements Authentication { +export class HttpBasicAuth implements Authentication { public username: string; public password: string; applyToRequest(requestOptions: request.Options): void { @@ -88,7 +88,7 @@ class HttpBasicAuth implements Authentication { } } -class ApiKeyAuth implements Authentication { +export class ApiKeyAuth implements Authentication { public apiKey: string; constructor(private location: string, private paramName: string) { @@ -103,7 +103,7 @@ class ApiKeyAuth implements Authentication { } } -class OAuth implements Authentication { +export class OAuth implements Authentication { public accessToken: string; applyToRequest(requestOptions: request.Options): void { @@ -111,7 +111,7 @@ class OAuth implements Authentication { } } -class VoidAuth implements Authentication { +export class VoidAuth implements Authentication { public username: string; public password: string; applyToRequest(requestOptions: request.Options): void { diff --git a/samples/client/petstore/typescript-node/git_push.sh b/samples/client/petstore/typescript-node/npm/git_push.sh similarity index 100% rename from samples/client/petstore/typescript-node/git_push.sh rename to samples/client/petstore/typescript-node/npm/git_push.sh diff --git a/samples/client/petstore/typescript-node-with-npm/package.json b/samples/client/petstore/typescript-node/npm/package.json similarity index 92% rename from samples/client/petstore/typescript-node-with-npm/package.json rename to samples/client/petstore/typescript-node/npm/package.json index 01213e7e2127..388727df1860 100644 --- a/samples/client/petstore/typescript-node-with-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.201604272308", + "version": "0.0.1-SNAPSHOT.201604282147", "description": "NodeJS client for @swagger/angular2-typescript-petstore", "main": "api.js", "scripts": { diff --git a/samples/client/petstore/typescript-node-with-npm/tsconfig.json b/samples/client/petstore/typescript-node/npm/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript-node-with-npm/tsconfig.json rename to samples/client/petstore/typescript-node/npm/tsconfig.json diff --git a/samples/client/petstore/typescript-node-with-npm/typings.json b/samples/client/petstore/typescript-node/npm/typings.json similarity index 100% rename from samples/client/petstore/typescript-node-with-npm/typings.json rename to samples/client/petstore/typescript-node/npm/typings.json From 19d22d834c20f367fc84573fc42d77b515acd195 Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Thu, 21 Apr 2016 12:47:07 -0400 Subject: [PATCH 038/114] 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 90442db86d9d53f1d52ca5fe8e2bf4022ada697c Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 29 Apr 2016 11:10:52 +0800 Subject: [PATCH 039/114] 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 040/114] 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 041/114] 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 042/114] 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 de5363c21b544da4ce4c915b5a6839fee9543a9c Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Fri, 29 Apr 2016 08:49:48 +0200 Subject: [PATCH 043/114] Correcting author --- README.md | 1 + .../src/main/resources/typescript-angular2/package.mustache | 2 +- .../src/main/resources/typescript-node/package.mustache | 4 ++-- samples/client/petstore/typescript-angular2/npm/README.md | 4 ++-- samples/client/petstore/typescript-angular2/npm/package.json | 4 ++-- samples/client/petstore/typescript-node/npm/package.json | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1d97c7675d8c..5d43198847dc 100644 --- a/README.md +++ b/README.md @@ -790,6 +790,7 @@ 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 ------- diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache index a472df51414a..0b2e50acb442 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/package.mustache @@ -2,7 +2,7 @@ "name": "{{npmName}}", "version": "{{npmVersion}}", "description": "swagger client for {{npmName}}", - "author": "Kristof Vrolijkx", + "author": "Swagger Codegen Contributors", "keywords": [ "swagger-client" ], diff --git a/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache index 29a9b60bbaee..967145002087 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-node/package.mustache @@ -6,8 +6,8 @@ "scripts": { "build": "typings install && tsc" }, - "author": "Mads M. Tandrup", - "license": "Apache 2.0", + "author": "Swagger Codegen Contributors", + "license": "MIT", "dependencies": { "bluebird": "^3.3.5", "request": "^2.72.0" diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index f362d0329cce..8120c59916e1 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604242228 +## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604282253 ### Building @@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's. _published:_ ``` -npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604242228 --save +npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604282253 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json index 01f8db7c5a01..cab5097a4edf 100644 --- a/samples/client/petstore/typescript-angular2/npm/package.json +++ b/samples/client/petstore/typescript-angular2/npm/package.json @@ -1,8 +1,8 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201604242228", + "version": "0.0.1-SNAPSHOT.201604282253", "description": "swagger client for @swagger/angular2-typescript-petstore", - "author": "Kristof Vrolijkx", + "author": "Swagger Codegen Contributors", "keywords": [ "swagger-client" ], diff --git a/samples/client/petstore/typescript-node/npm/package.json b/samples/client/petstore/typescript-node/npm/package.json index 388727df1860..67a7cc03a361 100644 --- a/samples/client/petstore/typescript-node/npm/package.json +++ b/samples/client/petstore/typescript-node/npm/package.json @@ -6,8 +6,8 @@ "scripts": { "build": "typings install && tsc" }, - "author": "Mads M. Tandrup", - "license": "Apache 2.0", + "author": "Swagger Codegen Contributors", + "license": "MIT", "dependencies": { "bluebird": "^3.3.5", "request": "^2.72.0" From a6e45bf97dfc25852dbabe0d24d9b6260dd9ebb0 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Fri, 29 Apr 2016 15:59:21 -0700 Subject: [PATCH 044/114] 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 045/114] 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 046/114] 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 047/114] 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 048/114] 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 049/114] 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 050/114] 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 051/114] 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 052/114] 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 053/114] 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 054/114] 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 d6158c4c55377bff8a2fbd0c7304ab1964c8e6f2 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 2 May 2016 22:06:33 +0800 Subject: [PATCH 055/114] 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 056/114] 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 057/114] 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 058/114] 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 d6941186858a148676a1318f047ca75976d33c65 Mon Sep 17 00:00:00 2001 From: Ben Herila Date: Sun, 27 Mar 2016 19:10:18 -0700 Subject: [PATCH 059/114] 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 060/114] 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 061/114] 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 062/114] 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 063/114] 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 064/114] 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 065/114] 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 066/114] 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 067/114] 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 068/114] 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 069/114] 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 070/114] 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 071/114] 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 072/114] 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 073/114] 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 074/114] 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 075/114] 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 076/114] 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 077/114] 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 078/114] 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 079/114] 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 080/114] 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 081/114] 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 082/114] 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 083/114] 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 084/114] 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 085/114] 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 086/114] 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 087/114] 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 088/114] 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 089/114] 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,QAMrB;AACD;IAAAG;IAUAC,CAACA;IAADD,UAACA;AAADA,CAACA,AAVD,IAUC;AAVY,WAAG,MAUf,CAAA;AAED,IAAiB,GAAG,CAMnB;AAND,WAAiB,GAAG,EAAC,CAAC;IAClBA,WAAYA,UAAUA;QAClBE,gDAA6BA,WAAWA,0BAAAA,CAAAA;QACxCA,8CAA2BA,SAASA,wBAAAA,CAAAA;QACpCA,2CAAwBA,MAAMA,qBAAAA,CAAAA;IAClCA,CAACA,EAJWF,cAAUA,KAAVA,cAAUA,QAIrBA;IAJDA,IAAYA,UAAUA,GAAVA,cAIXA,CAAAA;AACLA,CAACA,EANgB,GAAG,GAAH,WAAG,KAAH,WAAG,QAMnB;AACD;IAAAG;IAGAC,CAACA;IAADD,UAACA;AAADA,CAACA,AAHD,IAGC;AAHY,WAAG,MAGf,CAAA;AAED;IAAAE;IAYAC,CAACA;IAADD,WAACA;AAADA,CAACA,AAZD,IAYC;AAZY,YAAI,OAYhB,CAAA;AAUD;IAAAE;IAQAC,CAACA;IALGD,sCAAcA,GAAdA,UAAeA,cAA+BA;QAC1CE,cAAcA,CAACA,IAAIA,GAAGA;YAClBA,QAAQA,EAAEA,IAAIA,CAACA,QAAQA,EAAEA,QAAQA,EAAEA,IAAIA,CAACA,QAAQA;SACnDA,CAAAA;IACLA,CAACA;IACLF,oBAACA;AAADA,CAACA,AARD,IAQC;AARY,qBAAa,gBAQzB,CAAA;AAED;IAGIG,oBAAoBA,QAAgBA,EAAUA,SAAiBA;QAA3CC,aAAQA,GAARA,QAAQA,CAAQA;QAAUA,cAASA,GAATA,SAASA,CAAQA;IAC/DA,CAACA;IAEDD,mCAAcA,GAAdA,UAAeA,cAA+BA;QAC1CE,EAAEA,CAACA,CAACA,IAAIA,CAACA,QAAQA,IAAIA,OAAOA,CAACA,CAACA,CAACA;YACrBA,cAAcA,CAACA,EAAGA,CAACA,IAAIA,CAACA,SAASA,CAACA,GAAGA,IAAIA,CAACA,MAAMA,CAACA;QAC3DA,CAACA;QAACA,IAAIA,CAACA,EAAEA,CAACA,CAACA,IAAIA,CAACA,QAAQA,IAAIA,QAAQA,CAACA,CAACA,CAACA;YACnCA,cAAcA,CAACA,OAAOA,CAACA,IAAIA,CAACA,SAASA,CAACA,GAAGA,IAAIA,CAACA,MAAMA,CAACA;QACzDA,CAACA;IACLA,CAACA;IACLF,iBAACA;AAADA,CAACA,AAbD,IAaC;AAbY,kBAAU,aAatB,CAAA;AAED;IAAAG;IAMAC,CAACA;IAHGD,8BAAcA,GAAdA,UAAeA,cAA+BA;QAC1CE,cAAcA,CAACA,OAAOA,CAACA,eAAeA,CAACA,GAAGA,SAASA,GAAGA,IAAIA,CAACA,WAAWA,CAACA;IAC3EA,CAACA;IACLF,YAACA;AAADA,CAACA,AAND,IAMC;AANY,aAAK,QAMjB,CAAA;AAED;IAAAG;IAMAC,CAACA;IAHGD,iCAAcA,GAAdA,UAAeA,cAA+BA;IAE9CE,CAACA;IACLF,eAACA;AAADA,CAACA,AAND,IAMC;AANY,gBAAQ,WAMpB,CAAA;AAED,WAAY,aAAa;IACrBG,uDAAOA,CAAAA;AACXA,CAACA,EAFW,qBAAa,KAAb,qBAAa,QAExB;AAFD,IAAY,aAAa,GAAb,qBAEX,CAAA;AAED;IAWIC,gBAAYA,kBAA0BA,EAAEA,QAAiBA,EAAEA,QAAiBA;QAVlEC,aAAQA,GAAGA,eAAeA,CAACA;QAC3BA,mBAAcA,GAASA,EAAEA,CAACA;QAE1BA,oBAAeA,GAAGA;YACxBA,SAASA,EAAkBA,IAAIA,QAAQA,EAAEA;YACzCA,SAASA,EAAEA,IAAIA,UAAUA,CAACA,QAAQA,EAAEA,SAASA,CAACA;YAC9CA,eAAeA,EAAEA,IAAIA,KAAKA,EAAEA;SAC/BA,CAAAA;QAIGA,EAAEA,CAACA,CAACA,QAAQA,CAACA,CAACA,CAACA;YACXA,EAAEA,CAACA,CAACA,QAAQA,CAACA,CAACA,CAACA;gBACXA,IAAIA,CAACA,QAAQA,GAAGA,QAAQA,CAACA;YAC7BA,CAACA;QACLA,CAACA;QAACA,IAAIA,CAACA,CAACA;YACJA,EAAEA,CAACA,CAACA,kBAAkBA,CAACA,CAACA,CAACA;gBACrBA,IAAIA,CAACA,QAAQA,GAAGA,kBAAkBA,CAAAA;YACtCA,CAACA;QACLA,CAACA;IACLA,CAACA;IAEMD,0BAASA,GAAhBA,UAAiBA,GAAkBA,EAAEA,KAAaA;QAC9CE,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,GAAGA,CAACA,CAACA,CAACA,MAAMA,GAAGA,KAAKA,CAACA;IAC5DA,CAACA;IAEDF,sBAAIA,+BAAWA;aAAfA,UAAgBA,KAAaA;YACzBG,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,WAAWA,GAAGA,KAAKA,CAACA;QAC3DA,CAACA;;;OAAAH;IACOA,0BAASA,GAAjBA,UAAyBA,IAAQA,EAAEA,IAAQA;QACvCI,GAAGA,CAAAA,CAACA,GAAGA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,CAAAA,CAACA;YACjBA,EAAEA,CAAAA,CAACA,IAAIA,CAACA,cAAcA,CAACA,GAAGA,CAACA,CAACA,CAAAA,CAACA;gBACzBA,IAAIA,CAACA,GAAGA,CAACA,GAAGA,IAAIA,CAACA,GAAGA,CAACA,CAACA;YAC1BA,CAACA;QACLA,CAACA;QACDA,MAAMA,CAAQA,IAAIA,CAACA;IACvBA,CAACA;IAMMJ,uBAAMA,GAAbA,UAAeA,IAAUA;QACrBK,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,MAAMA,CAACA;QAC5CA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,MAAMA;YACdA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;YACVA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAElEA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAOML,0BAASA,GAAhBA,UAAkBA,KAAaA,EAAEA,MAAeA;QAC5CM,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,cAAcA;aAC9CA,OAAOA,CAACA,GAAGA,GAAGA,OAAOA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,KAAKA,CAACA,CAACA,CAACA;QACjDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,KAAKA,KAAKA,IAAIA,IAAIA,KAAKA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACxCA,MAAMA,IAAIA,KAAKA,CAACA,wEAAwEA,CAACA,CAACA;QAC9FA,CAACA;QAEDA,YAAYA,CAACA,SAASA,CAACA,GAAGA,MAAMA,CAACA;QAEjCA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,QAAQA;YAChBA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAElEA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMN,iCAAgBA,GAAvBA,UAAyBA,MAAsBA;QAC3CO,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,mBAAmBA,CAACA;QACzDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,EAAEA,CAACA,CAACA,MAAMA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACvBA,eAAeA,CAACA,QAAQA,CAACA,GAAGA,MAAMA,CAACA;QACvCA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAyDA,CAACA;QAC9FA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAElEA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMP,+BAAcA,GAArBA,UAAuBA,IAAoBA;QACvCQ,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,iBAAiBA,CAACA;QACvDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,EAAEA,CAACA,CAACA,IAAIA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACrBA,eAAeA,CAACA,MAAMA,CAACA,GAAGA,IAAIA,CAACA;QACnCA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAyDA,CAACA;QAC9FA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAElEA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMR,2BAAUA,GAAjBA,UAAmBA,KAAaA;QAC5BS,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,cAAcA;aAC9CA,OAAOA,CAACA,GAAGA,GAAGA,OAAOA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,KAAKA,CAACA,CAACA,CAACA;QACjDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,KAAKA,KAAKA,IAAIA,IAAIA,KAAKA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACxCA,MAAMA,IAAIA,KAAKA,CAACA,yEAAyEA,CAACA,CAACA;QAC/FA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAkDA,CAACA;QACvFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAElEA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMT,0BAASA,GAAhBA,UAAkBA,IAAUA;QACxBU,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,MAAMA,CAACA;QAC5CA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;YACVA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAElEA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAQMV,kCAAiBA,GAAxBA,UAA0BA,KAAaA,EAAEA,IAAaA,EAAEA,MAAeA;QACnEW,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,cAAcA;aAC9CA,OAAOA,CAACA,GAAGA,GAAGA,OAAOA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,KAAKA,CAACA,CAACA,CAACA;QACjDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,KAAKA,KAAKA,IAAIA,IAAIA,KAAKA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACxCA,MAAMA,IAAIA,KAAKA,CAACA,gFAAgFA,CAACA,CAACA;QACtGA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,EAAEA,CAACA,CAACA,IAAIA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACrBA,UAAUA,CAACA,MAAMA,CAACA,GAAGA,IAAIA,CAACA;QAC9BA,CAACA;QAEDA,EAAEA,CAACA,CAACA,MAAMA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACvBA,UAAUA,CAACA,QAAQA,CAACA,GAAGA,MAAMA,CAACA;QAClCA,CAACA;QAEDA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,MAAMA;YACdA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAElEA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAQMX,2BAAUA,GAAjBA,UAAmBA,KAAaA,EAAEA,kBAA2BA,EAAEA,IAAUA;QACrEY,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,0BAA0BA;aAC1DA,OAAOA,CAACA,GAAGA,GAAGA,OAAOA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,KAAKA,CAACA,CAACA,CAACA;QACjDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,KAAKA,KAAKA,IAAIA,IAAIA,KAAKA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACxCA,MAAMA,IAAIA,KAAKA,CAACA,yEAAyEA,CAACA,CAACA;QAC/FA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,EAAEA,CAACA,CAACA,kBAAkBA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACnCA,UAAUA,CAACA,oBAAoBA,CAACA,GAAGA,kBAAkBA,CAACA;QAC1DA,CAACA;QAEDA,EAAEA,CAACA,CAACA,IAAIA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACrBA,UAAUA,CAACA,MAAMA,CAACA,GAAGA,IAAIA,CAACA;QAC9BA,CAACA;QACDA,WAAWA,GAAGA,IAAIA,CAACA;QAEnBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,MAAMA;YACdA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAElEA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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,aAACA;AAADA,CAACA,AA1dD,IA0dC;AA1dY,cAAM,SA0dlB,CAAA;AACD,WAAY,eAAe;IACvBa,2DAAOA,CAAAA;AACXA,CAACA,EAFW,uBAAe,KAAf,uBAAe,QAE1B;AAFD,IAAY,eAAe,GAAf,uBAEX,CAAA;AAED;IAWIC,kBAAYA,kBAA0BA,EAAEA,QAAiBA,EAAEA,QAAiBA;QAVlEC,aAAQA,GAAGA,eAAeA,CAACA;QAC3BA,mBAAcA,GAASA,EAAEA,CAACA;QAE1BA,oBAAeA,GAAGA;YACxBA,SAASA,EAAkBA,IAAIA,QAAQA,EAAEA;YACzCA,SAASA,EAAEA,IAAIA,UAAUA,CAACA,QAAQA,EAAEA,SAASA,CAACA;YAC9CA,eAAeA,EAAEA,IAAIA,KAAKA,EAAEA;SAC/BA,CAAAA;QAIGA,EAAEA,CAACA,CAACA,QAAQA,CAACA,CAACA,CAACA;YACXA,EAAEA,CAACA,CAACA,QAAQA,CAACA,CAACA,CAACA;gBACXA,IAAIA,CAACA,QAAQA,GAAGA,QAAQA,CAACA;YAC7BA,CAACA;QACLA,CAACA;QAACA,IAAIA,CAACA,CAACA;YACJA,EAAEA,CAACA,CAACA,kBAAkBA,CAACA,CAACA,CAACA;gBACrBA,IAAIA,CAACA,QAAQA,GAAGA,kBAAkBA,CAAAA;YACtCA,CAACA;QACLA,CAACA;IACLA,CAACA;IAEMD,4BAASA,GAAhBA,UAAiBA,GAAoBA,EAAEA,KAAaA;QAChDE,IAAIA,CAACA,eAAeA,CAACA,eAAeA,CAACA,GAAGA,CAACA,CAACA,CAACA,MAAMA,GAAGA,KAAKA,CAACA;IAC9DA,CAACA;IAEDF,sBAAIA,iCAAWA;aAAfA,UAAgBA,KAAaA;YACzBG,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,WAAWA,GAAGA,KAAKA,CAACA;QAC3DA,CAACA;;;OAAAH;IACOA,4BAASA,GAAjBA,UAAyBA,IAAQA,EAAEA,IAAQA;QACvCI,GAAGA,CAAAA,CAACA,GAAGA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,CAAAA,CAACA;YACjBA,EAAEA,CAAAA,CAACA,IAAIA,CAACA,cAAcA,CAACA,GAAGA,CAACA,CAACA,CAAAA,CAACA;gBACzBA,IAAIA,CAACA,GAAGA,CAACA,GAAGA,IAAIA,CAACA,GAAGA,CAACA,CAACA;YAC1BA,CAACA;QACLA,CAACA;QACDA,MAAMA,CAAQA,IAAIA,CAACA;IACvBA,CAACA;IAMMJ,8BAAWA,GAAlBA,UAAoBA,OAAeA;QAC/BK,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,wBAAwBA;aACxDA,OAAOA,CAACA,GAAGA,GAAGA,SAASA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,OAAOA,CAACA,CAACA,CAACA;QACrDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,OAAOA,KAAKA,IAAIA,IAAIA,OAAOA,KAAKA,SAASA,CAACA,CAACA,CAACA;YAC5CA,MAAMA,IAAIA,KAAKA,CAACA,4EAA4EA,CAACA,CAACA;QAClGA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,QAAQA;YAChBA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAKML,+BAAYA,GAAnBA;QACIM,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,kBAAkBA,CAACA;QACxDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAyEA,CAACA;QAC9GA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMN,+BAAYA,GAAnBA,UAAqBA,OAAeA;QAChCO,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,wBAAwBA;aACxDA,OAAOA,CAACA,GAAGA,GAAGA,SAASA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,OAAOA,CAACA,CAACA,CAACA;QACrDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,OAAOA,KAAKA,IAAIA,IAAIA,OAAOA,KAAKA,SAASA,CAACA,CAACA,CAACA;YAC5CA,MAAMA,IAAIA,KAAKA,CAACA,6EAA6EA,CAACA,CAACA;QACnGA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAoDA,CAACA;QACzFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMP,6BAAUA,GAAjBA,UAAmBA,IAAYA;QAC3BQ,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,cAAcA,CAACA;QACpDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAoDA,CAACA;QACzFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,MAAMA;YACdA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;YACVA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IACLR,eAACA;AAADA,CAACA,AAxOD,IAwOC;AAxOY,gBAAQ,WAwOpB,CAAA;AACD,WAAY,cAAc;IACtBS,yDAAOA,CAAAA;AACXA,CAACA,EAFW,sBAAc,KAAd,sBAAc,QAEzB;AAFD,IAAY,cAAc,GAAd,sBAEX,CAAA;AAED;IAWIC,iBAAYA,kBAA0BA,EAAEA,QAAiBA,EAAEA,QAAiBA;QAVlEC,aAAQA,GAAGA,eAAeA,CAACA;QAC3BA,mBAAcA,GAASA,EAAEA,CAACA;QAE1BA,oBAAeA,GAAGA;YACxBA,SAASA,EAAkBA,IAAIA,QAAQA,EAAEA;YACzCA,SAASA,EAAEA,IAAIA,UAAUA,CAACA,QAAQA,EAAEA,SAASA,CAACA;YAC9CA,eAAeA,EAAEA,IAAIA,KAAKA,EAAEA;SAC/BA,CAAAA;QAIGA,EAAEA,CAACA,CAACA,QAAQA,CAACA,CAACA,CAACA;YACXA,EAAEA,CAACA,CAACA,QAAQA,CAACA,CAACA,CAACA;gBACXA,IAAIA,CAACA,QAAQA,GAAGA,QAAQA,CAACA;YAC7BA,CAACA;QACLA,CAACA;QAACA,IAAIA,CAACA,CAACA;YACJA,EAAEA,CAACA,CAACA,kBAAkBA,CAACA,CAACA,CAACA;gBACrBA,IAAIA,CAACA,QAAQA,GAAGA,kBAAkBA,CAAAA;YACtCA,CAACA;QACLA,CAACA;IACLA,CAACA;IAEMD,2BAASA,GAAhBA,UAAiBA,GAAmBA,EAAEA,KAAaA;QAC/CE,IAAIA,CAACA,eAAeA,CAACA,cAAcA,CAACA,GAAGA,CAACA,CAACA,CAACA,MAAMA,GAAGA,KAAKA,CAACA;IAC7DA,CAACA;IAEDF,sBAAIA,gCAAWA;aAAfA,UAAgBA,KAAaA;YACzBG,IAAIA,CAACA,eAAeA,CAACA,aAAaA,CAACA,WAAWA,GAAGA,KAAKA,CAACA;QAC3DA,CAACA;;;OAAAH;IACOA,2BAASA,GAAjBA,UAAyBA,IAAQA,EAAEA,IAAQA;QACvCI,GAAGA,CAAAA,CAACA,GAAGA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,CAAAA,CAACA;YACjBA,EAAEA,CAAAA,CAACA,IAAIA,CAACA,cAAcA,CAACA,GAAGA,CAACA,CAACA,CAAAA,CAACA;gBACzBA,IAAIA,CAACA,GAAGA,CAACA,GAAGA,IAAIA,CAACA,GAAGA,CAACA,CAACA;YAC1BA,CAACA;QACLA,CAACA;QACDA,MAAMA,CAAQA,IAAIA,CAACA;IACvBA,CAACA;IAMMJ,4BAAUA,GAAjBA,UAAmBA,IAAWA;QAC1BK,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;QAC7CA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,MAAMA;YACdA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;YACVA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMML,2CAAyBA,GAAhCA,UAAkCA,IAAkBA;QAChDM,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,uBAAuBA,CAACA;QAC7DA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,MAAMA;YACdA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;YACVA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMN,0CAAwBA,GAA/BA,UAAiCA,IAAkBA;QAC/CO,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,sBAAsBA,CAACA;QAC5DA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,MAAMA;YACdA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;YACVA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMP,4BAAUA,GAAjBA,UAAmBA,QAAgBA;QAC/BQ,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,kBAAkBA;aAClDA,OAAOA,CAACA,GAAGA,GAAGA,UAAUA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA;QACvDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,QAAQA,KAAKA,IAAIA,IAAIA,QAAQA,KAAKA,SAASA,CAACA,CAACA,CAACA;YAC9CA,MAAMA,IAAIA,KAAKA,CAACA,4EAA4EA,CAACA,CAACA;QAClGA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,QAAQA;YAChBA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAMMR,+BAAaA,GAApBA,UAAsBA,QAAgBA;QAClCS,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,kBAAkBA;aAClDA,OAAOA,CAACA,GAAGA,GAAGA,UAAUA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA;QACvDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,QAAQA,KAAKA,IAAIA,IAAIA,QAAQA,KAAKA,SAASA,CAACA,CAACA,CAACA;YAC9CA,MAAMA,IAAIA,KAAKA,CAACA,+EAA+EA,CAACA,CAACA;QACrGA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAOMT,2BAASA,GAAhBA,UAAkBA,QAAiBA,EAAEA,QAAiBA;QAClDU,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,aAAaA,CAACA;QACnDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,EAAEA,CAACA,CAACA,QAAQA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACzBA,eAAeA,CAACA,UAAUA,CAACA,GAAGA,QAAQA,CAACA;QAC3CA,CAACA;QAEDA,EAAEA,CAACA,CAACA,QAAQA,KAAKA,SAASA,CAACA,CAACA,CAACA;YACzBA,eAAeA,CAACA,UAAUA,CAACA,GAAGA,QAAQA,CAACA;QAC3CA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAqDA,CAACA;QAC1FA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAKMV,4BAAUA,GAAjBA;QACIW,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,cAAcA,CAACA;QACpDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAGzBA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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;IAOMX,4BAAUA,GAAjBA,UAAmBA,QAAgBA,EAAEA,IAAWA;QAC5CY,IAAMA,YAAYA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,kBAAkBA;aAClDA,OAAOA,CAACA,GAAGA,GAAGA,UAAUA,GAAGA,GAAGA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA;QACvDA,IAAIA,eAAeA,GAAQA,EAAEA,CAACA;QAC9BA,IAAIA,YAAYA,GAAQA,IAAIA,CAACA,SAASA,CAACA,EAAEA,EAAEA,IAAIA,CAACA,cAAcA,CAACA,CAACA;QAChEA,IAAIA,UAAUA,GAAQA,EAAEA,CAACA;QAIzBA,EAAEA,CAACA,CAACA,QAAQA,KAAKA,IAAIA,IAAIA,QAAQA,KAAKA,SAASA,CAACA,CAACA,CAACA;YAC9CA,MAAMA,IAAIA,KAAKA,CAACA,4EAA4EA,CAACA,CAACA;QAClGA,CAACA;QAEDA,IAAIA,WAAWA,GAAGA,KAAKA,CAACA;QAExBA,IAAIA,gBAAgBA,GAAGA,OAAOA,CAACA,KAAKA,EAAmDA,CAACA;QACxFA,IAAIA,cAAcA,GAAoBA;YAClCA,MAAMA,EAAEA,KAAKA;YACbA,EAAEA,EAAEA,eAAeA;YACnBA,OAAOA,EAAEA,YAAYA;YACrBA,GAAGA,EAAEA,YAAYA;YACjBA,IAAIA,EAAEA,IAAIA;YACVA,IAAIA,EAAEA,IAAIA;SACbA,CAACA;QAEFA,IAAIA,CAACA,eAAeA,CAACA,OAAOA,CAACA,cAAcA,CAACA,cAAcA,CAACA,CAACA;QAE5DA,EAAEA,CAACA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,CAACA,MAAMA,CAACA,CAACA,CAACA;YACjCA,EAAEA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACRA,cAAeA,CAACA,QAAQA,GAAGA,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 090/114] 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 091/114] 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 092/114] 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 093/114] 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 094/114] #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 095/114] [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 096/114] 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 097/114] 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 098/114] 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 099/114] 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 98a2a22abf6d3a460087099b87a2bcffe700d445 Mon Sep 17 00:00:00 2001 From: kolyjjj Date: Wed, 4 May 2016 17:56:02 +0800 Subject: [PATCH 100/114] [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 101/114] 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 8209653fb07166d9de2afdfe65b953f34a1d9a1f Mon Sep 17 00:00:00 2001 From: diyfr Date: Wed, 4 May 2016 16:38:36 +0200 Subject: [PATCH 102/114] 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 103/114] 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 104/114] 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 3b8a66bb8c3296a3b4edb5925131ff327063b6fd Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 5 May 2016 15:31:17 +0800 Subject: [PATCH 105/114] 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 106/114] 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 107/114] 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 108/114] 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 109/114] 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 110/114] 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 3dbab1b8931492dbc03d105830b3d48fcd2025e4 Mon Sep 17 00:00:00 2001 From: xhh Date: Fri, 6 May 2016 17:36:07 +0800 Subject: [PATCH 111/114] 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 112/114] 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 020a9fcdc053b0bd67372726f9b08bf582df0708 Mon Sep 17 00:00:00 2001 From: xhh Date: Fri, 6 May 2016 18:41:15 +0800 Subject: [PATCH 113/114] 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 bff6c8bab4ffb04815e69d79ca5bd4b5195471f1 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 7 May 2016 08:47:30 +0800 Subject: [PATCH 114/114] 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)