-
-
Notifications
You must be signed in to change notification settings - Fork 111
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 and examples for Class-Based Views (HTTPMethodView) #64
Conversation
Any idea when this will be merged in? |
Is this adding something different than #67? |
You can install forked version via pip and see what's different. @notnami I think that the main difference are examples and tags support for blueprint. And I didn't notice that there had been some PR trying to provide class-based views support when I wrote my own solution. |
@tudormunteanu I think that sanic-openapi is no longer under maintenance. Besides, I need support for OpenAPI 3 for bearer token authentication. And that's why I turn to api-spec with some tricky code. |
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.
How is this different than #67? Do we need this still? Can we get rid of one of them?
Can we get this pull request or 67 merged? |
@chenjr0719 Can you take a look at these two and decide which one needs to be merged? @logileifs The conflicts, but also understanding the overlap with #67. |
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 and verified with Sanic 19.3.1, everything works. But I'm afraid this PR is very behind to current master. There is no openapi.py
in current master, not sure what would happen if we merge it.
sanic_openapi/openapi.py
Outdated
if hasattr(route.handler, 'view_class'): | ||
# class based view | ||
view = route.handler.view_class | ||
for http_method in HTTP_METHODS: |
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.
BTW, here is a replacement if we don't want to import HTTP_METHODS:
for http_method in route.methods
I'm glad that this PR is receiving serious attention to bring class-based views to sanic-openapi. This PR has been around for a long time and may not match the current code of sanic-openapi. So what can I help? |
@Guoli-Lyu Glad to have you back. After version So, what you have to do are:
If there is any problem, just let me know. |
Ok, I have done rebasing and porting. @chenjr0719 |
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.
Great, appreciate your awesome PR. @ahopkins This PR is ready to merge.
What's the state of this PR? This PR have not merged yet. |
@Guoli-Lyu Thanks for the nudge. I was waiting for the tests to complete and then forgot about it. |
Hope it update soon. |
@junhoyeo what do you mean? it is merged. |
Add support for Class-Based Views as issues #12 and #42 have pointed out.
In addition, a simple example is added to demonstrate that in class based view, sanic-openapi can actually work.
Examples for class-based views is also added to car examples.