I have some problems with Xcode ios-cli errors

I have used Apollo-ios-cli version (CLI version: 1.15.3) Now i have 17.
Here is my .config file: `{
“schemaNamespace” : “xxxAPI”,
“input” : {
“operationSearchPaths” : [
“GraphQL/.graphql”
],
“schemaSearchPaths” : [
“Supergraph/
.graphqls”
]
},
“output” : {
“testMocks” : {
“none” : {
}
},
“schemaTypes” : {
“path” : "./XXXAPI,
“moduleType” : {
“swiftPackageManager”: {}
},
“federation”: true
},
“operations” : {
“inSchemaModule” : {
}
}
}
}

` The exact same work in another project, but there i have used 1.15 ios-cli instead. Now i get this error:

[DEBUG - ApolloCodegenLib:Glob.swift:211] - Evaluating /Users/xx/Documents/xx/GraphQL/.graphql[DEBUG - ApolloCodegenLib:Glob.swift:211] - Evaluating /Users/xx/Documents/xx/Supergraph/.graphqls

[DEBUG - ApolloCodegenLib:Glob.swift:225] - Matched /Users/xx/Documents/xx/Supergraph/schema.graphqls
[DEBUG - ApolloCodegenLib:Glob.swift:225] - Matched /Users/xx/Documents/xx/GraphQL/HasUserInfo.graphql
[DEBUG - ApolloCodegenLib:Glob.swift:225] - Matched /Users/xx/Documents/xx/GraphQL/GetUserDetails.graphql
Error: JavaScriptError: GraphQLError-Syntax Error: Unexpected character: “”.-GraphQLError@
c@
D@
lookahead@
advance@
advanceLexer@
expectToken@
many@
parseSelectionSet@
parseOperationDefinition@
many@
parseDocument@
@

I use the same federated schema that i have copied from my server and to the graphqls file i use. So what is wrong? I cant quite understand it since it work in the other.

If you are using the Supergraph schema file that contains all the internal directives like @join__directive, then that is the incorrect schema to use for client generation.

You should use the API schema which can be fetched via introspection from your router runtime or from the schema registry with rover graph fetch: Rover graph Commands - Apollo GraphQL Docs

@shanemyrick is correct that you should be using the API schema instead of the Supergraph schema.

Our codegen engine uses graphql-js under the hood. This error is being passed through from the validation step done by graphql-js. It looks like those errors changed in a recent update to that library and are a lot less clear than they used to be.

Just looking at the error description here, I’m not 100% sure what the specific validation issue is, but I’m pretty confident that it has to do with using the incorrect schema here. Please let us know if you’re still experiencing issues once you fix that!

1 Like