Skip to content
Ameen Abozaid
Planned lessonJNR-021-L03

Examples and error responses

  • Lesson 3 of 5
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

make the docs useful, not just generated.

Planned topics

  • Add a short description to each operation and field.
  • Add realistic examples for requests and responses so newcomers can copy them.
  • Document the error responses (400, 404, 409) with the Problem Details shape.
  • Undocumented errors force clients to guess.
  • Use @ApiResponse on operations, or a shared configuration for common errors.
Draft outline details

Demonstration

java
@Operation(summary = "Get a product")
@ApiResponse(responseCode = "404", description = "Product not found")
@GetMapping("/{id}")
ProductResponse get(@PathVariable long id) { ... }

Check your understanding

Why document 404?

Show answer

Clients need to know what can go wrong and what it looks like.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.