...
Check at least one of allowed field is submitted and has value:
first_name
last_name
second_name
gender
external_id
birth_date
emergency_contact
death_date
In case of error - return 422 (Schema validation failed)
Check if any forbidden field is submitted:
note
status
In case of error - return 422 (Schema validation failed)
Validate
...
fields
Validate external_id according to regexp -
8-10.8-10.1-10 [0-9
Validate birth_date - must be <= today()
else error 422 "Birth date can't be in the future"Validate death_date < now():
In case of error - return 422 - “Death date can not be in future”
Validate death_date > = birth_date:
else error 422 "Death date should equal or greater than birth_date"
If submitted, set mpi.preperson.status = inactive
...