How to complete the challenge POST /api/todos (422) title too long
Issue a POST request to /api/todos with a title longer than the maximum allowed length.
{
"title": "this title has far too many characters to validate.",
"doneStatus": true,
"description": "should trigger a 422 error"
}
The response should be 422 Unprocessable Content.
{
"errorMessages": [
"Failed Validation: Maximum allowable length exceeded for title - maximum allowed is 50"
]
}
Try it now
POST /api/todos with a long title to trigger 422
Lessons Learned
titlehas its own maximum length and should be tested separately fromdescription.- A field-length error should not depend on the rest of the payload being unusual.
- Title boundaries matter because titles are required and visible in collection summaries.
Suggested Experiments
- Compare a
50charactertitlewith a51charactertitlewhile keepingdescriptionshort. - Test an empty
titleseparately to distinguish missing or blank validation from length validation.