test

from flask import render_template
import connexion

port = 5984
# Create the application instance
app = connexion.App(__name__, specification_dir='./')

# Read the swagger.yml file to configure the endpoints
app.add_api('openAPI3.yaml')
# If we're running in stand alone mode, run the application
if __name__ == '__main__':
    print("Launch gevent server on port: {port}".format(port=port))
    app.run(port=port, server='gevent')


mac_apis.py
def test():
    return "sccuess"

openAPI3.yaml

openapi: 3.0.0
info:
  version: 1.0.0
  title: Mac API
servers:
  - url: /webexclient

paths:
  /test:
    get:
      operationId: mac_apis.test
      summary: mac_apis.test
      responses:
        '200':
          description: Successfully test
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Bad Request
原文地址:https://www.cnblogs.com/zhizhao/p/11543487.html