openapi json exception
jsonvot opened this issue · comments
Jsonvot commented
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When using class view, the generated openapi json mapping is out of order。
Code snippet
from sanic import Sanic
from sanic.blueprints import Blueprint
from sanic.request import Request
from sanic.response import json
from sanic.views import HTTPMethodView
app = Sanic(__name__)
app.config.update({
'OAS_UI_DEFAULT': 'swagger'
})
class DeleteMixin:
async def delete(self, request: Request):
pass
class PutMixin:
async def put(self, request: Request):
pass
class TestView(HTTPMethodView, DeleteMixin, PutMixin):
middleware = []
async def get(self, request: Request):
return json({'code': 200})
class UserView(HTTPMethodView, DeleteMixin, PutMixin):
middleware = []
async def get(self, request: Request):
return json({'code': 200})
test_bp = Blueprint('test_bp')
test_bp.add_route(TestView.as_view(), '/test-api/test')
user_bp = Blueprint('user_bp')
user_bp.add_route(UserView.as_view(), '/api/user')
app.blueprint(Blueprint.group(*[test_bp, user_bp]))
Expected Behavior
No response
How do you run Sanic?
Sanic CLI
Operating System
Linux
Sanic Version
23.12.0
Additional context
No response