summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDHNishi@gmail.com <DHNishi@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-14 19:35:04 +0000
committerDHNishi@gmail.com <DHNishi@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-14 19:35:04 +0000
commit04afd69e36366fa5cdc3b8c03720119d755c5580 (patch)
treeaba0d53401d425101e8301b500c3455441378648
parentaef5e0d088e5edaa02cbdaae4cb261f9ba05a6f9 (diff)
downloadchromium_src-04afd69e36366fa5cdc3b8c03720119d755c5580.zip
chromium_src-04afd69e36366fa5cdc3b8c03720119d755c5580.tar.gz
chromium_src-04afd69e36366fa5cdc3b8c03720119d755c5580.tar.bz2
Docserver: Add deprecation annotation for properties.
Example Image: http://i.imgur.com/9w5e9fC.png NOTRY=true BUG=239196 Review URL: https://codereview.chromium.org/65653002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235216 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/extensions/docs/server2/api_data_source.py27
-rw-r--r--chrome/common/extensions/docs/server2/app.yaml2
-rw-r--r--chrome/common/extensions/docs/server2/cron.yaml2
-rw-r--r--chrome/common/extensions/docs/templates/private/parameter_full.html2
-rw-r--r--chrome/common/extensions/docs/templates/private/property.html3
-rw-r--r--tools/json_schema_compiler/model.py2
6 files changed, 19 insertions, 19 deletions
diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py
index e0e250c..60e4b42 100644
--- a/chrome/common/extensions/docs/server2/api_data_source.py
+++ b/chrome/common/extensions/docs/server2/api_data_source.py
@@ -179,12 +179,7 @@ class _JSCModel(object):
'returns': None,
'id': _CreateId(function, 'method')
}
- if function.deprecated is not None:
- function_dict['deprecated'] = self._FormatDescription(
- function.deprecated)
- if (function.parent is not None and
- not isinstance(function.parent, model.Namespace)):
- function_dict['parentName'] = function.parent.simple_name
+ self._AddCommonProperties(function_dict, function)
if function.returns:
function_dict['returns'] = self._GenerateType(function.returns)
for param in function.params:
@@ -219,12 +214,7 @@ class _JSCModel(object):
'id': _CreateId(event, 'event'),
'byName': {},
}
- if event.deprecated is not None:
- event_dict['deprecated'] = self._FormatDescription(
- event.deprecated)
- if (event.parent is not None and
- not isinstance(event.parent, model.Namespace)):
- event_dict['parentName'] = event.parent.simple_name
+ self._AddCommonProperties(event_dict, event)
# Add the Event members to each event in this object.
# If refs are disabled then don't worry about this, since it's only needed
# for rendering, and disable_refs=True implies we're not rendering.
@@ -297,6 +287,7 @@ class _JSCModel(object):
'returns': None,
'id': _CreateId(property_, 'property')
}
+ self._AddCommonProperties(property_dict, property_)
if type_.property_type == model.PropertyType.FUNCTION:
function = type_.function
@@ -305,10 +296,6 @@ class _JSCModel(object):
if function.returns:
property_dict['returns'] = self._GenerateType(function.returns)
- if (property_.parent is not None and
- not isinstance(property_.parent, model.Namespace)):
- property_dict['parentName'] = property_.parent.simple_name
-
value = property_.value
if value is not None:
if isinstance(value, int):
@@ -478,6 +465,14 @@ class _JSCModel(object):
misc_rows.append({ 'title': category, 'content': content })
return misc_rows
+ def _AddCommonProperties(self, target, src):
+ if src.deprecated is not None:
+ target['deprecated'] = self._FormatDescription(
+ src.deprecated)
+ if (src.parent is not None and
+ not isinstance(src.parent, model.Namespace)):
+ target['parentName'] = src.parent.simple_name
+
class _LazySamplesGetter(object):
'''This class is needed so that an extensions API page does not have to fetch
diff --git a/chrome/common/extensions/docs/server2/app.yaml b/chrome/common/extensions/docs/server2/app.yaml
index 5341640..8650a19 100644
--- a/chrome/common/extensions/docs/server2/app.yaml
+++ b/chrome/common/extensions/docs/server2/app.yaml
@@ -1,5 +1,5 @@
application: chrome-apps-doc
-version: 2-40-3
+version: 2-41-0
runtime: python27
api_version: 1
threadsafe: false
diff --git a/chrome/common/extensions/docs/server2/cron.yaml b/chrome/common/extensions/docs/server2/cron.yaml
index 3ddc471..84412e0 100644
--- a/chrome/common/extensions/docs/server2/cron.yaml
+++ b/chrome/common/extensions/docs/server2/cron.yaml
@@ -2,4 +2,4 @@ cron:
- description: Repopulates all cached data.
url: /_cron
schedule: every 5 minutes
- target: 2-40-3
+ target: 2-41-0
diff --git a/chrome/common/extensions/docs/templates/private/parameter_full.html b/chrome/common/extensions/docs/templates/private/parameter_full.html
index a9f7e47..22ece4f 100644
--- a/chrome/common/extensions/docs/templates/private/parameter_full.html
+++ b/chrome/common/extensions/docs/templates/private/parameter_full.html
@@ -1,7 +1,7 @@
<div>
{{?parentName}}<a name="{{id}}"></a>{{/}}
<dl>
- {{+partials.property}}
+ {{+partials.property property:@}}
</dl>
{{?properties}}
<dd>
diff --git a/chrome/common/extensions/docs/templates/private/property.html b/chrome/common/extensions/docs/templates/private/property.html
index c89dfe2..78a4030 100644
--- a/chrome/common/extensions/docs/templates/private/property.html
+++ b/chrome/common/extensions/docs/templates/private/property.html
@@ -8,6 +8,9 @@
</span>
</dt>
<dd>
+{{?deprecated}}
+ {{+partials.warning_deprecated item:property}}
+{{/deprecated}}
{{?description}}
{{{description}}}
{{/description}}
diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py
index 3f459d0..dd68e9b 100644
--- a/tools/json_schema_compiler/model.py
+++ b/tools/json_schema_compiler/model.py
@@ -329,6 +329,7 @@ class Property(object):
- |description| a description of the property (if provided)
- |type_| the model.Type of this property
- |simple_name| the name of this Property without a namespace
+ - |deprecated| a reason and possible alternative for a deprecated property
"""
def __init__(self, parent, name, json, namespace, origin):
"""Creates a Property from JSON.
@@ -342,6 +343,7 @@ class Property(object):
self.description = json.get('description', None)
self.optional = json.get('optional', None)
self.instance_of = json.get('isInstanceOf', None)
+ self.deprecated = json.get('deprecated')
# HACK: only support very specific value types.
is_allowed_value = (