graphql-inspector
graphql-inspector copied to clipboard
diff: Unable to find any GraphQL type definitions for the following pointers: file-without-graphql-extension
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- [ ] 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generate
in the terminal.Please make sure the Codegen and plugins version under
package.json
matches yours. - [ ] 2. A failing test has been provided
- [ ] 3. A local solution has been provided
- [ ] 4. A pull request is pending review
Describe the bug
The diff
command fails if path doesn't have graphql
extension
error Error:
Unable to find any GraphQL type definitions for the following pointers:
- ./test-schema
To Reproduce Steps to reproduce the behavior:
- Create any schema
- Save it into
test-schema
-
graphql-inspector diff ./test-schema ./test-schema
Expected behavior
It should work
Environment:
- OS: Ubuntu 20
-
@graphql-inspector/cli
:^3.4.0
-
graphql
: ^16.6.0 - NodeJS: v14.20.0
Additional context
@LastDragon-ru Curious if you've found any workaround. I'm also stuck at this, and haven't found much online to resolve.
Even after an npm install graphql-cli
and which graphql
returning a command, I don't get this to run 🤔
@er9781 I think you just need to rename the file to add .graphql
extension.
Hm, I'd need to put together a minimal reproduction but I had two schemas with .graphql
extension.
graphql-inspector diff ./schema-old.graphql ./schema.graphql
With error output
error Error:
Unable to find any GraphQL type definitions for the following pointers:
- ./schema-old.graphql
at prepareResult (/Users/simon/co/acuity/hasura/node_modules/@graphql-tools/load/cjs/load-typedefs.js:95:15)
at loadTypedefs (/Users/simon/co/acuity/hasura/node_modules/@graphql-tools/load/cjs/load-typedefs.js:44:20)
at async loadSchema (/Users/simon/co/acuity/hasura/node_modules/@graphql-tools/load/cjs/schema.js:15:21)
at async Object.handler (/Users/simon/co/acuity/hasura/node_modules/@graphql-inspector/diff-command/cjs/index.js:95:35)
Maybe I'm mis-understanding but I'd expect to be able to compare two introspection query results but maybe I need to combine something about collecting .graphql
queries & mutations as well?
Maybe my issue is different and I should maybe open a separate issue (I poked at some code underneath but didn't get that far).
I will say for the issue you mention about extensions in particular, it doesn't surprise me the extension is needed given there's a bunch of different schema sources eg json, graphql, endpoints, git, and it'd be harder to differentiate without the extension? At a minimum an error could be provided though if it's not a recognized format?
Hi, were you able to fix this issue? I am getting the same error when trying out the cli commands locally.
The document path is expected to be in quotes. This is documented in validate command, but I think this also applies to other command, because I also have trouble to execute coverage
without the quoted document path. Either the CLI should expect unquoted document path, or the docs should be updated for each command.
Make sure to wrap the document in quotes.