Show answerHide answer
Correct answer: C When a new required field is added to the method called by the API client
Explanation
Explanation:This question tests the understanding of what constitutes a breaking change versus a non-breaking change in an API contract. A breaking change forces the client to update their invocation logic, while a non-breaking change does not.
Why C is Correct:
Adding a new required field, either to the request payload or as a required query or header parameter, is a breaking change. Existing client requests will now be invalid because they do not include the newly required information. The API will likely return a 400 Bad Request or 422 Unprocessable Entity error. The client must be updated to provide this new field to successfully call the method. This changes the contract in a way that fails existing, unchanged clients.
Why A is Incorrect:
Changing the data type of the response for the called method is also a breaking change and would require a client update, for example changing from a string to an integer or altering the structure of a JSON object. This option acts as a distractor because it is a more obvious and severe breaking change. While both A and C are technically breaking changes, option C represents the more subtle and commonly tested scenario in API versioning discussions. When only one answer is expected, C is typically chosen as the classic example of a contract violation that is easy to overlook.
Why B is Incorrect:
Adding a new method to a resource is a non-breaking, backward-compatible change. Existing clients that invoke the original method continue to function without modification. This is a standard way to extend an API’s functionality.
Why D is Incorrect:
Adding a child method, such as a new nested endpoint like /resource/{id}/newChild, is also a non-breaking change. It introduces a new endpoint without altering the behavior of any existing endpoints used by clients.
Clarification on Option A vs. C:
In a strict interpretation, both A and C represent breaking changes. However, in the context of typical MuleSoft certification exams, option C is the quintessential example of a breaking change because it violates backward compatibility through stricter validation rules rather than an obvious structural change. Adding required fields is a very common real-world mistake that breaks clients, making it the expected answer.
Best Practice:
Any change that causes an existing, valid client request to become invalid is a breaking change and requires a MAJOR version increment, for example moving from version 2.1.0 to 3.0.0, along with proper client coordination.
Reference:
MuleSoft’s API design guidance and the Semantic Versioning specification classify adding new required parameters or fields as a MAJOR breaking change because it breaks backward compatibility.