Skip to content

Commit

Permalink
Update README.md (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
hickscorp authored Jan 20, 2025
1 parent 099c58a commit da27655
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/graphql_codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,17 @@ no `$unknown` value will be added to your enum and all new values will be mapped

## Add typename

Please note that before toggling `addTypename` to `true` as it might just sound like a quick win for every GraphQL document,
you might want to consider that this option could end up generating documents that wouldn't be up-to-spec with the main GraphQL
specification. In particular, given that having [several root fields on subscriptions is forbidden](https://spec.graphql.org/October2021/#sec-Single-root-field)
you probably want to make sure that the server you'll be consuming the GraphQL endpoint against might enforce this rule and
[add an exception](#excluding-some-selections-from-adding-typename) to it, such as:

```yaml
addTypenameExcludedPaths:
- subscription.*
```

By default, the `addTypename` option is enabled. This'll add the `__typename` introspection field to every selection set. E.g.,

```graphql
Expand Down

0 comments on commit da27655

Please sign in to comment.