aiohttp-swagger icon indicating copy to clipboard operation
aiohttp-swagger copied to clipboard

Bug in helpers/builders.py

Open olexandr-klymenko opened this issue 8 years ago • 0 comments

Overview: if we declare route with class based view with method different from METH_ANY ('*') our endpoint doesn't show up There is a bug in helpers/builders.py:43:

if issubclass(route.handler, web.View) and route.method == METH_ANY:

STR:

  1. Create route with class based view:
app.router.add_route( method='DELETE',
                                  path='/some_path/',
                                  handler=SubClassOf_web_View,
                                  name='some_name')
  1. Create doc string for DELETE method:
class SubClassOf_web_View(web.View):
    async def delete(self):
       """
       ---
       valid doc string
       """

Excpected: declared endpoint shows up on api page Result: declared endpoint doesn't show up on api page

Solution: replace if issubclass(route.handler, web.View) and route.method == METH_ANY: with if issubclass(route.handler, web.View):

olexandr-klymenko avatar Oct 30 '17 15:10 olexandr-klymenko