From 14ceb4bf84bc228f57fa3c05479d62e7fa9aee98 Mon Sep 17 00:00:00 2001 From: demonfiddler Date: Fri, 25 Mar 2016 16:36:06 +0000 Subject: [PATCH 01/48] 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 02/48] 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 03/48] 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 04/48] 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 05/48] 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 dc4c8e5864077cd6f8faed421d27a59705a08d18 Mon Sep 17 00:00:00 2001 From: Fabien Da Silva Date: Mon, 18 Apr 2016 15:52:43 +0200 Subject: [PATCH 06/48] [Swift] Force required attrs to be defined with unwrapRequired Fix #2116 Removal of forced unwrapping, replaced by required attributes in constructor --- .../src/main/resources/swift/Models.mustache | 17 +++++++++++++++-- .../src/main/resources/swift/model.mustache | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/swift/Models.mustache b/modules/swagger-codegen/src/main/resources/swift/Models.mustache index 795fdd3d5e78..378c83525f14 100644 --- a/modules/swagger-codegen/src/main/resources/swift/Models.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/Models.mustache @@ -137,9 +137,22 @@ class Decoders { // Decoder for {{{classname}}} Decoders.addDecoder(clazz: {{{classname}}}.self) { (source: AnyObject) -> {{{classname}}} in let sourceDictionary = source as! [NSObject:AnyObject] + {{#unwrapRequired}} + let instance = {{classname}}({{#requiredVars}}{{^-first}}, {{/-first}}{{#isEnum}}{{name}}: {{classname}}.{{datatypeWithEnum}}(rawValue: (sourceDictionary["{{baseName}}"] as? String) ?? "")! {{/isEnum}}{{^isEnum}}{{name}}: Decoders.decode(clazz: {{{baseType}}}.self, source: sourceDictionary["{{baseName}}"]!){{/isEnum}}{{/requiredVars}}) + {{#optionalVars}} + {{#isEnum}} + instance.{{name}} = {{classname}}.{{datatypeWithEnum}}(rawValue: (sourceDictionary["{{baseName}}"] as? String) ?? "") + {{/isEnum}} + {{^isEnum}} + instance.{{name}} = Decoders.decodeOptional(clazz: {{{baseType}}}.self, source: sourceDictionary["{{baseName}}"]) + {{/isEnum}} + {{/optionalVars}} + {{/unwrapRequired}} + {{^unwrapRequired}} let instance = {{classname}}(){{#vars}}{{#isEnum}} - instance.{{name}} = {{classname}}.{{datatypeWithEnum}}(rawValue: (sourceDictionary["{{baseName}}"] as? String) ?? ""){{#unwrapRequired}}{{#required}}!{{/required}}{{/unwrapRequired}} {{/isEnum}}{{^isEnum}} - instance.{{name}} = Decoders.decode{{^unwrapRequired}}Optional{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}Optional{{/required}}{{/unwrapRequired}}(clazz: {{{baseType}}}.self, source: sourceDictionary["{{baseName}}"]{{#unwrapRequired}}{{#required}}!{{/required}}{{/unwrapRequired}}){{/isEnum}}{{/vars}} + instance.{{name}} = {{classname}}.{{datatypeWithEnum}}(rawValue: (sourceDictionary["{{baseName}}"] as? String) ?? "") {{/isEnum}}{{^isEnum}} + instance.{{name}} = Decoders.decodeOptional(clazz: {{{baseType}}}.self, source: sourceDictionary["{{baseName}}"]){{/isEnum}}{{/vars}} + {{/unwrapRequired}} return instance }{{/model}} {{/models}} diff --git a/modules/swagger-codegen/src/main/resources/swift/model.mustache b/modules/swagger-codegen/src/main/resources/swift/model.mustache index 3c0a47c2987d..9c1787e5bcd6 100644 --- a/modules/swagger-codegen/src/main/resources/swift/model.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/model.mustache @@ -21,15 +21,26 @@ public class {{classname}}: JSONEncodable { {{#vars}} {{#isEnum}} {{#description}}/** {{description}} */ - {{/description}}public var {{name}}: {{{datatypeWithEnum}}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{#required}}!{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} + {{/description}}public var {{name}}: {{{datatypeWithEnum}}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} {{/isEnum}} {{^isEnum}} {{#description}}/** {{description}} */ - {{/description}}public var {{name}}: {{{datatype}}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{#required}}!{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} + {{/description}}public var {{name}}: {{{datatype}}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} {{/isEnum}} {{/vars}} +{{^unwrapRequired}} public init() {} +{{/unwrapRequired}} +{{#unwrapRequired}} + public init({{#requiredVars}}{{^-first}}, {{/-first}}{{name}}: {{#isEnum}}{{datatypeWithEnum}}!{{/isEnum}}{{^isEnum}}{{datatype}}!{{/isEnum}}{{/requiredVars}}) { + {{#vars}} + {{#requiredVars}} + self.{{name}} = {{name}} + {{/requiredVars}} + {{/vars}} + } +{{/unwrapRequired}} // MARK: JSONEncodable func encodeToJSON() -> AnyObject { From c91f23c2ca4f6925149ba7c0f94c6007fd51d37c Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Mon, 25 Apr 2016 23:00:48 +0200 Subject: [PATCH 07/48] 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 08/48] 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 09/48] 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 2b71165584cda00294cd57d6bd58d93b406ecde7 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 27 Apr 2016 00:06:29 +0800 Subject: [PATCH 10/48] fix date mapping in qt5cpp --- .../main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java index ff75d7956560..aa32eb4e5100 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java @@ -111,7 +111,7 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { super.typeMapping = new HashMap(); - typeMapping.put("Date", "QDate"); + typeMapping.put("date", "QDate"); typeMapping.put("DateTime", "QDateTime"); typeMapping.put("string", "QString"); typeMapping.put("integer", "qint32"); From 1361bb7c0bdfd5491812422f893dafc61dd825c3 Mon Sep 17 00:00:00 2001 From: Brian Hou Date: Tue, 26 Apr 2016 10:21:16 -0700 Subject: [PATCH 11/48] Fix ruby model boolean attributes --- .../src/main/resources/ruby/model.mustache | 2 +- samples/client/petstore/ruby/README.md | 2 +- .../ruby/lib/petstore/models/animal.rb | 2 +- .../ruby/lib/petstore/models/api_response.rb | 6 ++--- .../petstore/ruby/lib/petstore/models/cat.rb | 4 ++-- .../ruby/lib/petstore/models/category.rb | 4 ++-- .../petstore/ruby/lib/petstore/models/dog.rb | 4 ++-- .../ruby/lib/petstore/models/format_test.rb | 24 +++++++++---------- .../lib/petstore/models/model_200_response.rb | 2 +- .../ruby/lib/petstore/models/model_return.rb | 2 +- .../petstore/ruby/lib/petstore/models/name.rb | 6 ++--- .../ruby/lib/petstore/models/order.rb | 12 +++++----- .../petstore/ruby/lib/petstore/models/pet.rb | 12 +++++----- .../lib/petstore/models/special_model_name.rb | 2 +- .../petstore/ruby/lib/petstore/models/tag.rb | 4 ++-- .../petstore/ruby/lib/petstore/models/user.rb | 16 ++++++------- .../petstore/ruby/spec/base_object_spec.rb | 10 +++++++- 17 files changed, 61 insertions(+), 53 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/ruby/model.mustache b/modules/swagger-codegen/src/main/resources/ruby/model.mustache index b95b55bcee93..14f26898d2bb 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/model.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/model.mustache @@ -38,7 +38,7 @@ module {{moduleName}}{{#models}}{{#model}}{{#description}} attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} {{#vars}} - if attributes[:'{{{baseName}}}'] + if attributes.has_key?(:'{{{baseName}}}') {{#isContainer}} if (value = attributes[:'{{{baseName}}}']).is_a?(Array) self.{{{name}}} = value diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 9d9deefd9eec..cab06a92ce16 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-25T23:58:59.140+08:00 +- Build date: 2016-04-26T10:05:22.048-07:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index 2f26f9b4bb0e..5612f227d097 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -42,7 +42,7 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'className'] + if attributes.has_key?(:'className') self.class_name = attributes[:'className'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb index da0418eda508..79da573e9413 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb @@ -50,15 +50,15 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'code'] + if attributes.has_key?(:'code') self.code = attributes[:'code'] end - if attributes[:'type'] + if attributes.has_key?(:'type') self.type = attributes[:'type'] end - if attributes[:'message'] + if attributes.has_key?(:'message') self.message = attributes[:'message'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/client/petstore/ruby/lib/petstore/models/cat.rb index 0f8c34f0896e..12f17b85553e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/cat.rb @@ -46,11 +46,11 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'className'] + if attributes.has_key?(:'className') self.class_name = attributes[:'className'] end - if attributes[:'declawed'] + if attributes.has_key?(:'declawed') self.declawed = attributes[:'declawed'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/category.rb b/samples/client/petstore/ruby/lib/petstore/models/category.rb index 33e4a539fb3e..c4879d65bb4b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/category.rb @@ -46,11 +46,11 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'id'] + if attributes.has_key?(:'id') self.id = attributes[:'id'] end - if attributes[:'name'] + if attributes.has_key?(:'name') self.name = attributes[:'name'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/client/petstore/ruby/lib/petstore/models/dog.rb index 66fd396e753b..90d213dbf45e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/dog.rb @@ -46,11 +46,11 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'className'] + if attributes.has_key?(:'className') self.class_name = attributes[:'className'] end - if attributes[:'breed'] + if attributes.has_key?(:'breed') self.breed = attributes[:'breed'] end 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 e4373bb955f1..a7ebd095f9d4 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -86,51 +86,51 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'integer'] + if attributes.has_key?(:'integer') self.integer = attributes[:'integer'] end - if attributes[:'int32'] + if attributes.has_key?(:'int32') self.int32 = attributes[:'int32'] end - if attributes[:'int64'] + if attributes.has_key?(:'int64') self.int64 = attributes[:'int64'] end - if attributes[:'number'] + if attributes.has_key?(:'number') self.number = attributes[:'number'] end - if attributes[:'float'] + if attributes.has_key?(:'float') self.float = attributes[:'float'] end - if attributes[:'double'] + if attributes.has_key?(:'double') self.double = attributes[:'double'] end - if attributes[:'string'] + if attributes.has_key?(:'string') self.string = attributes[:'string'] end - if attributes[:'byte'] + if attributes.has_key?(:'byte') self.byte = attributes[:'byte'] end - if attributes[:'binary'] + if attributes.has_key?(:'binary') self.binary = attributes[:'binary'] end - if attributes[:'date'] + if attributes.has_key?(:'date') self.date = attributes[:'date'] end - if attributes[:'dateTime'] + if attributes.has_key?(:'dateTime') self.date_time = attributes[:'dateTime'] end - if attributes[:'password'] + if attributes.has_key?(:'password') self.password = attributes[:'password'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb b/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb index 71b4501d99e8..7a2473fb8b90 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb @@ -43,7 +43,7 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'name'] + if attributes.has_key?(:'name') self.name = attributes[:'name'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb index bb015662bc48..0361451b290d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb @@ -43,7 +43,7 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'return'] + if attributes.has_key?(:'return') self._return = attributes[:'return'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/name.rb b/samples/client/petstore/ruby/lib/petstore/models/name.rb index bec29f9c69eb..d5e3ef4adb80 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/name.rb @@ -51,15 +51,15 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'name'] + if attributes.has_key?(:'name') self.name = attributes[:'name'] end - if attributes[:'snake_case'] + if attributes.has_key?(:'snake_case') self.snake_case = attributes[:'snake_case'] end - if attributes[:'property'] + if attributes.has_key?(:'property') self.property = attributes[:'property'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/order.rb b/samples/client/petstore/ruby/lib/petstore/models/order.rb index b243b70cfb87..6c021e50ec7a 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/order.rb @@ -63,27 +63,27 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'id'] + if attributes.has_key?(:'id') self.id = attributes[:'id'] end - if attributes[:'petId'] + if attributes.has_key?(:'petId') self.pet_id = attributes[:'petId'] end - if attributes[:'quantity'] + if attributes.has_key?(:'quantity') self.quantity = attributes[:'quantity'] end - if attributes[:'shipDate'] + if attributes.has_key?(:'shipDate') self.ship_date = attributes[:'shipDate'] end - if attributes[:'status'] + if attributes.has_key?(:'status') self.status = attributes[:'status'] end - if attributes[:'complete'] + if attributes.has_key?(:'complete') self.complete = attributes[:'complete'] else self.complete = false diff --git a/samples/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/client/petstore/ruby/lib/petstore/models/pet.rb index cdd312f1dad6..ba4d466df21c 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/pet.rb @@ -63,31 +63,31 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'id'] + if attributes.has_key?(:'id') self.id = attributes[:'id'] end - if attributes[:'category'] + if attributes.has_key?(:'category') self.category = attributes[:'category'] end - if attributes[:'name'] + if attributes.has_key?(:'name') self.name = attributes[:'name'] end - if attributes[:'photoUrls'] + if attributes.has_key?(:'photoUrls') if (value = attributes[:'photoUrls']).is_a?(Array) self.photo_urls = value end end - if attributes[:'tags'] + if attributes.has_key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self.tags = value end end - if attributes[:'status'] + if attributes.has_key?(:'status') self.status = attributes[:'status'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb index 94aa62981aab..853d1e496001 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb @@ -42,7 +42,7 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'$special[property.name]'] + if attributes.has_key?(:'$special[property.name]') self.special_property_name = attributes[:'$special[property.name]'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/tag.rb b/samples/client/petstore/ruby/lib/petstore/models/tag.rb index 3ef49f71eaa0..d6d49068e374 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/tag.rb @@ -46,11 +46,11 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'id'] + if attributes.has_key?(:'id') self.id = attributes[:'id'] end - if attributes[:'name'] + if attributes.has_key?(:'name') self.name = attributes[:'name'] end diff --git a/samples/client/petstore/ruby/lib/petstore/models/user.rb b/samples/client/petstore/ruby/lib/petstore/models/user.rb index b9e7b91b08bb..f0c39b741d55 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/user.rb @@ -71,35 +71,35 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes[:'id'] + if attributes.has_key?(:'id') self.id = attributes[:'id'] end - if attributes[:'username'] + if attributes.has_key?(:'username') self.username = attributes[:'username'] end - if attributes[:'firstName'] + if attributes.has_key?(:'firstName') self.first_name = attributes[:'firstName'] end - if attributes[:'lastName'] + if attributes.has_key?(:'lastName') self.last_name = attributes[:'lastName'] end - if attributes[:'email'] + if attributes.has_key?(:'email') self.email = attributes[:'email'] end - if attributes[:'password'] + if attributes.has_key?(:'password') self.password = attributes[:'password'] end - if attributes[:'phone'] + if attributes.has_key?(:'phone') self.phone = attributes[:'phone'] end - if attributes[:'userStatus'] + if attributes.has_key?(:'userStatus') self.user_status = attributes[:'userStatus'] end diff --git a/samples/client/petstore/ruby/spec/base_object_spec.rb b/samples/client/petstore/ruby/spec/base_object_spec.rb index 61dcb4d6d9d3..a315d52276b7 100644 --- a/samples/client/petstore/ruby/spec/base_object_spec.rb +++ b/samples/client/petstore/ruby/spec/base_object_spec.rb @@ -30,8 +30,16 @@ class ArrayMapObject < Petstore::Category end end - describe 'BaseObject' do + describe 'boolean values' do + let(:obj) { Petstore::Cat.new({declawed: false}) } + + it 'should have values set' do + obj.declawed.should_not eq nil + obj.declawed.should eq false + end + end + describe 'array and map properties' do let(:obj) { ArrayMapObject.new } From dab2b13df1e2312f180bcd6b12db7b80386fbb26 Mon Sep 17 00:00:00 2001 From: Neil O'Toole Date: Wed, 27 Apr 2016 01:32:02 +0100 Subject: [PATCH 12/48] issue #2711 adding equals, hashcode etc to model classes --- .../java/io/swagger/codegen/ClientOpts.java | 29 +++ .../java/io/swagger/codegen/CodegenModel.java | 110 ++++++++++- .../io/swagger/codegen/CodegenOperation.java | 153 +++++++++++++++ .../io/swagger/codegen/CodegenParameter.java | 180 ++++++++++++++++++ .../io/swagger/codegen/CodegenProperty.java | 6 + .../io/swagger/codegen/CodegenResponse.java | 67 +++++++ .../io/swagger/codegen/CodegenSecurity.java | 58 ++++++ .../io/swagger/codegen/SupportingFile.java | 23 +++ 8 files changed, 625 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/ClientOpts.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/ClientOpts.java index 9c4d41f7bfdf..1087de5786db 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/ClientOpts.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/ClientOpts.java @@ -54,4 +54,33 @@ public class ClientOpts { sb.append("}"); return sb.toString(); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ClientOpts that = (ClientOpts) o; + + if (uri != null ? !uri.equals(that.uri) : that.uri != null) + return false; + if (target != null ? !target.equals(that.target) : that.target != null) + return false; + if (auth != null ? !auth.equals(that.auth) : that.auth != null) + return false; + if (properties != null ? !properties.equals(that.properties) : that.properties != null) + return false; + return outputDirectory != null ? outputDirectory.equals(that.outputDirectory) : that.outputDirectory == null; + + } + + @Override + public int hashCode() { + int result = uri != null ? uri.hashCode() : 0; + result = 31 * result + (target != null ? target.hashCode() : 0); + result = 31 * result + (auth != null ? auth.hashCode() : 0); + result = 31 * result + (properties != null ? properties.hashCode() : 0); + result = 31 * result + (outputDirectory != null ? outputDirectory.hashCode() : 0); + return result; + } } 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 62f5e27aa051..945388b25886 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 @@ -1,7 +1,6 @@ package io.swagger.codegen; import io.swagger.models.ExternalDocs; - import java.util.*; public class CodegenModel { @@ -39,4 +38,113 @@ public class CodegenModel { allVars = vars; allMandatory = mandatory; } + + @Override + public String toString() { + return String.format("%s(%s)", name, classname); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenModel that = (CodegenModel) o; + + if (parent != null ? !parent.equals(that.parent) : that.parent != null) + return false; + if (parentSchema != null ? !parentSchema.equals(that.parentSchema) : that.parentSchema != null) + return false; + if (interfaces != null ? !interfaces.equals(that.interfaces) : that.interfaces != null) + return false; + if (parentModel != null ? !parentModel.equals(that.parentModel) : that.parentModel != null) + return false; + if (interfaceModels != null ? !interfaceModels.equals(that.interfaceModels) : that.interfaceModels != null) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (classname != null ? !classname.equals(that.classname) : that.classname != null) + return false; + if (description != null ? !description.equals(that.description) : that.description != null) + return false; + if (classVarName != null ? !classVarName.equals(that.classVarName) : that.classVarName != null) + return false; + if (modelJson != null ? !modelJson.equals(that.modelJson) : that.modelJson != null) + return false; + if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != null) + return false; + if (classFilename != null ? !classFilename.equals(that.classFilename) : that.classFilename != null) + return false; + if (unescapedDescription != null ? !unescapedDescription.equals(that.unescapedDescription) : that.unescapedDescription != null) + return false; + if (discriminator != null ? !discriminator.equals(that.discriminator) : that.discriminator != null) + return false; + if (defaultValue != null ? !defaultValue.equals(that.defaultValue) : that.defaultValue != null) + return false; + if (vars != null ? !vars.equals(that.vars) : that.vars != null) + return false; + if (requiredVars != null ? !requiredVars.equals(that.requiredVars) : that.requiredVars != null) + return false; + if (optionalVars != null ? !optionalVars.equals(that.optionalVars) : that.optionalVars != null) + return false; + if (allVars != null ? !allVars.equals(that.allVars) : that.allVars != null) + return false; + if (allowableValues != null ? !allowableValues.equals(that.allowableValues) : that.allowableValues != null) + return false; + if (mandatory != null ? !mandatory.equals(that.mandatory) : that.mandatory != null) + return false; + if (allMandatory != null ? !allMandatory.equals(that.allMandatory) : that.allMandatory != null) + return false; + if (imports != null ? !imports.equals(that.imports) : that.imports != null) + return false; + if (hasVars != null ? !hasVars.equals(that.hasVars) : that.hasVars != null) + return false; + if (emptyVars != null ? !emptyVars.equals(that.emptyVars) : that.emptyVars != null) + return false; + if (hasMoreModels != null ? !hasMoreModels.equals(that.hasMoreModels) : that.hasMoreModels != null) + return false; + if (hasEnums != null ? !hasEnums.equals(that.hasEnums) : that.hasEnums != null) + return false; + if (isEnum != null ? !isEnum.equals(that.isEnum) : that.isEnum != null) + return false; + if (externalDocs != null ? !externalDocs.equals(that.externalDocs) : that.externalDocs != null) + return false; + return vendorExtensions != null ? vendorExtensions.equals(that.vendorExtensions) : that.vendorExtensions == null; + + } + + @Override + public int hashCode() { + int result = parent != null ? parent.hashCode() : 0; + result = 31 * result + (parentSchema != null ? parentSchema.hashCode() : 0); + result = 31 * result + (interfaces != null ? interfaces.hashCode() : 0); + result = 31 * result + (parentModel != null ? parentModel.hashCode() : 0); + result = 31 * result + (interfaceModels != null ? interfaceModels.hashCode() : 0); + result = 31 * result + (name != null ? name.hashCode() : 0); + result = 31 * result + (classname != null ? classname.hashCode() : 0); + result = 31 * result + (description != null ? description.hashCode() : 0); + result = 31 * result + (classVarName != null ? classVarName.hashCode() : 0); + result = 31 * result + (modelJson != null ? modelJson.hashCode() : 0); + result = 31 * result + (dataType != null ? dataType.hashCode() : 0); + result = 31 * result + (classFilename != null ? classFilename.hashCode() : 0); + result = 31 * result + (unescapedDescription != null ? unescapedDescription.hashCode() : 0); + result = 31 * result + (discriminator != null ? discriminator.hashCode() : 0); + result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0); + result = 31 * result + (vars != null ? vars.hashCode() : 0); + result = 31 * result + (requiredVars != null ? requiredVars.hashCode() : 0); + result = 31 * result + (optionalVars != null ? optionalVars.hashCode() : 0); + result = 31 * result + (allVars != null ? allVars.hashCode() : 0); + result = 31 * result + (allowableValues != null ? allowableValues.hashCode() : 0); + result = 31 * result + (mandatory != null ? mandatory.hashCode() : 0); + result = 31 * result + (allMandatory != null ? allMandatory.hashCode() : 0); + result = 31 * result + (imports != null ? imports.hashCode() : 0); + result = 31 * result + (hasVars != null ? hasVars.hashCode() : 0); + result = 31 * result + (emptyVars != null ? emptyVars.hashCode() : 0); + result = 31 * result + (hasMoreModels != null ? hasMoreModels.hashCode() : 0); + result = 31 * result + (hasEnums != null ? hasEnums.hashCode() : 0); + result = 31 * result + (isEnum != null ? isEnum.hashCode() : 0); + result = 31 * result + (externalDocs != null ? externalDocs.hashCode() : 0); + result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java index 2485e657de27..48858a0d5049 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java @@ -88,4 +88,157 @@ public class CodegenOperation { return nonempty(formParams); } + @Override + public String toString() { + return String.format("%s(%s)", baseName, path); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenOperation that = (CodegenOperation) o; + + if (responseHeaders != null ? !responseHeaders.equals(that.responseHeaders) : that.responseHeaders != null) + return false; + if (hasAuthMethods != null ? !hasAuthMethods.equals(that.hasAuthMethods) : that.hasAuthMethods != null) + return false; + if (hasConsumes != null ? !hasConsumes.equals(that.hasConsumes) : that.hasConsumes != null) + return false; + if (hasProduces != null ? !hasProduces.equals(that.hasProduces) : that.hasProduces != null) + return false; + if (hasParams != null ? !hasParams.equals(that.hasParams) : that.hasParams != null) + return false; + if (hasOptionalParams != null ? !hasOptionalParams.equals(that.hasOptionalParams) : that.hasOptionalParams != null) + return false; + if (returnTypeIsPrimitive != null ? !returnTypeIsPrimitive.equals(that.returnTypeIsPrimitive) : that.returnTypeIsPrimitive != null) + return false; + if (returnSimpleType != null ? !returnSimpleType.equals(that.returnSimpleType) : that.returnSimpleType != null) + return false; + if (subresourceOperation != null ? !subresourceOperation.equals(that.subresourceOperation) : that.subresourceOperation != null) + return false; + if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null) + return false; + if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null) + return false; + if (isMultipart != null ? !isMultipart.equals(that.isMultipart) : that.isMultipart != null) + return false; + if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null) + return false; + if (isResponseBinary != null ? !isResponseBinary.equals(that.isResponseBinary) : that.isResponseBinary != null) + return false; + if (hasReference != null ? !hasReference.equals(that.hasReference) : that.hasReference != null) + return false; + if (path != null ? !path.equals(that.path) : that.path != null) + return false; + if (operationId != null ? !operationId.equals(that.operationId) : that.operationId != null) + return false; + if (returnType != null ? !returnType.equals(that.returnType) : that.returnType != null) + return false; + if (httpMethod != null ? !httpMethod.equals(that.httpMethod) : that.httpMethod != null) + return false; + if (returnBaseType != null ? !returnBaseType.equals(that.returnBaseType) : that.returnBaseType != null) + return false; + if (returnContainer != null ? !returnContainer.equals(that.returnContainer) : that.returnContainer != null) + return false; + if (summary != null ? !summary.equals(that.summary) : that.summary != null) + return false; + if (unescapedNotes != null ? !unescapedNotes.equals(that.unescapedNotes) : that.unescapedNotes != null) + return false; + if (notes != null ? !notes.equals(that.notes) : that.notes != null) + return false; + if (baseName != null ? !baseName.equals(that.baseName) : that.baseName != null) + return false; + if (defaultResponse != null ? !defaultResponse.equals(that.defaultResponse) : that.defaultResponse != null) + return false; + if (discriminator != null ? !discriminator.equals(that.discriminator) : that.discriminator != null) + return false; + if (consumes != null ? !consumes.equals(that.consumes) : that.consumes != null) + return false; + if (produces != null ? !produces.equals(that.produces) : that.produces != null) + return false; + if (bodyParam != null ? !bodyParam.equals(that.bodyParam) : that.bodyParam != null) + return false; + if (allParams != null ? !allParams.equals(that.allParams) : that.allParams != null) + return false; + if (bodyParams != null ? !bodyParams.equals(that.bodyParams) : that.bodyParams != null) + return false; + if (pathParams != null ? !pathParams.equals(that.pathParams) : that.pathParams != null) + return false; + if (queryParams != null ? !queryParams.equals(that.queryParams) : that.queryParams != null) + return false; + if (headerParams != null ? !headerParams.equals(that.headerParams) : that.headerParams != null) + return false; + if (formParams != null ? !formParams.equals(that.formParams) : that.formParams != null) + return false; + if (authMethods != null ? !authMethods.equals(that.authMethods) : that.authMethods != null) + return false; + if (tags != null ? !tags.equals(that.tags) : that.tags != null) + return false; + if (responses != null ? !responses.equals(that.responses) : that.responses != null) + return false; + if (imports != null ? !imports.equals(that.imports) : that.imports != null) + return false; + if (examples != null ? !examples.equals(that.examples) : that.examples != null) + return false; + if (externalDocs != null ? !externalDocs.equals(that.externalDocs) : that.externalDocs != null) + return false; + if (vendorExtensions != null ? !vendorExtensions.equals(that.vendorExtensions) : that.vendorExtensions != null) + return false; + if (nickname != null ? !nickname.equals(that.nickname) : that.nickname != null) + return false; + return operationIdLowerCase != null ? operationIdLowerCase.equals(that.operationIdLowerCase) : that.operationIdLowerCase == null; + + } + + @Override + public int hashCode() { + int result = responseHeaders != null ? responseHeaders.hashCode() : 0; + result = 31 * result + (hasAuthMethods != null ? hasAuthMethods.hashCode() : 0); + result = 31 * result + (hasConsumes != null ? hasConsumes.hashCode() : 0); + result = 31 * result + (hasProduces != null ? hasProduces.hashCode() : 0); + result = 31 * result + (hasParams != null ? hasParams.hashCode() : 0); + result = 31 * result + (hasOptionalParams != null ? hasOptionalParams.hashCode() : 0); + result = 31 * result + (returnTypeIsPrimitive != null ? returnTypeIsPrimitive.hashCode() : 0); + result = 31 * result + (returnSimpleType != null ? returnSimpleType.hashCode() : 0); + result = 31 * result + (subresourceOperation != null ? subresourceOperation.hashCode() : 0); + result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0); + result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0); + result = 31 * result + (isMultipart != null ? isMultipart.hashCode() : 0); + result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0); + result = 31 * result + (isResponseBinary != null ? isResponseBinary.hashCode() : 0); + result = 31 * result + (hasReference != null ? hasReference.hashCode() : 0); + result = 31 * result + (path != null ? path.hashCode() : 0); + result = 31 * result + (operationId != null ? operationId.hashCode() : 0); + result = 31 * result + (returnType != null ? returnType.hashCode() : 0); + result = 31 * result + (httpMethod != null ? httpMethod.hashCode() : 0); + result = 31 * result + (returnBaseType != null ? returnBaseType.hashCode() : 0); + result = 31 * result + (returnContainer != null ? returnContainer.hashCode() : 0); + result = 31 * result + (summary != null ? summary.hashCode() : 0); + result = 31 * result + (unescapedNotes != null ? unescapedNotes.hashCode() : 0); + result = 31 * result + (notes != null ? notes.hashCode() : 0); + result = 31 * result + (baseName != null ? baseName.hashCode() : 0); + result = 31 * result + (defaultResponse != null ? defaultResponse.hashCode() : 0); + result = 31 * result + (discriminator != null ? discriminator.hashCode() : 0); + result = 31 * result + (consumes != null ? consumes.hashCode() : 0); + result = 31 * result + (produces != null ? produces.hashCode() : 0); + result = 31 * result + (bodyParam != null ? bodyParam.hashCode() : 0); + result = 31 * result + (allParams != null ? allParams.hashCode() : 0); + result = 31 * result + (bodyParams != null ? bodyParams.hashCode() : 0); + result = 31 * result + (pathParams != null ? pathParams.hashCode() : 0); + result = 31 * result + (queryParams != null ? queryParams.hashCode() : 0); + result = 31 * result + (headerParams != null ? headerParams.hashCode() : 0); + result = 31 * result + (formParams != null ? formParams.hashCode() : 0); + result = 31 * result + (authMethods != null ? authMethods.hashCode() : 0); + result = 31 * result + (tags != null ? tags.hashCode() : 0); + result = 31 * result + (responses != null ? responses.hashCode() : 0); + result = 31 * result + (imports != null ? imports.hashCode() : 0); + result = 31 * result + (examples != null ? examples.hashCode() : 0); + result = 31 * result + (externalDocs != null ? externalDocs.hashCode() : 0); + result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0); + result = 31 * result + (nickname != null ? nickname.hashCode() : 0); + result = 31 * result + (operationIdLowerCase != null ? operationIdLowerCase.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java index 3f38d391e703..a69f71971813 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java @@ -137,5 +137,185 @@ public class CodegenParameter { return output; } + + @Override + public String toString() { + return String.format("%s(%s)", baseName, dataType); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenParameter that = (CodegenParameter) o; + + if (isEnum != that.isEnum) return false; + if (isFormParam != null ? !isFormParam.equals(that.isFormParam) : that.isFormParam != null) + return false; + if (isQueryParam != null ? !isQueryParam.equals(that.isQueryParam) : that.isQueryParam != null) + return false; + if (isPathParam != null ? !isPathParam.equals(that.isPathParam) : that.isPathParam != null) + return false; + if (isHeaderParam != null ? !isHeaderParam.equals(that.isHeaderParam) : that.isHeaderParam != null) + return false; + if (isCookieParam != null ? !isCookieParam.equals(that.isCookieParam) : that.isCookieParam != null) + return false; + if (isBodyParam != null ? !isBodyParam.equals(that.isBodyParam) : that.isBodyParam != null) + return false; + if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null) + return false; + if (isContainer != null ? !isContainer.equals(that.isContainer) : that.isContainer != null) + return false; + if (secondaryParam != null ? !secondaryParam.equals(that.secondaryParam) : that.secondaryParam != null) + return false; + if (isCollectionFormatMulti != null ? !isCollectionFormatMulti.equals(that.isCollectionFormatMulti) : that.isCollectionFormatMulti != null) + return false; + if (isPrimitiveType != null ? !isPrimitiveType.equals(that.isPrimitiveType) : that.isPrimitiveType != null) + return false; + if (baseName != null ? !baseName.equals(that.baseName) : that.baseName != null) + return false; + if (paramName != null ? !paramName.equals(that.paramName) : that.paramName != null) + return false; + if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != null) + return false; + if (datatypeWithEnum != null ? !datatypeWithEnum.equals(that.datatypeWithEnum) : that.datatypeWithEnum != null) + return false; + if (collectionFormat != null ? !collectionFormat.equals(that.collectionFormat) : that.collectionFormat != null) + return false; + if (description != null ? !description.equals(that.description) : that.description != null) + return false; + if (unescapedDescription != null ? !unescapedDescription.equals(that.unescapedDescription) : that.unescapedDescription != null) + return false; + if (baseType != null ? !baseType.equals(that.baseType) : that.baseType != null) + return false; + if (defaultValue != null ? !defaultValue.equals(that.defaultValue) : that.defaultValue != null) + return false; + if (example != null ? !example.equals(that.example) : that.example != null) + return false; + if (jsonSchema != null ? !jsonSchema.equals(that.jsonSchema) : that.jsonSchema != null) + return false; + if (isString != null ? !isString.equals(that.isString) : that.isString != null) + return false; + if (isInteger != null ? !isInteger.equals(that.isInteger) : that.isInteger != null) + return false; + if (isLong != null ? !isLong.equals(that.isLong) : that.isLong != null) + return false; + if (isFloat != null ? !isFloat.equals(that.isFloat) : that.isFloat != null) + return false; + if (isDouble != null ? !isDouble.equals(that.isDouble) : that.isDouble != null) + return false; + if (isByteArray != null ? !isByteArray.equals(that.isByteArray) : that.isByteArray != null) + return false; + if (isBinary != null ? !isBinary.equals(that.isBinary) : that.isBinary != null) + return false; + if (isBoolean != null ? !isBoolean.equals(that.isBoolean) : that.isBoolean != null) + return false; + if (isDate != null ? !isDate.equals(that.isDate) : that.isDate != null) + return false; + if (isDateTime != null ? !isDateTime.equals(that.isDateTime) : that.isDateTime != null) + return false; + if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null) + return false; + if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null) + return false; + if (isFile != null ? !isFile.equals(that.isFile) : that.isFile != null) + return false; + if (notFile != null ? !notFile.equals(that.notFile) : that.notFile != null) + return false; + if (_enum != null ? !_enum.equals(that._enum) : that._enum != null) + return false; + if (allowableValues != null ? !allowableValues.equals(that.allowableValues) : that.allowableValues != null) + return false; + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + if (vendorExtensions != null ? !vendorExtensions.equals(that.vendorExtensions) : that.vendorExtensions != null) + return false; + if (hasValidation != null ? !hasValidation.equals(that.hasValidation) : that.hasValidation != null) + return false; + if (required != null ? !required.equals(that.required) : that.required != null) + return false; + if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null) + return false; + if (exclusiveMaximum != null ? !exclusiveMaximum.equals(that.exclusiveMaximum) : that.exclusiveMaximum != null) + return false; + if (minimum != null ? !minimum.equals(that.minimum) : that.minimum != null) + return false; + if (exclusiveMinimum != null ? !exclusiveMinimum.equals(that.exclusiveMinimum) : that.exclusiveMinimum != null) + return false; + if (maxLength != null ? !maxLength.equals(that.maxLength) : that.maxLength != null) + return false; + if (minLength != null ? !minLength.equals(that.minLength) : that.minLength != null) + return false; + if (pattern != null ? !pattern.equals(that.pattern) : that.pattern != null) + return false; + if (maxItems != null ? !maxItems.equals(that.maxItems) : that.maxItems != null) + return false; + if (minItems != null ? !minItems.equals(that.minItems) : that.minItems != null) + return false; + if (uniqueItems != null ? !uniqueItems.equals(that.uniqueItems) : that.uniqueItems != null) + return false; + return multipleOf != null ? multipleOf.equals(that.multipleOf) : that.multipleOf == null; + + } + + @Override + public int hashCode() { + int result = isFormParam != null ? isFormParam.hashCode() : 0; + result = 31 * result + (isQueryParam != null ? isQueryParam.hashCode() : 0); + result = 31 * result + (isPathParam != null ? isPathParam.hashCode() : 0); + result = 31 * result + (isHeaderParam != null ? isHeaderParam.hashCode() : 0); + result = 31 * result + (isCookieParam != null ? isCookieParam.hashCode() : 0); + result = 31 * result + (isBodyParam != null ? isBodyParam.hashCode() : 0); + result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0); + result = 31 * result + (isContainer != null ? isContainer.hashCode() : 0); + result = 31 * result + (secondaryParam != null ? secondaryParam.hashCode() : 0); + result = 31 * result + (isCollectionFormatMulti != null ? isCollectionFormatMulti.hashCode() : 0); + result = 31 * result + (isPrimitiveType != null ? isPrimitiveType.hashCode() : 0); + result = 31 * result + (baseName != null ? baseName.hashCode() : 0); + result = 31 * result + (paramName != null ? paramName.hashCode() : 0); + result = 31 * result + (dataType != null ? dataType.hashCode() : 0); + result = 31 * result + (datatypeWithEnum != null ? datatypeWithEnum.hashCode() : 0); + result = 31 * result + (collectionFormat != null ? collectionFormat.hashCode() : 0); + result = 31 * result + (description != null ? description.hashCode() : 0); + result = 31 * result + (unescapedDescription != null ? unescapedDescription.hashCode() : 0); + result = 31 * result + (baseType != null ? baseType.hashCode() : 0); + result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0); + result = 31 * result + (example != null ? example.hashCode() : 0); + result = 31 * result + (jsonSchema != null ? jsonSchema.hashCode() : 0); + result = 31 * result + (isString != null ? isString.hashCode() : 0); + result = 31 * result + (isInteger != null ? isInteger.hashCode() : 0); + result = 31 * result + (isLong != null ? isLong.hashCode() : 0); + result = 31 * result + (isFloat != null ? isFloat.hashCode() : 0); + result = 31 * result + (isDouble != null ? isDouble.hashCode() : 0); + result = 31 * result + (isByteArray != null ? isByteArray.hashCode() : 0); + result = 31 * result + (isBinary != null ? isBinary.hashCode() : 0); + result = 31 * result + (isBoolean != null ? isBoolean.hashCode() : 0); + result = 31 * result + (isDate != null ? isDate.hashCode() : 0); + result = 31 * result + (isDateTime != null ? isDateTime.hashCode() : 0); + result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0); + result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0); + result = 31 * result + (isFile != null ? isFile.hashCode() : 0); + result = 31 * result + (notFile != null ? notFile.hashCode() : 0); + result = 31 * result + (isEnum ? 1 : 0); + result = 31 * result + (_enum != null ? _enum.hashCode() : 0); + result = 31 * result + (allowableValues != null ? allowableValues.hashCode() : 0); + result = 31 * result + (items != null ? items.hashCode() : 0); + result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0); + result = 31 * result + (hasValidation != null ? hasValidation.hashCode() : 0); + result = 31 * result + (required != null ? required.hashCode() : 0); + result = 31 * result + (maximum != null ? maximum.hashCode() : 0); + result = 31 * result + (exclusiveMaximum != null ? exclusiveMaximum.hashCode() : 0); + result = 31 * result + (minimum != null ? minimum.hashCode() : 0); + result = 31 * result + (exclusiveMinimum != null ? exclusiveMinimum.hashCode() : 0); + result = 31 * result + (maxLength != null ? maxLength.hashCode() : 0); + result = 31 * result + (minLength != null ? minLength.hashCode() : 0); + result = 31 * result + (pattern != null ? pattern.hashCode() : 0); + result = 31 * result + (maxItems != null ? maxItems.hashCode() : 0); + result = 31 * result + (minItems != null ? minItems.hashCode() : 0); + result = 31 * result + (uniqueItems != null ? uniqueItems.hashCode() : 0); + result = 31 * result + (multipleOf != null ? multipleOf.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java index 79b7c60a9eb8..d58a1a81b1d3 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java @@ -44,6 +44,12 @@ public class CodegenProperty { public Map vendorExtensions; public Boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template) + @Override + public String toString() { + return String.format("%s(%s)", baseName, datatype); + } + + @Override public int hashCode() { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenResponse.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenResponse.java index e20735b14185..746f65cea385 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenResponse.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenResponse.java @@ -22,4 +22,71 @@ public class CodegenResponse { public boolean isWildcard() { return "0".equals(code) || "default".equals(code); } + + @Override + public String toString() { + return String.format("%s(%s)", code, containerType); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenResponse that = (CodegenResponse) o; + + if (headers != null ? !headers.equals(that.headers) : that.headers != null) + return false; + if (code != null ? !code.equals(that.code) : that.code != null) + return false; + if (message != null ? !message.equals(that.message) : that.message != null) + return false; + if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null) + return false; + if (examples != null ? !examples.equals(that.examples) : that.examples != null) + return false; + if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != null) + return false; + if (baseType != null ? !baseType.equals(that.baseType) : that.baseType != null) + return false; + if (containerType != null ? !containerType.equals(that.containerType) : that.containerType != null) + return false; + if (isDefault != null ? !isDefault.equals(that.isDefault) : that.isDefault != null) + return false; + if (simpleType != null ? !simpleType.equals(that.simpleType) : that.simpleType != null) + return false; + if (primitiveType != null ? !primitiveType.equals(that.primitiveType) : that.primitiveType != null) + return false; + if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null) + return false; + if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null) + return false; + if (isBinary != null ? !isBinary.equals(that.isBinary) : that.isBinary != null) + return false; + if (schema != null ? !schema.equals(that.schema) : that.schema != null) + return false; + return jsonSchema != null ? jsonSchema.equals(that.jsonSchema) : that.jsonSchema == null; + + } + + @Override + public int hashCode() { + int result = headers != null ? headers.hashCode() : 0; + result = 31 * result + (code != null ? code.hashCode() : 0); + result = 31 * result + (message != null ? message.hashCode() : 0); + result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0); + result = 31 * result + (examples != null ? examples.hashCode() : 0); + result = 31 * result + (dataType != null ? dataType.hashCode() : 0); + result = 31 * result + (baseType != null ? baseType.hashCode() : 0); + result = 31 * result + (containerType != null ? containerType.hashCode() : 0); + result = 31 * result + (isDefault != null ? isDefault.hashCode() : 0); + result = 31 * result + (simpleType != null ? simpleType.hashCode() : 0); + result = 31 * result + (primitiveType != null ? primitiveType.hashCode() : 0); + result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0); + result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0); + result = 31 * result + (isBinary != null ? isBinary.hashCode() : 0); + result = 31 * result + (schema != null ? schema.hashCode() : 0); + result = 31 * result + (jsonSchema != null ? jsonSchema.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenSecurity.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenSecurity.java index 101182063839..2e33242c3706 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenSecurity.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenSecurity.java @@ -13,4 +13,62 @@ public class CodegenSecurity { // Oauth specific public String flow, authorizationUrl, tokenUrl; public List> scopes; + + @Override + public String toString() { + return String.format("%s(%s)", name, type); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenSecurity that = (CodegenSecurity) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (type != null ? !type.equals(that.type) : that.type != null) + return false; + if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null) + return false; + if (isBasic != null ? !isBasic.equals(that.isBasic) : that.isBasic != null) + return false; + if (isOAuth != null ? !isOAuth.equals(that.isOAuth) : that.isOAuth != null) + return false; + if (isApiKey != null ? !isApiKey.equals(that.isApiKey) : that.isApiKey != null) + return false; + if (keyParamName != null ? !keyParamName.equals(that.keyParamName) : that.keyParamName != null) + return false; + if (isKeyInQuery != null ? !isKeyInQuery.equals(that.isKeyInQuery) : that.isKeyInQuery != null) + return false; + if (isKeyInHeader != null ? !isKeyInHeader.equals(that.isKeyInHeader) : that.isKeyInHeader != null) + return false; + if (flow != null ? !flow.equals(that.flow) : that.flow != null) + return false; + if (authorizationUrl != null ? !authorizationUrl.equals(that.authorizationUrl) : that.authorizationUrl != null) + return false; + if (tokenUrl != null ? !tokenUrl.equals(that.tokenUrl) : that.tokenUrl != null) + return false; + return scopes != null ? scopes.equals(that.scopes) : that.scopes == null; + + } + + @Override + public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (type != null ? type.hashCode() : 0); + result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0); + result = 31 * result + (isBasic != null ? isBasic.hashCode() : 0); + result = 31 * result + (isOAuth != null ? isOAuth.hashCode() : 0); + result = 31 * result + (isApiKey != null ? isApiKey.hashCode() : 0); + result = 31 * result + (keyParamName != null ? keyParamName.hashCode() : 0); + result = 31 * result + (isKeyInQuery != null ? isKeyInQuery.hashCode() : 0); + result = 31 * result + (isKeyInHeader != null ? isKeyInHeader.hashCode() : 0); + result = 31 * result + (flow != null ? flow.hashCode() : 0); + result = 31 * result + (authorizationUrl != null ? authorizationUrl.hashCode() : 0); + result = 31 * result + (tokenUrl != null ? tokenUrl.hashCode() : 0); + result = 31 * result + (scopes != null ? scopes.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/SupportingFile.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/SupportingFile.java index 976376bae682..e5fb6a27da69 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/SupportingFile.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/SupportingFile.java @@ -21,4 +21,27 @@ public class SupportingFile { return builder.toString(); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + SupportingFile that = (SupportingFile) o; + + if (templateFile != null ? !templateFile.equals(that.templateFile) : that.templateFile != null) + return false; + if (folder != null ? !folder.equals(that.folder) : that.folder != null) + return false; + return destinationFilename != null ? destinationFilename.equals(that.destinationFilename) : that.destinationFilename == null; + + } + + @Override + public int hashCode() { + int result = templateFile != null ? templateFile.hashCode() : 0; + result = 31 * result + (folder != null ? folder.hashCode() : 0); + result = 31 * result + (destinationFilename != null ? destinationFilename.hashCode() : 0); + return result; + } } \ No newline at end of file From 21b39e24afd56fabec4591ee7e574d9f3de4a8f9 Mon Sep 17 00:00:00 2001 From: Silvio Heuberger Date: Wed, 27 Apr 2016 10:01:20 +0200 Subject: [PATCH 13/48] 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 14/48] 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 15/48] 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 16/48] 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 17/48] 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 18/48] 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 19/48] 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 20/48] 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 f59c43dffb1ca37c9e499730eefd384307f1e114 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Wed, 27 Apr 2016 20:53:48 +0100 Subject: [PATCH 21/48] 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 22/48] 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 23/48] 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;Q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M,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 24/48] 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 25/48] 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 26/48] Fix generated test directory name conflicting with sample test directory name --- .../languages/PythonClientCodegen.java | 2 +- samples/client/petstore/python/README.md | 2 +- .../swagger_client.egg-info/top_level.txt | 1 + .../client/petstore/python/test/__init__.py | 0 .../python/{tests => test}/test_animal.py | 0 .../{tests => test}/test_api_response.py | 0 .../python/{tests => test}/test_cat.py | 0 .../python/{tests => test}/test_category.py | 0 .../python/{tests => test}/test_dog.py | 0 .../python/{tests => test}/test_fake_api.py | 0 .../{tests => test}/test_format_test.py | 0 .../test_model_200_response.py | 0 .../{tests => test}/test_model_return.py | 0 .../python/{tests => test}/test_name.py | 0 .../python/{tests => test}/test_order.py | 0 .../python/{tests => test}/test_pet.py | 0 .../petstore/python/test/test_pet_api.py | 107 ++++++++++ .../test_special_model_name.py | 0 .../petstore/python/test/test_store_api.py | 75 +++++++ .../python/{tests => test}/test_tag.py | 0 .../python/{tests => test}/test_user.py | 0 .../python/{tests => test}/test_user_api.py | 0 .../petstore/python/tests/test_pet_api.py | 201 ++++++++++++------ .../petstore/python/tests/test_store_api.py | 69 ++---- 24 files changed, 328 insertions(+), 129 deletions(-) create mode 100644 samples/client/petstore/python/test/__init__.py rename samples/client/petstore/python/{tests => test}/test_animal.py (100%) rename samples/client/petstore/python/{tests => test}/test_api_response.py (100%) rename samples/client/petstore/python/{tests => test}/test_cat.py (100%) rename samples/client/petstore/python/{tests => test}/test_category.py (100%) rename samples/client/petstore/python/{tests => test}/test_dog.py (100%) rename samples/client/petstore/python/{tests => test}/test_fake_api.py (100%) rename samples/client/petstore/python/{tests => test}/test_format_test.py (100%) rename samples/client/petstore/python/{tests => test}/test_model_200_response.py (100%) rename samples/client/petstore/python/{tests => test}/test_model_return.py (100%) rename samples/client/petstore/python/{tests => test}/test_name.py (100%) rename samples/client/petstore/python/{tests => test}/test_order.py (100%) rename samples/client/petstore/python/{tests => test}/test_pet.py (100%) create mode 100644 samples/client/petstore/python/test/test_pet_api.py rename samples/client/petstore/python/{tests => test}/test_special_model_name.py (100%) create mode 100644 samples/client/petstore/python/test/test_store_api.py rename samples/client/petstore/python/{tests => test}/test_tag.py (100%) rename samples/client/petstore/python/{tests => test}/test_user.py (100%) rename samples/client/petstore/python/{tests => test}/test_user_api.py (100%) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index 08d63c426765..1bc95cfdd677 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -41,7 +41,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); - testFolder = "tests"; + testFolder = "test"; languageSpecificPrimitives.clear(); languageSpecificPrimitives.add("int"); diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index df5514aac39b..6640785fae99 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-27T22:01:43.565+01:00 +- Build date: 2016-04-27T22:50:21.115+01:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/swagger_client.egg-info/top_level.txt b/samples/client/petstore/python/swagger_client.egg-info/top_level.txt index 9a02a75c0585..01f6691e7caf 100644 --- a/samples/client/petstore/python/swagger_client.egg-info/top_level.txt +++ b/samples/client/petstore/python/swagger_client.egg-info/top_level.txt @@ -1,2 +1,3 @@ swagger_client +test tests diff --git a/samples/client/petstore/python/test/__init__.py b/samples/client/petstore/python/test/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/python/tests/test_animal.py b/samples/client/petstore/python/test/test_animal.py similarity index 100% rename from samples/client/petstore/python/tests/test_animal.py rename to samples/client/petstore/python/test/test_animal.py diff --git a/samples/client/petstore/python/tests/test_api_response.py b/samples/client/petstore/python/test/test_api_response.py similarity index 100% rename from samples/client/petstore/python/tests/test_api_response.py rename to samples/client/petstore/python/test/test_api_response.py diff --git a/samples/client/petstore/python/tests/test_cat.py b/samples/client/petstore/python/test/test_cat.py similarity index 100% rename from samples/client/petstore/python/tests/test_cat.py rename to samples/client/petstore/python/test/test_cat.py diff --git a/samples/client/petstore/python/tests/test_category.py b/samples/client/petstore/python/test/test_category.py similarity index 100% rename from samples/client/petstore/python/tests/test_category.py rename to samples/client/petstore/python/test/test_category.py diff --git a/samples/client/petstore/python/tests/test_dog.py b/samples/client/petstore/python/test/test_dog.py similarity index 100% rename from samples/client/petstore/python/tests/test_dog.py rename to samples/client/petstore/python/test/test_dog.py diff --git a/samples/client/petstore/python/tests/test_fake_api.py b/samples/client/petstore/python/test/test_fake_api.py similarity index 100% rename from samples/client/petstore/python/tests/test_fake_api.py rename to samples/client/petstore/python/test/test_fake_api.py diff --git a/samples/client/petstore/python/tests/test_format_test.py b/samples/client/petstore/python/test/test_format_test.py similarity index 100% rename from samples/client/petstore/python/tests/test_format_test.py rename to samples/client/petstore/python/test/test_format_test.py diff --git a/samples/client/petstore/python/tests/test_model_200_response.py b/samples/client/petstore/python/test/test_model_200_response.py similarity index 100% rename from samples/client/petstore/python/tests/test_model_200_response.py rename to samples/client/petstore/python/test/test_model_200_response.py diff --git a/samples/client/petstore/python/tests/test_model_return.py b/samples/client/petstore/python/test/test_model_return.py similarity index 100% rename from samples/client/petstore/python/tests/test_model_return.py rename to samples/client/petstore/python/test/test_model_return.py diff --git a/samples/client/petstore/python/tests/test_name.py b/samples/client/petstore/python/test/test_name.py similarity index 100% rename from samples/client/petstore/python/tests/test_name.py rename to samples/client/petstore/python/test/test_name.py diff --git a/samples/client/petstore/python/tests/test_order.py b/samples/client/petstore/python/test/test_order.py similarity index 100% rename from samples/client/petstore/python/tests/test_order.py rename to samples/client/petstore/python/test/test_order.py diff --git a/samples/client/petstore/python/tests/test_pet.py b/samples/client/petstore/python/test/test_pet.py similarity index 100% rename from samples/client/petstore/python/tests/test_pet.py rename to samples/client/petstore/python/test/test_pet.py diff --git a/samples/client/petstore/python/test/test_pet_api.py b/samples/client/petstore/python/test/test_pet_api.py new file mode 100644 index 000000000000..81ee6c76e9c7 --- /dev/null +++ b/samples/client/petstore/python/test/test_pet_api.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.pet_api import PetApi + + +class TestPetApi(unittest.TestCase): + """ PetApi unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.pet_api.PetApi() + + def tearDown(self): + pass + + def test_add_pet(self): + """ + Test case for add_pet + + Add a new pet to the store + """ + pass + + def test_delete_pet(self): + """ + Test case for delete_pet + + Deletes a pet + """ + pass + + def test_find_pets_by_status(self): + """ + Test case for find_pets_by_status + + Finds Pets by status + """ + pass + + def test_find_pets_by_tags(self): + """ + Test case for find_pets_by_tags + + Finds Pets by tags + """ + pass + + def test_get_pet_by_id(self): + """ + Test case for get_pet_by_id + + Find pet by ID + """ + pass + + def test_update_pet(self): + """ + Test case for update_pet + + Update an existing pet + """ + pass + + def test_update_pet_with_form(self): + """ + Test case for update_pet_with_form + + Updates a pet in the store with form data + """ + pass + + def test_upload_file(self): + """ + Test case for upload_file + + uploads an image + """ + pass + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_special_model_name.py b/samples/client/petstore/python/test/test_special_model_name.py similarity index 100% rename from samples/client/petstore/python/tests/test_special_model_name.py rename to samples/client/petstore/python/test/test_special_model_name.py diff --git a/samples/client/petstore/python/test/test_store_api.py b/samples/client/petstore/python/test/test_store_api.py new file mode 100644 index 000000000000..e8dc0a64b1ca --- /dev/null +++ b/samples/client/petstore/python/test/test_store_api.py @@ -0,0 +1,75 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.store_api import StoreApi + + +class TestStoreApi(unittest.TestCase): + """ StoreApi unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.store_api.StoreApi() + + def tearDown(self): + pass + + def test_delete_order(self): + """ + Test case for delete_order + + Delete purchase order by ID + """ + pass + + def test_get_inventory(self): + """ + Test case for get_inventory + + Returns pet inventories by status + """ + pass + + def test_get_order_by_id(self): + """ + Test case for get_order_by_id + + Find purchase order by ID + """ + pass + + def test_place_order(self): + """ + Test case for place_order + + Place an order for a pet + """ + pass + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/tests/test_tag.py b/samples/client/petstore/python/test/test_tag.py similarity index 100% rename from samples/client/petstore/python/tests/test_tag.py rename to samples/client/petstore/python/test/test_tag.py diff --git a/samples/client/petstore/python/tests/test_user.py b/samples/client/petstore/python/test/test_user.py similarity index 100% rename from samples/client/petstore/python/tests/test_user.py rename to samples/client/petstore/python/test/test_user.py diff --git a/samples/client/petstore/python/tests/test_user_api.py b/samples/client/petstore/python/test/test_user_api.py similarity index 100% rename from samples/client/petstore/python/tests/test_user_api.py rename to samples/client/petstore/python/test/test_user_api.py diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 81ee6c76e9c7..300a7bee7833 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -1,107 +1,168 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ref: https://github.com/swagger-api/swagger-codegen +Run the tests. +$ pip install nose (optional) +$ cd swagger_client-python +$ nosetests -v """ -from __future__ import absolute_import - import os -import sys +import time import unittest import swagger_client from swagger_client.rest import ApiException -from swagger_client.apis.pet_api import PetApi + +HOST = 'http://petstore.swagger.io/v2' -class TestPetApi(unittest.TestCase): - """ PetApi unit test stubs """ +class PetApiTests(unittest.TestCase): def setUp(self): - self.api = swagger_client.apis.pet_api.PetApi() + self.api_client = swagger_client.ApiClient(HOST) + self.pet_api = swagger_client.PetApi(self.api_client) + self.setUpModels() + self.setUpFiles() def tearDown(self): - pass + # sleep 1 sec between two every 2 tests + time.sleep(1) - def test_add_pet(self): - """ - Test case for add_pet + def setUpModels(self): + self.category = swagger_client.Category() + self.category.id = int(time.time()) + self.category.name = "dog" + self.tag = swagger_client.Tag() + self.tag.id = int(time.time()) + self.tag.name = "swagger-codegen-python-pet-tag" + self.pet = swagger_client.Pet() + self.pet.id = int(time.time()) + self.pet.name = "hello kity" + self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"] + self.pet.status = "sold" + self.pet.category = self.category + self.pet.tags = [self.tag] - Add a new pet to the store - """ - pass + def setUpFiles(self): + self.test_file_dir = os.path.join(os.path.dirname(__file__), "..", "testfiles") + self.test_file_dir = os.path.realpath(self.test_file_dir) + self.foo = os.path.join(self.test_file_dir, "foo.png") - def test_delete_pet(self): - """ - Test case for delete_pet + def test_create_api_instance(self): + pet_api = swagger_client.PetApi() + pet_api2 = swagger_client.PetApi() + api_client3 = swagger_client.ApiClient() + api_client3.user_agent = 'api client 3' + api_client4 = swagger_client.ApiClient() + api_client4.user_agent = 'api client 4' + pet_api3 = swagger_client.PetApi(api_client3) - Deletes a pet - """ - pass + # same default api client + self.assertEqual(pet_api.api_client, pet_api2.api_client) + # confirm using the default api client in the config module + self.assertEqual(pet_api.api_client, swagger_client.configuration.api_client) + # 2 different api clients are not the same + self.assertNotEqual(api_client3, api_client4) + # customized pet api not using the default api client + self.assertNotEqual(pet_api3.api_client, swagger_client.configuration.api_client) + # customized pet api not using the old pet api's api client + self.assertNotEqual(pet_api3.api_client, pet_api2.api_client) - def test_find_pets_by_status(self): - """ - Test case for find_pets_by_status + def test_async_request(self): + self.pet_api.add_pet(body=self.pet) - Finds Pets by status - """ - pass + def callback_function(data): + self.assertIsNotNone(data) + self.assertEqual(data.id, self.pet.id) + self.assertEqual(data.name, self.pet.name) + self.assertIsNotNone(data.category) + self.assertEqual(data.category.id, self.pet.category.id) + self.assertEqual(data.category.name, self.pet.category.name) + self.assertTrue(isinstance(data.tags, list)) + self.assertEqual(data.tags[0].id, self.pet.tags[0].id) + self.assertEqual(data.tags[0].name, self.pet.tags[0].name) - def test_find_pets_by_tags(self): - """ - Test case for find_pets_by_tags + thread = self.pet_api.get_pet_by_id(pet_id=self.pet.id, callback=callback_function) + thread.join(10) + if thread.isAlive(): + self.fail("Request timeout") - Finds Pets by tags - """ - pass + def test_add_pet_and_get_pet_by_id(self): + self.pet_api.add_pet(body=self.pet) - def test_get_pet_by_id(self): - """ - Test case for get_pet_by_id - - Find pet by ID - """ - pass + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertIsNotNone(fetched) + self.assertEqual(self.pet.id, fetched.id) + self.assertIsNotNone(fetched.category) + self.assertEqual(self.pet.category.name, fetched.category.name) def test_update_pet(self): - """ - Test case for update_pet + self.pet.name = "hello kity with updated" + self.pet_api.update_pet(body=self.pet) - Update an existing pet - """ - pass + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertIsNotNone(fetched) + self.assertEqual(self.pet.id, fetched.id) + self.assertEqual(self.pet.name, fetched.name) + self.assertIsNotNone(fetched.category) + self.assertEqual(fetched.category.name, self.pet.category.name) + + def test_find_pets_by_status(self): + self.pet_api.add_pet(body=self.pet) + + self.assertIn( + self.pet.id, + list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_status(status=[self.pet.status]))) + ) + + def test_find_pets_by_tags(self): + self.pet_api.add_pet(body=self.pet) + + self.assertIn( + self.pet.id, + list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_tags(tags=[self.tag.name]))) + ) def test_update_pet_with_form(self): - """ - Test case for update_pet_with_form + self.pet_api.add_pet(body=self.pet) - Updates a pet in the store with form data - """ - pass + name = "hello kity with form updated" + status = "pending" + self.pet_api.update_pet_with_form(pet_id=self.pet.id, name=name, status=status) + + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertEqual(self.pet.id, fetched.id) + self.assertEqual(name, fetched.name) + self.assertEqual(status, fetched.status) def test_upload_file(self): - """ - Test case for upload_file + # upload file with form parameter + try: + additional_metadata = "special" + self.pet_api.upload_file( + pet_id=self.pet.id, + additional_metadata=additional_metadata, + file=self.foo + ) + except ApiException as e: + self.fail("upload_file() raised {0} unexpectedly".format(type(e))) - uploads an image - """ - pass + # upload only file + try: + self.pet_api.upload_file(pet_id=self.pet.id, file=self.foo) + except ApiException as e: + self.fail("upload_file() raised {0} unexpectedly".format(type(e))) + def test_delete_pet(self): + self.pet_api.add_pet(body=self.pet) + self.pet_api.delete_pet(pet_id=self.pet.id, api_key="special-key") + + try: + self.pet_api.get_pet_by_id(pet_id=self.pet.id) + raise "expected an error" + except ApiException as e: + self.assertEqual(404, e.status) if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/tests/test_store_api.py b/samples/client/petstore/python/tests/test_store_api.py index e8dc0a64b1ca..42b92d0879c0 100644 --- a/samples/client/petstore/python/tests/test_store_api.py +++ b/samples/client/petstore/python/tests/test_store_api.py @@ -1,75 +1,30 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ref: https://github.com/swagger-api/swagger-codegen +Run the tests. +$ pip install nose (optional) +$ cd SwaggerPetstore-python +$ nosetests -v """ -from __future__ import absolute_import - import os -import sys +import time import unittest import swagger_client from swagger_client.rest import ApiException -from swagger_client.apis.store_api import StoreApi -class TestStoreApi(unittest.TestCase): - """ StoreApi unit test stubs """ +class StoreApiTests(unittest.TestCase): def setUp(self): - self.api = swagger_client.apis.store_api.StoreApi() + self.store_api = swagger_client.StoreApi() def tearDown(self): - pass - - def test_delete_order(self): - """ - Test case for delete_order - - Delete purchase order by ID - """ - pass + # sleep 1 sec between two every 2 tests + time.sleep(1) def test_get_inventory(self): - """ - Test case for get_inventory - - Returns pet inventories by status - """ - pass - - def test_get_order_by_id(self): - """ - Test case for get_order_by_id - - Find purchase order by ID - """ - pass - - def test_place_order(self): - """ - Test case for place_order - - Place an order for a pet - """ - pass - - -if __name__ == '__main__': - unittest.main() \ No newline at end of file + data = self.store_api.get_inventory() + self.assertIsNotNone(data) + self.assertTrue(isinstance(data, dict)) From fbde7f88eea846f4fdc69df9fb7394f5e88bd1e2 Mon Sep 17 00:00:00 2001 From: abcsun Date: Thu, 28 Apr 2016 10:39:54 +0800 Subject: [PATCH 27/48] add parameter validation in methord call --- .../src/main/resources/php/api.mustache | 61 +++- .../petstore/php/SwaggerClient-php/README.md | 25 +- .../php/SwaggerClient-php/docs/FakeApi.md | 75 +++++ .../php/SwaggerClient-php/lib/Api/FakeApi.php | 308 ++++++++++++++++++ .../php/SwaggerClient-php/lib/Api/PetApi.php | 32 +- .../SwaggerClient-php/lib/Api/StoreApi.php | 26 +- .../php/SwaggerClient-php/lib/Api/UserApi.php | 33 +- .../lib/Tests/FakeApiTest.php | 76 +++++ .../lib/Tests/FormatTestTest.php | 70 ++++ 9 files changed, 658 insertions(+), 48 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/FormatTestTest.php diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 2692ba66f94f..c31eff8bc4a8 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -122,7 +122,36 @@ use \{{invokerPackage}}\ObjectSerializer; // verify the required parameter '{{paramName}}' is set if (${{paramName}} === null) { throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{operationId}}'); - }{{/required}}{{/allParams}} + } + {{#hasValidation}} + {{#maxLength}} + if (strlen(${{paramName}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if (strlen(${{paramName}}) > {{minLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if (${{paramName}} > {{maximum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if (${{paramName}} < {{minimum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", ${{paramName}})) { + throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); + } + {{/pattern}} + + {{/hasValidation}} + {{/required}}{{/allParams}} // parse inputs $resourcePath = "{{path}}"; @@ -172,6 +201,33 @@ use \{{invokerPackage}}\ObjectSerializer; {{#formParams}}// form params if (${{paramName}} !== null) { + {{#hasValidation}} + {{#maxLength}} + if (strlen(${{paramName}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if (strlen(${{paramName}}) > {{minLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if (${{paramName}} > {{maximum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if (${{paramName}} < {{minimum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", ${{paramName}})) { + throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); + } + {{/pattern}} + {{/hasValidation}} {{#isFile}} // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax // See: https://wiki.php.net/rfc/curl-file-upload @@ -184,7 +240,8 @@ use \{{invokerPackage}}\ObjectSerializer; {{^isFile}} $formParams['{{baseName}}'] = $this->apiClient->getSerializer()->toFormValue(${{paramName}}); {{/isFile}} - }{{/formParams}} + } + {{/formParams}} {{#bodyParams}}// body params $_tempBody = null; if (isset(${{paramName}})) { diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 80e8d1bae7a9..aa6ce69b760a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-23T22:48:00.795+08:00 +- Build date: 2016-04-28T02:26:28.980Z - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -58,16 +58,24 @@ Please follow the [installation procedure](#installation--usage) and then run th setAccessToken('YOUR_ACCESS_TOKEN'); - -$api_instance = new Swagger\Client\Api\PetApi(); -$body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store +$api_instance = new Swagger\Client\Api\FakeApi(); +$number = "number_example"; // string | None +$double = 1.2; // double | None +$string = "string_example"; // string | None +$byte = "B"; // string | None +$integer = 56; // int | None +$int32 = 56; // int | None +$int64 = 789; // int | None +$float = 3.4; // float | None +$binary = "B"; // string | None +$date = new \DateTime(); // \DateTime | None +$date_time = new \DateTime(); // \DateTime | None +$password = "password_example"; // string | None try { - $api_instance->addPet($body); + $api_instance->testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); } catch (Exception $e) { - echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), "\n"; + echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), "\n"; } ?> @@ -79,6 +87,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters *PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md new file mode 100644 index 000000000000..bc47365c9e0d --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FakeApi.md @@ -0,0 +1,75 @@ +# Swagger\Client\FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters + + +# **testEndpointParameters** +> testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```php +testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), "\n"; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **string**| None | + **double** | **double**| None | + **string** | **string**| None | + **byte** | **string**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **binary** | **string**| None | [optional] + **date** | **\DateTime**| None | [optional] + **date_time** | **\DateTime**| None | [optional] + **password** | **string**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php new file mode 100644 index 000000000000..f6f2e73950a2 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -0,0 +1,308 @@ +getConfig()->setHost('http://petstore.swagger.io/v2'); + } + + $this->apiClient = $apiClient; + } + + /** + * Get API client + * @return \Swagger\Client\ApiClient get the API client + */ + public function getApiClient() + { + return $this->apiClient; + } + + /** + * Set the API client + * @param \Swagger\Client\ApiClient $apiClient set the API client + * @return FakeApi + */ + public function setApiClient(ApiClient $apiClient) + { + $this->apiClient = $apiClient; + return $this; + } + + /** + * testEndpointParameters + * + * Fake endpoint for testing various parameters + * + * @param string $number None (required) + * @param double $double None (required) + * @param string $string None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function testEndpointParameters($number, $double, $string, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $binary = null, $date = null, $date_time = null, $password = null) + { + list($response) = $this->testEndpointParametersWithHttpInfo ($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password); + return $response; + } + + + /** + * testEndpointParametersWithHttpInfo + * + * Fake endpoint for testing various parameters + * + * @param string $number None (required) + * @param double $double None (required) + * @param string $string None (required) + * @param string $byte None (required) + * @param int $integer None (optional) + * @param int $int32 None (optional) + * @param int $int64 None (optional) + * @param float $float None (optional) + * @param string $binary None (optional) + * @param \DateTime $date None (optional) + * @param \DateTime $date_time None (optional) + * @param string $password None (optional) + * @return Array of null, HTTP status code, HTTP response headers (array of strings) + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function testEndpointParametersWithHttpInfo($number, $double, $string, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $binary = null, $date = null, $date_time = null, $password = null) + { + + // verify the required parameter 'number' is set + if ($number === null) { + throw new \InvalidArgumentException('Missing the required parameter $number when calling testEndpointParameters'); + } + if ($number > 543.2) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.'); + } + if ($number < 32.1) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); + } + + + // verify the required parameter 'double' is set + if ($double === null) { + throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters'); + } + if ($double > 123.4) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.'); + } + if ($double < 67.8) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); + } + + + // verify the required parameter 'string' is set + if ($string === null) { + throw new \InvalidArgumentException('Missing the required parameter $string when calling testEndpointParameters'); + } + if (!preg_match("/[a-z]/i", $string)) { + throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.'); + } + + + // verify the required parameter 'byte' is set + if ($byte === null) { + throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters'); + } + + + // parse inputs + $resourcePath = "/fake"; + $httpBody = ''; + $queryParams = array(); + $headerParams = array(); + $formParams = array(); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); + + + + + // default format to json + $resourcePath = str_replace("{format}", "json", $resourcePath); + + // form params + if ($integer !== null) { + if ($integer > 100.0) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.'); + } + if ($integer < 10.0) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.'); + } + $formParams['integer'] = $this->apiClient->getSerializer()->toFormValue($integer); + } +// form params + if ($int32 !== null) { + if ($int32 > 200.0) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.'); + } + if ($int32 < 20.0) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.'); + } + $formParams['int32'] = $this->apiClient->getSerializer()->toFormValue($int32); + } +// form params + if ($int64 !== null) { + $formParams['int64'] = $this->apiClient->getSerializer()->toFormValue($int64); + } +// form params + if ($number !== null) { + if ($number > 543.2) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.'); + } + if ($number < 32.1) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); + } + $formParams['number'] = $this->apiClient->getSerializer()->toFormValue($number); + } +// form params + if ($float !== null) { + if ($float > 987.6) { + throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); + } + $formParams['float'] = $this->apiClient->getSerializer()->toFormValue($float); + } +// form params + if ($double !== null) { + if ($double > 123.4) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.'); + } + if ($double < 67.8) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); + } + $formParams['double'] = $this->apiClient->getSerializer()->toFormValue($double); + } +// form params + if ($string !== null) { + if (!preg_match("/[a-z]/i", $string)) { + throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.'); + } + $formParams['string'] = $this->apiClient->getSerializer()->toFormValue($string); + } +// form params + if ($byte !== null) { + $formParams['byte'] = $this->apiClient->getSerializer()->toFormValue($byte); + } +// form params + if ($binary !== null) { + $formParams['binary'] = $this->apiClient->getSerializer()->toFormValue($binary); + } +// form params + if ($date !== null) { + $formParams['date'] = $this->apiClient->getSerializer()->toFormValue($date); + } +// form params + if ($date_time !== null) { + $formParams['dateTime'] = $this->apiClient->getSerializer()->toFormValue($date_time); + } +// form params + if ($password !== null) { + if (strlen($password) > 64) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); + } + if (strlen($password) > 10) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); + } + $formParams['password'] = $this->apiClient->getSerializer()->toFormValue($password); + } + + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, 'POST', + $queryParams, $httpBody, + $headerParams + ); + + return array(null, $statusCode, $httpHeader); + } catch (ApiException $e) { + switch ($e->getCode()) { + } + + throw $e; + } + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 1154b72929c7..fff4e6be41a7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -122,6 +122,7 @@ class PetApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling addPet'); } + // parse inputs $resourcePath = "/pet"; @@ -141,8 +142,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -209,6 +209,7 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling deletePet'); } + // parse inputs $resourcePath = "/pet/{petId}"; @@ -238,8 +239,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -300,6 +300,7 @@ class PetApi if ($status === null) { throw new \InvalidArgumentException('Missing the required parameter $status when calling findPetsByStatus'); } + // parse inputs $resourcePath = "/pet/findByStatus"; @@ -325,8 +326,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -394,6 +394,7 @@ class PetApi if ($tags === null) { throw new \InvalidArgumentException('Missing the required parameter $tags when calling findPetsByTags'); } + // parse inputs $resourcePath = "/pet/findByTags"; @@ -419,8 +420,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -488,6 +488,7 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetById'); } + // parse inputs $resourcePath = "/pet/{petId}"; @@ -514,8 +515,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -585,6 +585,7 @@ class PetApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling updatePet'); } + // parse inputs $resourcePath = "/pet"; @@ -604,8 +605,7 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -674,6 +674,7 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling updatePetWithForm'); } + // parse inputs $resourcePath = "/pet/{petId}"; @@ -703,7 +704,8 @@ class PetApi // form params if ($name !== null) { $formParams['name'] = $this->apiClient->getSerializer()->toFormValue($name); - }// form params + } +// form params if ($status !== null) { $formParams['status'] = $this->apiClient->getSerializer()->toFormValue($status); } @@ -772,6 +774,7 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling uploadFile'); } + // parse inputs $resourcePath = "/pet/{petId}/uploadImage"; @@ -801,7 +804,8 @@ class PetApi // form params if ($additional_metadata !== null) { $formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata); - }// form params + } +// form params if ($file !== null) { // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax // See: https://wiki.php.net/rfc/curl-file-upload diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index e5bf83b4463d..77d5b9ecba13 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -122,6 +122,11 @@ class StoreApi if ($order_id === null) { throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deleteOrder'); } + if ($order_id < 1.0) { + throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.deleteOrder, must be bigger than or equal to 1.0.'); + } + + // parse inputs $resourcePath = "/store/order/{orderId}"; @@ -148,8 +153,7 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -218,8 +222,7 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -289,6 +292,14 @@ class StoreApi if ($order_id === null) { throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderById'); } + if ($order_id > 5.0) { + throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be smaller than or equal to 5.0.'); + } + if ($order_id < 1.0) { + throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.0.'); + } + + // parse inputs $resourcePath = "/store/order/{orderId}"; @@ -315,8 +326,7 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -379,6 +389,7 @@ class StoreApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling placeOrder'); } + // parse inputs $resourcePath = "/store/order"; @@ -398,8 +409,7 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 4882ccd97640..7376d58e8fea 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -122,6 +122,7 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUser'); } + // parse inputs $resourcePath = "/user"; @@ -141,8 +142,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -202,6 +202,7 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithArrayInput'); } + // parse inputs $resourcePath = "/user/createWithArray"; @@ -221,8 +222,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -282,6 +282,7 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithListInput'); } + // parse inputs $resourcePath = "/user/createWithList"; @@ -301,8 +302,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -362,6 +362,7 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling deleteUser'); } + // parse inputs $resourcePath = "/user/{username}"; @@ -388,8 +389,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -445,6 +445,7 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling getUserByName'); } + // parse inputs $resourcePath = "/user/{username}"; @@ -471,8 +472,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -537,10 +537,12 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling loginUser'); } + // verify the required parameter 'password' is set if ($password === null) { throw new \InvalidArgumentException('Missing the required parameter $password when calling loginUser'); } + // parse inputs $resourcePath = "/user/login"; @@ -566,8 +568,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -643,8 +644,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - + // for model (json/xml) if (isset($_tempBody)) { @@ -702,10 +702,12 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling updateUser'); } + // verify the required parameter 'body' is set if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling updateUser'); } + // parse inputs $resourcePath = "/user/{username}"; @@ -732,8 +734,7 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - - // body params + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php new file mode 100644 index 000000000000..47b8fa21b68b --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/FakeApiTest.php @@ -0,0 +1,76 @@ + Date: Wed, 27 Apr 2016 22:43:08 -0700 Subject: [PATCH 28/48] 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 29/48] 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 30/48] 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 31/48] 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 32/48] 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 33/48] 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 34/48] 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 35/48] 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 36/48] 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 37/48] 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 38/48] 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,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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 72120099b43f6453f7e890993720080bac791d43 Mon Sep 17 00:00:00 2001 From: abcsun Date: Fri, 29 Apr 2016 11:04:27 +0800 Subject: [PATCH 39/48] change the validation to allParams --- .../src/main/resources/php/api.mustache | 33 +----- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 101 +++++++----------- .../php/SwaggerClient-php/lib/Api/PetApi.php | 32 +++--- .../SwaggerClient-php/lib/Api/StoreApi.php | 18 ++-- .../php/SwaggerClient-php/lib/Api/UserApi.php | 38 +++---- 6 files changed, 85 insertions(+), 139 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index c31eff8bc4a8..c0401940b484 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -123,6 +123,7 @@ use \{{invokerPackage}}\ObjectSerializer; if (${{paramName}} === null) { throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{operationId}}'); } + {{/required}} {{#hasValidation}} {{#maxLength}} if (strlen(${{paramName}}) > {{maxLength}}) { @@ -151,7 +152,7 @@ use \{{invokerPackage}}\ObjectSerializer; {{/pattern}} {{/hasValidation}} - {{/required}}{{/allParams}} + {{/allParams}} // parse inputs $resourcePath = "{{path}}"; @@ -201,33 +202,6 @@ use \{{invokerPackage}}\ObjectSerializer; {{#formParams}}// form params if (${{paramName}} !== null) { - {{#hasValidation}} - {{#maxLength}} - if (strlen(${{paramName}}) > {{maxLength}}) { - throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); - } - {{/maxLength}} - {{#minLength}} - if (strlen(${{paramName}}) > {{minLength}}) { - throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); - } - {{/minLength}} - {{#maximum}} - if (${{paramName}} > {{maximum}}) { - throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); - } - {{/maximum}} - {{#minimum}} - if (${{paramName}} < {{minimum}}) { - throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); - } - {{/minimum}} - {{#pattern}} - if (!preg_match("{{pattern}}", ${{paramName}})) { - throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); - } - {{/pattern}} - {{/hasValidation}} {{#isFile}} // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax // See: https://wiki.php.net/rfc/curl-file-upload @@ -240,8 +214,7 @@ use \{{invokerPackage}}\ObjectSerializer; {{^isFile}} $formParams['{{baseName}}'] = $this->apiClient->getSerializer()->toFormValue(${{paramName}}); {{/isFile}} - } - {{/formParams}} + }{{/formParams}} {{#bodyParams}}// body params $_tempBody = null; if (isset(${{paramName}})) { diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index aa6ce69b760a..e7d9b552b043 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-28T02:26:28.980Z +- Build date: 2016-04-29T03:01:58.276Z - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index f6f2e73950a2..ee15a10d025a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -151,7 +151,7 @@ class FakeApi throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); } - + // verify the required parameter 'double' is set if ($double === null) { throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters'); @@ -163,7 +163,7 @@ class FakeApi throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); } - + // verify the required parameter 'string' is set if ($string === null) { throw new \InvalidArgumentException('Missing the required parameter $string when calling testEndpointParameters'); @@ -172,12 +172,36 @@ class FakeApi throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.'); } - + // verify the required parameter 'byte' is set if ($byte === null) { throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters'); } - + if ($integer > 100.0) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.'); + } + if ($integer < 10.0) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.'); + } + + if ($int32 > 200.0) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.'); + } + if ($int32 < 20.0) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.'); + } + + if ($float > 987.6) { + throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); + } + + if (strlen($password) > 64) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); + } + if (strlen($password) > 10) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); + } + // parse inputs $resourcePath = "/fake"; @@ -199,86 +223,39 @@ class FakeApi // form params if ($integer !== null) { - if ($integer > 100.0) { - throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.'); - } - if ($integer < 10.0) { - throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.'); - } $formParams['integer'] = $this->apiClient->getSerializer()->toFormValue($integer); - } -// form params + }// form params if ($int32 !== null) { - if ($int32 > 200.0) { - throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.'); - } - if ($int32 < 20.0) { - throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.'); - } $formParams['int32'] = $this->apiClient->getSerializer()->toFormValue($int32); - } -// form params + }// form params if ($int64 !== null) { $formParams['int64'] = $this->apiClient->getSerializer()->toFormValue($int64); - } -// form params + }// form params if ($number !== null) { - if ($number > 543.2) { - throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.'); - } - if ($number < 32.1) { - throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); - } $formParams['number'] = $this->apiClient->getSerializer()->toFormValue($number); - } -// form params + }// form params if ($float !== null) { - if ($float > 987.6) { - throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); - } $formParams['float'] = $this->apiClient->getSerializer()->toFormValue($float); - } -// form params + }// form params if ($double !== null) { - if ($double > 123.4) { - throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.'); - } - if ($double < 67.8) { - throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); - } $formParams['double'] = $this->apiClient->getSerializer()->toFormValue($double); - } -// form params + }// form params if ($string !== null) { - if (!preg_match("/[a-z]/i", $string)) { - throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.'); - } $formParams['string'] = $this->apiClient->getSerializer()->toFormValue($string); - } -// form params + }// form params if ($byte !== null) { $formParams['byte'] = $this->apiClient->getSerializer()->toFormValue($byte); - } -// form params + }// form params if ($binary !== null) { $formParams['binary'] = $this->apiClient->getSerializer()->toFormValue($binary); - } -// form params + }// form params if ($date !== null) { $formParams['date'] = $this->apiClient->getSerializer()->toFormValue($date); - } -// form params + }// form params if ($date_time !== null) { $formParams['dateTime'] = $this->apiClient->getSerializer()->toFormValue($date_time); - } -// form params + }// form params if ($password !== null) { - if (strlen($password) > 64) { - throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); - } - if (strlen($password) > 10) { - throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); - } $formParams['password'] = $this->apiClient->getSerializer()->toFormValue($password); } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index fff4e6be41a7..1154b72929c7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -122,7 +122,6 @@ class PetApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling addPet'); } - // parse inputs $resourcePath = "/pet"; @@ -142,7 +141,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -209,7 +209,6 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling deletePet'); } - // parse inputs $resourcePath = "/pet/{petId}"; @@ -239,7 +238,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -300,7 +300,6 @@ class PetApi if ($status === null) { throw new \InvalidArgumentException('Missing the required parameter $status when calling findPetsByStatus'); } - // parse inputs $resourcePath = "/pet/findByStatus"; @@ -326,7 +325,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -394,7 +394,6 @@ class PetApi if ($tags === null) { throw new \InvalidArgumentException('Missing the required parameter $tags when calling findPetsByTags'); } - // parse inputs $resourcePath = "/pet/findByTags"; @@ -420,7 +419,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -488,7 +488,6 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetById'); } - // parse inputs $resourcePath = "/pet/{petId}"; @@ -515,7 +514,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -585,7 +585,6 @@ class PetApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling updatePet'); } - // parse inputs $resourcePath = "/pet"; @@ -605,7 +604,8 @@ class PetApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -674,7 +674,6 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling updatePetWithForm'); } - // parse inputs $resourcePath = "/pet/{petId}"; @@ -704,8 +703,7 @@ class PetApi // form params if ($name !== null) { $formParams['name'] = $this->apiClient->getSerializer()->toFormValue($name); - } -// form params + }// form params if ($status !== null) { $formParams['status'] = $this->apiClient->getSerializer()->toFormValue($status); } @@ -774,7 +772,6 @@ class PetApi if ($pet_id === null) { throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling uploadFile'); } - // parse inputs $resourcePath = "/pet/{petId}/uploadImage"; @@ -804,8 +801,7 @@ class PetApi // form params if ($additional_metadata !== null) { $formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata); - } -// form params + }// form params if ($file !== null) { // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax // See: https://wiki.php.net/rfc/curl-file-upload diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 77d5b9ecba13..27253a09f4fc 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -126,7 +126,6 @@ class StoreApi throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.deleteOrder, must be bigger than or equal to 1.0.'); } - // parse inputs $resourcePath = "/store/order/{orderId}"; @@ -153,7 +152,8 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -202,8 +202,7 @@ class StoreApi */ public function getInventoryWithHttpInfo() { - - + // parse inputs $resourcePath = "/store/inventory"; $httpBody = ''; @@ -222,7 +221,8 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -299,7 +299,6 @@ class StoreApi throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.0.'); } - // parse inputs $resourcePath = "/store/order/{orderId}"; @@ -326,7 +325,8 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -389,7 +389,6 @@ class StoreApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling placeOrder'); } - // parse inputs $resourcePath = "/store/order"; @@ -409,7 +408,8 @@ class StoreApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 7376d58e8fea..96c9fa6fc09a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -122,7 +122,6 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUser'); } - // parse inputs $resourcePath = "/user"; @@ -142,7 +141,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -202,7 +202,6 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithArrayInput'); } - // parse inputs $resourcePath = "/user/createWithArray"; @@ -222,7 +221,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -282,7 +282,6 @@ class UserApi if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithListInput'); } - // parse inputs $resourcePath = "/user/createWithList"; @@ -302,7 +301,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; @@ -362,7 +362,6 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling deleteUser'); } - // parse inputs $resourcePath = "/user/{username}"; @@ -389,7 +388,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -445,7 +445,6 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling getUserByName'); } - // parse inputs $resourcePath = "/user/{username}"; @@ -472,7 +471,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -537,12 +537,11 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling loginUser'); } - + // verify the required parameter 'password' is set if ($password === null) { throw new \InvalidArgumentException('Missing the required parameter $password when calling loginUser'); } - // parse inputs $resourcePath = "/user/login"; @@ -568,7 +567,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -624,8 +624,7 @@ class UserApi */ public function logoutUserWithHttpInfo() { - - + // parse inputs $resourcePath = "/user/logout"; $httpBody = ''; @@ -644,7 +643,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - + + // for model (json/xml) if (isset($_tempBody)) { @@ -702,12 +702,11 @@ class UserApi if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling updateUser'); } - + // verify the required parameter 'body' is set if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling updateUser'); } - // parse inputs $resourcePath = "/user/{username}"; @@ -734,7 +733,8 @@ class UserApi // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); - // body params + + // body params $_tempBody = null; if (isset($body)) { $_tempBody = $body; From 90442db86d9d53f1d52ca5fe8e2bf4022ada697c Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 29 Apr 2016 11:10:52 +0800 Subject: [PATCH 40/48] 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 41/48] 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 42/48] 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 43/48] 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 44/48] 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 83567861e0987f731db3ecde4eee20b3f975d036 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 30 Apr 2016 20:15:45 +0800 Subject: [PATCH 45/48] 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 46/48] 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 47/48] 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 48/48] 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')) {