kamilkisiela / graphql-inspector

🕵️‍♀️ Validate schema, get schema change notifications, validate operations, find breaking changes, look for similar types, schema coverage
https://the-guild.dev/graphql/inspector
MIT License
1.66k stars 188 forks source link

--federation and --aws break diff #2051

Open MichalChomo opened 3 years ago

MichalChomo commented 3 years ago

Describe the bug

When --federation or --aws flag is used, it renders diff command useless.

To Reproduce Steps to reproduce the behavior:

  1. Create a test file
    $ cat << EOF > test.graphql
    type Test {
    field: Invalid
    }
    EOF
  2. Run diff
    $ graphql-inspector diff test.graphql test.graphql
    error Error: Unknown type "Invalid".
    at assertValidSDL (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/graphql/validation/validate.js:107:11)
    at Object.buildASTSchema (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/graphql/utilities/buildASTSchema.js:45:34)
    at makeExecutableSchema (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/node_modules/@graphql-tools/schema/index.js:497:26)
    at Object.mergeSchemas (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/node_modules/@graphql-tools/schema/index.js:534:12)
    at Object.loadSchema (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/index.js:597:29)
    Error: Unknown type "Invalid".
    at assertValidSDL (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/graphql/validation/validate.js:107:11)
    at Object.buildASTSchema (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/graphql/utilities/buildASTSchema.js:45:34)
    at makeExecutableSchema (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/node_modules/@graphql-tools/schema/index.js:497:26)
    at Object.mergeSchemas (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/node_modules/@graphql-tools/schema/index.js:534:12)
    at Object.loadSchema (/Users/michal.chomo/.nvm/versions/node/v16.6.0/lib/node_modules/@graphql-inspector/cli/node_modules/@graphql-tools/load/index.js:597:29)
  3. Run diff with --federation
    $ graphql-inspector --federation diff test.graphql test.graphql
  4. Run diff with --aws
    $ graphql-inspector --aws diff test.graphql test.graphql

Expected behavior

Error is displayed with --federation and --aws too.

Environment:

sMorm commented 3 years ago

I am running into the same issue on v3.0.2 as well.

sonamp commented 2 years ago

Try graphql-inspector diff test.graphql test.graphql --federation

revmischa commented 1 year ago

If I run: graphql-inspector diff schema/generated/prod.graphql schema/generated/platform.graphql --aws

I get:

error Command 'aws' not found