Skip to content

Commit

Permalink
Fix false negative in regex subset
Browse files Browse the repository at this point in the history
If s2 is a regex and s1 is empty or None, then s1 is equivalent to
all the  strings, but s2 can also be a regex equivalent to all the
strings (for instance `.*|[abc]`).

In that case, the two regex are equivalent and subsets of each other.
  • Loading branch information
kmichel-aiven committed Jun 16, 2024
1 parent 532f57b commit 2b4105a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jsonsubschema/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def regex_isSubset(s1, s2):
elif s1:
return True
elif s2:
return False
return parse(s2).equivalent(parse(".*"))


# def regex_isProperSubset(s1, s2):
Expand Down

0 comments on commit 2b4105a

Please sign in to comment.