Open
Description
Description
The generation of the Swift-3 client produces wrong code, when it comes to generating a call that has a parameter which is of integer (or more generally raw-type).
Swagger-codegen version
reproduced with both
- https://editor.swagger.io/
- latest editor from github
Swagger declaration file content or url
/users/cards:
delete:
description: Delete a card from a user
produces:
- application/json
parameters:
- in: body
name: cardSlot
description: the card that will be deleted
required: true
schema:
type: integer
format: int32
responses:
'200':
description: Success
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Generated code looks like this:
DefaultAPI.swift:
open class func usersCardsDeleteWithRequestBuilder(cardSlot: Int32) -> RequestBuilder<Void> {
let path = "/users/cards"
let URLString = SwaggerClientAPI.basePath + path
let parameters = cardSlot.encodeToJSON() as? [String:AnyObject] //-> this will fail and result in nil because of:
Extensions.swift:
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
why should the parameter be always a dictionary?
As a workaround, I will change my yaml, to contain an object.. but I think the above case should be supported as well.
Metadata
Metadata
Assignees
Labels
No labels