Curriculum
Phase 3
API Contracts, Validation, Errors, and Testing
Grow a working API into one that never breaks its consumers. Covers specifications, input validation, boundary values, error formats, status codes, testing, and compatibility.
- Topics
- 9
- topic groups
- Ready
- 120
- implemented tasks
- Total
- 120
- planned tasks
Topic 3-1
Turning an API spec into code
Connect a spec sheet, example responses, allowed fields, and DTOs to the implementation.
- Implemented
- 12
- Passed
- 0
- Planned
- 12
- Environment
- node:http / pseudo-HTTP / tests
- Goal
- A memo API protected by contracts and tests
Required Tasks
Exercises
- 01Accept the required fields for `POST /memos` exactly as specifiedAuto grading / FeedbackSign in
- 02Don't save the out-of-spec field `isAdmin`Auto grading / FeedbackSign in
- 03Return `createdAt` as an ISO string as shown in the response exampleAuto grading / FeedbackSign in
- 04Wrap the detail response in `{ data }`Auto grading / FeedbackSign in
- 05Add `meta.total` to the list responseAuto grading / FeedbackSign in
- 06Restrict `status` to the spec-defined enum onlyAuto grading / FeedbackSign in
- 07Implement the contract that returns 400 for undefined fieldsAuto grading / FeedbackSign in
- 08Exclude `passwordHash` from the user creation responseAuto grading / FeedbackSign in
- 09Normalize an unspecified optional `description` to `null`Auto grading / FeedbackSign in
- 10Use the same DTO formatting function for list and detailAuto grading / FeedbackSign in
- 11Return `id` as a number as the contract requiresAuto grading / FeedbackSign in
- 12Align the memo API response with the Phase 3 contractAuto grading / FeedbackSign in