When running the server preset plugin, some of the created resolvers are redundant. For example, for the following schema:
type Something {
value: String
}
input DeleteSomethingInput {
value: String
}
type DeleteSomethingPayload {
somethingId: ID!
}
union DeleteSomethingResult =
DeleteSomethingPayload
| InvalidInputError
| NotAllowedError
| NotFoundError
extend type Mutation {
deleteSomething(input: DeleteSomethingInput!): DeleteSomethingResult!
}
In this example, DeleteSomethingPayload only appears as a union member of the return type of deleteSomething, and will always include all of its scalar properties via the return value of the deleteSomething mutation resolver.
This plugin will create a separate resolver for CreateSomethingPayload as well. Due to my codebase conventions, this resolver is redundant. Would it be possible to include a config option to:
avoid creating resolvers for object types that match a certain suffix (or regex)?
enforce all object fields to be present for these types (because they don’t have a corresponding resolver)
Or is there a different/better approach to achieve the desired effect?
Closing because I realised I should simplify my schema instead (in the example above: removing the DeleteSomethingPayload type and replacing it in the response with Something)
Hello,
When running the server preset plugin, some of the created resolvers are redundant. For example, for the following schema:
In this example,
DeleteSomethingPayload
only appears as a union member of the return type ofdeleteSomething
, and will always include all of its scalar properties via the return value of thedeleteSomething
mutation resolver.This plugin will create a separate resolver for
CreateSomethingPayload
as well. Due to my codebase conventions, this resolver is redundant. Would it be possible to include a config option to:Or is there a different/better approach to achieve the desired effect?
Many thanks in advance!