Fix extension registration to not only check nested properties
for spec compliance, but also the toplevel properties, if any.pull/1/head
parent
e99be67c1e
commit
945e3375aa
|
@ -1,3 +1,4 @@
|
|||
import itertools
|
||||
import re
|
||||
|
||||
from . import registry, version
|
||||
|
@ -144,7 +145,12 @@ def _register_extension(
|
|||
|
||||
"""
|
||||
ext_type = new_extension._type
|
||||
properties = new_extension._properties
|
||||
|
||||
# Need to check both toplevel and nested properties
|
||||
prop_groups = [new_extension._properties]
|
||||
if hasattr(new_extension, "_toplevel_properties"):
|
||||
prop_groups.append(new_extension._toplevel_properties)
|
||||
prop_names = itertools.chain.from_iterable(prop_groups)
|
||||
|
||||
_validate_type(ext_type, version)
|
||||
|
||||
|
@ -161,7 +167,7 @@ def _register_extension(
|
|||
ext_type,
|
||||
)
|
||||
|
||||
for prop_name in properties.keys():
|
||||
for prop_name in prop_names:
|
||||
if not re.match(PREFIX_21_REGEX, prop_name):
|
||||
raise ValueError("Property name '%s' must begin with an alpha character." % prop_name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue