Replies: 1 comment 2 replies
-
@frederikhors why move to discussion? This could be a bug IMHO In my opinion, the directive callback should only be called with |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What happened?
@oneOf
is a commonly used directive on input-types. graphql/graphql-spec#825Using this directive, it is possible to validate that one (and only one) field from an input object is set, e.g:
What did you expect?
It would be great, if gqlgen could support and validate this directive.
I already tried to implement it by myself, but I'm confused by the directive function syntax:
In theory, I need to iterate through all keys of
obj
and check if only one of them is!=nil
.Problems:
UserInput
type, then a 2nd time for the actualUserBy
type on which the@oneOf
directive is used.UserBy
input typeQuestions:
UserBy
types in my directive callback?_, ok := obj.(model.UserBy)
. The@oneOf
directive will be used on multiple input times. I can't add a new type-assertion to the directive everytime a new input types uses that directive.Beta Was this translation helpful? Give feedback.
All reactions