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

Unstable schema discovery in Unity project with Rider IDE #647

Open
barryyeee opened this issue Feb 27, 2023 · 3 comments
Open

Unstable schema discovery in Unity project with Rider IDE #647

barryyeee opened this issue Feb 27, 2023 · 3 comments

Comments

@barryyeee
Copy link

Version and Environment Details
Rider 2022.3.2
Plugin version: 3.4.0

Describe the bug
when first create the .graphqlconfig file and execute it to generate schema.graphql file, GraphQL panel can discover the schema correctly and everything looks good when write queries.
Screenshot 2023-02-26 at 7 04 32 PM
When close the IDE and reopen it, the previous dicovered schema will be changed to 'Default project-wide schema', and all the types in the schema file will have 'Unknown field "xxx": The parent selection or operation does not resolve to a valid schema type'
Screenshot 2023-02-26 at 7 02 27 PM
errors in .graphql files
Screenshot 2023-02-26 at 7 20 33 PM
Screenshot 2023-02-26 at 7 20 42 PM
Here is the my configuration file:
Screenshot 2023-02-26 at 7 08 20 PM

I'm not sure if it's because of the special project structure of unity project. The file structure looks like this in Rider:
Screenshot 2023-02-26 at 7 29 21 PM
actually the path is ProjectName/Assets/..., Assets folder is not the project root.

the methods I tried to solve this:

  1. invalidate caches
  2. file association in Rider settings
  3. put .graphconfig and schema.graphql file under ProjectName/Assets/
  4. put all .graphconfig and .graphql files under ProjectName/Assets/GraphQL/

the first method doesn't work, and the last 3 ones only work temporarily: when reopen the IDE or sometimes even switch beteen unity engine and Rider or create a new .graphql file to write a new query, same errors will occur again

@vepanimas
Copy link
Collaborator

vepanimas commented Feb 27, 2023

Hey! As a quick solution please try to click on your .graphqlconfig and choose Tools > Start Index

image

@barryyeee
Copy link
Author

Hey! As a quick solution please try to click on your .graphqlconfig and choose Tools > Start Index

image

Hiiii vepanimas, thx for replying. this definitely solves my problem; and for others for reference:

  • click on .graphqlconfig and choose Tools > Start Index
  • if there's still schema error: "A schema should have a 'query' operation defined", do the same thing with schema.graphql file (click on the generated schema.graphql file and choose Tools > Start Index)

@vepanimas
Copy link
Collaborator

I'm glad that it helped! Though let's leave that issue as opened for now, perhaps we will be able to solve it somehow in the future.

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