Agent Wranglers

API-27Required

Make only additive changes

Change a live API only by adding optional inputs, response fields, endpoints or enum values. Never remove, rename or retype what clients use.

How to do it

Treat these as breaking. Removing or renaming a field, adding a required input, tightening validation, changing a default and changing a status code. A new value in a response enum is safe only once clients are told to accept unknown values, as in tolerant clients. Check every change against the released contract before it merges. Catch a removed or renamed field in CI with Check the contract between services.

Examples

Shell example

oasdiff breaking released/openapi.yaml openapi.yaml --fail-on ERR

How to check

A tool such as oasdiff compares the new OpenAPI file with the released one, and the build fails on any breaking change.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/changes-over-time/additive-changes">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.