mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
Merge branch 'patch-2' of https://github.com/JMDHo/swagger-codegen into JMDHo-patch-2
This commit is contained in:
commit
a466844063
@ -18,4 +18,22 @@ class APIHelper {
|
||||
}
|
||||
return destination
|
||||
}
|
||||
|
||||
static func convertBoolToString(source: [String: AnyObject]?) -> [String:AnyObject] {
|
||||
var destination = [String:AnyObject]()
|
||||
let theTrue = NSNumber(bool: true)
|
||||
let theFalse = NSNumber(bool: false)
|
||||
if (source != nil) {
|
||||
for (key, value) in source! {
|
||||
switch value {
|
||||
case let x where x === theTrue || x === theFalse:
|
||||
destination[key] = "\(value as! Bool)"
|
||||
default:
|
||||
destination[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
return destination
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,11 +80,14 @@ public class {{classname}}: APIBase {
|
||||
]{{/hasMore}}{{/formParams}}{{/queryParams}}{{#queryParams}}{{^secondaryParam}}[{{/secondaryParam}}
|
||||
"{{baseName}}": {{paramName}}{{#isInteger}}{{^required}}?{{/required}}.encodeToJSON(){{/isInteger}}{{#isLong}}{{^required}}?{{/required}}.encodeToJSON(){{/isLong}}{{#hasMore}},{{/hasMore}}{{^hasMore}}
|
||||
]{{/hasMore}}{{/queryParams}}
|
||||
|
||||
let parameters = APIHelper.rejectNil(nillableParameters){{/bodyParam}}
|
||||
|
||||
|
||||
let convertedParameters = APIHelper.convertBoolToString(parameters)
|
||||
|
||||
let requestBuilder: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.Type = {{projectName}}API.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "{{httpMethod}}", URLString: URLString, parameters: parameters, isBody: {{^queryParams}}{{^formParams}}true{{/formParams}}{{/queryParams}}{{#queryParams}}{{^secondaryParam}}false{{/secondaryParam}}{{/queryParams}}{{#formParams}}{{^secondaryParam}}false{{/secondaryParam}}{{/formParams}})
|
||||
return requestBuilder.init(method: "{{httpMethod}}", URLString: URLString, parameters: convertedParameters, isBody: {{^queryParams}}{{^formParams}}true{{/formParams}}{{/queryParams}}{{#queryParams}}{{^secondaryParam}}false{{/secondaryParam}}{{/queryParams}}{{#formParams}}{{^secondaryParam}}false{{/secondaryParam}}{{/formParams}})
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
Loading…
Reference in New Issue
Block a user