Optional vs required fields in APIs
Many contracts mark fields as optional in documentation but treat them as required in practice. Over time, clients and servers form different assumptions about what must be present in a request or response.
How optional fields become required
- Business rules change, but the contract is not updated.
- Validation logic starts rejecting requests missing previously "optional" data.
- New clients start relying on data that older clients never sent.
Spotting optional/required drift
In the HTTP Contract Drift Inspector, fields that appear as null in the expected contract but have values in the actual payload are treated as optional fields gaining importance. Missing non-null example fields are flagged as breaking when strict contract mode is enabled.