The field named `js` in the schema causes the Relay compiler to fail when this field is requested in the query
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
The field named `js` in the schema causes the Relay compiler to fail when this field is requested in the query.
## Steps to reproduce
1. Define the following schema:
```
type Query {
hello: String
js: String
}
schema {
query: Query
}
```
2. Define the following query:
```
const query = graphql`
query srcAppQuery {
hello
js
}
`;
```
3. Execute the Relay compiler to generate the query and observe the output in the console.
## Expected Result
The query is generated successfully. Expected output in the console:
```
> bug-relay-compiler-js-field@1.0.0 relay
> relay-compiler
[INFO] [default] compiling...
[INFO] [default] compiled documents: 1 reader, 1 normalization, 1 operation text
[INFO] Compilation completed.
[INFO] Done.
```
## Actual Result
The query generation fails. Actual output in the console:
```
> bug-relay-compiler-js-field@1.0.0 relay
> relay-compiler
[INFO] [default] compiling...
[ERROR] Error: ✖︎ 'js' should be defined on the server schema.
src/index.ts:6:5
5 │ hello
6 │ js
│ ^^
7 │ }
[ERROR] Compilation failed.
[ERROR] Unable to run relay compiler. Error details:
Failed to build:
- Validation errors: 1 error(s) encountered above.
```
## Notes
1. If the `js` field is removed from the definition of `srcAppQuery`, the query is generated successfully (but obviously without the `js` field included).
2. The sample project to reproduce the issue is available at https://github.com/SiarheiBarysenka/bug-relay-compiler-js-field .
Contributor guide
Assessment
This issue has not been assessed yet.