Open ghost opened 6 years ago
I solved the problem by creating a AlamofireImplementations.mustache
template with a queue specified. But should there be another way to do this?
Hey there @afetrifork do you have a PR for this yet? My idea would be to pass in a queue object into the AlamofireRequestBuilder execute()
and processRequest()
methods.
Then swagger user could use their own requestBuilderFactory
which overrides execute()
to specify the queue.
I didn't create a PR for this, but I fixed the issue by creating a custom AlamofireImplementations template. I think it would be a good idea to allow passing in a queue
Description
There is a problem in the
AlamofireDecodableRequestBuilder
class or maybe rather a lack of way to make serialization of responses run on another queue than the main queue.In the
processRequest
method there is multiple cases on how to handle the response based on the data type. In Alamofire it is possible to pass a queue to run the serialization on. With large amounts of data this is causing the main thread to be blocked (locking up the user interface).Docs on how to do it in Alamofire:
https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#response-mapping
Swagger-codegen version
2.3.1
Command line used for generation
java -jar $jar_codegen_file generate -i $json_spec_file -o . -l swift4 --additional-properties responseAs=RxSwift --additional-properties unwrapRequired=true
Steps to reproduce
Suggest a fix/enhancement
Make it possible to generate
AlamofireDecodableRequestBuilder
with a specific queue which the serialization should happen on.