3

I have a model like this:

my_resource_model = api.model(
  RESOURCE_NAME,
  'month_id': rest.fields.String,
  'week_id': rest.fields.String
)

And a Resource like this:

class MyResource(Resource):
  @api.expect(my_resource_model):
  def post(self):
    # need to require either week_id *or* month_id is present in request 

How can I specify that both fields are not required but at least one must be passed?

Jon Rose
  • 1,457
  • 1
  • 15
  • 25
  • You can refer to this solution: https://stackoverflow.com/questions/29703979/flask-conditional-validation-on-multiple-form-fields – Hasni Iheb Sep 21 '19 at 17:07

0 Answers0