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
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.