Closed hsz1273327 closed 3 years ago
I just was looking at this. Sanic supports decorators on methods:
Agreed. This should work, but does not.
class HelloView(HTTPMethodView):
@openapi.parameter("name", str, location="query")
async def get(self, request: Request) -> HTTPResponse:
name = request.args.get("name", "world")
return text(f"Hello, {name}.")
bp.add_route(HelloView.as_view(), "/")
This does work, but is not always a viable option.
class HelloView(HTTPMethodView):
decorators = [openapi.parameter("name", str, location="query")]
async def get(self, request: Request) -> HTTPResponse:
...
Describe the bug Decorator doc/openapi not work when using
routes of HTTPMethodView under Bluebprint instanc
way,Screenshots![api-2](https://user-images.githubusercontent.com/7850148/118249850-6972d100-b4d8-11eb-8c3a-c18df24ba376.PNG)
To Reproduce
file1
userlistsource.py
usersource.py
Expected behavior
there should be
summary
,and these sections should inuser
tagEnvironment (please complete the following information):
Additional context Add any other context about the problem here. This might be how to fix this bug or some hint to fix it.