Skip to content
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

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

Open
danwetherald opened this issue Jan 13, 2021 · 3 comments

Comments

@danwetherald
Copy link

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),
        }),
      }),
    },
  },
};
@JCMais
Copy link
Owner

JCMais commented Jan 24, 2021

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

@danwetherald
Copy link
Author

danwetherald commented Feb 5, 2021

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

@rolivegab
Copy link

Having the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants