-
-
Notifications
You must be signed in to change notification settings - Fork 765
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 middleware documentation #1706
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice documentation, don't have anything to add at this stage!
One question/comment on "first to last" order wrt middlewares, others are minor things
docs/middleware.rst
Outdated
**SwaggerUIMiddleware**, Adds a Swagger UI to your application | ||
**RoutingMiddleware**, "Routes incoming requests to the right operation defined in the | ||
specification" | ||
**SecurityMiddleware**, Checks incoming requests against the security defined in the spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: inconsistency between "specification" in RoutingMiddleware and "spec" here
docs/middleware.rst
Outdated
**RoutingMiddleware**, "Routes incoming requests to the right operation defined in the | ||
specification" | ||
**SecurityMiddleware**, Checks incoming requests against the security defined in the spec | ||
**RequestValidationMiddleware**, validates the incoming requests against the spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: validates --> Validates
docs/middleware.rst
Outdated
The :code:`add_middleware` method takes a :code:`position` argument to define where in the | ||
middleware stack it should be inserted, which should be an instance of the | ||
:class:`~connexion.middleware.MiddlewarePosition` Enum. The positions below are ordered from | ||
first to last. Note that responses hit the middlewares in reversed order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean with "first to last"? 😅
I find it easier to talk about "outer" and "inner" when it comes to middleware, but might be personal?
If you need more flexibility, or want to modify or delete any of the default middlewares, you can | ||
also pass in a customized middleware stack when instantiating your application. | ||
|
||
For example, if you would like to remove the :class:`SecurityMiddleware` since you are handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A remove_middleware()
method or exclude
argument could be useful indeed 😛
Contributes towards #1531
This PR adds a documentation page on middleware.