Index: tools/json_schema_compiler/schema_util.py |
diff --git a/tools/json_schema_compiler/schema_util.py b/tools/json_schema_compiler/schema_util.py |
index 046e2bdb3367fd31bc7622bee42095ace773386f..b5f5c30906891e89078c42f3e0dec4c338dabb99 100644 |
--- a/tools/json_schema_compiler/schema_util.py |
+++ b/tools/json_schema_compiler/schema_util.py |
@@ -4,6 +4,8 @@ |
"""Utilies for the processing of schema python structures. |
""" |
+from json_parse import OrderedDict |
+ |
def CapitalizeFirstLetter(value): |
return value[0].capitalize() + value[1:] |
@@ -22,7 +24,7 @@ def PrefixSchemasWithNamespace(schemas): |
_PrefixWithNamespace(s.get("namespace"), s) |
def _MaybePrefixFieldWithNamespace(namespace, schema, key): |
- if type(schema) == dict and key in schema: |
+ if isinstance(schema, (dict, OrderedDict)) and key in schema: |
old_value = schema[key] |
if not "." in old_value: |
schema[key] = namespace + "." + old_value |
@@ -33,7 +35,7 @@ def _PrefixTypesWithNamespace(namespace, types): |
_MaybePrefixFieldWithNamespace(namespace, t, "customBindings") |
def _PrefixWithNamespace(namespace, schema): |
- if type(schema) == dict: |
+ if isinstance(schema, (dict, OrderedDict)): |
if "types" in schema: |
_PrefixTypesWithNamespace(namespace, schema.get("types")) |
_MaybePrefixFieldWithNamespace(namespace, schema, "$ref") |