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

Add setup_swagger(path_prefix) parameter

Open asvetlov opened this issue 7 years ago • 3 comments

The param should be used as prefix to yaml definitions.

Now swagger_path accepts either absolute path or relative to current directory.

The parameter will allow to use relative to prefix paths.

Moreover, we could add loader concept like Jinja2 loaders -- I believe it makes sense.

asvetlov avatar Oct 25 '16 14:10 asvetlov

Use of path_prefix could be good idea, but initially I choose this approach thinking in simplicity.

You're right that in the swagger_path is missing the consideration of relative / absolute paths. I'll take a look.

cr0hn avatar Oct 25 '16 15:10 cr0hn

Thinking on simplicity I'm inclining to adding loaders. If no loader is specified by setup_swagger call the path is just a path (relative to current folder or absolute). But if the loader is specified the path is not file path but a parameter for loader. It could be relative path or just a name if dict -- it depends on loader which accepts the parameter. Just like jinja2 does.

We'll keep basic usage simple but allow to use very complex ways for yaml spec finding.

asvetlov avatar Oct 25 '16 15:10 asvetlov

fixed in #34

olexandr-klymenko avatar Oct 25 '17 09:10 olexandr-klymenko