How to use JSON Schema to require one of two fields

You need to add:

"anyOf": [
  { "required":
    [ "emailAddress" ] },
  { "required":
    [ "PhoneNumber" ] }
]

to the schema of RecordObject property.

It requires that at least one of fields is present. If you need exactly one field (i.e., not both) present, you need to use “oneOf” keyword (the rest should be the same).

This reference of JSON Schema keywords can be useful.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)