Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7728
Closed
Open
Issue created Oct 15, 2020 by Administrator@rootContributor

[BUG][SWIFT5] Swift5 generator sets wrong platforms requirement in Package.swift

Created by: deniskr

Description

Swift5 generates Package.swift a manifest file for Swift Package Manger. The manifest file contains a platforms directive that specifies the minimum iOS, macOS, tvOS, watchOS SDK version required to compile the generaged sources. Swift5 generator config options include a responseAs configuration that specifies what libraries the generated code should use. When responseAs is set to Combine, the generated code will use the Combine Framework, which is available on iOS 13, tvOS 13, macOS 10.15, watchOS 6 and above. The platforms directive in the Package.swift file does not reflect this requirement.

Expected Package.swift:
platforms: [
        .iOS(.v13),
        .macOS(.v10_11),
        .tvOS(.v9),
        .watchOS(.v3)
    ],
Actual Package.swift:
platforms: [
        .iOS(.v9),
        .macOS(.v10_11),
        .tvOS(.v9),
        .watchOS(.v3)
    ],
openapi-generator version

4.3.1

OpenAPI declaration file content or url

Gradle.build.kts:

openApiGenerate {
    validateSpec.set(true)
    generatorName.set("swift5")
    outputDir.set(openApiOutputDir.toString())
    inputSpec.set(file("openapi.yaml").toString())
    configOptions.set(mapOf(
            "nonPublicApi" to "false",
            "responseAs" to "Combine",
            "projectName" to "SpeedtestPlus",
            "swiftUseApiNamespace" to "false"
    ))
}
Steps to reproduce

Create a Gradle build file with the above configuration, use any openapi.yaml, and generate.

Suggest a fix

When responseAs is set to Combine, the platforms directive in Package.swift should be as follows:

platforms: [
        .iOS(.v13),
        .macOS(.v10_15),
        .tvOS(.v13),
        .watchOS(.v6)
    ],
Assignee
Assign to
Time tracking