Comments (14)
the current error is your second one, about swift-format mismatch, I think it's related to
I'm on Ventura, so I can't run Xcode13, I've tried to use the
lib_InternalSwiftSyntaxParser.dylib
from xcode13, but that didn't helped :(
@wambambizzle as per that screenshot, I've built library locally using latest main
branch, which worked (instead of trying to match exact versions)
@maticzav this might be a viable solution, maybe you'd like me to create pull request?
from swift-graphql.
@wambambizzle, @nrudnyk , @maticzav:
same unpleasing experience for us
- Xcode 14.0.1
- swift tools version 5.7
- swift-graphql 4.0.0
the described and reproducible issue reported by @nrudnyk regarding code generation seems to be caused by the hard swift-format dependency within the Package.swift
dependencies: [
// .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-format", from: "0.50600.1"),
// ...
As the dev team from swift-format
points out here (see screenshot from @nrudnyk above) this specific version is bind to Xcode 13.3 and swift tools version 5.6.
Current workaround
Therefore my current workaround which does the trick has been the following so far:
- clone the swift-graphql repository
- modify the Package.swift file in line 28 to
.package(url: "https://github.com/apple/swift-format", branch: "main"),
- build the swift-graphql executable via
make install
- copy the executable from
.build/release/swift-graphql
to our current project - run e.g. `swift-graphql <your.respective.url>/graphql --output ./Sources/Generated/API.swift --header "Authorization: Basic AXVubzpwQDU1dzByYM=="
- Voila 🎉 smooth sailing
Generating SwiftGraphQL Selection 🚀
Adding headers to your request:
- Authorization: Basic AXVubzpwQDU1dzByYM==
✔ Schema loaded!
✔ API generated successfully!
⠙ Analyzing Schema
- fix a couple of issues caused by the breaking changes introduced in 3.0.0 and 4.0.0 (coming from 2.3.0) 🙈
@maticzav: any chance to create a PR regarding the pointed version of swift-format as dependency used by the SwiftGraphQLCodegen library which is a dependency of the SwiftGraphQLCLI executable?
An additional comment on this topic
Related to the note in the contribution guidelines
Due to a major improvement in swift-format Source:
NOTE: swift-format on the main branch now uses a version of SwiftSyntax whose parser has been rewritten in Swift and no longer has dependencies on libraries in the Swift toolchain. This allows swift-format to be built, developed, and run using any version of Swift that can compile it, decoupling it from the version that supported a particular syntax.
makes the described requirement and the currently used fix version of swift-format obsolete.
from swift-graphql.
Update:
I've managed to get past the above error by copying over the executable from the swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/lib_InternalSwiftSyntaxParser.dylib
and placing it into the swift-5.5 folder and down grading my code gen cli to 3.0.2. But I'm still running into an issue when trying to use the code gen
swift-graphql https://your-api-here --config swiftgraphql.yml -o Schema.swift
Generating SwiftGraphQL Selection 🚀
✔ Schema loaded!
✖ The operation couldn’t be completed. (SwiftSyntaxParser.ParserError error 1.)
Error: There was an error formatting the code. Make sure your Swift version (i.e. `swift-format`) matches the `swift-format` version. If you need any help, don't hesitate to open an issue and include the log above!
Re downloaded Xcode 13.4.1 (https://developer.apple.com/download/all/?q=xcode%2013.4). Recopied the parser.dylib
file into swift-5.5/macosx
and the code gen worked. Seems that Xcode 13 utilizes swift 5.5 and Xcode 14 used 5.6/7. This was were the swift versioning issues was coming from
from swift-graphql.
@wambambizzle @maticzav
some other libs faced this issue, for example Needle
hopefully this can be resolved
from swift-graphql.
Recopied the parser.dylib file into swift-5.5/macosx and the code gen worked. Seems that Xcode 13 utilizes swift 5.5 and Xcode 14 used 5.6/7. This was were the swift versioning issues was coming from
@wambambizzle what do you mean by recopied, could you please be more specific? thanks!
from swift-graphql.
Sorry, I just meant "copied" !
from swift-graphql.
@wambambizzle you've mentioned that you copied lib_InternalSwiftSyntaxParser.dylib
from /Applications/Xcode.app
into it's swift-5.5
folder. This step helped fixing first issue with missing parser.dylib.
Then appeared SwiftSyntaxParser.ParserError error
. So you copied lib_InternalSwiftSyntaxParser.dylib
from Xcode13 into swift-5.5/macosx
Is that correct?
So both for the lib_InternalSwiftSyntaxParser.dylib
libs are from Xcode 13 or some of them from Xcode14?
sorry for confusion, but I still can't get it working
from swift-graphql.
IIRC I copied it from the swift/Mac
into swift-5.5/Mac
and any other places that it was saying was missing.
Do you have the code gen cli installed locally via something like homebrew? And version of Xcode are you currently building against ? No need to apologize, I understand completely.
from swift-graphql.
@wambambizzle I've built it manually using make. At the moment I have Xcode14, which is released officially
from swift-graphql.
Do you still have Xcode 13.x installed by chance? I think part of the issue (besides needing to copy that lib into the other folders), is that Xcode 13.x is associated to Swift 5.5 while Xcode 14 is Swift 5.6/7. What is the current error(s) that you are seeing?
from swift-graphql.
the current error is your second one, about swift-format mismatch, I think it's related to
I'm on Ventura, so I can't run Xcode13, I've tried to use the lib_InternalSwiftSyntaxParser.dylib
from xcode13, but that didn't helped :(
from swift-graphql.
You can't run it or you can't download/install it at all? If not, think you might have try and find a way to manually install Swift 5.5
from swift-graphql.
to be explicit, it's
✖ The operation couldn’t be completed. (SwiftSyntaxParser.ParserError error 1.)
Error: There was an error formatting the code. Make sure your Swift version (i.e. `swift-format`) matches the `swift-format` version. If you need any help, don't hesitate to open an issue and include the log above!
from swift-graphql.
hi everyone
excuse my silence, I see that you've made quite a bit of progress investigating the issue. I'd love to approve a PR if anyone has the capacity or pair program or even just chat with someone from this thread.
Let me know if anyone wants to help with this, I have capacity for the next two weeks 🙂
from swift-graphql.
Related Issues (20)
- GraphQLWebSocket' does not conform to protocol 'WebSocketDelegate' HOT 1
- Remove dependency on starscream in favor of URLSession HOT 1
- Add support for AWS AppSync HOT 7
- Remove dependency on starscream in favor of URLSession HOT 13
- Does Query Builder support multi-operation queries? HOT 2
- Add suport for Linux and swift-server HOT 1
- Update package to remove CLI as dep for client HOT 7
- Massive amounts of warnings due to type parameters being shadowed (will be errors in Swift 6) HOT 2
- GraphQLSupport: Schema support HOT 1
- There are no changes listed for releases since 5.0.9 HOT 3
- GraphQL: Mock request support for testing HOT 2
- Project Roadmap HOT 3
- Caching HOT 2
- Race condition with `active` dictionary when using async/await (w/ proposed fix) HOT 2
- Generic parameter 'T'/'TypeLock' could not be inferred HOT 8
- ErrorExchange doesnt seem to be called HOT 5
- using args causes error in response HOT 2
- Optional lists? optional().list.optional()
- Category Tree Structure upto 2 levels
- How to debug codegen errors?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-graphql.