How to complete the challenge POST /api/todos (422) extra
Issue a POST request to /api/todos with a field that is not part of the todo schema.
{
"title": "create new todo",
"doneStatus": false,
"description": "created via API Challenges",
"extra": "not part of the schema"
}
The response should be 422 Unprocessable Content because the payload is syntactically valid, but the todo data cannot be processed as a todo.
Try it now
POST /api/todos with an extra field to trigger 422
Lessons Learned
- Strict request-body validation can reject fields that are syntactically valid
JSONbut outside the schema. - Extra-field tests reveal whether the API ignores unknown data or treats it as a client error.
422 Unprocessable Contenthere is about contract enforcement, not media type.
Suggested Experiments
- Add one unknown property, then add two, and compare whether the error identifies all unexpected fields.
- Remove only the extra property and confirm the same payload becomes a successful create.