-
Notifications
You must be signed in to change notification settings - Fork 97
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
"Unknown field" - does not resolve to a valid schema type (New in plugin version 2.5) #348
Comments
Hi Frederike, Thanks for using the plugin. Could you please attach a 2.5.0 screenshot of the GraphQL tool panel which shows the result of schema discovery and any errors that may prevent the schema from being built. |
is that what you are looking for? I'm having the same issue. This is using the github schema (https://github.com/octokit/graphql-schema/blob/master/schema.json) |
@AllanWang Thanks, yes it was. I see that the schema has been discovered, at least in your case. On that basis I'm thinking that this may be related to indexing/caching used by the editor. Can you try the "File" > "Invalidate Caches / Restart" menu action and then click the "Invalidate and Restart" button? |
I am also having this issue. For me, the schema discovery looks OK (there are types, inputs and scalars). Interesting remark is that it does find the types, and if I hover my mouse over the base query I get references to the schema.graphql file, but the fields are not recognized. Even more funny thing is; it works fine in one project, but not in another project..... Both versions use the same version of graphql-tag. I tried the "Invalidate Caches" solution, but it didn't work. |
Just comparing both projects again. I work with python/graphene to build the server-side schema. Initially, I named by query class "Query" and the mutation class "Mutation". In the old project where GraphQL JS worked well, I named them "ReadingQuery" and "MutationQuery".
So I renamed them in my current project as well, and now discovery works again!
Bit more testing shows that the root query in "schema.graphql" should not be named "Query". I named it "ReadingQuery" and all works fine. The name of the Mutation root type does not affect field discovery. |
Using the plugin with 2.4.0 version works fine, 2.5.0 cannot resolve the fields. I tried to invalidate cache but it does not help in this case, the same goes with using earlier versions of WebStorm.
|
I'm still unable to reproduce this locally. It would be really helpful with specific steps to reproduce, or an example project that demonstrates the issue so that a fix is made possible. |
@jimkyndemeyer Sorry for not getting back earlier. Missed the notifications.
|
I'm trying to reproduce this and I have a few guesses, but I'm not sure exactly what the reason is in each case. It would be ideal to get a complete schema, or at least a minimal set of types from it, for which it is possible to reproduce this bug +
Most of all, I want to understand at this point what the structure of your projects is. Specifically, are there places other than the schema specified in Please, especially check if there are any @friederikewild also errors from the schema file can also be very useful. I can see that you're using @friederikewild @simon2k @blacksmoke26 @ErikRtvl any info from you is very appreciated 🙏! It looks like this issue is critical and common, but there are plenty of possible reasons for this behavior. |
Closing due to lack of response. If the issue still exists in a new 2.6.0 version, please, feel free to comment here. |
Hello, I am currently having this problem.
When I run this query it correctly returns data, but when I hover over How do I fix this and get schema autocompletion and validation? I am using GraphQL 3.1.2 plugin in PycharmProfessional.
the scratch.graphql file in in src folder. If you need more info please let me know. I also get a |
same issue on 4.2.0 :( |
WebStorm 2022.1.3 Non-Bundled Plugins: |
I didn't have any issues using IntelliIdea on Windows but I started facing problems with the GraphQL plugin after using it on Linux. There might be a problem with the file system handling of IntellijIdea. |
I was having error types since version upgrade. If this thread didn't help, this #438 might help you getting things fixed. |
I had a problem with unknown everything. Graphql config file may be in a wrong directory, try to put it into directory, where the schema actually is. In some setups it's one directory higher. |
I am using Graphql with Code Generator and graphql-request. I had the same issue. What worked for me:
My query now has autocomplete and the IDE is not complaining anymore. |
Describe the bug
grapql queries
now all requested fields are red and on hovering show error "Unknown field"To Reproduce
type
?I really hope this helps. If not I can try to workout a simple demo project, but will take me longer
Expected behavior
Screenshots
Using version 2.5:
Using version 2.4:
Version and Environment Details
Operation system: macOS
IDE name and version: Android Studio 4.0
Plugin version: 2.5
Additional context
The text was updated successfully, but these errors were encountered: