You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/graphql_codegen/README.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -623,6 +623,17 @@ no `$unknown` value will be added to your enum and all new values will be mapped
623
623
624
624
## Add typename
625
625
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
+
626
637
By default, the `addTypename` option is enabled. This'll add the `__typename` introspection field to every selection set. E.g.,
0 commit comments