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

Create new middleware for query params validation #76

Open
emmanuelm41 opened this issue Feb 28, 2024 · 0 comments
Open

Create new middleware for query params validation #76

emmanuelm41 opened this issue Feb 28, 2024 · 0 comments

Comments

@emmanuelm41
Copy link
Member

emmanuelm41 commented Feb 28, 2024

Context

On an REST http server, endpoints usually receive some optional/mandatory values as configuration which modifies the endpoint behavior in some way. For example, when an endpoint process a request, and retrieve the response data in pages, clients usually send the page they want as a query param. Likewise, if the pagination uses cursor instead of plain pages, the cursor is sent there.

The problem

Getting the value from context and validating it can be done easily. However, the validation process may be spread across multiple endpoints that check the same parameter.

New feature

It would be great to have a middleware that can be "instantiated" with some specific configuration about which parameters should be validated, and how to validate each one. Based on that, the instantiated middleware can be coupled to desired endpoints, so that the validation process is concentrated on only one place.

🔗 zboto Link

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