We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I wanted to implement a custom directive for input types called @validate.
input
@validate
My directive hook looks like this:
config.Directives.Validate = func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { if _, ok := obj.(map[string]any); ok { return next(ctx) } if err := validate.StructCtx(ctx, obj); err != nil { return nil, err } return next(ctx) }
I expected the validate.StructCtx to be called, and obj to be of the type model.CreateCarInput.
validate.StructCtx
obj
model.CreateCarInput
directive @validate on OBJECT | INPUT_OBJECT input CreateCarInput @validate { make: String! @goTag(key: "validate", value: "notblank") model: String! type: String! year: Int! }
go run github.com/99designs/gqlgen version
go version
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What happened?
I wanted to implement a custom directive for
input
types called@validate
.My directive hook looks like this:
What did you expect?
I expected the
validate.StructCtx
to be called, andobj
to be of the typemodel.CreateCarInput
.Minimal graphql.schema and models to reproduce
versions
go run github.com/99designs/gqlgen version
v0.17.49go version
go version go1.22.3 linux/amd64The text was updated successfully, but these errors were encountered: