You need to add docs to the view-func. The first line is the summary, and the rest is the description. Like this:
1234567
@app.get('/book/<int:bid>',tags=[book_tag],responses={200:BookResponse},security=security)defget_book(path:BookPath,query:BookBody):"""Get book Get some book by id, like: http://localhost:5000/book/3 """return{"code":0,"message":"ok","data":{"bid":path.bid,"age":query.age,"author":query.author}}
Now keyword parameters summary and description is supported, it will be take first.
1234567
@app.get('/book/<int:bid>',summary="new summary",description='new description')defget_book(path:BookPath,query:BookBody):"""Get book Get some book by id, like: http://localhost:5000/book/3 """return{"code":0,"message":"ok","data":{}}
fromflask_openapi3importOpenAPI,ExternalDocumentationapp=OpenAPI(__name__,info=info)@app.get('/book/<int:bid>',tags=[book_tag],summary='new summary',description='new description',external_docs=ExternalDocumentation(url="https://www.openapis.org/",description="Something great got better, get excited!"))defget_book(path:BookPath):...
You can set a custom callback to automatically set operation_id for an api (operation).
Just add a operation_id_callback param to the constructor of OpenAPI or APIBlueprint or APIView.
The example shows setting the default operation_id to be the function name, in this case create_book.
An array of Server Objects, which provide connectivity information to a target server. If the server's property is not provided, or is an empty array, the default value would be a Server Object with an url value of /.
While the OpenAPI Specification tries to accommodate most use cases,
additional data can be added to extend the specification at certain points.
See Specification Extensions.