mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
* Add a swift4 client generator * Updates per review comments: - Changed Alamofire dependency from 4.0 to 4.5 - Added "Codable", "Encodable", and "Decodable" to list of reserved words in generator - Ran "pod update" in default, promisekit, and rxswift samples test projects
28 lines
692 B
Plaintext
28 lines
692 B
Plaintext
//
|
|
// JSONEncodingHelper.swift
|
|
//
|
|
// Generated by swagger-codegen
|
|
// https://github.com/swagger-api/swagger-codegen
|
|
//
|
|
|
|
import Foundation
|
|
import Alamofire
|
|
|
|
open class JSONEncodingHelper {
|
|
|
|
open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> Parameters? {
|
|
var params: Parameters? = nil
|
|
|
|
// Encode the Encodable object
|
|
if let encodableObj = encodableObj {
|
|
let encodeResult = CodableHelper.encode(encodableObj, prettyPrint: true)
|
|
if encodeResult.error == nil {
|
|
params = JSONDataEncoding.encodingParameters(jsonData: encodeResult.data)
|
|
}
|
|
}
|
|
|
|
return params
|
|
}
|
|
|
|
}
|