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

diff: Unable to find any GraphQL type definitions for the following pointers: file-without-graphql-extension #2189

Open
4 tasks
Tracked by #2651 ...
LastDragon-ru opened this issue Oct 6, 2022 · 5 comments

Comments

@LastDragon-ru
Copy link

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:

  1. Create any schema
  2. Save it into test-schema
  3. 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

@theguild-bot theguild-bot mentioned this issue Apr 16, 2023
39 tasks
@er9781
Copy link

er9781 commented Jul 2, 2023

@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 🤔

@LastDragon-ru
Copy link
Author

@er9781 I think you just need to rename the file to add .graphql extension.

@er9781
Copy link

er9781 commented Jul 2, 2023

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?

@theguild-bot theguild-bot mentioned this issue Oct 26, 2023
38 tasks
@sidarth164
Copy link

Hi, were you able to fix this issue? I am getting the same error when trying out the cli commands locally.

@Looooong
Copy link

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.

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

4 participants