Created
February 20, 2018 23:36
-
-
Save zetafish/06f76a7cc435ff085288f2504426dda7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_placeholder_refs(tree): | |
allowed = set([k for (k, v) in tree['template-set.json']['placeholders'].items()]) | |
def check_refs(placeholder): | |
for k, v in placeholder.items(): | |
if not k in allowed: | |
raise Invalid('no-such-placeholder', path=[k]) | |
return placeholder | |
schema = Schema({ | |
Match(REGEX_WIDTH_HEIGHT): { | |
'template.json': { | |
'placeholderExceptions': check_refs | |
} | |
} | |
}, extra=ALLOW_EXTRA) | |
return schema(tree) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment