swagger-api / swagger-api/swagger-codegen
[Swift4] fix multi thread issue
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The generated AlamofireImplementations.swift file has a non thread-locked dictionary to save session managers. Accessing this dictionary from multiple threads at the same times causes a crash. Not all versions of this file in the file tree has a defect implementation. Simply copy a fixed version to all non fixed versions will fix this issue.
Some implementation of this file in the Swift 5 generator also needs a fix.
Swagger-codegen version
3.0.14
Command line used for generation
swagger-codegen generate -l swift4 -DprojectName=FolderService -i swagger.json -o folder --model-name-prefix "FolderService"
Steps to reproduce
Generate swift 4 code with v 3.0.14 installed via Homebrew.
Related issues/PRs
#3873 #8583 #5610
Suggest a fix/enhancement
Copy solution from fixed implementations of the AlamofireImplementations.swift
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/swift4/AlamofireImplementations.mustache
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 modules/swagger-codegen/src/main/resources/swift4/AlamofireImplementations.mustache and compare it with the fixed implementations referenced in the issue. Check the other Swift 4 and Swift 5 generator templates that produce AlamofireImplementations.swift, then run the provided swagger-codegen command to verify generated clients no longer use the defective session-manager dictionary implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile-dev, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100