request-property-pattern-added

Request property pattern set.

directionrequestareaschemakindconstraintsactionadd

Breaking change (level: error)

It adds a constraint to a request value, so values that were accepted before can now be rejected.

What this check detects

A pattern constrains a string property to a regular expression. When a request property has no pattern, any string is accepted; adding one narrows what the server will accept.

This is a breaking change because values that were valid before, but that do not match the new expression, are now rejected. Existing clients that happened to send such values start failing validation with no change on their side.

Example

Before
After
1schema:1schema:
2 type: object2 type: object
3 properties:3 properties:
4 username:4 username:
5 type: string5 type: string
6 pattern: '^[a-z0-9]+$'

A pattern now constrains the "username" request property. Values that were valid before, such as "John_Doe", are now rejected.

How to handle this change

When oasdiff flags request-property-pattern-added, you have a few ways to respond:

  • Find a backward-compatible alternative. Redesign the change so clients that followed the old contract keep working, and agree on the approach with whoever introduced it.
  • Release it in a new API version. Keep the current contract and introduce the change in a new version, then deprecate the old one with a sunset date so clients have time to migrate.
  • Accept it as a deliberate breaking change. Sometimes a breaking change is unavoidable, such as an urgent or security fix. Approve it knowingly, document it in your release notes, and tell affected clients. This should be the exception, not a routine way of working.

If oasdiff's verdict does not match your API's compatibility policy, you can also change how it treats request-property-pattern-added with a severity-levels file:

Put one rule per line; the level can be err, warn, or info, or none to disable the check entirely:

# severity.txt
request-property-pattern-added warn

Then pass it to oasdiff:

oasdiff changelog base.yaml revision.yaml --severity-levels severity.txt

Related schema rules

Browse all 509 checks →