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
Settings some queries/mutations/subscriptions to null in @model directive results in more GraphQL statements/types being cut out than were set to null
#765
Open
2 tasks done
SalmonMode opened this issue
Nov 22, 2023
· 4 comments
If applicable, what version of Node.js are you using?
v16.20.2
Amplify CLI Version
12.8.2
What operating system are you using?
Ubuntu
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
When using the @model directive in the GraphQL schema file to set queries/mutations/subscriptions to null (or specific subsets within them), things that were not set to null are still not generated. I've noticed that since my codegen is configured to go 2 levels deep, if a type that's fully nulled out in all these fields is included in the model of another that isn't, they will be generated.
The get query for the model would not be generated, and the type for the Application itself might also not be generated (not entirely sure what's causing it to be generated or not generated).
Sometimes, even if a thing is not specified, it could be not generated at all. For example, I could not specify subscriptions or mutations, and only set queries to be null, and it would still not generate the subscriptions or mutations.
Expected behavior
The types would all still be generated (as they are useful in other contexts), and only the statements/types/resolvers that were set to null would not be created. Similarly, if queries is set to {list: null}, the get statement would still be generated. I'm also unclear if this means the associated resolvers are also not generated.
Reproduction steps
Create a schema with a model that has a @model directive of @model(queries: { list: null }, mutations: null, subscriptions: null)
Create another model with a similar directive, but include it as a relationship with another model that has an empty @model
directive.
Make sure the codegen is configured to go 2 nested levels deep
Run amplify api push --y
Project Identifier
No response
Log output
# Put your logs below this line
Additional information
No response
Before submitting, please confirm:
I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
I have removed any sensitive information from my code snippets and submission.
The text was updated successfully, but these errors were encountered:
Just an update, but I found a workaround, which entails explicitly stating every name for all operations/resolvers that I still want to keep. It looks a bit like this:
I could not specify subscriptions or mutations, and only set queries to be null, and it would still not generate the subscriptions or mutations.
I wasn't able to reproduce this part and observed that if you have @model(queries: { list: null }), the get query is not being generated (the bug) and the mutations, subscriptions are generated as expected.
Any updates on this? I have kinda the same problem. I set this: @model(subscriptions: null, mutations: { create: null })
And now any mutation is not generated. I use the latest amplify version. Just did today an update of amplify and the v6. Now it does not work anymore????
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v16.20.2
Amplify CLI Version
12.8.2
What operating system are you using?
Ubuntu
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
When using the @model directive in the GraphQL schema file to set queries/mutations/subscriptions to null (or specific subsets within them), things that were not set to null are still not generated. I've noticed that since my codegen is configured to go 2 levels deep, if a type that's fully nulled out in all these fields is included in the model of another that isn't, they will be generated.
For example:
This would result in the type for
Resume
to still be generated, as Candidate should be fully generated.In this example, though:
The get query for the model would not be generated, and the type for the
Application
itself might also not be generated (not entirely sure what's causing it to be generated or not generated).Sometimes, even if a thing is not specified, it could be not generated at all. For example, I could not specify
subscriptions
ormutations
, and only setqueries
to benull
, and it would still not generate the subscriptions or mutations.Expected behavior
The types would all still be generated (as they are useful in other contexts), and only the statements/types/resolvers that were set to null would not be created. Similarly, if
queries
is set to{list: null}
, the get statement would still be generated. I'm also unclear if this means the associated resolvers are also not generated.Reproduction steps
@model
directive of@model(queries: { list: null }, mutations: null, subscriptions: null)
@model
directive.
amplify api push --y
Project Identifier
No response
Log output
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: