-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Hi,
I was trying to add a custom executable directive to my schema. This directive looks like this :
directive @timeFormat(format: String!) on FIELD | FIELD_DEFINITION
scalar DateTimeThis would be applied on the DateTime scalar and would give the possibility to change the result to the expected format, let's say YYYY-MM-DD for example.
Currently, the only way I found to implement this behavior is, for each field where the return type is DateTime, to take the FieldParams in a custom Result where I would check all the directives available and apply the correct directives with the correct params. This is quite cumbersome in my opinion because if in the future I want to be able to do so on a Date, I would have to change all those fields as well...
I was wondering if there was another way to do that, in a more centralized way where, rather than doing it on the resolver level, it would be done on the schema level. Is there something like that ? Like a DirectiveHandler Registry or something ? If not, would that be foreseen in a future version ?
I'd be interrested in helping if needed.
Thanks in advance for your answer