facebook / facebook/relay

Type generation Required/optional swap with fragments/mask

Open
#2,644 8 comments 1 reaction 1 assignee Claimed by @alloy View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Please visit the repo for a whole and simple reproduction example: https://github.com/artola/relay-bug

Basically using a fragment that `implements` and `interface` together with the directive `@relay(mask: false)` produce that the typings exposed in the query differ from the fragment in the property's required/optional.

```js
graphql`
fragment bugFoo on F2 {
foo
}
`;

graphql`
query bugQuery {
q {
...bugFoo @relay(mask: false)
}
}
`;
```

**Required** in the fragment: `+foo: string,`
https://github.com/artola/relay-bug/blob/a2fd4ad98aa6e3a48d17be9819ddf7470a7878e0/src/__generated__/bugFoo.graphql.js#L14

but **optional** in the query: `+foo?: string`
https://github.com/artola/relay-bug/blob/a2fd4ad98aa6e3a48d17be9819ddf7470a7878e0/src/__generated__/bugQuery.graphql.js#L15

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.