-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
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
support query validation #4
Comments
Hey @meodemsao, I will need more details/sample code to understand the issue |
everything run but not return input is invalid, i using many lib but still can't valid input |
@JCMais const middleware = [yupMiddleware()]
// schema
const schema = makeExecutableSchema({
typeDefs,
resolvers,
schemaDirective: {
rateLimitDirective
}
})
const schemaWithMiddleware = applyMiddleware(schema, ...middleware) import { resolver, createConnectionResolver } from 'graphql-sequelize'
import { validator, validate } from 'graphql-validation'
import * as yup from 'yup'
export default {
category: resolver((parent, args, context, info) => context.models.Category),
categories: {
validationSchema: yup.object().shape({
limit: yup.number().required().min(1).max(10)
}),
resolve: resolver((parent, args, context, info) => context.models.Category)
},
categoriesConnection: createConnectionResolver({
target: (parent, args, context, info) => context.models.Category,
where: (findOptions, args) => args
}).resolveConnection
} schema.graphql type FieldValidationError {
field: String!
errors: [String!]!
}
type MutationValidationError {
message: String!
details: [FieldValidationError!]!
}
# Write your query or mutation here
query{
categories(limit: 40){
id
name
}
}
but don't return error |
Hi @meodemsao, I'm not having time to look into that, however if you are able to share a full sample code, runnable, I may be able to run it locally and see If I can find what is wrong. |
@JCMais thank, i using graphql-shield for my project |
i try use this lib with validate query argument but seem not work
The text was updated successfully, but these errors were encountered: