JCMais/graphql-yup-middleware

Validations not running or failing with latest version of graphql-js and graphql-relay-js

Opened this issue · 3 comments

Trying to use this but nothing seems to be happening, simple schema that should fail, but nothing gets thrown and the resolver continues to create records that should be failing validation.

export const updateShopMutation = {
  ...updateUser,
  extensions: {
    ...updateUser.extensions,
    yupMiddleware: {
      validationSchema: yup.object().shape({
        input: yup.object().shape({
          name: yup
            .string()
            .required()
            .min(3),
        }),
      }),
    },
  },
};

Are you adding the middleware? You must call applyMiddlewares from graphql-middlewares

Yes I was, I ended up going with the built in yup() middleware that comes with graphql-shield which seems to be working perfectly.

https://github.com/maticzav/graphql-shield#rules-on-input-types-or-arguments

Having the same issue