4

I have an existing written application where the APIs are written in following way:

@app.route('/')
def hello():
    return "Hello World":

I want to generate the Swagger documentation from this type of APIs. So far, I've tried few options but most of them generate documents from yml files or yml strings in docstring of a particular method.

I would like to use annotation based approach. There are few libraries which do that but they need to have class for each method which we don't have in code (and changing all of the code is not possible)

Can anybody give me some pointers? What do you use in your projects?

1 Answer 1

3

Have you tried flask-sillywalk? It is not quite what you're asking for, but the closest to the real thing I've seen so far.

Of course I'd also prefer something that would use the contents of the docstring to generate the input for swagger.

Update: There is flasgger. You put the swagger doc in the docstrings of the decorated flask-methods and flasgger will provide a new endpoint for your app with the generated output. Works very well!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.