Is your feature request related to a problem? Please describe.
apollo-angular v12 introduced a breaking change in the signature of generated Query, Mutation, and Subscription services: All parameters are now combined into a single options object, meaning variables must be nested within the variables property. For example:
- myQuery.watch({ myVariable: 'foo' }, { fetchPolicy: 'cache-and-network' });
+ myQuery.watch({ variables: { myVariable: 'foo' }, fetchPolicy: 'cache-and-network' })
- myMutation.mutate({ myVariable: 'foo' }, { errorPolicy: 'ignore' });
+ myMutation.mutate({ variables: { myVariable: 'foo' }, errorPolicy: 'ignore' });
- mySubscription.subscribe({ myVariable: 'foo' }, { fetchPolicy: 'network-only' });
+ mySubscription.subscribe({ variables: { myVariable: 'foo' }, fetchPolicy: 'network-only' });
Currently, @graphql-codegen/typescript-apollo-angular does not generate code compatible with this change even when setting the apolloAngularVersion config. The old, deprecated parameter style is still used in output.
Describe the solution you'd like
- Add support for apollo-angular v12 in the codegen plugin under the
apolloAngularVersion: 12 config (and above, as needed).
- When this version is set, generate service methods that combine all parameters into a single options object, matching the new apollo-angular v13 signature requirements (
variables property nested inside options).
- Document this breaking change in the plugin readme and migration guides.
Describe alternatives you've considered
- Staying on apollo-angular v11 and below (not desirable)
- Manually wrapping all generated services (not scalable if there are many operations)
Additional context
Is your feature request related to a problem? Please describe.
apollo-angular v12 introduced a breaking change in the signature of generated Query, Mutation, and Subscription services: All parameters are now combined into a single options object, meaning variables must be nested within the
variablesproperty. For example:Currently,
@graphql-codegen/typescript-apollo-angulardoes not generate code compatible with this change even when setting theapolloAngularVersionconfig. The old, deprecated parameter style is still used in output.Describe the solution you'd like
apolloAngularVersion: 12config (and above, as needed).variablesproperty nested inside options).Describe alternatives you've considered
Additional context