You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered: