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

Add Zod validation to GraphQL server #4

Open
Eprince-hub opened this issue Nov 14, 2024 · 0 comments
Open

Add Zod validation to GraphQL server #4

Eprince-hub opened this issue Nov 14, 2024 · 0 comments

Comments

@Eprince-hub
Copy link
Member

We are currently not validating the user inputs on the GraphQL server with Zod; instead, we are doing the validation with such code block like below. We want also to have Zod validation in GraphQL similar to what we have In Next.js Routes

 if (
      typeof args.firstName !== 'string' ||
      typeof args.type !== 'string' ||
      (args.accessory && typeof args.type !== 'string') ||
      !args.firstName ||
      !args.type
    ) {
      throw new GraphQLError('Required field missing');
    }
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

1 participant