-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/quart #3
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.
Looks great!
There's a lot of code duplication between the Flask & Quart implementation, so it might be good to make this code reusable.
Did you already run Connexion with a Quart backend? Would be great to add it as an example.
We probably also want to add tests for Quart, similar to the ones for AioHttp.
logger = logging.getLogger('connexion.apis.quart_api') | ||
|
||
|
||
class QuartApi(AbstractAPI): |
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.
There are a couple of methods in here that are identical to the FlaskApi. You might want to extract those into a super class, or subclass from the FlaskAPI.
If there are changes, it's often just a difference between using flask
or quart
, so you could make the framework a property of the class that you can override.
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.
This is also the case for the other classes in quart_api.py
and quart_app.py
.
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.
I had a go at this but couldn't immediately get it to work, probably I'm trying to do it in the wrong way.
I added a new FlaskLikeApi
class with a class atribute framework = None
.
Then, FlaskApi
inherits from FlaskLikeApi
and the framework is set to flask
, but this raised an error in the parent class because for example a method uses self.framework.json
, giving an AttributeError.
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.
Hard to say without looking at the code. But we can continue like this for now and try to refactor once everything works.
I added an example for Quart as well, you can also specify However, there seems to be an issue if aiohttp is not installed because it is imported in |
c3457f2
to
367220b
Compare
Changes proposed in this pull request: