Consumer-driven contracts
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 a contract from the consumer's needs.
Planned topics
- The consumer states what it uses from the provider: request and the response fields it reads.
- The contract is a file (Pact JSON, or a Spring Cloud Contract definition) generated from consumer tests.
- The provider verifies it against the real provider code, with no consumer running.
- Match only what the consumer needs (types, required fields), not the whole payload.
- Both sides review the contract; writing it from the provider alone defeats the point.
Draft outline details
Demonstration
orders (consumer) expects GET /stock/{sku} returns {sku: string, available: integer}; the Pact file records exactly that.
Check your understanding
Who writes the contract's expectations?
Show answer
The consumer, from what it actually uses.
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.