OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import copy | 5 import copy |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 from docs_server_utils import GetLinkToRefType | 9 from docs_server_utils import GetLinkToRefType |
10 import third_party.json_schema_compiler.model as model | 10 import third_party.json_schema_compiler.model as model |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 'parameters': map(self._GenerateProperty, event.params) | 119 'parameters': map(self._GenerateProperty, event.params) |
120 } | 120 } |
121 if len(event_dict['parameters']) > 0: | 121 if len(event_dict['parameters']) > 0: |
122 event_dict['parameters'][-1]['last'] = True | 122 event_dict['parameters'][-1]['last'] = True |
123 return event_dict | 123 return event_dict |
124 | 124 |
125 def _GenerateCallback(self, callback): | 125 def _GenerateCallback(self, callback): |
126 if not callback: | 126 if not callback: |
127 return None | 127 return None |
128 callback_dict = { | 128 callback_dict = { |
129 'name': 'callback', | 129 'name': callback.name, |
130 'description': self._FormatDescription(callback.description), | 130 'description': self._FormatDescription(callback.description), |
131 'simple_type': {'simple_type': 'function'}, | 131 'simple_type': {'simple_type': 'function'}, |
132 'optional': callback.optional, | 132 'optional': callback.optional, |
133 'parameters': [] | 133 'parameters': [] |
134 } | 134 } |
135 for param in callback.params: | 135 for param in callback.params: |
136 callback_dict['parameters'].append(self._GenerateProperty(param)) | 136 callback_dict['parameters'].append(self._GenerateProperty(param)) |
137 if (len(callback_dict['parameters']) > 0): | 137 if (len(callback_dict['parameters']) > 0): |
138 callback_dict['parameters'][-1]['last'] = True | 138 callback_dict['parameters'][-1]['last'] = True |
139 return callback_dict | 139 return callback_dict |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 elif property_.type_ == model.PropertyType.ENUM: | 176 elif property_.type_ == model.PropertyType.ENUM: |
177 dst_dict['enum_values'] = [] | 177 dst_dict['enum_values'] = [] |
178 for enum_value in property_.enum_values: | 178 for enum_value in property_.enum_values: |
179 dst_dict['enum_values'].append({'name': enum_value}) | 179 dst_dict['enum_values'].append({'name': enum_value}) |
180 if len(dst_dict['enum_values']) > 0: | 180 if len(dst_dict['enum_values']) > 0: |
181 dst_dict['enum_values'][-1]['last'] = True | 181 dst_dict['enum_values'][-1]['last'] = True |
182 elif property_.instance_of: | 182 elif property_.instance_of: |
183 dst_dict['simple_type'] = property_.instance_of.lower() | 183 dst_dict['simple_type'] = property_.instance_of.lower() |
184 else: | 184 else: |
185 dst_dict['simple_type'] = property_.type_.name.lower() | 185 dst_dict['simple_type'] = property_.type_.name.lower() |
OLD | NEW |