How to validate arguments #3337
Unanswered
eskimoblood
asked this question in
Q&A
Replies: 1 comment 11 replies
-
Great question! Anything you want to do at runtime probably involves wrapping field resolvers. what you probably want to do is something like running mapSchema once without modifying the schema, just analyzing it, ie collect field arguments that have whatever directives, and then running it again to modify your resolvers based on that analysis |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We had a working solution to validate input arguments using directives and
SchemaDirectiveVisitor
. We imported it from apollo-server. As we try to update and apollo removes the exports from graphql-tools, I found out that alsoSchemaDirectiveVisitor
isn't part of graphql-tools anymore but that this is the way to work with custom direct.During my research I also found that
GraphQLArgumentConfig
returned bymapSchema
doesn't even have aresolve
function. So I wonder if there is any way to validate query arguments using directives like this:Beta Was this translation helpful? Give feedback.
All reactions