Skip to content

[Swift4] fix multi thread issue #10077

Description

@fnolis
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions