Module 06 Activity
Scenario
Make the responses and errors something a client can rely on and handle.
What you build
Response models that filter, structured errors with stable codes, declared error responses and a versioning plan.
Steps
- Add a response model to every endpoint and prove it filters a field the handler returns.
- Give every error a stable machine-readable code alongside the human text, plus enough context to act on.
- Use 201 with a Location header for creation and 204 where a body would be meaningless.
- Declare every error response in the contract so callers see them without reading your source.
- Classify a list of proposed changes as safe or breaking, paying attention to enum direction.
- Write the versioning plan for the first breaking change you expect.
Evidence to hand in
- Evidence the response model filtered a field.
- The error format with codes and context.
- The 201 and 204 responses.
- The declared error responses in the schema.
- The change classification.
- The versioning plan.
Review checklist
- Every endpoint has a response model, and one is shown to filter a field.
- Every error carries a stable code and enough context to act on.
- Creation returns 201 with a Location header.
- Error responses are declared in the contract.
- The enum-direction rule is applied correctly in the classification.
