Provide the ability to generate queries/mutations/subscriptions to different depths #2671
Open
1 of 2 tasks
Labels
feature-request
New feature or request
Describe the feature you'd like to request
Currently in Amplify there is a setting in
graphqlconfig.yml
under theextensions/amplify
section calledmaxDepth
which controls the depth of queries to generate for GraphQL queries, mutations, and subscriptions:Due to the recent change to mutations and subscriptions to not allow relationships to be returned unless the authorization matches exactly, it is possible for mutations to fail and report the error:
If the relationships are removed, things work as expected. It would be very convenient to be able to granularly control the depth of queries for mutations/queries/subscriptions separately (e.g. queries maybe set to say 3 or 4, and subscriptions and mutations set to 1).
Describe the solution you'd like
A solution like this might be useful to independently control mutations/subscriptions/queries:
Or
maxDepth
could only apply to queries and not subscriptions and mutations by default, unless some other setting is applied or an override is set.This is just an idea, there might be a better way to solve the problem.
The unfortunate issue today is if you have a relatively large
maxDepth
set (we use 4 right now), in many cases this makes default generated mutations (which up until recently have been very useful) essentially unusable given the problem described above.Describe alternatives you've considered
This workaround described by @chrisbonifacio is a good stop-gap, but a bit clunky to rely on long-term.
Another alternative is to rely on creating custom mutations and to manually remove the nested types (relationships) as mentioned here, however this does somewhat negate the utility of the codegen for mutations.ts so would be nice to avoid if possible.
Additional context
See https://github.com/aws-amplify/docs/pull/7768/files which describes the recent change to mutations/subscriptions.
Is this something that you'd be interested in working on?
Would this feature include a breaking change?
The text was updated successfully, but these errors were encountered: