0

I am using flask-restful, webargs, marshmallow and flasgger. My code looks something like this:

#flasgger_yamlsv2 dir is in resources, so is this method
@swag_from('flasgger_yamlsv2/xyz.yml')
#MySchema is a marshmallow schema
@use_args(MySchema())
def get(self, args):
    data = method1(args)
    json.loads(data)

On loading apidocs url the templates are being looked for in lib/python3.6/site-packages/webargs . Things work when I move flasgger_yamlsv2 to that location. However I do not want to. Want to keep them as part of the src and not the lib

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
ortiv
  • 171
  • 1
  • 7

1 Answers1

0

My answer could be a bit naive but isn't the "file:" directive the answer to your problem ?

@app.route('/colors/<palette>/')
def colors(palette):
    """
    file: colors.yml
    """
    ...

from : https://github.com/flasgger/flasgger

Gwi
  • 1
  • I did try that the behavior is same as @swag_from, with the code that you have written you would expect that file.yml will be picked up from the current dir however thats not what happens, flasgger tries to find the yml file in lib/python3.6/site-packages/webargs. I think this might be because of use_args from webargs but I am not sure. – ortiv Nov 07 '19 at 23:04