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

How to use `swagger_from_file` when file is in the parent directory?

Open 0xLuz opened this issue 5 years ago • 1 comments

I have the following structure in my project:

project
     ├── core
     │      └── factory.py
     └── docs
             └── swagger.yaml

My core.factory.py loads the swagger.yaml in the build_app function with:

    setup_swagger(
        app,
        swagger_url='/docs',
        swagger_from_file="/../docs/swagger.yaml"
    )

But it crashes the app raising the error gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3> (If I remove setup_swagger it works normally).

I have tried:

  • swagger_from_file="/../docs/swagger.yaml"
  • swagger_from_file="../docs/swagger.yaml"
  • swagger_from_file="docs/swagger.yaml"

And they all have failed. So I came to ask for help on that. Is there a way to load the swagger file when that file is located the parent dir?

0xLuz avatar Mar 11 '20 17:03 0xLuz

I've the same structure and the swagger_from_file="docs/swagger.yaml" works just fine for me.

rafa-acioly avatar May 28 '20 20:05 rafa-acioly