Skip to content

Conversation

@domdomegg
Copy link

Summary

Implements detection of JSON Schema string validation constraints: pattern, minLength, and maxLength.

Changes

Pattern Support

  • PatternAdd/Remove/Change change types
  • Pattern changes conservatively treated as breaking (determining if one regex is a subset of another requires complex AST analysis or fuzzing, which is out of scope per issue discussion)

MinLength Support

  • MinLengthAdd/Remove/Change change types
  • Smart breaking logic:
    • Increasing minLength: breaking (rejects previously valid shorter strings)
    • Decreasing minLength: non-breaking (accepts more strings)

MaxLength Support

  • MaxLengthAdd/Remove/Change change types
  • Smart breaking logic:
    • Decreasing maxLength: breaking (rejects previously valid longer strings)
    • Increasing maxLength: non-breaking (accepts more strings)

Test Coverage

14 comprehensive test fixtures covering:

  • Pattern: add, remove, change, unchanged
  • MinLength: add, remove, increase (breaking), decrease (non-breaking), unchanged
  • MaxLength: add, remove, decrease (breaking), increase (non-breaking), unchanged

Examples

# Pattern add (breaking)
{"path":"","change":{"PatternAdd":{"added":"^[a-z]+$"}},"is_breaking":true}

# MinLength increase 3→5 (breaking)
{"path":"","change":{"MinLengthChange":{"old_value":3,"new_value":5}},"is_breaking":true}

# MinLength decrease 5→3 (non-breaking)
{"path":"","change":{"MinLengthChange":{"old_value":5,"new_value":3}},"is_breaking":false}

# MaxLength decrease 10→5 (breaking)
{"path":"","change":{"MaxLengthChange":{"old_value":10,"new_value":5}},"is_breaking":true}

Fixes #23
Fixes #50

Implements detection of JSON Schema string validation constraints.

Changes:
- Add 9 new change types for pattern, minLength, and maxLength
- Pattern changes conservatively treated as breaking (regex subset
  detection is complex and out of scope)
- MinLength/MaxLength with smart directional breaking logic:
  - Increasing minLength: breaking (rejects shorter strings)
  - Decreasing minLength: non-breaking (accepts more strings)
  - Decreasing maxLength: breaking (rejects longer strings)
  - Increasing maxLength: non-breaking (accepts more strings)
- Comprehensive test coverage: 14 test fixtures covering all scenarios

Fixes getsentry#23
Fixes getsentry#50

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@domdomegg domdomegg requested a review from a team as a code owner October 7, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String validation support Support for pattern and format

1 participant