내가 개발 한 Restable API에 대한 문서를 생성하기 위해 Swagger를 발견했지만, 플라스크를 사용하지 않을 때 플래쉬를 사용하지 않고 편안하게 플라스크를 사용하려고합니다.Flask만으로 Swagger 사용하기
from sqlalchemy.orm import create_session
from flask import Flask, request, jsonify
from Model import *
from flask_restful import Api
from flask_restful_swagger import swagger
app = Flask(__name__)
api = swagger.docs(Api(app), apiVersion='0.1', api_spec_url="/api/spec")
session = create_session(bind=engine)
@app.route('/employees/', methods=['GET'])
@swagger.operation(
parameters=[
{
"name": "body",
"description": "Get the empployees in the shop.",
"required": True,
"allowMultiple": False,
"dataType": NsEmployee.__name__,
"paramType": "body"
}
],
responseMessages=[
{
"code": 201,
"message": "Created. The URL of the created blueprint should be in the Location header"
},
{
"code": 405,
"message": "Invalid input"
}
])
def employees():
if request.method == 'GET':
# do something...
return jsonify(json_results)
if __name__ == '__main__':
app.run(debug=True)
을하지만 /api/spec/
를 얻을 때 나는를 찾을 수 없음 을 구하십시오 -swagger가이 같은 예를 들어 뭔가를, 작동하지 않습니다 래퍼. 내 질문은 플라스크 - 안락한 - 스 저거의 사용을 피하고 플라스크와 함께 스 내거를 통합 할 수있는 방법이 있다는 것입니다.
도움을 주시면 감사하겠습니다.