Skip to content

Swift Package does not generate code when added via Swift Package Manager to Xcode Project #744

Open
@TheCoderateKid

Description

@TheCoderateKid

Question

So I can run and generate the code when i have the swift package opened as a stand alone. My goal is to have just the open api spec and the required configuration file committed and have the code auto generated when it is added as a package to the main app project via swift package manager. is this possible?? currently it is not running at all

Package.swift

import PackageDescription

let package = Package(
    name: "ClientLibrary",
    platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1)],
    dependencies: [
        .package(url: "https://github.com/apple/swift-openapi-generator", from: "1.6.0"),
        .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.7.0"),
        .package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),
    ],
    targets: [
        .executableTarget(
            name: "ClientLibrary",
            dependencies: [
                .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
                .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
            ],
            plugins: [
                .plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"),
            ]
        )
    ]
)

configuration yaml

generate:
  - types
  - client
accessModifier: package
namingStrategy: idiomatic

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/supportAdopter support requests.status/triageCollecting information required to triage the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions