-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support for endpoint-level validation #18
Comments
@gargol Please let me know if this change makes sense and if I could contribute to implementing it. |
👋 @kibertoad . Thanks for the input! Can you please provide some code on how you see it being used. My understanding is something like this?
|
That's the thing, Google Cloud Functions have no concept of server or router, so minimal Cloud Function code looks like this:
End result of this is that when you call HOST_NAME/helloHttp, this function will be invoked. Recommended pattern for middleware looks like this:
Obviously you can structure code in a somewhat smarter fashion and implement express-like chains, but the main point here is that you can't rely on any existing context for resolving triggered path. Ideally validation middleware API would be something like this:
|
(sorry, my original example was wrong, updated it now) |
My understanding is that it would require to extract |
Thank you for the reply! Will try to cook up something for this :) |
(switched companies since and feature become less relevant for me, but I still intend to implement it. Sorry for delay!) |
@kibertoad no worries, know the pain. I'm having troubles giving this project time as well 😃 |
Judging by documentation, it is currently only possible to use the validator application-wide, immediately affecting all of the endpoints. It would be helpful to be able to attach middleware to specific endpoints with predefined swagger path already filled during instantiation.
This is useful for two scenarios:
swagger-express-validator
impossible;The text was updated successfully, but these errors were encountered: