Automatic Relay InputType
See original GitHub issueIs your feature request related to a problem? Please describe.
If I want to write Mutations according to the relay guide I have to declare an input type containing all arguments and a clientMutationId
which is returned in the response.
Currently I have to write a lot of annoying Code. One class for the input, one for the payload and in the Mutation itself I have to pass the clientMutationId
from the input to the payload manually.
Describe the solution you’d like I would like to have a very simple and easy solution to speed up development. Maybe something like:
In my mutation/Resolver i would like to have a function as always without the inputType:
public User CreateUser(string firstname, string lastname, CancellationToken ctx){
...
return new User(....);
}
in my ObjectType
for the Muation I would like to do something like:
descriptor
.Field(m => m.CreateUser(default, default, default))
.UseRelayInputType()
this than should convert this stuff to provide a schema like:
type Mutation {
createUser(input: CreateUserInput!): CreateUserPayload!
}
type CreateUserInput{
fistname: String
lastname: String
clientMutationId: String
}
type CreateUserPayload{
user: User
clientMutationId: String
}
HC should then automatically pass the `clientMutationId``from the input to the payload and all the fields should be mapped. The GraphQLNonNullType should be respected by this solution
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:8 (7 by maintainers)
Top GitHub Comments
The
clientMutationId
is no longer apart of Relay. It was removed when Relay Modern was introduced (3 years ago). Reference. I’m not sure if this should or even needs to be covered by HC at this point!?It would still be nice if HC would provide an easy way to convert from “normal” functions like
to GraphQL like mutations
(not sure if the payload part makes sense in this case but the input certainly would)