swagger-api / swagger-api/swagger-codegen
[SWIFT] Alamofire Serialization on another queue than main
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
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
- Generate Swift code from Swagger spec.
- Serialize big amounts of data
- Main thread is being blocked
Suggest a fix/enhancement
Make it possible to generate AlamofireDecodableRequestBuilder with a specific queue which the serialization should happen on.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated Swift AlamofireDecodableRequestBuilder and its processRequest method, then compare the requested behavior with Alamofire's response-mapping documentation. The change is done when generated clients can specify a queue for response serialization so large responses do not block the main thread; no test file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100