I fixed UploadFile type to confirm Codable to upload binary data either a reference of model or binary data as string a.k.a a primitive type.
This changes allows to upload following model that could not be uploaded because of UploadFile can't be encode or decode when UploadFile is contained in user defined models.
This model is converted to this code and swift complier could not build as following error.
Trade-off
When generating specs with --option typeAliases.File:UploadFile, TestSpec could not be build because of the error below.
SwagGen/Specs/TestSpec/generated/Swift/Sources/Requests/GetFile.swift:52:49: error: cannot convert value of type 'Data' to expected argument type 'File' (aka 'UploadFile')
case 200: self = try .status200(data)
^
To overcome this issue, we have to define public typealias File that responds to request body or response.
If there any concerns, please let me know freely :)
Motivation
I fixed
UploadFile
type to confirmCodable
to upload binary data either a reference of model or binary data as string a.k.a a primitive type. This changes allows to upload following model that could not be uploaded because ofUploadFile
can't be encode or decode whenUploadFile
is contained in user defined models.I uploaded a minimal, reproducible example here.
This model is converted to this code and swift complier could not build as following error.
Trade-off
When generating specs with
--option typeAliases.File:UploadFile
,TestSpec
could not be build because of the error below.To overcome this issue, we have to define
public typealias File
that responds to request body or response.If there any concerns, please let me know freely :)