Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.0.7. setup_swagger doesn't work #68

Open
vkropotko opened this issue Jul 17, 2019 · 10 comments
Open

Version 1.0.7. setup_swagger doesn't work #68

vkropotko opened this issue Jul 17, 2019 · 10 comments

Comments

@vkropotko
Copy link
Contributor

Hi,

Versions:
python==3.7.3
aiohttp==3.5.4
aiohttp-swagger==1.0.7

If I try to run examples from https://aiohttp-swagger.readthedocs.io/en/latest/quick_start.html,
it doesn't work.
Example:

>from aiohttp_swagger import *
>async def ping(request):
...     """
...     ---
...     description: This end-point allow to test that service is up.
...     tags:
...     - Health check
...     produces:
...     - text/plain
...     responses:
...         "200":
...             description: successful operation. Return "pong" text
...         "405":
...             description: invalid HTTP Method
...     """
...     return web.Response(text="pong")
...
>app = web.Application()
>app.router.add_route('GET', "/ping", ping)
<ResourceRoute [GET] <PlainResource  /ping> -> <function ping at 0x1066a6268>
>setup_swagger(app)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/aiohttp_swagger/__init__.py", line 65, in setup_swagger
    security_definitions=security_definitions,
  File "/usr/local/lib/python3.7/site-packages/aiohttp_swagger/helpers/builders.py", line 139, in generate_doc_from_each_end_point
    end_point_doc = _build_doc_from_func_doc(route)
  File "/usr/local/lib/python3.7/site-packages/aiohttp_swagger/helpers/builders.py", line 43, in _build_doc_from_func_doc
    if issubclass(route.handler, web.View) and route.method == METH_ANY:
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/abc.py", line 143, in __subclasscheck__
    return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class
@jaredvacanti
Copy link

I can confirm this after testing the most recent version just published today to PyPI.

@palko444
Copy link

Same issue is with 1.0.6, only 1.0.5 works for me

@cr0hn
Copy link
Owner

cr0hn commented Jul 17, 2019

I’m sorry. I have not time to check this issue. Can anyone help me?

@sirkonst
Copy link

I have same issue :-(

vkropotko added a commit to vkropotko/aiohttp-swagger that referenced this issue Jul 18, 2019
@vkropotko
Copy link
Contributor Author

Also, this requires to be merged to pass tests due to a sub_app issue.
#69

@vkropotko
Copy link
Contributor Author

#71

cr0hn added a commit that referenced this issue Jul 18, 2019
Update subclass of web.View verification. Issue #68
@cr0hn
Copy link
Owner

cr0hn commented Jul 18, 2019

I just merged some PR that aims to fix this issues in version 1.0.8.

@palko444
Copy link

Thank you @cr0hn, 1.0.8 is working ok for me, even with security definitions

vkropotko added a commit to vkropotko/aiohttp-swagger that referenced this issue Jul 18, 2019
@palko444
Copy link

So, there seems to be issue with swagger generation, its not getting properly HTTP method from function. Even if method is PUT, swagger is generated with GET.

@vkropotko
Copy link
Contributor Author

So, there seems to be issue with swagger generation, its not getting properly HTTP method from function. Even if method is PUT, swagger is generated with GET.

Yes, here is a fix for that - #72

cr0hn added a commit that referenced this issue Jul 25, 2019
Fix an issue with wrong methods in generated UI. Issue #68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants