python - 如何要求端点的“fask_restplus”两个字段之一
问题描述
我有一个这样的模型:
my_resource_model = api.model(
RESOURCE_NAME,
'month_id': rest.fields.String,
'week_id': rest.fields.String
)
和这样的资源:
class MyResource(Resource):
@api.expect(my_resource_model):
def post(self):
# need to require either week_id *or* month_id is present in request
如何指定两个字段都不是必需的,但至少必须通过一个?
解决方案
推荐阅读
- c# - 谷歌地图显示两个目的地之间的不同距离
- python - 在使用 tkinter Button 小部件在 python 中传递参数时需要帮助
- python - 3D 数据(Python)上的单值分解(SVD)问题
- java - 无法将 JDBC 与 SQL Server 连接
- angular6 - 如何使用 AgmMap 进行反向地理编码?
- validation - 仅用于复制和粘贴值的脚本(GOOGLE 电子表格)
- firebase - 为云函数指定区域时出现异常“firebase.functions() 需要...无参数...”
- sql - 如何在 SSMS 中检查表的约束
- angular - 角度选择选项 ExpressionChangedAfterItHasBeenCheckedError
- python - Selenium / xpath - 找不到元素,找到父 div