json-schema-diff icon indicating copy to clipboard operation
json-schema-diff copied to clipboard

Support for `pattern` and `format`

Open untitaker opened this issue 2 years ago • 2 comments

Addition of pattern or format should be a breaking change. Removal should not be.

Changing format to a different value should also be a breaking change. Not out of principle, but I think it is somewhat unlikely that one format is a subset of another. So this seems like the easiest thing to do.

But what about changing the value of pattern? We'd have to figure out whether the set of strings accepted by one regex is a subset of the strings accepted by another regex. Maybe the rust regex crate exposes the AST for that, but regexes in jsonschema are ECMAscript regexes. Maybe the saner way to go about this is to detect breaking changes using fuzzing or property testing.

An exciting research topic for sure.

untitaker avatar May 09 '23 18:05 untitaker

This is an unrealistic edge case but if both lhs and rhs are sets of regexes within anyOf, fuzzing will run n * m times to find the most similar pairs of regexes. Nice if we can avoid this

6293 avatar May 19 '23 11:05 6293

e.g. just respect the ordering and skip hungarian in such cases

6293 avatar May 19 '23 11:05 6293