基于连接 class 的处理
Connexion class based handling
我正在为 Flask 使用 connexion 框架。我想将几个相关函数分组到一个 class 中,我想知道 class 的方法是否可以用于 operationId 而不是函数。
类似
class Job:
def get():
"something"
def post():
"something"
在描述 yaml
文件中:
paths:
/hello:
post:
operationId: myapp.api.Job.post
您可以使用这些方法,如果它们在 class 上作为静态方法可用:
class Job:
@staticmethod
def get():
"something"
@staticmethod
def post():
"something"
我正在为 Flask 使用 connexion 框架。我想将几个相关函数分组到一个 class 中,我想知道 class 的方法是否可以用于 operationId 而不是函数。
类似
class Job:
def get():
"something"
def post():
"something"
在描述 yaml
文件中:
paths:
/hello:
post:
operationId: myapp.api.Job.post
您可以使用这些方法,如果它们在 class 上作为静态方法可用:
class Job:
@staticmethod
def get():
"something"
@staticmethod
def post():
"something"