Skip to content

Commit c61b1ae

Browse files
committed
Fix false negative in regex subset
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.
1 parent 88abf36 commit c61b1ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jsonsubschema/_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def regex_isSubset(s1, s2):
199199
elif s1:
200200
return True
201201
elif s2:
202-
return False
202+
return parse(s2).equivalent(parse(".*"))
203203

204204

205205
# def regex_isProperSubset(s1, s2):

0 commit comments

Comments
 (0)