apple / swift-openapi-generator

Generate Swift client and server code from an OpenAPI document.
https://swiftpackageindex.com/apple/swift-openapi-generator/documentation
Apache License 2.0
1.21k stars 87 forks source link

Swift tools version 5.9.2 but the installed version is 5.9.0 #535

Closed CainLuo closed 1 month ago

CainLuo commented 2 months ago

Description

Running the HelloWorldVaporServer command using the commands provided in the documentation displays the following error.

swift run HelloWorldVaporServer

error: 'hello-world-vapor-server-example': package 'hello-world-vapor-server-example' is using Swift tools version 5.9.2 but the installed version is 5.9.0

Reproduction

without any input

Package version(s)

├── swift-algorithms<https://github.com/apple/swift-algorithms@1.2.0>
│   └── swift-numerics<https://github.com/apple/swift-numerics.git@1.0.2>
├── openapikit<https://github.com/mattpolzin/OpenAPIKit@3.1.3>
│   └── yams<https://github.com/jpsim/Yams@5.0.6>
├── yams<https://github.com/jpsim/Yams@5.0.6>
├── swift-argument-parser<https://github.com/apple/swift-argument-parser@1.3.0>
├── swift-openapi-runtime<https://github.com/apple/swift-openapi-runtime@1.3.2>
│   └── swift-http-types<https://github.com/apple/swift-http-types@1.0.3>
├── swift-http-types<https://github.com/apple/swift-http-types@1.0.3>
└── swift-docc-plugin<https://github.com/apple/swift-docc-plugin@1.3.0>
    └── swift-docc-symbolkit<https://github.com/apple/swift-docc-symbolkit@1.0.0>

Expected behavior

Swift support version update to 5.9.2, or come up with a solution to be compatible.

Environment

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx13.0

Additional information

My current device is MacBook Pro 16, M2 Pro, macOS 13.5.2, Xcode 15.2

simonjbeaumont commented 2 months ago

@CainLuo this appears to be Xcode that's shipped with an older SwiftPM. Thanks for providing the output of swift version; can you also provide the output of swift package --version?

IIRC we bumped the tools version in the Package.swift for these examples because to ensure we used 5.9.2 SwiftPM which had a bug fix with linking when using plugins.

If you want a solution, I imagine just changing the tools version at the top of Package.swift to 5.9.0 will work fine with your Xcode.

simonjbeaumont commented 2 months ago

@CainLuo did you get a chance to look at this yet?

simonjbeaumont commented 1 month ago

@CainLuo this should be even less of an issue now with the most recent Xcode, which shipped with Swift 5.10.

I'll close this but if you have any problems, please re-open and we'll take a look.

CainLuo commented 1 month ago

@CainLuo this should be even less of an issue now with the most recent Xcode, which shipped with Swift 5.10.

I'll close this but if you have any problems, please re-open and we'll take a look.

Hi, @simonjbeaumont I can't believe I forgot to reply to this issue because I've been so busy with work lately, I'm very sorry, after discussing with Backend, we decided to use GraphQL, I'm going to try to use swift-openapi-generator in my own project, I'll keep consulting with you guys if I have any other questions, thank you very much.