[Bug] Incompatible with Sanic>=21.0
MSusik opened this issue · comments
Describe the bug
Can't start a simple app with Sanic 21.3. Works well with Sanic 20.12.2
Traceback (most recent call last):
File "yon/app2.py", line 6, in <module>
app.blueprint(swagger_blueprint)
File "/usr/local/lib/python3.8/site-packages/sanic/app.py", line 421, in blueprint
blueprint.register(self, options)
File "/usr/local/lib/python3.8/site-packages/sanic/blueprints.py", line 234, in register
route = app._apply_static(apply_route)
File "/usr/local/lib/python3.8/site-packages/sanic/app.py", line 345, in _apply_static
return self._register_static(static)
File "/usr/local/lib/python3.8/site-packages/sanic/mixins/routes.py", line 796, in _register_static
route, _ = self.route(
File "/usr/local/lib/python3.8/site-packages/sanic/mixins/routes.py", line 155, in decorator self._apply_route(route)
File "/usr/local/lib/python3.8/site-packages/sanic/app.py", line 335, in _apply_route
routes = self.router.add(**params)
File "/usr/local/lib/python3.8/site-packages/sanic/router.py", line 128, in add
route = super().add(**params) # type: ignore
File "/usr/local/lib/python3.8/site-packages/sanic_routing/router.py", line 170, in add route.add_handler(path, handler, method, requirements, overwrite)
File "/usr/local/lib/python3.8/site-packages/sanic_routing/route.py", line 114, in add_handler
raise RouteExists(
sanic_routing.exceptions.RouteExists: Route already registered: swagger/ [GET]
To Reproduce
Run the example from the documentation with Sanic 21.3
Environment (please complete the following information):
- OS: [e.g. Ubuntu] Docker build on top of python:3.8-slim-buster or WSL with Ubuntu 18.04
- Version [e.g. 0.5.3] 0.6.2
Yes sanic-openapi is broken with sanic 21.3, should be fixed in release next monday. Hope you can use sanic==20.12
until then...
Yes, that would work!
Thanks, I just was not sure if you are aware of this :)
Would appreciate it if you would test against https://github.com/artcg/sanic-openapi/tree/s21
So you can install like this
pip install git+https://github.com/artcg/sanic-openapi.git@s21
It works for my organisations project at least :)
and make sure you update sanic to the latest release (21.3.2 released today/yesterday -- previous version had a bug that affected sanic-openapi)
Closing this since sanic 21.3 is now implemented (#218)