From 404a9999a7cccbd565ed9173da19986ce5258db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Tue, 7 Mar 2017 10:28:08 +0100 Subject: [PATCH] Fix (partially) #4898 for swift3 (#4916) * fix (partially) #4898 for swift3. * Update petstore samples for swift3 (after fix for #4898) --- .../src/main/resources/swift3/api.mustache | 2 +- .../Classes/Swaggers/APIs/PetAPI.swift | 38 +++++++++---------- .../Classes/Swaggers/APIs/StoreAPI.swift | 26 ++++++------- .../Classes/Swaggers/APIs/UserAPI.swift | 8 ++-- .../Classes/Swaggers/APIs/PetAPI.swift | 38 +++++++++---------- .../Classes/Swaggers/APIs/StoreAPI.swift | 24 ++++++------ .../Classes/Swaggers/APIs/UserAPI.swift | 8 ++-- .../Classes/Swaggers/APIs/PetAPI.swift | 38 +++++++++---------- .../Classes/Swaggers/APIs/StoreAPI.swift | 22 +++++------ .../Classes/Swaggers/APIs/UserAPI.swift | 4 +- 10 files changed, 104 insertions(+), 104 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/swift3/api.mustache b/modules/swagger-codegen/src/main/resources/swift3/api.mustache index 817560299521..89768cd5832f 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/api.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/api.mustache @@ -105,7 +105,7 @@ open class {{classname}}: APIBase { */ open class func {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{path}}"{{#pathParams}} - path = path.replacingOccurrences(of: "{{=<% %>=}}{<%paramName%>}<%={{ }}=%>", with: "\({{paramName}}{{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}})", options: .literal, range: nil){{/pathParams}} + path = path.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: "\({{paramName}}{{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}})", options: .literal, range: nil){{/pathParams}} let URLString = {{projectName}}API.basePath + path {{#bodyParam}} let parameters = {{paramName}}{{^required}}?{{/required}}.encodeToJSON() as? [String:AnyObject] diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 6c9db5c937cc..852c37fae465 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -134,14 +134,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 4, + "id" : 7, "category" : { "name" : "aeiou", - "id" : 5 + "id" : 4 }, "tags" : [ { "name" : "aeiou", - "id" : 6 + "id" : 5 } ], "status" : "available" } ]}] @@ -157,14 +157,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 4, + "id" : 7, "category" : { "name" : "aeiou", - "id" : 5 + "id" : 4 }, "tags" : [ { "name" : "aeiou", - "id" : 6 + "id" : 5 } ], "status" : "available" } ]}] @@ -221,14 +221,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 2, + "id" : 3, "category" : { "name" : "aeiou", - "id" : 5 + "id" : 2 }, "tags" : [ { "name" : "aeiou", - "id" : 6 + "id" : 9 } ], "status" : "available" } ]}] @@ -244,14 +244,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 2, + "id" : 3, "category" : { "name" : "aeiou", - "id" : 5 + "id" : 2 }, "tags" : [ { "name" : "aeiou", - "id" : 6 + "id" : 9 } ], "status" : "available" } ]}] @@ -308,14 +308,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example={ "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 0, + "id" : 8, "category" : { "name" : "aeiou", - "id" : 5 + "id" : 2 }, "tags" : [ { "name" : "aeiou", - "id" : 3 + "id" : 8 } ], "status" : "available" }}] @@ -331,14 +331,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example={ "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 0, + "id" : 8, "category" : { "name" : "aeiou", - "id" : 5 + "id" : 2 }, "tags" : [ { "name" : "aeiou", - "id" : 3 + "id" : 8 } ], "status" : "available" }}] @@ -471,7 +471,7 @@ open class PetAPI: APIBase { - type: oauth2 - name: petstore_auth - examples: [{contentType=application/json, example={ - "code" : 4, + "code" : 9, "type" : "aeiou", "message" : "aeiou" }}] diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index b879d5066d63..f68aa46de596 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -66,7 +66,7 @@ open class StoreAPI: APIBase { - type: apiKey api_key - name: api_key - examples: [{contentType=application/json, example={ - "key" : 7 + "key" : 5 }}] - returns: RequestBuilder<[String:Int32]> @@ -109,9 +109,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 1, - "quantity" : 7, - "id" : 5, + "petId" : 8, + "quantity" : 9, + "id" : 0, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -124,9 +124,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 1, - "quantity" : 7, - "id" : 5, + "petId" : 8, + "quantity" : 9, + "id" : 0, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -175,9 +175,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 3, - "quantity" : 1, - "id" : 9, + "petId" : 6, + "quantity" : 6, + "id" : 7, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -190,9 +190,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 3, - "quantity" : 1, - "id" : 9, + "petId" : 6, + "quantity" : 6, + "id" : 7, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 8ed4814cad91..772baa19fe0f 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -181,9 +181,9 @@ open class UserAPI: APIBase { "firstName" : "aeiou", "lastName" : "aeiou", "password" : "aeiou", - "userStatus" : 0, + "userStatus" : 8, "phone" : "aeiou", - "id" : 7, + "id" : 6, "email" : "aeiou", "username" : "aeiou" }}] @@ -200,9 +200,9 @@ open class UserAPI: APIBase { "firstName" : "aeiou", "lastName" : "aeiou", "password" : "aeiou", - "userStatus" : 0, + "userStatus" : 8, "phone" : "aeiou", - "id" : 7, + "id" : 6, "email" : "aeiou", "username" : "aeiou" }}] diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 4368f4954f13..b35c0c7b4764 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -187,14 +187,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 1, + "id" : 5, "category" : { "name" : "aeiou", - "id" : 0 + "id" : 5 }, "tags" : [ { "name" : "aeiou", - "id" : 2 + "id" : 4 } ], "status" : "available" } ]}] @@ -210,14 +210,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 1, + "id" : 5, "category" : { "name" : "aeiou", - "id" : 0 + "id" : 5 }, "tags" : [ { "name" : "aeiou", - "id" : 2 + "id" : 4 } ], "status" : "available" } ]}] @@ -291,14 +291,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 4, + "id" : 0, "category" : { "name" : "aeiou", - "id" : 9 + "id" : 3 }, "tags" : [ { "name" : "aeiou", - "id" : 3 + "id" : 8 } ], "status" : "available" } ]}] @@ -314,14 +314,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 4, + "id" : 0, "category" : { "name" : "aeiou", - "id" : 9 + "id" : 3 }, "tags" : [ { "name" : "aeiou", - "id" : 3 + "id" : 8 } ], "status" : "available" } ]}] @@ -395,14 +395,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example={ "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 8, + "id" : 0, "category" : { "name" : "aeiou", - "id" : 5 + "id" : 8 }, "tags" : [ { "name" : "aeiou", - "id" : 4 + "id" : 7 } ], "status" : "available" }}] @@ -418,14 +418,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example={ "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 8, + "id" : 0, "category" : { "name" : "aeiou", - "id" : 5 + "id" : 8 }, "tags" : [ { "name" : "aeiou", - "id" : 4 + "id" : 7 } ], "status" : "available" }}] @@ -613,7 +613,7 @@ open class PetAPI: APIBase { - type: oauth2 - name: petstore_auth - examples: [{contentType=application/json, example={ - "code" : 0, + "code" : 7, "type" : "aeiou", "message" : "aeiou" }}] diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index ee9734a9d682..ca6f1f49df91 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -160,9 +160,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 2, - "quantity" : 9, - "id" : 4, + "petId" : 6, + "quantity" : 5, + "id" : 0, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -175,9 +175,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 2, - "quantity" : 9, - "id" : 4, + "petId" : 6, + "quantity" : 5, + "id" : 0, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -243,9 +243,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 8, - "quantity" : 2, - "id" : 0, + "petId" : 9, + "quantity" : 9, + "id" : 3, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -258,9 +258,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 8, - "quantity" : 2, - "id" : 0, + "petId" : 9, + "quantity" : 9, + "id" : 3, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 4a2302894850..d28bec41e388 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -267,9 +267,9 @@ open class UserAPI: APIBase { "firstName" : "aeiou", "lastName" : "aeiou", "password" : "aeiou", - "userStatus" : 9, + "userStatus" : 5, "phone" : "aeiou", - "id" : 9, + "id" : 0, "email" : "aeiou", "username" : "aeiou" }}] @@ -286,9 +286,9 @@ open class UserAPI: APIBase { "firstName" : "aeiou", "lastName" : "aeiou", "password" : "aeiou", - "userStatus" : 9, + "userStatus" : 5, "phone" : "aeiou", - "id" : 9, + "id" : 0, "email" : "aeiou", "username" : "aeiou" }}] diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 540fe41b57ce..84a61915862d 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -193,14 +193,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 2, + "id" : 6, "category" : { "name" : "aeiou", - "id" : 2 + "id" : 6 }, "tags" : [ { "name" : "aeiou", - "id" : 0 + "id" : 1 } ], "status" : "available" } ]}] @@ -216,14 +216,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 2, + "id" : 6, "category" : { "name" : "aeiou", - "id" : 2 + "id" : 6 }, "tags" : [ { "name" : "aeiou", - "id" : 0 + "id" : 1 } ], "status" : "available" } ]}] @@ -299,14 +299,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 4, + "id" : 2, "category" : { "name" : "aeiou", - "id" : 0 + "id" : 1 }, "tags" : [ { "name" : "aeiou", - "id" : 3 + "id" : 2 } ], "status" : "available" } ]}] @@ -322,14 +322,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 4, + "id" : 2, "category" : { "name" : "aeiou", - "id" : 0 + "id" : 1 }, "tags" : [ { "name" : "aeiou", - "id" : 3 + "id" : 2 } ], "status" : "available" } ]}] @@ -405,14 +405,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example={ "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 1, + "id" : 8, "category" : { "name" : "aeiou", - "id" : 1 + "id" : 7 }, "tags" : [ { "name" : "aeiou", - "id" : 2 + "id" : 7 } ], "status" : "available" }}] @@ -428,14 +428,14 @@ open class PetAPI: APIBase { }, {contentType=application/json, example={ "photoUrls" : [ "aeiou" ], "name" : "doggie", - "id" : 1, + "id" : 8, "category" : { "name" : "aeiou", - "id" : 1 + "id" : 7 }, "tags" : [ { "name" : "aeiou", - "id" : 2 + "id" : 7 } ], "status" : "available" }}] @@ -629,7 +629,7 @@ open class PetAPI: APIBase { - type: oauth2 - name: petstore_auth - examples: [{contentType=application/json, example={ - "code" : 1, + "code" : 9, "type" : "aeiou", "message" : "aeiou" }}] diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 6414443125d7..c21a0be53d56 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -104,7 +104,7 @@ open class StoreAPI: APIBase { - type: apiKey api_key - name: api_key - examples: [{contentType=application/json, example={ - "key" : 7 + "key" : 9 }}] - returns: RequestBuilder<[String:Int32]> @@ -166,9 +166,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 6, + "petId" : 0, "quantity" : 0, - "id" : 5, + "id" : 2, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -181,9 +181,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 6, + "petId" : 0, "quantity" : 0, - "id" : 5, + "id" : 2, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -251,9 +251,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 3, - "quantity" : 8, - "id" : 8, + "petId" : 4, + "quantity" : 3, + "id" : 0, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" @@ -266,9 +266,9 @@ open class StoreAPI: APIBase { aeiou true }, {contentType=application/json, example={ - "petId" : 3, - "quantity" : 8, - "id" : 8, + "petId" : 4, + "quantity" : 3, + "id" : 0, "shipDate" : "2000-01-23T04:56:07.000+00:00", "complete" : false, "status" : "placed" diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 9a5081f2f518..bd784dcce0d4 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -279,7 +279,7 @@ open class UserAPI: APIBase { "password" : "aeiou", "userStatus" : 2, "phone" : "aeiou", - "id" : 4, + "id" : 7, "email" : "aeiou", "username" : "aeiou" }}] @@ -298,7 +298,7 @@ open class UserAPI: APIBase { "password" : "aeiou", "userStatus" : 2, "phone" : "aeiou", - "id" : 4, + "id" : 7, "email" : "aeiou", "username" : "aeiou" }}]