Tolerant readers
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
write consumers that survive harmless change.
Planned topics
- Tolerant reader: read only the fields you need; ignore unknown ones.
- Do not fail on new fields, new enum values you can safely default, or reordered fields.
- Be strict about what you depend on: a missing required field is still an error.
- In Jackson, ignore unknown properties for external payloads (
FAIL_ON_UNKNOWN_PROPERTIESoff, or@JsonIgnoreProperties(ignoreUnknown = true)). - Map to your own model; do not leak the provider's DTO through your code.
Draft outline details
Demonstration
a consumer PaymentView record with three fields reading a payload that has fifteen.
Check your understanding
What should a tolerant reader do with an unknown field?
Show answer
Ignore it.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.