Skip to content

Commit da27655

Browse files
authored
Update README.md (#382)
1 parent 099c58a commit da27655

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/graphql_codegen/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,17 @@ no `$unknown` value will be added to your enum and all new values will be mapped
623623

624624
## Add typename
625625

626+
Please note that before toggling `addTypename` to `true` as it might just sound like a quick win for every GraphQL document,
627+
you might want to consider that this option could end up generating documents that wouldn't be up-to-spec with the main GraphQL
628+
specification. In particular, given that having [several root fields on subscriptions is forbidden](https://spec.graphql.org/October2021/#sec-Single-root-field)
629+
you probably want to make sure that the server you'll be consuming the GraphQL endpoint against might enforce this rule and
630+
[add an exception](#excluding-some-selections-from-adding-typename) to it, such as:
631+
632+
```yaml
633+
addTypenameExcludedPaths:
634+
- subscription.*
635+
```
636+
626637
By default, the `addTypename` option is enabled. This'll add the `__typename` introspection field to every selection set. E.g.,
627638

628639
```graphql

0 commit comments

Comments
 (0)