Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Apollo Codegen in my project folder try to generate from apollo-ios package .graphql files #2602

Closed
Dimillian opened this issue Oct 24, 2022 · 6 comments

Comments

@Dimillian
Copy link

Hello,

Trying to upgrade our project from 0.5.X to 1.0.2, updated our Swift codegen package successfully (well at least to compile) and i'm running into new errors.

You can see here the error when running ApolloCodegen.build(with: configuration, withRootURL: hangtagFolderURL)

/Users/dimillian/Documents/Developer/hangtag/Codegen/.build/checkouts/apollo-ios/Tests/TestCodeGenConfigurations/Other-CustomTarget/GraphQLAPI/graphql/ccnGraphql/ClassroomPetsCCN.graphql:2:16
1 | query ClassroomPetsCCN {
2 |   classroomPets[!]? {
  |                ^
3 |     ...ClassroomPetDetailsCCN

I have a very basic configuration

let configuration = ApolloCodegenConfiguration(schemaName: "GQL",
                                               input: .init(schemaPath: urlToSchemaFile.absoluteString),
                                               output: .init(schemaTypes: .init(path: outputURL.absoluteString,
                                                                                moduleType: .swiftPackageManager)))

How do I exclude Xcode SPM checkout / build folders? It was not trying to generate from these folders with the javascript CLI, is it a bug with the new Swift based codegen?

Thanks!

@Dimillian Dimillian changed the title Running Apollo Codegen in my project foltder try to generate from apollo-ios .graphql files Running Apollo Codegen in my project folder try to generate from apollo-ios package .graphql files Oct 24, 2022
@Dimillian
Copy link
Author

Dimillian commented Oct 24, 2022

If I'm specifying directories where I want to search for operations:

operationSearchPaths: ["hangtag/**/*.graphql", "Packages/**/*.graphql"])

I get another error:

[DEBUG - ApolloCodegenLib:Glob.swift:194] - Matching /Users/dimillian/Documents/Developer/hangtag/Packages/Model/.swiftpm/xcode/xcshareddata/*.graphql
[DEBUG - ApolloCodegenLib:Glob.swift:194] - Matching /Users/dimillian/Documents/Developer/hangtag/Packages/Model/.swiftpm/xcode/xcshareddata/xcschemes/*.graphql
ApolloCodegenLib/JavaScriptBridge.swift:343: Precondition failed: Expected JavaScript array but found: undefined

@calvincestari
Copy link
Member

Hi @Dimillian 👋🏻 - yes, this is a bug in the new Swift-based Codegen. We're got #2552 to track a fix for it and it will be included in the next release, 1.0.3.

As for the second error, I've only seen that when the schema file cannot be located. Does the log output show that it finds your schema file?

@Dimillian
Copy link
Author

Thanks!

@calvincestari
Copy link
Member

I'm going to close this issue and we can track the progress of the bug in #2552.

@calvincestari
Copy link
Member

@Dimillian, this is fixed with the merging of #2628 and will be included with 1.0.3. There is maybe one or two other issues I need to check on first before cutting that next release.

@Dimillian
Copy link
Author

@calvincestari Thanks, all good for this issue, which led me to another issue #2645 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants