diff --git a/README.md b/README.md index a925e6d886a2..1bb545480334 100644 --- a/README.md +++ b/README.md @@ -696,9 +696,12 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [Ergon](http://www.ergon.ch/) - [everystory.us](http://everystory.us) - [Expected Behavior](http://www.expectedbehavior.com/) +- [LiveAgent](https://www.ladesk.com/) - [nViso](http://www.nviso.ch/) - [Okiok](https://www.okiok.com) - [OSDN](https://osdn.jp) +- [Pixoneye](http://www.pixoneye.com/) +- [PostAffiliatePro](https://www.postaffiliatepro.com/) - [Reload! A/S](https://reload.dk/) - [Royal Bank of Canada (RBC)](http://www.rbc.com/canada.html) - [SmartRecruiters](https://www.smartrecruiters.com/) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java index bf79a3b72707..6809c4970d24 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java @@ -105,6 +105,8 @@ public interface CodegenConfig { void processSwagger(Swagger swagger); + String sanitizeTag(String tag); + String toApiFilename(String name); String toModelFilename(String name); 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 7bb2ed585011..87c8b36aad4e 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 @@ -2293,6 +2293,19 @@ public class DefaultCodegen { return name.replaceAll("[^a-zA-Z0-9_]", ""); } + @SuppressWarnings("static-method") + public String sanitizeTag(String tag) { + // remove spaces and make strong case + String[] parts = tag.split(" "); + StringBuilder buf = new StringBuilder(); + for (String part : parts) { + if (StringUtils.isNotEmpty(part)) { + buf.append(StringUtils.capitalize(part)); + } + } + return buf.toString().replaceAll("[^a-zA-Z ]", ""); + } + /** * Only write if the file doesn't exist * 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 f817b244b3ca..965291cd3266 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 @@ -15,7 +15,6 @@ import org.slf4j.LoggerFactory; import java.io.*; import java.util.*; -import static org.apache.commons.lang3.StringUtils.capitalize; import static org.apache.commons.lang3.StringUtils.isNotEmpty; public class DefaultGenerator extends AbstractGenerator implements Generator { @@ -623,8 +622,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { try { co = config.fromOperation(resourcePath, httpMethod, operation, swagger.getDefinitions(), swagger); co.tags = new ArrayList(); - co.tags.add(sanitizeTag(tag)); - config.addOperationToGroup(sanitizeTag(tag), resourcePath, operation, co, operations); + co.tags.add(config.sanitizeTag(tag)); + config.addOperationToGroup(config.sanitizeTag(tag), resourcePath, operation, co, operations); List>> securities = operation.getSecurity(); if (securities == null && swagger.getSecurity() != null) { @@ -683,19 +682,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { return parameter.getName() + ":" + parameter.getIn(); } - @SuppressWarnings("static-method") - protected String sanitizeTag(String tag) { - // remove spaces and make strong case - String[] parts = tag.split(" "); - StringBuilder buf = new StringBuilder(); - for (String part : parts) { - if (isNotEmpty(part)) { - buf.append(capitalize(part)); - } - } - return buf.toString().replaceAll("[^a-zA-Z ]", ""); - } - @SuppressWarnings("static-method") public Map processOperations(CodegenConfig config, String tag, List ops) { Map operations = new HashMap(); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java index 5228c86457ff..bf55e5736448 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ClojureClientCodegen.java @@ -145,6 +145,11 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi supportingFiles.add(new SupportingFile("core.mustache", baseNamespaceFolder, "core.clj")); } + @Override + public String sanitizeTag(String tag) { + return tag.replaceAll("[^a-zA-Z_]+", "_"); + } + @Override public String apiFileFolder() { return outputFolder + File.separator + sourceFolder + File.separator + namespaceToFolder(apiPackage); @@ -160,6 +165,11 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi return dashize(sanitizeName(operationId)); } + @Override + public String toApiFilename(String name) { + return underscore(toApiName(name)); + } + @Override public String toApiName(String name) { return dashize(name); 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 6d76d726ccfc..8f1764f9a6cc 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 @@ -44,7 +44,8 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { "case", "defer", "go", "map", "struct", "chan", "else", "goto", "package", "switch", "const", "fallthrough", "if", "range", "type", - "continue", "for", "import", "return", "var") + "continue", "for", "import", "return", "var", "error") + // Added "error" as it's used so frequently that it may as well be a keyword ); defaultIncludes = new HashSet( @@ -131,8 +132,22 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { } @Override - public String escapeReservedWord(String name) { - return "_" + name; + public String escapeReservedWord(String name) + { + // Can't start with an underscore, as our fields need to start with an + // UppercaseLetter so that Go treats them as public/visible. + + // Options? + // - MyName + // - AName + // - TheName + // - XName + // - X_Name + // ... or maybe a suffix? + // - Name_ ... think this will work. + + // FIXME: This should also really be a customizable option + return camelize(name) + '_'; } @Override @@ -166,8 +181,13 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toParamName(String name) { - // should be the same as variable name - return toVarName(name); + // params should be lowerCamelCase. E.g. "person Person", instead of + // "Person Person". + // + // REVISIT: Actually, for idiomatic go, the param name should + // really should just be a letter, e.g. "p Person"), but we'll get + // around to that some other time... Maybe. + return camelize(toVarName(name), true); } @Override @@ -200,7 +220,24 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { return getSwaggerType(p) + "[string]" + getTypeDeclaration(inner); } - return super.getTypeDeclaration(p); + //return super.getTypeDeclaration(p); + + // Not using the supertype invocation, because we want to UpperCamelize + // the type. + String swaggerType = getSwaggerType(p); + if (typeMapping.containsKey(swaggerType)) { + return typeMapping.get(swaggerType); + } + + if(typeMapping.containsValue(swaggerType)) { + return swaggerType; + } + + if(languageSpecificPrimitives.contains(swaggerType)) { + return swaggerType; + } + + return camelize(swaggerType, false); } @Override 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 516fca1e8b6e..27f8ddf7e582 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 @@ -83,6 +83,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { ); instantiationTypes.put("array", "ArrayList"); instantiationTypes.put("map", "HashMap"); + typeMapping.put("date", "Date"); + typeMapping.put("file", "File"); cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); @@ -488,7 +490,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { if (typeMapping.containsKey(swaggerType)) { type = typeMapping.get(swaggerType); if (languageSpecificPrimitives.contains(type) || type.indexOf(".") >= 0 || - type.equals("Map") || type.equals("List")) { + type.equals("Map") || type.equals("List") || + type.equals("File") || type.equals("Date")) { return type; } } else { diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache index 6ef0a6a9dc5b..409dbff81e5b 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache @@ -31,6 +31,11 @@ * The default HTTP headers to be included for all API calls. */ this.defaultHeaders = {}; + + /** + * The default HTTP timeout for all API calls. + */ + this.timeout = 60000; }; ApiClient.prototype.paramToString = function paramToString(param) { @@ -231,6 +236,9 @@ // set header parameters request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); + //set request timeout + request.timeout(this.timeout); + var contentType = this.jsonPreferredMime(contentTypes); if (contentType) { request.type(contentType); diff --git a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache index 1f0f48226a70..068a42c8d4c8 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/model.mustache @@ -73,10 +73,6 @@ {{/vars}} {{/omitModelMethods}} - {{classname}}.prototype.toJson = function() { - return JSON.stringify(this); - } - {{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} {{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/swift/api.mustache b/modules/swagger-codegen/src/main/resources/swift/api.mustache index 9bb19c54b340..64757126563c 100644 --- a/modules/swagger-codegen/src/main/resources/swift/api.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/api.mustache @@ -76,9 +76,9 @@ public class {{classname}}: APIBase { {{#bodyParam}} let parameters = {{paramName}}{{^required}}?{{/required}}.encodeToJSON() as? [String:AnyObject]{{/bodyParam}}{{^bodyParam}} let nillableParameters: [String:AnyObject?] = {{^queryParams}}{{^formParams}}[:]{{/formParams}}{{#formParams}}{{^secondaryParam}}[{{/secondaryParam}} - "{{paramName}}": {{paramName}}{{#hasMore}},{{/hasMore}}{{^hasMore}} + "{{baseName}}": {{paramName}}{{#hasMore}},{{/hasMore}}{{^hasMore}} ]{{/hasMore}}{{/formParams}}{{/queryParams}}{{#queryParams}}{{^secondaryParam}}[{{/secondaryParam}} - "{{paramName}}": {{paramName}}{{#hasMore}},{{/hasMore}}{{^hasMore}} + "{{baseName}}": {{paramName}}{{#hasMore}},{{/hasMore}}{{^hasMore}} ]{{/hasMore}}{{/queryParams}} let parameters = APIHelper.rejectNil(nillableParameters){{/bodyParam}} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/languages/ClojureClientCodegenTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/languages/ClojureClientCodegenTest.java new file mode 100644 index 000000000000..60d22d9cfe9a --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/languages/ClojureClientCodegenTest.java @@ -0,0 +1,38 @@ +package io.swagger.codegen.languages; + +import org.testng.Assert; +import org.testng.annotations.Test; + +public class ClojureClientCodegenTest { + ClojureClientCodegen codegen = new ClojureClientCodegen(); + + @Test + public void testSanitizeTag() throws Exception { + Assert.assertEquals(codegen.sanitizeTag("users-api"), "users_api"); + Assert.assertEquals(codegen.sanitizeTag("users_api"), "users_api"); + Assert.assertEquals(codegen.sanitizeTag("users api"), "users_api"); + Assert.assertEquals(codegen.sanitizeTag("users.api"), "users_api"); + Assert.assertEquals(codegen.sanitizeTag("Users Api"), "Users_Api"); + Assert.assertEquals(codegen.sanitizeTag("UsersApi"), "UsersApi"); + Assert.assertEquals(codegen.sanitizeTag("usersapi"), "usersapi"); + Assert.assertEquals(codegen.sanitizeTag("Usersapi"), "Usersapi"); + } + + @Test + public void testToApiName() throws Exception { + Assert.assertEquals(codegen.toApiName("users_api"), "users-api"); + Assert.assertEquals(codegen.toApiName("Users_Api"), "users-api"); + Assert.assertEquals(codegen.toApiName("UsersApi"), "users-api"); + Assert.assertEquals(codegen.toApiName("usersapi"), "usersapi"); + Assert.assertEquals(codegen.toApiName("Usersapi"), "usersapi"); + } + + @Test + public void testToApiFilename() throws Exception { + Assert.assertEquals(codegen.toApiFilename("users_api"), "users_api"); + Assert.assertEquals(codegen.toApiFilename("Users_Api"), "users_api"); + Assert.assertEquals(codegen.toApiFilename("UsersApi"), "users_api"); + Assert.assertEquals(codegen.toApiFilename("usersapi"), "usersapi"); + Assert.assertEquals(codegen.toApiFilename("Usersapi"), "usersapi"); + } +} diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index a0c70eb10ee1..e2ab48cf09cb 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -34,6 +34,11 @@ * The default HTTP headers to be included for all API calls. */ this.defaultHeaders = {}; + + /** + * The default HTTP timeout for all API calls. + */ + this.timeout = 60000; }; ApiClient.prototype.paramToString = function paramToString(param) { @@ -234,6 +239,9 @@ // set header parameters request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); + //set request timeout + request.timeout(this.timeout); + var contentType = this.jsonPreferredMime(contentTypes); if (contentType) { request.type(contentType); diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index b9dd09d6d9f4..044413ab544b 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -87,8 +87,8 @@ /** * Finds Pets by status - * Multiple status values can be provided with comma seperated strings - * @param {[String]} opts['status'] Status values that need to be considered for filter + * Multiple status values can be provided with comma separated strings + * @param {[String]} opts['status'] Status values that need to be considered for query * data is of type: [Pet] */ self.findPetsByStatus = function(opts) { @@ -321,12 +321,12 @@ * @param {Integer} petId ID of pet that needs to be fetched * data is of type: 'String' */ - self.getPetByIdWithByteArray = function(petId) { + self.petPetIdtestingByteArraytrueGet = function(petId) { var postBody = null; // verify the required parameter 'petId' is set if (petId == null) { - throw "Missing the required parameter 'petId' when calling getPetByIdWithByteArray"; + throw "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"; } diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index d47898d74956..1919aacef5f6 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -21,6 +21,40 @@ var self = this; + /** + * Finds orders by status + * A single status value can be provided as a string + * @param {String} opts['status'] Status value that needs to be considered for query + * data is of type: [Order] + */ + self.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 diff --git a/samples/client/petstore/javascript-promise/src/model/Category.js b/samples/client/petstore/javascript-promise/src/model/Category.js index 7de066c5928e..729a22b9e046 100644 --- a/samples/client/petstore/javascript-promise/src/model/Category.js +++ b/samples/client/petstore/javascript-promise/src/model/Category.js @@ -69,10 +69,6 @@ - Category.prototype.toJson = function() { - return JSON.stringify(this); - } - if (module) { diff --git a/samples/client/petstore/javascript-promise/src/model/Order.js b/samples/client/petstore/javascript-promise/src/model/Order.js index 575064ebc894..4d2e4625d904 100644 --- a/samples/client/petstore/javascript-promise/src/model/Order.js +++ b/samples/client/petstore/javascript-promise/src/model/Order.js @@ -143,10 +143,6 @@ - Order.prototype.toJson = function() { - return JSON.stringify(this); - } - var StatusEnum = { /** diff --git a/samples/client/petstore/javascript-promise/src/model/Pet.js b/samples/client/petstore/javascript-promise/src/model/Pet.js index 3b8bdeef1238..d751182c303f 100644 --- a/samples/client/petstore/javascript-promise/src/model/Pet.js +++ b/samples/client/petstore/javascript-promise/src/model/Pet.js @@ -153,10 +153,6 @@ - Pet.prototype.toJson = function() { - return JSON.stringify(this); - } - var StatusEnum = { /** diff --git a/samples/client/petstore/javascript-promise/src/model/Tag.js b/samples/client/petstore/javascript-promise/src/model/Tag.js index dd0e9c38ea0c..fbd43adb7e04 100644 --- a/samples/client/petstore/javascript-promise/src/model/Tag.js +++ b/samples/client/petstore/javascript-promise/src/model/Tag.js @@ -69,10 +69,6 @@ - Tag.prototype.toJson = function() { - return JSON.stringify(this); - } - if (module) { diff --git a/samples/client/petstore/javascript-promise/src/model/User.js b/samples/client/petstore/javascript-promise/src/model/User.js index 976395c5a622..2f6c9863ef8c 100644 --- a/samples/client/petstore/javascript-promise/src/model/User.js +++ b/samples/client/petstore/javascript-promise/src/model/User.js @@ -179,10 +179,6 @@ - User.prototype.toJson = function() { - return JSON.stringify(this); - } - if (module) { diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index d4377e34d1a8..b1492ceb28f4 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -34,6 +34,11 @@ * The default HTTP headers to be included for all API calls. */ this.defaultHeaders = {}; + + /** + * The default HTTP timeout for all API calls. + */ + this.timeout = 60000; }; ApiClient.prototype.paramToString = function paramToString(param) { @@ -234,6 +239,9 @@ // set header parameters request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); + //set request timeout + request.timeout(this.timeout); + var contentType = this.jsonPreferredMime(contentTypes); if (contentType) { request.type(contentType); diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index d63d58c3c682..e2221bd26215 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -89,8 +89,8 @@ /** * Finds Pets by status - * Multiple status values can be provided with comma seperated strings - * @param {[String]} opts['status'] Status values that need to be considered for filter + * Multiple status values can be provided with comma separated strings + * @param {[String]} opts['status'] Status values that need to be considered for query * @param {function} callback the callback function, accepting three arguments: error, data, response * data is of type: [Pet] */ diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index 6abe687b7f49..46fd1f3e4568 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -21,6 +21,41 @@ var self = this; + /** + * Finds orders by status + * A single status value can be provided as a string + * @param {String} opts['status'] Status value that needs to be considered for query + * @param {function} callback the callback function, accepting three arguments: error, data, response + * data is of type: [Order] + */ + self.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 + ); + + } + /** * Returns pet inventories by status * Returns a map of status codes to quantities diff --git a/samples/client/petstore/javascript/src/model/Category.js b/samples/client/petstore/javascript/src/model/Category.js index 7de066c5928e..729a22b9e046 100644 --- a/samples/client/petstore/javascript/src/model/Category.js +++ b/samples/client/petstore/javascript/src/model/Category.js @@ -69,10 +69,6 @@ - Category.prototype.toJson = function() { - return JSON.stringify(this); - } - if (module) { diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index 575064ebc894..4d2e4625d904 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -143,10 +143,6 @@ - Order.prototype.toJson = function() { - return JSON.stringify(this); - } - var StatusEnum = { /** diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index 3b8bdeef1238..d751182c303f 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -153,10 +153,6 @@ - Pet.prototype.toJson = function() { - return JSON.stringify(this); - } - var StatusEnum = { /** diff --git a/samples/client/petstore/javascript/src/model/Tag.js b/samples/client/petstore/javascript/src/model/Tag.js index dd0e9c38ea0c..fbd43adb7e04 100644 --- a/samples/client/petstore/javascript/src/model/Tag.js +++ b/samples/client/petstore/javascript/src/model/Tag.js @@ -69,10 +69,6 @@ - Tag.prototype.toJson = function() { - return JSON.stringify(this); - } - if (module) { diff --git a/samples/client/petstore/javascript/src/model/User.js b/samples/client/petstore/javascript/src/model/User.js index 976395c5a622..2f6c9863ef8c 100644 --- a/samples/client/petstore/javascript/src/model/User.js +++ b/samples/client/petstore/javascript/src/model/User.js @@ -179,10 +179,6 @@ - User.prototype.toJson = function() { - return JSON.stringify(this); - } - if (module) { diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 5dd20e2fe7eb..ca260a2b92ac 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -129,7 +129,7 @@ public class PetAPI: APIBase { Finds Pets by status - - parameter status: (query) Status values that need to be considered for filter + - parameter status: (query) Status values that need to be considered for query - parameter completion: completion handler to receive the data and the error objects */ public class func findPetsByStatus(status status: [String]?, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) { @@ -142,7 +142,7 @@ public class PetAPI: APIBase { Finds Pets by status - - parameter status: (query) Status values that need to be considered for filter + - parameter status: (query) Status values that need to be considered for query - returns: Promise<[Pet]> */ public class func findPetsByStatus(status status: [String]?) -> Promise<[Pet]> { @@ -162,24 +162,24 @@ public class PetAPI: APIBase { Finds Pets by status - GET /pet/findByStatus - - Multiple status values can be provided with comma seperated strings + - Multiple status values can be provided with comma separated strings - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -188,21 +188,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -211,9 +211,9 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - - parameter status: (query) Status values that need to be considered for filter + - parameter status: (query) Status values that need to be considered for query - returns: RequestBuilder<[Pet]> */ @@ -272,20 +272,20 @@ public class PetAPI: APIBase { - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -294,21 +294,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -317,7 +317,7 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - parameter tags: (query) Tags to filter by @@ -375,26 +375,26 @@ public class PetAPI: APIBase { - GET /pet/{petId} - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - API Key: - - type: apiKey api_key - - name: api_key - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example={ - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - API Key: + - type: apiKey api_key + - name: api_key + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 doggie @@ -403,21 +403,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example={ - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 doggie @@ -426,7 +426,7 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - parameter petId: (path) ID of pet that needs to be fetched @@ -578,11 +578,11 @@ public class PetAPI: APIBase { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server - - parameter file: (form) file to upload + - parameter _file: (form) file to upload - parameter completion: completion handler to receive the data and the error objects */ - public class func uploadFile(petId petId: Int, additionalMetadata: String?, file: NSURL?, completion: ((error: ErrorType?) -> Void)) { - uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { (response, error) -> Void in + public class func uploadFile(petId petId: Int, additionalMetadata: String?, _file: NSURL?, completion: ((error: ErrorType?) -> Void)) { + uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, _file: _file).execute { (response, error) -> Void in completion(error: error); } } @@ -593,12 +593,12 @@ public class PetAPI: APIBase { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server - - parameter file: (form) file to upload + - parameter _file: (form) file to upload - returns: Promise */ - public class func uploadFile(petId petId: Int, additionalMetadata: String?, file: NSURL?) -> Promise { + public class func uploadFile(petId petId: Int, additionalMetadata: String?, _file: NSURL?) -> Promise { let deferred = Promise.pendingPromise() - uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { error in + uploadFile(petId: petId, additionalMetadata: additionalMetadata, _file: _file) { error in if let error = error { deferred.reject(error) } else { @@ -620,18 +620,18 @@ public class PetAPI: APIBase { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server - - parameter file: (form) file to upload + - parameter _file: (form) file to upload - returns: RequestBuilder */ - public class func uploadFileWithRequestBuilder(petId petId: Int, additionalMetadata: String?, file: NSURL?) -> RequestBuilder { + public class func uploadFileWithRequestBuilder(petId petId: Int, additionalMetadata: String?, _file: NSURL?) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil) let URLString = PetstoreClientAPI.basePath + path let nillableParameters: [String:AnyObject?] = [ "additionalMetadata": additionalMetadata, - "file": file + "file": _file ] let parameters = APIHelper.rejectNil(nillableParameters) @@ -678,14 +678,14 @@ public class PetAPI: APIBase { - GET /pet/{petId}?testing_byte_array=true - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - API Key: - - type: apiKey api_key - - name: api_key - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}] - - examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}] + - API Key: + - type: apiKey api_key + - name: api_key + - examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}] + - examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}] - parameter petId: (path) ID of pet that needs to be fetched diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 4aa7663fdf53..e8511765a975 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -11,6 +11,99 @@ import PromiseKit public class StoreAPI: APIBase { + /** + + Finds orders by status + + - parameter status: (query) Status value that needs to be considered for query + - parameter completion: completion handler to receive the data and the error objects + */ + public class func findOrdersByStatus(status status: String?, completion: ((data: [Order]?, error: ErrorType?) -> Void)) { + findOrdersByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in + completion(data: response?.body, error: error); + } + } + + /** + + Finds orders by status + + - parameter status: (query) Status value that needs to be considered for query + - returns: Promise<[Order]> + */ + public class func findOrdersByStatus(status status: String?) -> Promise<[Order]> { + let deferred = Promise<[Order]>.pendingPromise() + findOrdersByStatus(status: status) { data, error in + if let error = error { + deferred.reject(error) + } else { + deferred.fulfill(data!) + } + } + return deferred.promise + } + + /** + + Finds orders by status + + - GET /store/findByStatus + - A single status value can be provided as a string + - API Key: + - type: apiKey x-test_api_client_id + - name: test_api_client_id + - API Key: + - type: apiKey x-test_api_client_secret + - name: test_api_client_secret + - examples: [{contentType=application/json, example=[ { + "petId" : 123456789, + "quantity" : 123, + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +} ]}, {contentType=application/xml, example= + 123456 + 123456 + 0 + 2000-01-23T04:56:07.000Z + string + true +}] + - examples: [{contentType=application/json, example=[ { + "petId" : 123456789, + "quantity" : 123, + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +} ]}, {contentType=application/xml, example= + 123456 + 123456 + 0 + 2000-01-23T04:56:07.000Z + string + true +}] + + - parameter status: (query) Status value that needs to be considered for query + + - returns: RequestBuilder<[Order]> + */ + public class func findOrdersByStatusWithRequestBuilder(status status: String?) -> RequestBuilder<[Order]> { + let path = "/store/findByStatus" + let URLString = PetstoreClientAPI.basePath + path + + let nillableParameters: [String:AnyObject?] = [ + "status": status + ] + let parameters = APIHelper.rejectNil(nillableParameters) + + let requestBuilder: RequestBuilder<[Order]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: false) + } + /** Returns pet inventories by status @@ -50,12 +143,12 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey api_key - name: api_key - - examples: [{example={ + - examples: [{contentType=application/json, example={ "key" : 123 -}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}] - - examples: [{example={ +}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}] + - examples: [{contentType=application/json, example={ "key" : 123 -}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}] +}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}] - returns: RequestBuilder<[String:Int]> */ @@ -115,36 +208,36 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey x-test_api_client_secret - name: test_api_client_secret - - examples: [{example={ - "id" : 123456789, + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] - - examples: [{example={ - "id" : 123456789, +}] + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] +}] - parameter body: (body) order placed for purchasing the pet @@ -199,42 +292,42 @@ public class StoreAPI: APIBase { - GET /store/order/{orderId} - For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - - API Key: - - type: apiKey test_api_key_header - - name: test_api_key_header - API Key: - type: apiKey test_api_key_query (QUERY) - name: test_api_key_query - - examples: [{example={ - "id" : 123456789, + - API Key: + - type: apiKey test_api_key_header + - name: test_api_key_header + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] - - examples: [{example={ - "id" : 123456789, +}] + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] +}] - parameter orderId: (path) ID of pet that needs to be fetched diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 7d304039bb0b..dffc01db15f2 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -213,8 +213,8 @@ public class UserAPI: APIBase { - GET /user/login - - - examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}] - - examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text @@ -325,7 +325,7 @@ public class UserAPI: APIBase { - GET /user/{username} - - - examples: [{example={ + - examples: [{contentType=application/json, example={ "id" : 1, "username" : "johnp", "firstName" : "John", @@ -334,7 +334,7 @@ public class UserAPI: APIBase { "password" : "-secret-", "phone" : "0123456789", "userStatus" : 0 -}, contentType=application/json}] +}}] - parameter username: (path) The name that needs to be fetched. Use user1 for testing. diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift index 04c07fa97ffb..f9b6c5ade484 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift @@ -124,6 +124,24 @@ class Decoders { fatalError("formatter failed to parse \(source)") } + // Decoder for [Order] + Decoders.addDecoder(clazz: [Order].self) { (source: AnyObject) -> [Order] in + return Decoders.decode(clazz: [Order].self, source: source) + } + // Decoder for Order + Decoders.addDecoder(clazz: Order.self) { (source: AnyObject) -> Order in + let sourceDictionary = source as! [NSObject:AnyObject] + let instance = Order() + instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) + instance.petId = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["petId"]) + instance.quantity = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["quantity"]) + instance.shipDate = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["shipDate"]) + instance.status = Order.Status(rawValue: (sourceDictionary["status"] as? String) ?? "") + instance.complete = Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["complete"]) + return instance + } + + // Decoder for [User] Decoders.addDecoder(clazz: [User].self) { (source: AnyObject) -> [User] in return Decoders.decode(clazz: [User].self, source: source) @@ -158,6 +176,20 @@ class Decoders { } + // Decoder for [Tag] + Decoders.addDecoder(clazz: [Tag].self) { (source: AnyObject) -> [Tag] in + return Decoders.decode(clazz: [Tag].self, source: source) + } + // Decoder for Tag + Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject) -> Tag in + let sourceDictionary = source as! [NSObject:AnyObject] + let instance = Tag() + instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) + instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) + return instance + } + + // Decoder for [Pet] Decoders.addDecoder(clazz: [Pet].self) { (source: AnyObject) -> [Pet] in return Decoders.decode(clazz: [Pet].self, source: source) @@ -175,38 +207,6 @@ class Decoders { return instance } - - // Decoder for [Tag] - Decoders.addDecoder(clazz: [Tag].self) { (source: AnyObject) -> [Tag] in - return Decoders.decode(clazz: [Tag].self, source: source) - } - // Decoder for Tag - Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject) -> Tag in - let sourceDictionary = source as! [NSObject:AnyObject] - let instance = Tag() - instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) - instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) - return instance - } - - - // Decoder for [Order] - Decoders.addDecoder(clazz: [Order].self) { (source: AnyObject) -> [Order] in - return Decoders.decode(clazz: [Order].self, source: source) - } - // Decoder for Order - Decoders.addDecoder(clazz: Order.self) { (source: AnyObject) -> Order in - let sourceDictionary = source as! [NSObject:AnyObject] - let instance = Order() - instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) - instance.petId = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["petId"]) - instance.quantity = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["quantity"]) - instance.shipDate = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["shipDate"]) - instance.status = Order.Status(rawValue: (sourceDictionary["status"] as? String) ?? "") - instance.complete = Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["complete"]) - return instance - } - } } } diff --git a/samples/client/petstore/swift/SwaggerClientTests/Podfile.lock b/samples/client/petstore/swift/SwaggerClientTests/Podfile.lock index 276eaa75e701..76889714e21f 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Podfile.lock +++ b/samples/client/petstore/swift/SwaggerClientTests/Podfile.lock @@ -10,17 +10,17 @@ PODS: - PetstoreClient (0.0.1): - Alamofire (~> 3.1.4) - PromiseKit (~> 3.0.0) - - PromiseKit (3.0.2): - - PromiseKit/Foundation (= 3.0.2) - - PromiseKit/QuartzCore (= 3.0.2) - - PromiseKit/UIKit (= 3.0.2) - - PromiseKit/CorePromise (3.0.2) - - PromiseKit/Foundation (3.0.2): + - PromiseKit (3.0.3): + - PromiseKit/Foundation (= 3.0.3) + - PromiseKit/QuartzCore (= 3.0.3) + - PromiseKit/UIKit (= 3.0.3) + - PromiseKit/CorePromise (3.0.3) + - PromiseKit/Foundation (3.0.3): - OMGHTTPURLRQ (~> 3.1.0) - PromiseKit/CorePromise - - PromiseKit/QuartzCore (3.0.2): + - PromiseKit/QuartzCore (3.0.3): - PromiseKit/CorePromise - - PromiseKit/UIKit (3.0.2): + - PromiseKit/UIKit (3.0.3): - PromiseKit/CorePromise DEPENDENCIES: @@ -34,6 +34,6 @@ SPEC CHECKSUMS: Alamofire: 5f730ba29fd113b7ddd71c1e65d0c630acf5d7b0 OMGHTTPURLRQ: 633f98ee745aeda02345935a52eec1784cddb589 PetstoreClient: c9a3d06cf7954479a767135676406c4922cd3c4a - PromiseKit: ab1a380f7a30cf8cce663a2411e8b3580b10313d + PromiseKit: 00ec2a219bf5ad2833f95977698e921932b8dfd3 COCOAPODS: 0.39.0 diff --git a/samples/client/petstore/swift/SwaggerClientTests/Pods/Manifest.lock b/samples/client/petstore/swift/SwaggerClientTests/Pods/Manifest.lock index 276eaa75e701..76889714e21f 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Pods/Manifest.lock +++ b/samples/client/petstore/swift/SwaggerClientTests/Pods/Manifest.lock @@ -10,17 +10,17 @@ PODS: - PetstoreClient (0.0.1): - Alamofire (~> 3.1.4) - PromiseKit (~> 3.0.0) - - PromiseKit (3.0.2): - - PromiseKit/Foundation (= 3.0.2) - - PromiseKit/QuartzCore (= 3.0.2) - - PromiseKit/UIKit (= 3.0.2) - - PromiseKit/CorePromise (3.0.2) - - PromiseKit/Foundation (3.0.2): + - PromiseKit (3.0.3): + - PromiseKit/Foundation (= 3.0.3) + - PromiseKit/QuartzCore (= 3.0.3) + - PromiseKit/UIKit (= 3.0.3) + - PromiseKit/CorePromise (3.0.3) + - PromiseKit/Foundation (3.0.3): - OMGHTTPURLRQ (~> 3.1.0) - PromiseKit/CorePromise - - PromiseKit/QuartzCore (3.0.2): + - PromiseKit/QuartzCore (3.0.3): - PromiseKit/CorePromise - - PromiseKit/UIKit (3.0.2): + - PromiseKit/UIKit (3.0.3): - PromiseKit/CorePromise DEPENDENCIES: @@ -34,6 +34,6 @@ SPEC CHECKSUMS: Alamofire: 5f730ba29fd113b7ddd71c1e65d0c630acf5d7b0 OMGHTTPURLRQ: 633f98ee745aeda02345935a52eec1784cddb589 PetstoreClient: c9a3d06cf7954479a767135676406c4922cd3c4a - PromiseKit: ab1a380f7a30cf8cce663a2411e8b3580b10313d + PromiseKit: 00ec2a219bf5ad2833f95977698e921932b8dfd3 COCOAPODS: 0.39.0 diff --git a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Categories/UIKit/UIViewController+AnyPromise.h b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Categories/UIKit/UIViewController+AnyPromise.h index 4508d0c9445f..b131488df706 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Categories/UIKit/UIViewController+AnyPromise.h +++ b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Categories/UIKit/UIViewController+AnyPromise.h @@ -51,7 +51,7 @@ } - (void)viewDidLoad { - _promise = [AnyPromise promiseWithResolver:&resolve]; + _promise = [[AnyPromise alloc] initWithResolver:&resolve]; } - (void)later { diff --git a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/README.markdown b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/README.markdown index a12107caf981..30dba5f10be1 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/README.markdown +++ b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/README.markdown @@ -45,7 +45,7 @@ If you still are using Xcode 6 and Swift 1.2 then use PromiseKit 2. # PromiseKit 2 -PromiseKit 2 contains many interesting and important additions. Check out our our [release announcement](http://promisekit.org/PromiseKit-2.0-Released/) for full details. +PromiseKit 2 contains many interesting and important additions. Check out our our [release announcement](http://promisekit.org/PromiseKit-2.0-Released) for full details. # PromiseKit 1 diff --git a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/AnyPromise.h b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/AnyPromise.h index ec224bb1208b..5a76d4d7147f 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/AnyPromise.h +++ b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/AnyPromise.h @@ -154,7 +154,7 @@ typedef NS_ENUM(NSInteger, PMKCatchPolicy) { @param block The provided block is immediately executed, inside the block call `resolve` to resolve this promise and cause any attached handlers to execute. If you are wrapping a delegate-based system, we recommend - instead to use: promiseWithResolver: + instead to use: initWithResolver: @return A new promise. @@ -173,7 +173,7 @@ typedef NS_ENUM(NSInteger, PMKCatchPolicy) { prefer resolverWithBlock: as the resulting code is more elegant. PMKResolver resolve; - AnyPromise *promise = [AnyPromise promiseWithResolver:&resolve]; + AnyPromise *promise = [[AnyPromise alloc] initWithResolver:&resolve]; // later resolve(@"foo"); @@ -216,7 +216,7 @@ typedef void (^PMKBooleanAdapter)(BOOL, NSError * __nullable); provide this convenience adapter to make wrapping such systems more elegant. - return [PMKPromise promiseWithAdapter:^(PMKAdapter adapter){ + return [PMKPromise promiseWithAdapterBlock:^(PMKAdapter adapter){ PFQuery *query = [PFQuery …]; [query findObjectsInBackgroundWithBlock:adapter]; }]; diff --git a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/AnyPromise.swift b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/AnyPromise.swift index f913c8c1d859..e672d5ecd856 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/AnyPromise.swift +++ b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/AnyPromise.swift @@ -50,6 +50,15 @@ import Foundation.NSError self.init(bound: bound.then(on: zalgo) { NSDictionary(dictionary: $0) }) } + /** + - Returns: A new AnyPromise bound to a `Promise`. + The two promises represent the same task, any changes to either will instantly reflect on both. + The value is converted to an NSString so Objective-C can use it. + */ + convenience public init(bound: Promise) { + self.init(bound: bound.then(on: zalgo) { NSString(string: $0) }) + } + /** - Returns: A new AnyPromise bound to a `Promise`. The two promises represent the same task, any changes to either will instantly reflect on both. @@ -59,6 +68,15 @@ import Foundation.NSError self.init(bound: bound.then(on: zalgo) { NSNumber(integer: $0) }) } + /** + - Returns: A new AnyPromise bound to a `Promise`. + The two promises represent the same task, any changes to either will instantly reflect on both. + The value is converted to an NSNumber so Objective-C can use it. + */ + convenience public init(bound: Promise) { + self.init(bound: bound.then(on: zalgo) { NSNumber(bool: $0) }) + } + /** - Returns: A new AnyPromise bound to a `Promise`. The two promises represent the same task, any changes to either will instantly reflect on both. diff --git a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/Promise.swift b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/Promise.swift index d7063bf9270c..a99b6977e2bb 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/Promise.swift +++ b/samples/client/petstore/swift/SwaggerClientTests/Pods/PromiseKit/Sources/Promise.swift @@ -173,6 +173,18 @@ public class Promise { } } + /** + A `typealias` for the return values of `pendingPromise()`. Simplifies declaration of properties that reference the values' containing tuple when this is necessary. For example, when working with multiple `pendingPromise()`s within the same scope, or when the promise initialization must occur outside of the caller's initialization. + + ``` + class Foo: BarDelegate { + var pendingPromise: Promise.PendingPromise? + } + ``` + - SeeAlso: pendingPromise() + */ + public typealias PendingPromise = (promise: Promise, fulfill: (T) -> Void, reject: (ErrorType) -> Void) + /** Making promises that wrap asynchronous delegation systems or other larger asynchronous systems without a simple completion handler is easier with pendingPromise. @@ -193,7 +205,7 @@ public class Promise { 2) A function that fulfills that promise 3) A function that rejects that promise */ - public class func pendingPromise() -> (promise: Promise, fulfill: (T) -> Void, reject: (ErrorType) -> Void) { + public class func pendingPromise() -> PendingPromise { var fulfill: ((T) -> Void)! var reject: ((ErrorType) -> Void)! let promise = Promise { fulfill = $0; reject = $1 } diff --git a/samples/client/petstore/swift/SwaggerClientTests/Pods/Target Support Files/PromiseKit/Info.plist b/samples/client/petstore/swift/SwaggerClientTests/Pods/Target Support Files/PromiseKit/Info.plist index 26f3ef80b787..039da19eb7c4 100644 --- a/samples/client/petstore/swift/SwaggerClientTests/Pods/Target Support Files/PromiseKit/Info.plist +++ b/samples/client/petstore/swift/SwaggerClientTests/Pods/Target Support Files/PromiseKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.0.2 + 3.0.3 CFBundleSignature ???? CFBundleVersion