Skip to content

Commit 066eb28

Browse files
authored
Merge pull request #98 from nanotaboada/feat/94-97-input-validation-422
feat(routes): add payload validation, return 422 on failure (#97, #94)
2 parents 279fb5b + ffbe49a commit 066eb28

6 files changed

Lines changed: 544 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- Field-level validation on `PlayerRequest` payloads using the `validator` crate (`#97`): all required string fields (`first_name`, `last_name`, `date_of_birth`, `position`, `abbr_position`, `team`, `league`) must be non-empty; `squad_number` must be in the range 1–99
13+
- Six new route-level integration tests covering validation failure scenarios for POST and PUT endpoints (`#97`)
14+
1215
### Changed
1316

17+
- POST `/players` and PUT `/players/squadnumber/{squad_number}` now return `422 Unprocessable Entity` for field validation failures; `400 Bad Request` is reserved for malformed JSON / wrong `Content-Type` (`#94`, `#97`)
18+
1419
### Fixed
1520

1621
### Removed

0 commit comments

Comments
 (0)