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

Not finding local schema extensions #3986

Open
rokn opened this issue Jun 21, 2022 · 5 comments
Open

Not finding local schema extensions #3986

rokn opened this issue Jun 21, 2022 · 5 comments
Labels

Comments

@rokn
Copy link

rokn commented Jun 21, 2022

Hey, I've tried adding a local client schema extension as described here: https://relay.dev/docs/guides/client-schema-extensions/

The problem arises when I try to compile a query which uses this extensions. I've set-up a tiny example repo which showcases the problem: https://github.com/rokn/relay-example-local-schema/

There is one schema in data/schema.graphql

And one extension schema in src/clientSchema.graphql

When I try to run the relay compiler I get the following error:

yarn run relay-compiler
yarn run v1.22.18
$ /home/rokn/relay-local-test/node_modules/.bin/relay-compiler
[INFO] querying files to compile...
[INFO] [default] compiling...
[ERROR] Error in the project `default`: ✖︎ The type `Query` has no field `notifications`.

  src/App.tsx:12:9
   11 │         }
   12 │         notifications {
      │         ^^^^^^^^^^^^^
   13 │             title

[ERROR] Compilation failed.
[ERROR] Unable to run relay compiler. Error details:
Failed to build:
 - Validation errors:
 - The type `Query` has no field `notifications`.:src/App.tsx:100:113

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command

If I add the extension schema to be part of the main schema there are no problems compiling it.

@ellemedit
Copy link

In relay-compiler document, we can set 'schemaExtensions' option. After setting 'schemaExtensions', my client schema extension worked. I guess the documentation need explicit explanation.

@alunyov
Copy link
Contributor

alunyov commented Jun 22, 2022

Thanks for reporting. I think @beingbook is right, and we need to update documentation to mention the schemaExtensions in the compiler configuration.

@alunyov alunyov added the docs label Jun 22, 2022
@rokn
Copy link
Author

rokn commented Jun 29, 2022

Yup, adding a folder which contains the schema extensions to the schemaExtensions property in my package.json worked.

@captbaritone
Copy link
Contributor

Thanks for the report @rokn and the solution @beingbook. Would either of you like to like to contribute a fix to the docs?

@ellemedit
Copy link

Let me try documentation coming week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants