Sanic OpenAPI 3

Getting started

Here is an example to use Sanic-OpenAPI 2:

from sanic import Sanic
from sanic.response import json

from sanic_openapi import openapi3_blueprint

app = Sanic("Hello world")
app.blueprint(openapi3_blueprint)


@app.route("/")
async def test(request):
    return json({"hello": "world"})


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)

And you can get your Swagger document at http://localhost:8000/swagger like this: ../_images/hello_world_example1.png