apple / apple/swift-openapi-generator

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

Open
#744 4 comments 0 reactions 0 assignees View on GitHub
kind/support status/triage
Dominant language
Swift
Stars
2k
Forks
182
Avg merge
13h 28m
Merged PRs (30d)
5

Description

### 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
```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

```yaml

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

Contributor guide

Open the contributing guide

Research direction

Start with Package.swift and the configuration YAML, comparing generation when the package is opened standalone with generation when it is added through Swift Package Manager to an Xcode project. Reproduce the missing plugin execution in Xcode and determine whether the documented package setup supports this workflow; done means code is generated automatically from the OpenAPI spec in the host project.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.