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

Can't use apispec tornado plugin icw complex paths #13

Open
lafrech opened this issue Nov 3, 2018 · 1 comment
Open

Can't use apispec tornado plugin icw complex paths #13

lafrech opened this issue Nov 3, 2018 · 1 comment
Labels
tornado Tornado framework

Comments

@lafrech
Copy link
Member

lafrech commented Nov 3, 2018

Issue by p0psicles
Monday Dec 11, 2017 at 19:41 GMT
Originally opened as marshmallow-code/apispec#176


I'm trying to use apispec icw the 'apispec.ext.tornado' and 'apispec.ext.marshmallow' plugins.
Only i'm getting the following error:

Traceback (most recent call last):
  File "D:\JetBrains\PyCharm 2017.2.4\helpers\pydev\pydevd.py", line 1599, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "D:\JetBrains\PyCharm 2017.2.4\helpers\pydev\pydevd.py", line 1026, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "D:\myproj/start.py", line 7, in <module>
    main()
  File "D:\myproj\medusa\__main__.py", line 2104, in main
    application.start(sys.argv[1:])
  File "D:\myproj\medusa\__main__.py", line 347, in start
    self.web_server = AppWebServer(self.web_options)
  File "D:\myproj\medusa\server\core.py", line 230, in __init__
    spec.add_path(urlspec=urlspec)
  File "D:\Python27\lib\site-packages\apispec\core.py", line 211, in add_path
    raise APISpecError('Path template is not specified')
apispec.exceptions.APISpecError: Path template is not specified

It seems to be happening because matcher._path is None.
https://github.com/marshmallow-code/apispec/blob/dev/apispec/ext/tornado.py#L95

urlspec.matcher._path returns None, because of this:
https://github.com/tornadoweb/tornado/blob/master/tornado/routing.py#L571

And my route looks like this:
'/api/v2/series/(?P<series_slug>\\w+)/episode(?:(?:(?:(?:/(?P<episode_slug>[\\w-]+))|/?)(?:(?:/(?P<path_param>\\w+))|/?))|/?)/?$'

So because the tornado plugin uses the matcher._path, it's can't translate to an OpenApi compliant path.
Is there anything I can do about it?

@lafrech
Copy link
Member Author

lafrech commented Nov 3, 2018

Comment by p0psicles
Sunday Mar 25, 2018 at 11:07 GMT


I still think this is a bug. I'll try to look for a workaround. But any help would be really welcome.

@lafrech lafrech added plugins tornado Tornado framework and removed plugins labels Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tornado Tornado framework
Projects
None yet
Development

No branches or pull requests

1 participant