You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing a issue while POST and PUT requests. By default Swagger expects a body as dictionary type. I have requests where i have to send json array, String etc. For example this is one sample method which got created while generating
open class func FunctionName(lbid: Int64, lasid: Int64, luid: Int64, lcasid: Int64? = nil, lupid: Int64? = nil, ptype: String? = nil, cform: Bool? = nil, csform: Bool? = nil, body: [SomeModel]? = nil) -> RequestBuilder<SomeResponseObject> {
let path = "<some path>"
let URLString = SwaggerClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject] -----> This line has a problem
let convertedParameters = APIHelper.convertBoolToString(parameters)
let requestBuilder: RequestBuilder<SomeResponseObject>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "POST", URLString: URLString, parameters: convertedParameters, isBody: false)
}
When encodeToJson() method is called it is expecting result to be of dictionary type but I had to pass array here as seen in method signature. When i send array, String parameters is becoming nil. How can i send array without disturbing Swagger code(because new methods will be added and I don't want to change everytime I generate Swagger code). Can I somehow pass my request object directly which will avoid this situation?
The text was updated successfully, but these errors were encountered:
I am facing a issue while POST and PUT requests. By default Swagger expects a body as dictionary type. I have requests where i have to send json array, String etc. For example this is one sample method which got created while generating
When encodeToJson() method is called it is expecting result to be of dictionary type but I had to pass array here as seen in method signature. When i send array, String parameters is becoming nil. How can i send array without disturbing Swagger code(because new methods will be added and I don't want to change everytime I generate Swagger code). Can I somehow pass my request object directly which will avoid this situation?
The text was updated successfully, but these errors were encountered: