GraphQLBundle
GraphQLBundle copied to clipboard
Added GraphQL type config resolve directive
| Q | A |
|---|---|
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes/no |
| Documented? | no |
| Fixed tickets | |
| License | MIT |
We're looking at federating our schemas, and an important piece in making that process smooth is to be able to define our type configuration using the GraphQL Schema syntax. However, we're not very keen on using resolver maps, and would much rather just define our resolvers using directives in the schema. This PR adds support for defining resolvers using a directive.
I'm creating this as a draft PR, because before any merging I would like to discuss this further, specifically the following points:
- Is defining schema metadata in directives a road you want to go down?
- What other metadata should we support?
- How can we ensure that schema metadata doesn't end up in schema introspection queries?
We're willing to put some work into this, so I'm looking forward to a discussion!
Example of how a schema definition using this:
directive @resolve(
expression: String!
) on FIELD_DEFINITION
# Represents a review for a movie
type Review {
# The number of stars this review gave, 1-5
stars: Int! @deprecated
# Comment about the movie
commentary: String @resolve(expression:"@=resolver('reviewcommentary')")
}