graphql

fmnoise 2025-02-03T14:38:59.722719Z

guys, I have a question - I need to nullify blank strings before checking if schema contract passes - is it possible to do that on the backend? if not, then it would be good at least to throw an error while parsing scalar with field name, so it not Cannot convert " " to String but Last name can't be blank

2025-02-08T16:41:00.349939Z

Yes, it's possible. I implemented that sort of thing using directives to tag arguments in the schema which need checking. The :apply-field-directives option to schema compilation lets you modify the context based on the directives specified. I wrote a wrapper for all my resolver functions that looks for instructions in the context left by the apply-field-directives function and checks or modifies arguments as required before running the resolver function.

🙏 1
fmnoise 2025-02-10T10:51:50.517179Z

thank you, I'll try that