Practise vocabulary for contract-first API development: API-first design, mock providers, schema evolution, and consumer-provider negotiation.
0 / 45 completed
1 / 45
Contract-first development means the API ___ is agreed upon before any implementation code is written.
In contract-first development, teams agree on the API contract (structure of requests and responses) before writing implementation code. This allows consumer and provider teams to work in parallel.
2 / 45
A ___ mock provider allows the consumer team to write and run their code against a simulated version of the provider during development.
A contract-driven mock (e.g., Pact's mock provider) simulates the provider based on the agreed contract interactions. The consumer tests against this mock, and the contract is then verified against the real provider.
3 / 45
Adding a new optional field to an existing API response is an example of a ___ change.
A backward-compatible change (additive change) doesn't break existing consumers because they ignore fields they don't know about. Breaking changes — removing or renaming fields, changing types — require consumer updates.
4 / 45
When a consumer needs a new field from the provider that doesn't exist yet, the appropriate approach in CDC is to ___.
CDC promotes consumer-provider collaboration: the consumer adds the new interaction to their contract, publishes it, and the provider team implements the required change to pass verification. This is explicit, traceable negotiation.
5 / 45
'Design by contract' in the Eiffel programming sense is ___ consumer-driven contract testing.
Eiffel's 'design by contract' (preconditions, postconditions, invariants in code) and consumer-driven contract testing (inter-service API contracts) are related concepts but different in scope and tooling. Distinguishing them shows precise technical vocabulary.
6 / 45
John: "Hey team, I'm implementing the new UserProfile API. I just finished the first draft of the response schema – it includes fields for `firstName`, `lastName`, and `email`. Should I push this to the branch now?"
John's approach demonstrates a core element of contract-first development: proposing and gaining agreement on the API structure upfront. While pushing a draft schema isn't *always* wrong, it bypasses crucial validation steps and stakeholder feedback. The correct response reflects the disciplined process of defining the API contract before implementation begins, reducing the likelihood of integration issues and rework. John should seek confirmation that the proposed schema aligns with the overall design.
7 / 45
Sarah: 'I've reviewed the PR for the new PaymentService. The team is using a mock provider to test the integration against it, but they're not documenting the contract clearly in the PR description. It just says 'mock data'. This isn't sufficient – we need to ensure everyone understands the expected response format before moving forward.'
Which of the following actions would Sarah recommend to improve this situation?
Sarah is highlighting a critical aspect of Contract-First Development: clear documentation of the API contract. While testing with mocks is important, simply stating 'mock data' isn't enough. Using tools like Swagger (or similar) automatically generates and maintains an up-to-date definition of the expected response format – this ensures everyone involved has a shared understanding and reduces integration issues later on. Focusing solely on functionality without contract documentation creates ambiguity and increases the risk of misinterpretation.
8 / 45
During a code review for the new OrderService API, David comments: 'I've created the initial response schema. It includes `orderId`, `totalAmount`, and a boolean flag `isShipped`. I'm pushing this to the feature branch now – it should be pretty straightforward.' Maria replies, 'David, while you're taking action, could you please add a note to the PR description outlining the expected data types for each field? Specifically, `totalAmount` is a decimal and `isShipped` must be a boolean. Without this clarification, we risk inconsistencies when consuming the API later.' Which of the following best represents Maria's concern?
Maria's concern highlights the importance of explicitly defining data types within a contract-first approach. Contract-First Development Language emphasizes precise specifications to prevent misinterpretations during implementation and consumption. Simply stating the fields doesn't convey crucial information like `totalAmount` being a decimal or `isShipped` needing a boolean value; this could lead to downstream errors when consuming the API.
9 / 45
PR Description: "Implemented the new UserProfile API endpoint. Returns a JSON object with fields for `firstName`, `lastName` and `email`. Mock data used for testing."
This scenario highlights the importance of detailed PR descriptions in contract-first development. Simply stating 'JSON object with fields...' is insufficient; the description needs to explicitly define the expected data types (e.g., `firstName` as a string, `lastName` as a string) and any constraints on the values. Without this, consumers risk misinterpreting the API response and creating integration bugs. The correct answer reflects the critical need for unambiguous specification of data types within the PR.
10 / 45
David is pushing a new API response schema for the `ProductSearch` service to his feature branch. The schema includes fields like `productId`, `productName`, and `price`. Later, another developer, Emily, consumes this API and encounters unexpected data types in the responses – sometimes `price` is a string, other times an integer. What's the most appropriate action for David to take *immediately* to prevent this issue from happening again?
The core principle of contract-first development is to clearly define the expected interface *before* implementation. David's responsibility is to ensure the API response schema accurately reflects the consumer's expectations. Adding comprehensive documentation to the PR description forces everyone involved – including Emily – to understand and adhere to these agreed-upon specifications, preventing downstream data type issues. Options A and B represent misunderstandings of CDC; the contract should define the expected types, not the consumer's handling of them. Option C is a dangerous approach that violates the fundamental principles.
11 / 45
John: "Hey team, I'm implementing the new UserProfile API. I just finished the first draft of the response schema – it includes fields for `firstName`, `lastName`, and `email`. Should I push this to the branch now?"
John's approach demonstrates a core element of contract-first development: proposing and gaining agreement on the API structure upfront. While pushing a draft schema isn't *always* wrong, it bypasses crucial validation steps and stakeholder feedback. The correct response reflects the disciplined process of defining the API contract before implementation begins, reducing the likelihood of integration issues and rework. John should seek confirmation that the proposed schema aligns with the overall design.
12 / 45
Sarah: 'I've reviewed the PR for the new PaymentService. The team is using a mock provider to test the integration against it, but they're not documenting the contract clearly in the PR description. It just says 'mock data'. This isn't sufficient – we need to ensure everyone understands the expected response format before moving forward.'
Which of the following actions would Sarah recommend to improve this situation?
Sarah is highlighting a critical aspect of Contract-First Development: clear documentation of the API contract. While testing with mocks is important, simply stating 'mock data' isn't enough. Using tools like Swagger (or similar) automatically generates and maintains an up-to-date definition of the expected response format – this ensures everyone involved has a shared understanding and reduces integration issues later on. Focusing solely on functionality without contract documentation creates ambiguity and increases the risk of misinterpretation.
13 / 45
During a code review for the new OrderService API, David comments: 'I've created the initial response schema. It includes `orderId`, `totalAmount`, and a boolean flag `isShipped`. I'm pushing this to the feature branch now – it should be pretty straightforward.' Maria replies, 'David, while you're taking action, could you please add a note to the PR description outlining the expected data types for each field? Specifically, `totalAmount` is a decimal and `isShipped` must be a boolean. Without this clarification, we risk inconsistencies when consuming the API later.' Which of the following best represents Maria's concern?
Maria's concern highlights the importance of explicitly defining data types within a contract-first approach. Contract-First Development Language emphasizes precise specifications to prevent misinterpretations during implementation and consumption. Simply stating the fields doesn't convey crucial information like `totalAmount` being a decimal or `isShipped` needing a boolean value; this could lead to downstream errors when consuming the API.
14 / 45
PR Description: "Implemented the new UserProfile API endpoint. Returns a JSON object with fields for `firstName`, `lastName` and `email`. Mock data used for testing."
This scenario highlights the importance of detailed PR descriptions in contract-first development. Simply stating 'JSON object with fields...' is insufficient; the description needs to explicitly define the expected data types (e.g., `firstName` as a string, `lastName` as a string) and any constraints on the values. Without this, consumers risk misinterpreting the API response and creating integration bugs. The correct answer reflects the critical need for unambiguous specification of data types within the PR.
15 / 45
David is pushing a new API response schema for the `ProductSearch` service to his feature branch. The schema includes fields like `productId`, `productName`, and `price`. Later, another developer, Emily, consumes this API and encounters unexpected data types in the responses – sometimes `price` is a string, other times an integer. What's the most appropriate action for David to take *immediately* to prevent this issue from happening again?
The core principle of contract-first development is to clearly define the expected interface *before* implementation. David's responsibility is to ensure the API response schema accurately reflects the consumer's expectations. Adding comprehensive documentation to the PR description forces everyone involved – including Emily – to understand and adhere to these agreed-upon specifications, preventing downstream data type issues. Options A and B represent misunderstandings of CDC; the contract should define the expected types, not the consumer's handling of them. Option C is a dangerous approach that violates the fundamental principles.
16 / 45
John: "Hey team, I'm implementing the new UserProfile API. I just finished the first draft of the response schema – it includes fields for `firstName`, `lastName`, and `email`. Should I push this to the branch now?"
John's approach demonstrates a core element of contract-first development: proposing and gaining agreement on the API structure upfront. While pushing a draft schema isn't *always* wrong, it bypasses crucial validation steps and stakeholder feedback. The correct response reflects the disciplined process of defining the API contract before implementation begins, reducing the likelihood of integration issues and rework. John should seek confirmation that the proposed schema aligns with the overall design.
17 / 45
Sarah: 'I've reviewed the PR for the new PaymentService. The team is using a mock provider to test the integration against it, but they're not documenting the contract clearly in the PR description. It just says 'mock data'. This isn't sufficient – we need to ensure everyone understands the expected response format before moving forward.'
Which of the following actions would Sarah recommend to improve this situation?
Sarah is highlighting a critical aspect of Contract-First Development: clear documentation of the API contract. While testing with mocks is important, simply stating 'mock data' isn't enough. Using tools like Swagger (or similar) automatically generates and maintains an up-to-date definition of the expected response format – this ensures everyone involved has a shared understanding and reduces integration issues later on. Focusing solely on functionality without contract documentation creates ambiguity and increases the risk of misinterpretation.
18 / 45
During a code review for the new OrderService API, David comments: 'I've created the initial response schema. It includes `orderId`, `totalAmount`, and a boolean flag `isShipped`. I'm pushing this to the feature branch now – it should be pretty straightforward.' Maria replies, 'David, while you're taking action, could you please add a note to the PR description outlining the expected data types for each field? Specifically, `totalAmount` is a decimal and `isShipped` must be a boolean. Without this clarification, we risk inconsistencies when consuming the API later.' Which of the following best represents Maria's concern?
Maria's concern highlights the importance of explicitly defining data types within a contract-first approach. Contract-First Development Language emphasizes precise specifications to prevent misinterpretations during implementation and consumption. Simply stating the fields doesn't convey crucial information like `totalAmount` being a decimal or `isShipped` needing a boolean value; this could lead to downstream errors when consuming the API.
19 / 45
PR Description: "Implemented the new UserProfile API endpoint. Returns a JSON object with fields for `firstName`, `lastName` and `email`. Mock data used for testing."
This scenario highlights the importance of detailed PR descriptions in contract-first development. Simply stating 'JSON object with fields...' is insufficient; the description needs to explicitly define the expected data types (e.g., `firstName` as a string, `lastName` as a string) and any constraints on the values. Without this, consumers risk misinterpreting the API response and creating integration bugs. The correct answer reflects the critical need for unambiguous specification of data types within the PR.
20 / 45
David is pushing a new API response schema for the `ProductSearch` service to his feature branch. The schema includes fields like `productId`, `productName`, and `price`. Later, another developer, Emily, consumes this API and encounters unexpected data types in the responses – sometimes `price` is a string, other times an integer. What's the most appropriate action for David to take *immediately* to prevent this issue from happening again?
The core principle of contract-first development is to clearly define the expected interface *before* implementation. David's responsibility is to ensure the API response schema accurately reflects the consumer's expectations. Adding comprehensive documentation to the PR description forces everyone involved – including Emily – to understand and adhere to these agreed-upon specifications, preventing downstream data type issues. Options A and B represent misunderstandings of CDC; the contract should define the expected types, not the consumer's handling of them. Option C is a dangerous approach that violates the fundamental principles.
21 / 45
John: "Hey team, I'm implementing the new UserProfile API. I just finished the first draft of the response schema – it includes fields for `firstName`, `lastName`, and `email`. Should I push this to the branch now?"
John's approach demonstrates a core element of contract-first development: proposing and gaining agreement on the API structure upfront. While pushing a draft schema isn't *always* wrong, it bypasses crucial validation steps and stakeholder feedback. The correct response reflects the disciplined process of defining the API contract before implementation begins, reducing the likelihood of integration issues and rework. John should seek confirmation that the proposed schema aligns with the overall design.
22 / 45
Sarah: 'I've reviewed the PR for the new PaymentService. The team is using a mock provider to test the integration against it, but they're not documenting the contract clearly in the PR description. It just says 'mock data'. This isn't sufficient – we need to ensure everyone understands the expected response format before moving forward.'
Which of the following actions would Sarah recommend to improve this situation?
Sarah is highlighting a critical aspect of Contract-First Development: clear documentation of the API contract. While testing with mocks is important, simply stating 'mock data' isn't enough. Using tools like Swagger (or similar) automatically generates and maintains an up-to-date definition of the expected response format – this ensures everyone involved has a shared understanding and reduces integration issues later on. Focusing solely on functionality without contract documentation creates ambiguity and increases the risk of misinterpretation.
23 / 45
During a code review for the new OrderService API, David comments: 'I've created the initial response schema. It includes `orderId`, `totalAmount`, and a boolean flag `isShipped`. I'm pushing this to the feature branch now – it should be pretty straightforward.' Maria replies, 'David, while you're taking action, could you please add a note to the PR description outlining the expected data types for each field? Specifically, `totalAmount` is a decimal and `isShipped` must be a boolean. Without this clarification, we risk inconsistencies when consuming the API later.' Which of the following best represents Maria's concern?
Maria's concern highlights the importance of explicitly defining data types within a contract-first approach. Contract-First Development Language emphasizes precise specifications to prevent misinterpretations during implementation and consumption. Simply stating the fields doesn't convey crucial information like `totalAmount` being a decimal or `isShipped` needing a boolean value; this could lead to downstream errors when consuming the API.
24 / 45
PR Description: "Implemented the new UserProfile API endpoint. Returns a JSON object with fields for `firstName`, `lastName` and `email`. Mock data used for testing."
This scenario highlights the importance of detailed PR descriptions in contract-first development. Simply stating 'JSON object with fields...' is insufficient; the description needs to explicitly define the expected data types (e.g., `firstName` as a string, `lastName` as a string) and any constraints on the values. Without this, consumers risk misinterpreting the API response and creating integration bugs. The correct answer reflects the critical need for unambiguous specification of data types within the PR.
25 / 45
David is pushing a new API response schema for the `ProductSearch` service to his feature branch. The schema includes fields like `productId`, `productName`, and `price`. Later, another developer, Emily, consumes this API and encounters unexpected data types in the responses – sometimes `price` is a string, other times an integer. What's the most appropriate action for David to take *immediately* to prevent this issue from happening again?
The core principle of contract-first development is to clearly define the expected interface *before* implementation. David's responsibility is to ensure the API response schema accurately reflects the consumer's expectations. Adding comprehensive documentation to the PR description forces everyone involved – including Emily – to understand and adhere to these agreed-upon specifications, preventing downstream data type issues. Options A and B represent misunderstandings of CDC; the contract should define the expected types, not the consumer's handling of them. Option C is a dangerous approach that violates the fundamental principles.
26 / 45
John: "Hey team, I'm implementing the new UserProfile API. I just finished the first draft of the response schema – it includes fields for `firstName`, `lastName`, and `email`. Should I push this to the branch now?"
John's approach demonstrates a core element of contract-first development: proposing and gaining agreement on the API structure upfront. While pushing a draft schema isn't *always* wrong, it bypasses crucial validation steps and stakeholder feedback. The correct response reflects the disciplined process of defining the API contract before implementation begins, reducing the likelihood of integration issues and rework. John should seek confirmation that the proposed schema aligns with the overall design.
27 / 45
Sarah: 'I've reviewed the PR for the new PaymentService. The team is using a mock provider to test the integration against it, but they're not documenting the contract clearly in the PR description. It just says 'mock data'. This isn't sufficient – we need to ensure everyone understands the expected response format before moving forward.'
Which of the following actions would Sarah recommend to improve this situation?
Sarah is highlighting a critical aspect of Contract-First Development: clear documentation of the API contract. While testing with mocks is important, simply stating 'mock data' isn't enough. Using tools like Swagger (or similar) automatically generates and maintains an up-to-date definition of the expected response format – this ensures everyone involved has a shared understanding and reduces integration issues later on. Focusing solely on functionality without contract documentation creates ambiguity and increases the risk of misinterpretation.
28 / 45
During a code review for the new OrderService API, David comments: 'I've created the initial response schema. It includes `orderId`, `totalAmount`, and a boolean flag `isShipped`. I'm pushing this to the feature branch now – it should be pretty straightforward.' Maria replies, 'David, while you're taking action, could you please add a note to the PR description outlining the expected data types for each field? Specifically, `totalAmount` is a decimal and `isShipped` must be a boolean. Without this clarification, we risk inconsistencies when consuming the API later.' Which of the following best represents Maria's concern?
Maria's concern highlights the importance of explicitly defining data types within a contract-first approach. Contract-First Development Language emphasizes precise specifications to prevent misinterpretations during implementation and consumption. Simply stating the fields doesn't convey crucial information like `totalAmount` being a decimal or `isShipped` needing a boolean value; this could lead to downstream errors when consuming the API.
29 / 45
PR Description: "Implemented the new UserProfile API endpoint. Returns a JSON object with fields for `firstName`, `lastName` and `email`. Mock data used for testing."
This scenario highlights the importance of detailed PR descriptions in contract-first development. Simply stating 'JSON object with fields...' is insufficient; the description needs to explicitly define the expected data types (e.g., `firstName` as a string, `lastName` as a string) and any constraints on the values. Without this, consumers risk misinterpreting the API response and creating integration bugs. The correct answer reflects the critical need for unambiguous specification of data types within the PR.
30 / 45
David is pushing a new API response schema for the `ProductSearch` service to his feature branch. The schema includes fields like `productId`, `productName`, and `price`. Later, another developer, Emily, consumes this API and encounters unexpected data types in the responses – sometimes `price` is a string, other times an integer. What's the most appropriate action for David to take *immediately* to prevent this issue from happening again?
The core principle of contract-first development is to clearly define the expected interface *before* implementation. David's responsibility is to ensure the API response schema accurately reflects the consumer's expectations. Adding comprehensive documentation to the PR description forces everyone involved – including Emily – to understand and adhere to these agreed-upon specifications, preventing downstream data type issues. Options A and B represent misunderstandings of CDC; the contract should define the expected types, not the consumer's handling of them. Option C is a dangerous approach that violates the fundamental principles.
31 / 45
John: "Hey team, I'm implementing the new UserProfile API. I just finished the first draft of the response schema – it includes fields for `firstName`, `lastName`, and `email`. Should I push this to the branch now?"
John's approach demonstrates a core element of contract-first development: proposing and gaining agreement on the API structure upfront. While pushing a draft schema isn't *always* wrong, it bypasses crucial validation steps and stakeholder feedback. The correct response reflects the disciplined process of defining the API contract before implementation begins, reducing the likelihood of integration issues and rework. John should seek confirmation that the proposed schema aligns with the overall design.
32 / 45
Sarah: 'I've reviewed the PR for the new PaymentService. The team is using a mock provider to test the integration against it, but they're not documenting the contract clearly in the PR description. It just says 'mock data'. This isn't sufficient – we need to ensure everyone understands the expected response format before moving forward.'
Which of the following actions would Sarah recommend to improve this situation?
Sarah is highlighting a critical aspect of Contract-First Development: clear documentation of the API contract. While testing with mocks is important, simply stating 'mock data' isn't enough. Using tools like Swagger (or similar) automatically generates and maintains an up-to-date definition of the expected response format – this ensures everyone involved has a shared understanding and reduces integration issues later on. Focusing solely on functionality without contract documentation creates ambiguity and increases the risk of misinterpretation.
33 / 45
During a code review for the new OrderService API, David comments: 'I've created the initial response schema. It includes `orderId`, `totalAmount`, and a boolean flag `isShipped`. I'm pushing this to the feature branch now – it should be pretty straightforward.' Maria replies, 'David, while you're taking action, could you please add a note to the PR description outlining the expected data types for each field? Specifically, `totalAmount` is a decimal and `isShipped` must be a boolean. Without this clarification, we risk inconsistencies when consuming the API later.' Which of the following best represents Maria's concern?
Maria's concern highlights the importance of explicitly defining data types within a contract-first approach. Contract-First Development Language emphasizes precise specifications to prevent misinterpretations during implementation and consumption. Simply stating the fields doesn't convey crucial information like `totalAmount` being a decimal or `isShipped` needing a boolean value; this could lead to downstream errors when consuming the API.
34 / 45
PR Description: "Implemented the new UserProfile API endpoint. Returns a JSON object with fields for `firstName`, `lastName` and `email`. Mock data used for testing."
This scenario highlights the importance of detailed PR descriptions in contract-first development. Simply stating 'JSON object with fields...' is insufficient; the description needs to explicitly define the expected data types (e.g., `firstName` as a string, `lastName` as a string) and any constraints on the values. Without this, consumers risk misinterpreting the API response and creating integration bugs. The correct answer reflects the critical need for unambiguous specification of data types within the PR.
35 / 45
David is pushing a new API response schema for the `ProductSearch` service to his feature branch. The schema includes fields like `productId`, `productName`, and `price`. Later, another developer, Emily, consumes this API and encounters unexpected data types in the responses – sometimes `price` is a string, other times an integer. What's the most appropriate action for David to take *immediately* to prevent this issue from happening again?
The core principle of contract-first development is to clearly define the expected interface *before* implementation. David's responsibility is to ensure the API response schema accurately reflects the consumer's expectations. Adding comprehensive documentation to the PR description forces everyone involved – including Emily – to understand and adhere to these agreed-upon specifications, preventing downstream data type issues. Options A and B represent misunderstandings of CDC; the contract should define the expected types, not the consumer's handling of them. Option C is a dangerous approach that violates the fundamental principles.
36 / 45
John: "Hey team, I'm implementing the new UserProfile API. I just finished the first draft of the response schema – it includes fields for `firstName`, `lastName`, and `email`. Should I push this to the branch now?"
John's approach demonstrates a core element of contract-first development: proposing and gaining agreement on the API structure upfront. While pushing a draft schema isn't *always* wrong, it bypasses crucial validation steps and stakeholder feedback. The correct response reflects the disciplined process of defining the API contract before implementation begins, reducing the likelihood of integration issues and rework. John should seek confirmation that the proposed schema aligns with the overall design.
37 / 45
Sarah: 'I've reviewed the PR for the new PaymentService. The team is using a mock provider to test the integration against it, but they're not documenting the contract clearly in the PR description. It just says 'mock data'. This isn't sufficient – we need to ensure everyone understands the expected response format before moving forward.'
Which of the following actions would Sarah recommend to improve this situation?
Sarah is highlighting a critical aspect of Contract-First Development: clear documentation of the API contract. While testing with mocks is important, simply stating 'mock data' isn't enough. Using tools like Swagger (or similar) automatically generates and maintains an up-to-date definition of the expected response format – this ensures everyone involved has a shared understanding and reduces integration issues later on. Focusing solely on functionality without contract documentation creates ambiguity and increases the risk of misinterpretation.
38 / 45
During a code review for the new OrderService API, David comments: 'I've created the initial response schema. It includes `orderId`, `totalAmount`, and a boolean flag `isShipped`. I'm pushing this to the feature branch now – it should be pretty straightforward.' Maria replies, 'David, while you're taking action, could you please add a note to the PR description outlining the expected data types for each field? Specifically, `totalAmount` is a decimal and `isShipped` must be a boolean. Without this clarification, we risk inconsistencies when consuming the API later.' Which of the following best represents Maria's concern?
Maria's concern highlights the importance of explicitly defining data types within a contract-first approach. Contract-First Development Language emphasizes precise specifications to prevent misinterpretations during implementation and consumption. Simply stating the fields doesn't convey crucial information like `totalAmount` being a decimal or `isShipped` needing a boolean value; this could lead to downstream errors when consuming the API.
39 / 45
PR Description: "Implemented the new UserProfile API endpoint. Returns a JSON object with fields for `firstName`, `lastName` and `email`. Mock data used for testing."
This scenario highlights the importance of detailed PR descriptions in contract-first development. Simply stating 'JSON object with fields...' is insufficient; the description needs to explicitly define the expected data types (e.g., `firstName` as a string, `lastName` as a string) and any constraints on the values. Without this, consumers risk misinterpreting the API response and creating integration bugs. The correct answer reflects the critical need for unambiguous specification of data types within the PR.
40 / 45
David is pushing a new API response schema for the `ProductSearch` service to his feature branch. The schema includes fields like `productId`, `productName`, and `price`. Later, another developer, Emily, consumes this API and encounters unexpected data types in the responses – sometimes `price` is a string, other times an integer. What's the most appropriate action for David to take *immediately* to prevent this issue from happening again?
The core principle of contract-first development is to clearly define the expected interface *before* implementation. David's responsibility is to ensure the API response schema accurately reflects the consumer's expectations. Adding comprehensive documentation to the PR description forces everyone involved – including Emily – to understand and adhere to these agreed-upon specifications, preventing downstream data type issues. Options A and B represent misunderstandings of CDC; the contract should define the expected types, not the consumer's handling of them. Option C is a dangerous approach that violates the fundamental principles.
41 / 45
John: "Hey team, I'm implementing the new UserProfile API. I just finished the first draft of the response schema – it includes fields for `firstName`, `lastName`, and `email`. Should I push this to the branch now?"
John's approach demonstrates a core element of contract-first development: proposing and gaining agreement on the API structure upfront. While pushing a draft schema isn't *always* wrong, it bypasses crucial validation steps and stakeholder feedback. The correct response reflects the disciplined process of defining the API contract before implementation begins, reducing the likelihood of integration issues and rework. John should seek confirmation that the proposed schema aligns with the overall design.
42 / 45
Sarah: 'I've reviewed the PR for the new PaymentService. The team is using a mock provider to test the integration against it, but they're not documenting the contract clearly in the PR description. It just says 'mock data'. This isn't sufficient – we need to ensure everyone understands the expected response format before moving forward.'
Which of the following actions would Sarah recommend to improve this situation?
Sarah is highlighting a critical aspect of Contract-First Development: clear documentation of the API contract. While testing with mocks is important, simply stating 'mock data' isn't enough. Using tools like Swagger (or similar) automatically generates and maintains an up-to-date definition of the expected response format – this ensures everyone involved has a shared understanding and reduces integration issues later on. Focusing solely on functionality without contract documentation creates ambiguity and increases the risk of misinterpretation.
43 / 45
During a code review for the new OrderService API, David comments: 'I've created the initial response schema. It includes `orderId`, `totalAmount`, and a boolean flag `isShipped`. I'm pushing this to the feature branch now – it should be pretty straightforward.' Maria replies, 'David, while you're taking action, could you please add a note to the PR description outlining the expected data types for each field? Specifically, `totalAmount` is a decimal and `isShipped` must be a boolean. Without this clarification, we risk inconsistencies when consuming the API later.' Which of the following best represents Maria's concern?
Maria's concern highlights the importance of explicitly defining data types within a contract-first approach. Contract-First Development Language emphasizes precise specifications to prevent misinterpretations during implementation and consumption. Simply stating the fields doesn't convey crucial information like `totalAmount` being a decimal or `isShipped` needing a boolean value; this could lead to downstream errors when consuming the API.
44 / 45
PR Description: "Implemented the new UserProfile API endpoint. Returns a JSON object with fields for `firstName`, `lastName` and `email`. Mock data used for testing."
This scenario highlights the importance of detailed PR descriptions in contract-first development. Simply stating 'JSON object with fields...' is insufficient; the description needs to explicitly define the expected data types (e.g., `firstName` as a string, `lastName` as a string) and any constraints on the values. Without this, consumers risk misinterpreting the API response and creating integration bugs. The correct answer reflects the critical need for unambiguous specification of data types within the PR.
45 / 45
David is pushing a new API response schema for the `ProductSearch` service to his feature branch. The schema includes fields like `productId`, `productName`, and `price`. Later, another developer, Emily, consumes this API and encounters unexpected data types in the responses – sometimes `price` is a string, other times an integer. What's the most appropriate action for David to take *immediately* to prevent this issue from happening again?
The core principle of contract-first development is to clearly define the expected interface *before* implementation. David's responsibility is to ensure the API response schema accurately reflects the consumer's expectations. Adding comprehensive documentation to the PR description forces everyone involved – including Emily – to understand and adhere to these agreed-upon specifications, preventing downstream data type issues. Options A and B represent misunderstandings of CDC; the contract should define the expected types, not the consumer's handling of them. Option C is a dangerous approach that violates the fundamental principles.
What will I practice in "Contract-First Development Language"?
This is an API Contract Testing exercise set. It walks through 45 scenario-based multiple-choice questions built around real usage of API Contract Testing terminology that IT professionals encounter on the job.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to complete with no account, sign-up, or paywall.
How many questions are in this exercise?
This set contains 45 questions. Each one shows immediate feedback and a detailed explanation after you answer, so you learn the correct usage right away rather than waiting for a final score.
Do I need prior experience to complete this exercise?
No prior experience is required. Each question includes a full explanation covering the reasoning behind the correct answer, so the exercise itself teaches the API Contract Testing vocabulary as you go.
Can I retry the exercise if I get questions wrong?
Yes — use the "Try again" button on the results screen to reset your answers and go through all the questions again. There is no limit on attempts.
Is my progress saved?
Your answers and score for the current session are tracked in the browser as you go. No account or login is needed, and there is nothing to install.
What if I don't understand a term used in a question?
Read the explanation shown after you answer each question — it breaks down the correct term in plain English with a real-world example. You can also check the site Glossary for quick definitions.
How is this different from reading a blog article on the topic?
Exercises like this one are interactive drills that test and reinforce specific vocabulary through multiple-choice questions, while blog articles explain concepts in prose. Practising here after reading builds active recall, not just passive recognition.
Where can I find more API Contract Testing exercises?
See the API Contract Testing exercises hub for the full set of related pages, or browse all exercise categories from the main Exercises index.
Can I use this exercise to prepare for a technical interview?
Yes — API Contract Testing vocabulary comes up often in technical discussions and interviews. Pair this exercise with our dedicated Interview Preparation section for role-specific practice.