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

Refine server side validations #4284

Closed
apoorv-mishra opened this issue Oct 13, 2022 · 2 comments · Fixed by #5638
Closed

Refine server side validations #4284

apoorv-mishra opened this issue Oct 13, 2022 · 2 comments · Fixed by #5638
Labels

Comments

@apoorv-mishra
Copy link
Collaborator

Currently, different types of validations for a given API are scattered within the handlers as a bunch of assertions, added on ad-hoc basis. This ends up making handlers fat and cluttered. It'd be good if validations could be pulled out and be handled more declaratively, in one place, possibly through a middleware. It'd be worth exploring Zod for this purpose.

@tommoor
Copy link
Member

tommoor commented Oct 13, 2022

Now we're talkin'.

I think we should write our own middleware based on zod, as you say – but this express one might provide some inspiration:
https://github.com/andrewkeig/express-validation

@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days

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

Successfully merging a pull request may close this issue.

2 participants