OpenAPIGenerator package requirements have a dependency that causes errors

Trying to utilize the new OpenAPI Generator, but after following all of the steps exactly as stated in the video, I get the following errors:

- The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0

- The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0

- The package product 'SwiftFormat' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0

- The package product 'SwiftFormatConfiguration' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0

under both _OpenAPIGeneratorCore and swift-openapi-generator

I've seen other things online where people have had similar issues, but the fixes haven't been particularly relevant that I could tell.

Answered by Developer Tools Engineer in 756684022

This is likely because you're linking the generator target itself to the iOS app, which is not supported. See Step 7 of https://swiftpackageindex.com/apple/swift-openapi-generator/0.1.3/tutorials/swift-openapi-generator/clientxcode#Configuring-your-target-to-use-the-Swift-OpenAPI-Generator-plugin, which clarifies that the checkboxes to link the generator targets (_OpenAPIGeneratorCore and swift-openapi-generator) should not be linked directly, they're only meant to be used through the plugin.

Only the OpenAPIRuntime and any transport libraries are meant to be linked to your app.

Here is an issue tracking improving the errors when this happens: https://github.com/apple/swift-openapi-generator/pull/87

A way to fix it is: in Xcode, go to the Project Editor -> select your app target -> go to Build Phases -> expand Link Binary with Libraries, and remove _OpenAPIGeneratorCore and swift-openapi-generator. Then try to build again.

Are you actually trying to build code that supports all the way back to iOS 12?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I should also clarify that the only dependencies I'm currently using are those recommended in the video, namely:

so I suspect that one of the dependencies loaded by these are the culprit, but I can't tell which one or how I would fix that even if/when I do find it.

Is your final product a package built with Swift package manager? Or are you trying to use the OpenAPI stuff from an Xcode project?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

This is likely because you're linking the generator target itself to the iOS app, which is not supported. See Step 7 of https://swiftpackageindex.com/apple/swift-openapi-generator/0.1.3/tutorials/swift-openapi-generator/clientxcode#Configuring-your-target-to-use-the-Swift-OpenAPI-Generator-plugin, which clarifies that the checkboxes to link the generator targets (_OpenAPIGeneratorCore and swift-openapi-generator) should not be linked directly, they're only meant to be used through the plugin.

Only the OpenAPIRuntime and any transport libraries are meant to be linked to your app.

Here is an issue tracking improving the errors when this happens: https://github.com/apple/swift-openapi-generator/pull/87

A way to fix it is: in Xcode, go to the Project Editor -> select your app target -> go to Build Phases -> expand Link Binary with Libraries, and remove _OpenAPIGeneratorCore and swift-openapi-generator. Then try to build again.

OpenAPIGenerator package requirements have a dependency that causes errors
 
 
Q