What's the best way to add custom validation logic to a wrapped schema? #6319
Unanswered
wujekbogdan
asked this question in
General
Replies: 1 comment
-
You can do that validation inside |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I use schema wrapping to perform various transformations (like filtering, renames, type changes, etc.), but I need to add some validation logic that can't be covered by the built-in transformation helpers that come with the
@graphql-tools/wrap
package.I figured I could use a custom transformer and peek into the request data thanks to the
transformRequest
callback, do validation there, and throw an error, but I have a gut feeling that's not the best way to handle validation.Another solution that comes to mind is adding a custom resolver, validating the input there, and then delegating the request to the wrapped schema.
Are these the only options? Is there any go-to solution I missed?
Beta Was this translation helpful? Give feedback.
All reactions