in resolver validate an answer before sending it? #2085
Unanswered
Andrei-Stepanov
asked this question in
Q&A
Replies: 1 comment
-
Actually GraphQL isn't working like that so you can add an extra layer to manage this validation. |
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
-
I am sorry, I read https://www.graphql-tools.com/ all documentation a few times.
I asked on stackoverflow, discord. Useless.
May be you will be so kind to help?
How do I in resolver validate(convert) a JS object to GraphQL type?
In other words: check if JS object maps to GraphQL type defined in schema.
I want to validate in resolver, that I am going to return correct data.
I have an JS object that I want to return in resolver, that has requested fields.
If I return incorrect data according to GraphQL schema, I want to catch such errors and fix them in resolver.
This happens when graphql-server acts as proxy to other DB.
The type I want to return has around 100 fields. I see ineffective to write own validator.
Maybe there is something like dry-run reply (sorry for graphql unprofessional slang)?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions