Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Unified Diff: tools/json_schema_compiler/schema_util.py

Issue 11079010: Extensions Docs Server: Preserve JSON declaration order in extensions documentation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..dc84e6159163aaf9b7d1958a118c3ea782266a23 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.
"""
+import json_parse
+
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 json_parse.IsDict(schema) 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 json_parse.IsDict(schema):
if "types" in schema:
_PrefixTypesWithNamespace(namespace, schema.get("types"))
_MaybePrefixFieldWithNamespace(namespace, schema, "$ref")
« tools/json_schema_compiler/json_schema.py ('K') | « tools/json_schema_compiler/model.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698