Skip to content

Commit

Permalink
map_validator: check single quotes and extension names in keys
Browse files Browse the repository at this point in the history
  • Loading branch information
pcoccoli committed Mar 18, 2024
1 parent b0e51d2 commit ec07d49
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions map_validator/validate_mapping.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import json
import logging
import re


# create logging formatter
Expand Down Expand Up @@ -113,6 +114,11 @@ def main():
if not isinstance(key, str):
log_error(mapping, '"key" is not a string')
continue # This is "fatal" for this mapping
if "'" in key:
log_error(mapping, 'single quotes are not allowed in "key"')
if ".extensions." in key:
if re.match(r"^.*\.extensions\.[a-z]*$", key):
log_error(mapping, 'missing extension name in "key"')

otype, _, rest = key.partition('.')
if not rest:
Expand Down

0 comments on commit ec07d49

Please sign in to comment.