Configuring breaking changes
Customize breaking changes in your own way.Not every change that could be breaking is breaking for your API.
openapi-changes lets you customize which changes are flagged as breaking, so you can tailor the rules
to match your API’s versioning strategy and consumer expectations.
This feature is available from
v0.0.91
How it works
By default, openapi-changes uses libopenapi’s built-in breaking change rules.
These rules are sensible defaults that work for most APIs, but sometimes you need more control.
You can override any rule by creating a configuration file called changes-rules.yaml (this is the default config file name).
Using a config file
Explicit config file
Use the --config or -c flag to specify a config file:
Auto-detected config
If you don’t specify a config file, openapi-changes automatically looks for changes-rules.yaml in the following places:
- The current working directory (
./changes-rules.yaml) - Your home config directory (
~/.config/changes-rules.yaml)
openapi-changes uses the
default breaking rules from libopenapi.Configuration structure
Each rule in the config file has three options:
addedis adding this property a breaking change?modifiedis modifying this property a breaking change?removedis removing this property a breaking change?
Set any option to true (breaking) or false (not breaking).
Real-world examples
Relaxed mode for deprecation workflows
When you’re deprecating endpoints, removing them isn’t really breaking, your consumers have been warned. This config makes operation and path removals non-breaking:
# changes-rules.yaml - Relaxed rules for deprecation workflows
pathItem:
get:
removed: false
post:
removed: false
put:
removed: false
delete:
removed: false
patch:
removed: false
options:
removed: false
head:
removed: false
trace:
removed: false
Flexible enum handling
Enum changes are often flagged as breaking, but in practice, adding new enum values is usually safe (consumers should handle unknown values), and removing values might be acceptable in some contexts:
# changes-rules.yaml - Flexible enum handling
schema:
enum:
added: false # Adding new enum values is safe
removed: false # Removing enum values is acceptable
modified: false # Reordering enum values is fine
Strict mode for new APIs
For brand new APIs in active development, you might want stricter rules that flag more changes as breaking to ensure stability:
# changes-rules.yaml - Strict mode for new APIs
schema:
description:
modified: true # Even description changes should be reviewed
example:
modified: true # Example changes could affect consumer tests
operation:
summary:
modified: true # Summary changes need review
description:
modified: true # Description changes need review
Ignoring optional parameter changes
If your API consumers are expected to handle optional parameters gracefully, you can make adding new optional parameters non-breaking:
# changes-rules.yaml - Flexible optional parameters
parameter:
required:
modified: false # Changing required status is acceptable
schema:
required:
modified: false # Schema required changes are acceptable
Full example with multiple overrides
Here’s a comprehensive example combining several common overrides:
# changes-rules.yaml - Production API rules
#
# These rules are tailored for a mature API with:
# - Deprecation workflows (removals are expected)
# - Flexible enum handling (consumers handle unknowns)
# - Strict parameter rules (parameters are contracted)
# Operation/endpoint removals are expected (deprecation workflow)
pathItem:
get:
removed: false
post:
removed: false
put:
removed: false
delete:
removed: false
patch:
removed: false
# Enum handling - consumers should handle unknown values
schema:
enum:
added: false
removed: false
# Security changes should always be flagged
securityRequirement:
added: true
removed: true
modified: true
Configurable objects
pathsPath definitionspathItemOperations (get, post, put, delete, patch, etc.)operationOperation details (operationId, requestBody, etc.)parameterParameter properties (name, required, schema, in)schemaSchema properties (type, format, enum, properties)responseResponse definitionssecuritySchemeSecurity scheme propertiessecurityRequirementSecurity requirements on operationsheaderHeader definitionsmediaTypeMedia type definitions (content types)callbackCallback definitions
For the complete list of configurable properties within each component, see the default breaking rules reference in the libopenapi documentation.
What’s next?
Now that you know how to customize breaking change detection, check out:
- Command arguments for all available flags
- Summary command for CI/CD-friendly output
- HTML report for visual change exploration