Skip to content

Commit 13c8e3a

Browse files
committed
Make sure pattern and patternProperties matches are not anchored
1 parent 82aa0a8 commit 13c8e3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jsonschema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def validate_patternProperties(self, patternProperties, instance, schema):
230230

231231
for pattern, subschema in iteritems(patternProperties):
232232
for k, v in iteritems(instance):
233-
if re.match(pattern, k):
233+
if re.search(pattern, k):
234234
for error in self.iter_errors(v, subschema):
235235
yield error
236236

@@ -346,7 +346,7 @@ def validate_uniqueItems(self, uI, instance, schema):
346346
yield ValidationError("%r has non-unique elements" % instance)
347347

348348
def validate_pattern(self, patrn, instance, schema):
349-
if self.is_type(instance, "string") and not re.match(patrn, instance):
349+
if self.is_type(instance, "string") and not re.search(patrn, instance):
350350
yield ValidationError("%r does not match %r" % (instance, patrn))
351351

352352
def validate_format(self, format, instance, schema):

0 commit comments

Comments
 (0)