Skip to content

How can I get custom directive on input field? #617

Answered by srinivasankavitha
maxixcom asked this question in Q&A
Discussion options

You must be logged in to vote

Actually the validation library provided by graphql-java does what you are looking for: https://github.com/graphql-java/graphql-java-extended-validation/blob/master/src/main/java/graphql/validation/schemawiring/ValidationSchemaWiring.java#L34

You could probably use that approach. Essentially, you will need to override the onField method in SchemaDirectiveWiring and replace the data fetcher. Unfortunately, you will need to dig into the data fetching environment to extract the input value definitions and check which ones have the directive applied to them to customize the logic. Don't believe there is an easier way around this.

The extended-validation library does something similar and buil…

Replies: 5 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@maxixcom
Comment options

Comment options

You must be logged in to vote
1 reply
@maxixcom
Comment options

Comment options

You must be logged in to vote
1 reply
@maxixcom
Comment options

Comment options

You must be logged in to vote
2 replies
@maxixcom
Comment options

@pratgoyal
Comment options

Comment options

You must be logged in to vote
2 replies
@maxixcom
Comment options

@khacsinhcs
Comment options

Answer selected by maxixcom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants