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

Plugin Mechanism #719

Closed
sharbov opened this issue Oct 15, 2018 · 2 comments
Closed

Plugin Mechanism #719

sharbov opened this issue Oct 15, 2018 · 2 comments

Comments

@sharbov
Copy link

sharbov commented Oct 15, 2018

Description

I would like to propose a plugin mechanism to the request handling flow.
The idea is to enable the registration of functions / decorators on predefined hooks,
to later be triggered at certain points of the request life-cycle.
I would also like o be able to set the order of these plugins execution.

Some examples of possible plugins:

  • Logging
  • Authentication
  • Metric collection

The plugins could be initialized at the app definition.
The implementation could be very similar to the current custom validators, but free of the current assumptions (the validators are only triggered when needed, and not on every incoming request).

@dtkav
Copy link
Collaborator

dtkav commented Oct 18, 2018

FWIW you can override the function property on the Operation class here: https://github.com/zalando/connexion/blob/master/connexion/operation.py#L361

That method is where all of the decorators are specified, including the order in which they are applied.

If you like, you can create a pull request with the plugin API you have in mind. I'm happy to provide feedback / review.

@RobbeSneyders
Copy link
Member

You can add custom middlewares starting from version 3.0: #1395

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

Successfully merging a pull request may close this issue.

3 participants