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

Help: Unknown type "ID" #651

Closed
angelica-snowit opened this issue Apr 3, 2023 · 9 comments
Closed

Help: Unknown type "ID" #651

angelica-snowit opened this issue Apr 3, 2023 · 9 comments

Comments

@angelica-snowit
Copy link

I cant't find a way for the plugin recognize standard scalars, like ID or String.
I keep getting Error:(1, 33) Unknown type "ID"
All the custom types works well.

I've a basic configuration:

{
  "name": "GraphQL Schema",
  "schemaPath": "./src/GraphQL/schema.json"
}

The local schema file is generated by GraphQL Code Generator.

@vepanimas
Copy link
Collaborator

Hi @angelica-snowit! Sorry for the late reply. If it's still an issue for you, please follow the instructions here #438 (comment).

It's also worth trying to update your installed GraphQL plugin to the latest version 4.0.0.

@angelica-snowit
Copy link
Author

Updated this morning. Wonderful: now not only ID and other scalars are not recognized, everything is marked as error. The schema appears to be empty, no matter how many time I clear cache and restart.

@vepanimas
Copy link
Collaborator

@angelica-snowit I'm sorry to hear that 😞. Have you checked the logs? Is there anything related to GraphQL there?

If you're using a schema in JSON format, you may try converting it into GraphQL to see if it helps. The easiest way to do this is by following the instructions in the screenshot below. Don't forget to change the schemaPath parameter to point to the newly created file.

image

@angelica-snowit
Copy link
Author

Yes, I've already tried graphql schema (both generated that the same created by the plugin using the remote url), same result :(
Also checked the logs, nothing.

@vepanimas
Copy link
Collaborator

@angelica-snowit Okay, that seems very strange. We have some issues, but in your case, it doesn't work at all despite any efforts to fix it.

We had some weird cases when it could behave that way:

  1. Make sure that neither the directory containing the configuration file nor the directory containing the schema are marked as excluded in the IDE. This may not be applicable to you, but it's still worth mentioning.

  2. Do you use a .graphqlconfig? We had an old issue related to it when a file association was broken by the IDE, so a plugin couldn't grab a config at all. Probably, the best thing you can do here to ensure that it's not the reason is to create a graphql.config.yml with

schema: ./src/GraphQL/schema.json

Note, that it will work only in 4.0.0 plugin version.

  1. A similar issue with file associations could happen with GraphQL files. Please, ensure, that when you create a query.graphql file, it's recognized by the IDE and has a correct icon, it shouldn't be just a plain text file.

  2. Which IDE do you use? For example, in Rider, it's possible that some files are excluded from indexing due to the C# project model.

  3. Regarding an issue with unresolved built-in types. Do you have that file in external libraries?

image

@angelica-snowit
Copy link
Author

Than you for the follow-up. I've already tried all this:

  1. The directory is not excluded
  2. I used a .graphqlconfig but I switched to the .yml after upgrading. I've also tried all the other file names in the docs :D btw, the config file should not be a problem because the plugin seems configurated correctly, with endpoints etc.
  3. Files are recognized as graphql (or I wouldn't have seen that initial alert about the scalar type)
  4. I use PhpStorm 2023.1
  5. I had also checked already the specification, is there where it should be

@vepanimas
Copy link
Collaborator

Maybe it's related to the schema itself then? Could you share a schema file (probably not, but I couldn't resist asking)? Have you tried providing some simple types as SDL definitions instead of using your current schema? Like:

type User {
  id: Int
}

type Query {
  user: User
}

@cstephens-cni
Copy link

I'm having a similar issue, if not the same issue.

Screenshot 2023-09-26 at 11 06 33 AM

I used your simple schema

@cstephens-cni
Copy link

I found my issue, I had to add my root directory as the project root, so it was an .idea issue in this project. I'm the only one using webstorm so I typically gitignore the idea file....I may change that practice.

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

No branches or pull requests

3 participants