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

Unable to find any GraphQL type definitions for the following pointers #2201

Closed
FerasAlazzeh opened this issue Nov 4, 2022 · 2 comments
Closed
Assignees
Labels
essentials/validate Issues that related to Validate

Comments

@FerasAlazzeh
Copy link

FerasAlazzeh commented Nov 4, 2022

Describe the bug

This is the same issue described here: #2001

which was closed however seems to still be broken on latest versions of inspector

Unable to find any GraphQL type definitions for the following pointers

The following errors out when use wildcard.

graphql-inspector validate ./client/**/*.graphql  ./schema.graphql

Although when I copy/paste all the graphql queries/mutations into document.graphql, it never errors out.

graphql-inspector validate ./client/documents.graphql  ./schema.graphql

To Reproduce
Steps to reproduce the behavior:

First Approach
client/queries/companies.graphql


query getCompanies {
  companies {
    id
  }
}

client/queries/hotels.graphql

query getHotels {
  hotels {
    id
  }
}

schema.graphql

type Company {
  id: ID!
}

type Hotel {
  id: ID!
}

type Query {
  companies: [Company]!
  hotels: [Hotel]!
}

output

➜  test_graphql graphql-inspector validate *.graphql  ./schema/schema.graphql
Error: 
      Unable to find any GraphQL type definitions for the following pointers:
        
          - hotels.graphql
          
    at prepareResult (/Users/falazzeh/.config/yarn/global/node_modules/@graphql-tools/load/index.js:561:15)
    at loadTypedefs (/Users/falazzeh/.config/yarn/global/node_modules/@graphql-tools/load/index.js:527:12)
    at async Object.loadSchema (/Users/falazzeh/.config/yarn/global/node_modules/@graphql-tools/load/index.js:612:21)

Environment:
OS: MacOS Monterey
@graphql-inspector/...: 3.4.0

@FerasAlazzeh
Copy link
Author

It seems to work if I do the following

graphql-inspector validate ./client/**/*.graphql ./schema.graphql

rather than

graphql-inspector validate *.graphql ./schema/schema.graphql

If this is intended we should include that in the docs :)

@TuvalSimha TuvalSimha self-assigned this Nov 10, 2022
@TuvalSimha
Copy link
Collaborator

Hey @FerasAlazzeh,
Thank you for the bug report!

I was trying to reproduce your issue and I have a solution for you.
When you did this -> graphql-inspector validate ./client/**/*.graphql ./schema.graphql it might result be -> graphql-inspector validate ./client/foo/1.graphql ./client/foo/2.graphql ./client/bar/1.graphql ./schema.graphql.

So, try to add " before the path of the documents. Like that:
graphql-inspector validate "./client/**/*.graphql" ./schema.graphql ,and like we did in our docs example here: https://the-guild.dev/graphql/inspector/docs/essentials/validate

@TuvalSimha TuvalSimha added the essentials/validate Issues that related to Validate label Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
essentials/validate Issues that related to Validate
Projects
None yet
Development

No branches or pull requests

2 participants