refactor(api): unify typed error contract across draft pricing and publish flows

standardize typed error responses across draft, pricing and publish endpoints

reduce contract drift between related flows
keep client-side handling more predictable and consistent
This commit is contained in:
greebo
2026-03-19 19:54:42 +03:00
parent 64ec1c5180
commit af175d88dd
7 changed files with 89 additions and 38 deletions

View File

@@ -164,3 +164,18 @@ Additional draft read-side stale checks:
- GET /api/v1/schemes/{scheme_id}/draft/groups/records/{group_record_id}?expected_scheme_version_id={current_version_id} -> 200
- same endpoints with stale expected_scheme_version_id -> 409
## 11. Typed error contract
Validate representative failures return JSON detail objects with:
- code
- message
Recommended checks:
- stale_draft_version -> 409
- stale_current_version -> 409
- duplicate_sector_id / duplicate_group_id -> 422
- unknown_sector_id / unknown_group_id -> 422
- invalid_amount -> 422
- publish_validation_failed -> 409