-
Notifications
You must be signed in to change notification settings - Fork 867
Support using Input Types for Mutation arguments #38
Comments
Would be using the Relay API an option for you as well? |
Maybe, but it greatly complicates things. I'd say using Input Types is a general great practice that should be encouraged. |
There are a couple of alternatives from the top of my head:
Would be interested to hear what your thoughts are on this and especially if you'd see any other viable options? |
I'd say a configuration option, perhaps per model, would be best. |
But also, new projects should be created in the input type mode, and allow you to switch if you want. |
👍 to being able to select which mutations and queries are exposed. This would be a great feature |
We're looking to enhance the Simple API with an object input argument as described in this feature request. This would be a great opportunity to work on other feature requests that require an input object, like #45. |
This is happening :-) Thanks for the great suggestion! https://github.com/graphcool/framework/issues/353 |
Currently when you do a mutation, you just have
createPost(field1, field2, ... , fieldN)
, which means it's quite difficult to use variables on complex mutations.A better route would be to allow a input
type
, for instance:createPost(post: Post)
— in this case just using thePost
type.A further extension on this would be to allow using "Input Types", which are effectively subsets of the entity's Type, for instance:
createPost(post: CreatePostInput)
Where
Post
is defined as:And
CreatePostInput
is defined as:By allowing these "Input Types", we can effectively achieve finer grain creation. It also prevents code like the following (taken from graphql-training/graphql-training.github.io)
Instead, I could've just done:
The text was updated successfully, but these errors were encountered: