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 #2001

Closed
batmanhit opened this issue Sep 7, 2021 · 3 comments
Closed
Labels
📦 released This issue or pull request is released
Milestone

Comments

@batmanhit
Copy link

batmanhit commented Sep 7, 2021

Describe the bug

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:

  1. 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]!
}
> graphql-inspector validate ./client/**/*.graphql  ./schema.graphql

Error: 
      Unable to find any GraphQL type definitions for the following pointers:
        
          - ./client/hotels.graphql
          
    at prepareResult (/Users/username/.npm/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/index.cjs.js:591:15)
    at loadTypedefs (/Users/username/.npm/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/index.cjs.js:556:12)
    at async Object.loadSchema (/Users/username/.npm/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/index.cjs.js:641:21)
  1. Second Approach
    But, if I create a documents.graphql, then it passes.

documents.graphql

query getCompanies {
  companies {
    id
  }
}
query getHotels {
  hotels {
    id
  }
}
> graphql-inspector validate ./documents.graphql  ./schema.graphql

success All documents are valid

Expected behavior

The first case should pass based on the documentations

Environment:

  • OS: MacOS Big Sur
  • @graphql-inspector/...: 2.9.0
  • graphql: 15.5.3
  • NodeJS: v14.17.3

Additional context

@gsingh56
Copy link

gsingh56 commented Sep 7, 2021

I am getting the same error. But for me if I run the validate command in the terminal, it works perfectly fine. But when I add it as a npm script in the package.json, it gives the following error: Error:
Unable to find any GraphQL type definitions for the following pointers:

      - ./schema/graphql/apps/apps.graphqls
      
at prepareResult (/usr/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/index.cjs.js:591:15)
at loadTypedefs (/usr/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/index.cjs.js:556:12)
at async Object.loadSchema (/usr/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/index.cjs.js:641:21)

This is the command I run in the terminal:

graphql-inspector validate 'src/schema/queries/apps/*.graphql' 'src/schema/graphql/apps/*.graphqls'

This is the what I added in the package.json scripts:

{
  "validate": "graphql-inspector validate 'src/schema/queries/apps/*.graphql' 'src/schema/graphql/apps/*.graphqls'"
}

The upper command works perfectly fine but the lower one fails.

@tobiasdiez tobiasdiez mentioned this issue Sep 13, 2021
45 tasks
@kamilkisiela kamilkisiela added the ⏳ waiting for release This issue or pull request is waiting to be released label Sep 27, 2021
@kamilkisiela kamilkisiela added this to the v2.0.0 milestone Sep 29, 2021
@kamilkisiela kamilkisiela added 📦 released This issue or pull request is released and removed ⏳ waiting for release This issue or pull request is waiting to be released labels Sep 29, 2021
@kamilkisiela
Copy link
Owner

released in v3.0.0

@FerasAlazzeh
Copy link

I am still seeing this bug on latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 released This issue or pull request is released
Projects
None yet
Development

No branches or pull requests

4 participants