Fix (partially) #4898 for swift3 (#4916)

* fix (partially) #4898 for swift3.

* Update petstore samples for swift3 (after fix for #4898)
This commit is contained in:
Paŭlo Ebermann
2017-03-07 10:28:08 +01:00
committed by wing328
parent 0f88e4a721
commit 404a9999a7
10 changed files with 104 additions and 104 deletions

View File

@@ -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]

View File

@@ -134,14 +134,14 @@ open class PetAPI: APIBase {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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"
}}]

View File

@@ -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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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"

View File

@@ -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"
}}]

View File

@@ -187,14 +187,14 @@ open class PetAPI: APIBase {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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"
}}]

View File

@@ -160,9 +160,9 @@ open class StoreAPI: APIBase {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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"

View File

@@ -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"
}}]

View File

@@ -193,14 +193,14 @@ open class PetAPI: APIBase {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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 {
</Pet>}, {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"
}}]

View File

@@ -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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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 {
<status>aeiou</status>
<complete>true</complete>
</Order>}, {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"

View File

@@ -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"
}}]