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

Side by Side Diff: chrome/common/extensions/docs/server2/schema_processor.py

Issue 549353002: Fix regression where some apis were registered, but didn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from collections import defaultdict, Mapping 5 from collections import defaultdict, Mapping
6 import traceback 6 import traceback
7 7
8 from third_party.json_schema_compiler import json_parse, idl_schema, idl_parser 8 from third_party.json_schema_compiler import json_parse, idl_schema, idl_parser
9 from reference_resolver import ReferenceResolver 9 from reference_resolver import ReferenceResolver
10 from compiled_file_system import CompiledFileSystem 10 from compiled_file_system import CompiledFileSystem
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 '''Replace '$ref's that refer to inline_docs with the json for those docs. 119 '''Replace '$ref's that refer to inline_docs with the json for those docs.
120 If |retain_inlined_types| is False, then the inlined nodes are removed 120 If |retain_inlined_types| is False, then the inlined nodes are removed
121 from the schema. 121 from the schema.
122 ''' 122 '''
123 inline_docs = {} 123 inline_docs = {}
124 types_without_inline_doc = [] 124 types_without_inline_doc = []
125 internal_api = False 125 internal_api = False
126 126
127 api_features = self._features_bundle.GetAPIFeatures().Get() 127 api_features = self._features_bundle.GetAPIFeatures().Get()
128 # We don't want to inline the events API, as it's handled differently 128 # We don't want to inline the events API, as it's handled differently
129 if schema.get('namespace', '') != 'events': 129 # Also, the webviewTag API is handled differently, as it only exists
130 # for the purpose of documentation, it's not a true internal api
131 namespace = schema.get('namespace', '')
132 if namespace != 'events' and namespace != 'webviewTag':
130 internal_api = api_features.get(schema.get('namespace', ''), {}).get( 133 internal_api = api_features.get(schema.get('namespace', ''), {}).get(
131 'internal', False) 134 'internal', False)
132 135
133 api_refs = set() 136 api_refs = set()
134 # Gather refs to internal APIs 137 # Gather refs to internal APIs
135 def gather_api_refs(node): 138 def gather_api_refs(node):
136 if isinstance(node, list): 139 if isinstance(node, list):
137 for i in node: 140 for i in node:
138 gather_api_refs(i) 141 gather_api_refs(i)
139 elif isinstance(node, Mapping): 142 elif isinstance(node, Mapping):
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 try: 232 try:
230 schemas = json_parse.Parse(file_data) 233 schemas = json_parse.Parse(file_data)
231 except: 234 except:
232 raise ValueError('Cannot parse "%s" as JSON:\n%s' % 235 raise ValueError('Cannot parse "%s" as JSON:\n%s' %
233 (path, traceback.format_exc())) 236 (path, traceback.format_exc()))
234 for schema in schemas: 237 for schema in schemas:
235 # Schemas could consist of one API schema (data for a specific API file) 238 # Schemas could consist of one API schema (data for a specific API file)
236 # or multiple (data from extension_api.json). 239 # or multiple (data from extension_api.json).
237 trim_and_inline(schema) 240 trim_and_inline(schema)
238 return schemas 241 return schemas
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | extensions/common/api/_api_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698