This allows to specify custom validation rules that will be executed when a query is run.
The logic already existed in GraphQL but wasn't exposed in Graphiti.
I experimented with multiple places where to expose the validation rules parameter. I added it to the normal schema execution function. But in the relatively new API world, I added it as an optional protocol requirement that can be implemented in the specify GraphQL API. What do you think about this approach?
I used the types the GraphQL package uses for building custom validation rules instead of building new types only Graphiti uses to reduce overhead.
This allows to specify custom validation rules that will be executed when a query is run. The logic already existed in GraphQL but wasn't exposed in Graphiti.
Use-Cases: E.g. disabling schema introspection in production (also done via validations in JS https://github.com/helfer/graphql-disable-introspection/blob/master/index.js). We already had a short discussion about this over at the GraphQL repo: https://github.com/GraphQLSwift/GraphQL/issues/122
Discussions:
API
world, I added it as an optional protocol requirement that can be implemented in the specify GraphQL API. What do you think about this approach?Feedback and change requests are welcome.