Skip to content

Commit 7a7265b

Browse files
committed
Merge pull request #2293 from Glagnar/issue-2181
Issue 2181
2 parents 336d80c + dea699f commit 7a7265b

File tree

13 files changed

+311
-188
lines changed

13 files changed

+311
-188
lines changed

modules/swagger-codegen/src/main/resources/swift/api.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public class {{classname}}: APIBase {
7676
{{#bodyParam}}
7777
let parameters = {{paramName}}{{^required}}?{{/required}}.encodeToJSON() as? [String:AnyObject]{{/bodyParam}}{{^bodyParam}}
7878
let nillableParameters: [String:AnyObject?] = {{^queryParams}}{{^formParams}}[:]{{/formParams}}{{#formParams}}{{^secondaryParam}}[{{/secondaryParam}}
79-
"{{paramName}}": {{paramName}}{{#hasMore}},{{/hasMore}}{{^hasMore}}
79+
"{{baseName}}": {{paramName}}{{#hasMore}},{{/hasMore}}{{^hasMore}}
8080
]{{/hasMore}}{{/formParams}}{{/queryParams}}{{#queryParams}}{{^secondaryParam}}[{{/secondaryParam}}
81-
"{{paramName}}": {{paramName}}{{#hasMore}},{{/hasMore}}{{^hasMore}}
81+
"{{baseName}}": {{paramName}}{{#hasMore}},{{/hasMore}}{{^hasMore}}
8282
]{{/hasMore}}{{/queryParams}}
8383
let parameters = APIHelper.rejectNil(nillableParameters){{/bodyParam}}
8484

samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public class PetAPI: APIBase {
129129

130130
Finds Pets by status
131131

132-
- parameter status: (query) Status values that need to be considered for filter
132+
- parameter status: (query) Status values that need to be considered for query
133133
- parameter completion: completion handler to receive the data and the error objects
134134
*/
135135
public class func findPetsByStatus(status status: [String]?, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
@@ -142,7 +142,7 @@ public class PetAPI: APIBase {
142142

143143
Finds Pets by status
144144

145-
- parameter status: (query) Status values that need to be considered for filter
145+
- parameter status: (query) Status values that need to be considered for query
146146
- returns: Promise<[Pet]>
147147
*/
148148
public class func findPetsByStatus(status status: [String]?) -> Promise<[Pet]> {
@@ -162,24 +162,24 @@ public class PetAPI: APIBase {
162162
Finds Pets by status
163163

164164
- GET /pet/findByStatus
165-
- Multiple status values can be provided with comma seperated strings
165+
- Multiple status values can be provided with comma separated strings
166166
- OAuth:
167167
- type: oauth2
168168
- name: petstore_auth
169-
- examples: [{example=[ {
170-
"tags" : [ {
171-
"id" : 123456789,
172-
"name" : "aeiou"
173-
} ],
169+
- examples: [{contentType=application/json, example=[ {
170+
"photoUrls" : [ "aeiou" ],
171+
"name" : "doggie",
174172
"id" : 123456789,
175173
"category" : {
176-
"id" : 123456789,
177-
"name" : "aeiou"
174+
"name" : "aeiou",
175+
"id" : 123456789
178176
},
179-
"status" : "aeiou",
180-
"name" : "doggie",
181-
"photoUrls" : [ "aeiou" ]
182-
} ], contentType=application/json}, {example=<Pet>
177+
"tags" : [ {
178+
"name" : "aeiou",
179+
"id" : 123456789
180+
} ],
181+
"status" : "aeiou"
182+
} ]}, {contentType=application/xml, example=<Pet>
183183
<id>123456</id>
184184
<name>doggie</name>
185185
<photoUrls>
@@ -188,21 +188,21 @@ public class PetAPI: APIBase {
188188
<tags>
189189
</tags>
190190
<status>string</status>
191-
</Pet>, contentType=application/xml}]
192-
- examples: [{example=[ {
193-
"tags" : [ {
194-
"id" : 123456789,
195-
"name" : "aeiou"
196-
} ],
191+
</Pet>}]
192+
- examples: [{contentType=application/json, example=[ {
193+
"photoUrls" : [ "aeiou" ],
194+
"name" : "doggie",
197195
"id" : 123456789,
198196
"category" : {
199-
"id" : 123456789,
200-
"name" : "aeiou"
197+
"name" : "aeiou",
198+
"id" : 123456789
201199
},
202-
"status" : "aeiou",
203-
"name" : "doggie",
204-
"photoUrls" : [ "aeiou" ]
205-
} ], contentType=application/json}, {example=<Pet>
200+
"tags" : [ {
201+
"name" : "aeiou",
202+
"id" : 123456789
203+
} ],
204+
"status" : "aeiou"
205+
} ]}, {contentType=application/xml, example=<Pet>
206206
<id>123456</id>
207207
<name>doggie</name>
208208
<photoUrls>
@@ -211,9 +211,9 @@ public class PetAPI: APIBase {
211211
<tags>
212212
</tags>
213213
<status>string</status>
214-
</Pet>, contentType=application/xml}]
214+
</Pet>}]
215215

216-
- parameter status: (query) Status values that need to be considered for filter
216+
- parameter status: (query) Status values that need to be considered for query
217217

218218
- returns: RequestBuilder<[Pet]>
219219
*/
@@ -272,20 +272,20 @@ public class PetAPI: APIBase {
272272
- OAuth:
273273
- type: oauth2
274274
- name: petstore_auth
275-
- examples: [{example=[ {
276-
"tags" : [ {
277-
"id" : 123456789,
278-
"name" : "aeiou"
279-
} ],
275+
- examples: [{contentType=application/json, example=[ {
276+
"photoUrls" : [ "aeiou" ],
277+
"name" : "doggie",
280278
"id" : 123456789,
281279
"category" : {
282-
"id" : 123456789,
283-
"name" : "aeiou"
280+
"name" : "aeiou",
281+
"id" : 123456789
284282
},
285-
"status" : "aeiou",
286-
"name" : "doggie",
287-
"photoUrls" : [ "aeiou" ]
288-
} ], contentType=application/json}, {example=<Pet>
283+
"tags" : [ {
284+
"name" : "aeiou",
285+
"id" : 123456789
286+
} ],
287+
"status" : "aeiou"
288+
} ]}, {contentType=application/xml, example=<Pet>
289289
<id>123456</id>
290290
<name>doggie</name>
291291
<photoUrls>
@@ -294,21 +294,21 @@ public class PetAPI: APIBase {
294294
<tags>
295295
</tags>
296296
<status>string</status>
297-
</Pet>, contentType=application/xml}]
298-
- examples: [{example=[ {
299-
"tags" : [ {
300-
"id" : 123456789,
301-
"name" : "aeiou"
302-
} ],
297+
</Pet>}]
298+
- examples: [{contentType=application/json, example=[ {
299+
"photoUrls" : [ "aeiou" ],
300+
"name" : "doggie",
303301
"id" : 123456789,
304302
"category" : {
305-
"id" : 123456789,
306-
"name" : "aeiou"
303+
"name" : "aeiou",
304+
"id" : 123456789
307305
},
308-
"status" : "aeiou",
309-
"name" : "doggie",
310-
"photoUrls" : [ "aeiou" ]
311-
} ], contentType=application/json}, {example=<Pet>
306+
"tags" : [ {
307+
"name" : "aeiou",
308+
"id" : 123456789
309+
} ],
310+
"status" : "aeiou"
311+
} ]}, {contentType=application/xml, example=<Pet>
312312
<id>123456</id>
313313
<name>doggie</name>
314314
<photoUrls>
@@ -317,7 +317,7 @@ public class PetAPI: APIBase {
317317
<tags>
318318
</tags>
319319
<status>string</status>
320-
</Pet>, contentType=application/xml}]
320+
</Pet>}]
321321

322322
- parameter tags: (query) Tags to filter by
323323

@@ -375,26 +375,26 @@ public class PetAPI: APIBase {
375375

376376
- GET /pet/{petId}
377377
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
378-
- API Key:
379-
- type: apiKey api_key
380-
- name: api_key
381378
- OAuth:
382379
- type: oauth2
383380
- name: petstore_auth
384-
- examples: [{example={
385-
"tags" : [ {
386-
"id" : 123456789,
387-
"name" : "aeiou"
388-
} ],
381+
- API Key:
382+
- type: apiKey api_key
383+
- name: api_key
384+
- examples: [{contentType=application/json, example={
385+
"photoUrls" : [ "aeiou" ],
386+
"name" : "doggie",
389387
"id" : 123456789,
390388
"category" : {
391-
"id" : 123456789,
392-
"name" : "aeiou"
389+
"name" : "aeiou",
390+
"id" : 123456789
393391
},
394-
"status" : "aeiou",
395-
"name" : "doggie",
396-
"photoUrls" : [ "aeiou" ]
397-
}, contentType=application/json}, {example=<Pet>
392+
"tags" : [ {
393+
"name" : "aeiou",
394+
"id" : 123456789
395+
} ],
396+
"status" : "aeiou"
397+
}}, {contentType=application/xml, example=<Pet>
398398
<id>123456</id>
399399
<name>doggie</name>
400400
<photoUrls>
@@ -403,21 +403,21 @@ public class PetAPI: APIBase {
403403
<tags>
404404
</tags>
405405
<status>string</status>
406-
</Pet>, contentType=application/xml}]
407-
- examples: [{example={
408-
"tags" : [ {
409-
"id" : 123456789,
410-
"name" : "aeiou"
411-
} ],
406+
</Pet>}]
407+
- examples: [{contentType=application/json, example={
408+
"photoUrls" : [ "aeiou" ],
409+
"name" : "doggie",
412410
"id" : 123456789,
413411
"category" : {
414-
"id" : 123456789,
415-
"name" : "aeiou"
412+
"name" : "aeiou",
413+
"id" : 123456789
416414
},
417-
"status" : "aeiou",
418-
"name" : "doggie",
419-
"photoUrls" : [ "aeiou" ]
420-
}, contentType=application/json}, {example=<Pet>
415+
"tags" : [ {
416+
"name" : "aeiou",
417+
"id" : 123456789
418+
} ],
419+
"status" : "aeiou"
420+
}}, {contentType=application/xml, example=<Pet>
421421
<id>123456</id>
422422
<name>doggie</name>
423423
<photoUrls>
@@ -426,7 +426,7 @@ public class PetAPI: APIBase {
426426
<tags>
427427
</tags>
428428
<status>string</status>
429-
</Pet>, contentType=application/xml}]
429+
</Pet>}]
430430

431431
- parameter petId: (path) ID of pet that needs to be fetched
432432

@@ -578,11 +578,11 @@ public class PetAPI: APIBase {
578578

579579
- parameter petId: (path) ID of pet to update
580580
- parameter additionalMetadata: (form) Additional data to pass to server
581-
- parameter file: (form) file to upload
581+
- parameter _file: (form) file to upload
582582
- parameter completion: completion handler to receive the data and the error objects
583583
*/
584-
public class func uploadFile(petId petId: Int, additionalMetadata: String?, file: NSURL?, completion: ((error: ErrorType?) -> Void)) {
585-
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { (response, error) -> Void in
584+
public class func uploadFile(petId petId: Int, additionalMetadata: String?, _file: NSURL?, completion: ((error: ErrorType?) -> Void)) {
585+
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, _file: _file).execute { (response, error) -> Void in
586586
completion(error: error);
587587
}
588588
}
@@ -593,12 +593,12 @@ public class PetAPI: APIBase {
593593

594594
- parameter petId: (path) ID of pet to update
595595
- parameter additionalMetadata: (form) Additional data to pass to server
596-
- parameter file: (form) file to upload
596+
- parameter _file: (form) file to upload
597597
- returns: Promise<Void>
598598
*/
599-
public class func uploadFile(petId petId: Int, additionalMetadata: String?, file: NSURL?) -> Promise<Void> {
599+
public class func uploadFile(petId petId: Int, additionalMetadata: String?, _file: NSURL?) -> Promise<Void> {
600600
let deferred = Promise<Void>.pendingPromise()
601-
uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { error in
601+
uploadFile(petId: petId, additionalMetadata: additionalMetadata, _file: _file) { error in
602602
if let error = error {
603603
deferred.reject(error)
604604
} else {
@@ -620,18 +620,18 @@ public class PetAPI: APIBase {
620620

621621
- parameter petId: (path) ID of pet to update
622622
- parameter additionalMetadata: (form) Additional data to pass to server
623-
- parameter file: (form) file to upload
623+
- parameter _file: (form) file to upload
624624

625625
- returns: RequestBuilder<Void>
626626
*/
627-
public class func uploadFileWithRequestBuilder(petId petId: Int, additionalMetadata: String?, file: NSURL?) -> RequestBuilder<Void> {
627+
public class func uploadFileWithRequestBuilder(petId petId: Int, additionalMetadata: String?, _file: NSURL?) -> RequestBuilder<Void> {
628628
var path = "/pet/{petId}/uploadImage"
629629
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
630630
let URLString = PetstoreClientAPI.basePath + path
631631

632632
let nillableParameters: [String:AnyObject?] = [
633633
"additionalMetadata": additionalMetadata,
634-
"file": file
634+
"file": _file
635635
]
636636
let parameters = APIHelper.rejectNil(nillableParameters)
637637

@@ -678,14 +678,14 @@ public class PetAPI: APIBase {
678678

679679
- GET /pet/{petId}?testing_byte_array=true
680680
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
681-
- API Key:
682-
- type: apiKey api_key
683-
- name: api_key
684681
- OAuth:
685682
- type: oauth2
686683
- name: petstore_auth
687-
- examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}]
688-
- examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}]
684+
- API Key:
685+
- type: apiKey api_key
686+
- name: api_key
687+
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}]
688+
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}]
689689

690690
- parameter petId: (path) ID of pet that needs to be fetched
691691

0 commit comments

Comments
 (0)