Skip to content
Ameen Abozaid
Planned lessonJNR-013-L08

Demo: separating DTOs from domain models

  • Lesson 8 of 8
  • Junior
On This Lesson 3 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

stop serializing domain objects; prepares JNR-013-LAB1.

Draft outline details

Step by step

  1. Call the endpoint and see the raw Product JSON, including internal costCents.
  2. Create ProductResponse with only public fields.
  3. Add a mapper method toResponse(Product).
  4. Planned mistake: reuse one ProductDto for create, update, and response; clients can then send an id or change fields they should not. Fix: CreateProductRequest, UpdateProductRequest, ProductResponse.
  5. Rename a domain field and show the API response does not change.

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.

Type to search levels, phases, modules and lessons.