Closed rehatkathuria closed 1 year ago
@rehatkathuria I don't see anything standing out from what you have posted to give this error, it does look like getUser(identifier: $identifier)
should be getUser(id: $identifier)
based on your schema. Although that wouldn't present this specific error. Can you provide a small sample schema and operation that would present this issue that we could use to debug and see what the issue is?
It's occurring specifically on the ./apollo-ios-cli generate
command and nowhere else. The studio explorer behaves as expected with the operations.
Here's an example repository: https://github.com/rehatkathuria/ApolloGraphCLICodeExample
Navigating to the Networking
folder and running ./apollo-ios-cli generate
will give you the following error: Error: GraphQLSchemaValidationError: Unknown type "String".
Thanks for providing that, I will take a look!
@rehatkathuria was able to get your sample project working by making sure the schemaSearchPaths
in your codegen config uses the .graphqls
file extension which is used for schema files like this:
"input" : {
"operationSearchPaths" : [
"**/*.graphql"
],
"schemaSearchPaths" : [
"**/*.graphqls"
]
}
and then ensuring the graphl-schema
file has the .graphqls
file extension.
That solved it, thank you!
Good catch @BobaFetters.
@rehatkathuria, the technical reason here is that the codegen engine is finding your operation file, trying to parse it as a schema and then erroring out. If you want to use the wildcard search paths "**/*.
then you have to use distinct subpaths or extensions to disambiguate the files.
Summary
I am having an issue resolving my graphql file with the
generate
functionVersion
1.5.0
Steps to reproduce the behavior
My fetched schema resolves the queries in my file as the following:
I have a
.graphql
file as the following:When running
./apollo-ios-cli generate
using version 1.5.0 I am presented with the following error:Error: GraphQLSchemaValidationError: Unknown type "String".
Logs
No response
Anything else?
No response