Skip to content

Commit

Permalink
bug fix Grokzen#167 and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
swills committed May 5, 2020
1 parent f96b76e commit 66ead10
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pykwalify/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def _validate_mapping(self, value, rule, path, done=None):
if not is_regex_rule:
is_present = k in value
else:
is_present = any([re.search(required_regex, v) for v in value])
is_present = any([re.search(required_regex, str(v)) for v in value])

# Specifying =: as key is considered the "default" if no other keys match
if rr.required and not is_present and k != "=":
Expand Down
17 changes: 16 additions & 1 deletion tests/files/success/test_mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,19 @@ schema:
type: map
mapping:
regex;(person[1-9]):
required: True
required: True
---
name: mapping19
desc: Test regex mapping with integer keys
data:
test:
1: test
2: test2
schema:
type: map
mapping:
test:
type: map
mapping:
regex;(.+):
type: str

0 comments on commit 66ead10

Please sign in to comment.