Как файл Open API v3 swagger. json структурирован на основе моего flask сервера API ниже?
Большое спасибо!
------- -------- Python v3 -------------
#!python3
from flask import Flask, jsonify
from flask import request
from flask import make_response
from flask import abort
from flask import url_for
import math
from flasgger import Swagger
from flasgger.utils import swag_from
app = Flask(__name__)
Swagger(app)
#Sum
#curl -i http://localhost:5000/cal/api/v1.0/sum/2,3
@app.route('/cal/api/v1.0/sum/<int:num1>,<int:num2>', methods=['GET'])
@swag_from('swagger.json')
def get_sum(num1,num2):
sum = num1 + num2
return jsonify({"num1 + num2 = ": sum})
#Substraction
@app.route('/cal/api/v1.0/sub/<int:num1>,<int:num2>', methods=['GET'])
def get_sub(num1,num2):
sub = num1 - num2
return jsonify({"num1 - num2 = ": sub})
if __name__ == '__main__':
app.run(debug=True)