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

Issue 11315018: Extensions Docs Server: Generalize $ref's to work for any schema node (Closed)

Created:
8 years, 1 month ago by cduvall
Modified:
8 years, 1 month ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org
Visibility:
Public.

Description

Extensions Docs Server: Generalize $ref's to work for any schema node You can now use a $ref to refer to any top level type, event, method, or property in an API. The docs server searches through the API to find a match for the node, and renders the link accordingly. BUG=144505 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=166099

Patch Set 1 #

Total comments: 33

Patch Set 2 : addressed comments #

Total comments: 28

Patch Set 3 : rework #

Total comments: 11

Patch Set 4 : cleanup #

Unified diffs Side-by-side diffs Delta from patch set Stats (+567 lines, -173 lines) Patch
M chrome/common/extensions/api/privacy.json View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/api_data_source.py View 1 2 3 9 chunks +138 lines, -40 lines 0 comments Download
M chrome/common/extensions/docs/server2/api_data_source_test.py View 1 2 3 6 chunks +46 lines, -32 lines 0 comments Download
M chrome/common/extensions/docs/server2/api_list_data_source.py View 1 2 3 1 chunk +6 lines, -2 lines 0 comments Download
M chrome/common/extensions/docs/server2/compiled_file_system.py View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/common/extensions/docs/server2/docs_server_utils.py View 1 2 chunks +2 lines, -13 lines 0 comments Download
M chrome/common/extensions/docs/server2/handler.py View 1 2 2 chunks +11 lines, -4 lines 0 comments Download
M chrome/common/extensions/docs/server2/intro_data_source.py View 1 2 2 chunks +1 line, -4 lines 0 comments Download
M chrome/common/extensions/docs/server2/known_issues_data_source.py View 1 2 1 chunk +0 lines, -3 lines 0 comments Download
A chrome/common/extensions/docs/server2/reference_resolver.py View 1 2 3 1 chunk +76 lines, -0 lines 0 comments Download
A chrome/common/extensions/docs/server2/reference_resolver_test.py View 1 2 3 1 chunk +100 lines, -0 lines 0 comments Download
M chrome/common/extensions/docs/server2/samples_data_source.py View 1 2 3 8 chunks +12 lines, -42 lines 0 comments Download
M chrome/common/extensions/docs/server2/samples_data_source_test.py View 1 2 chunks +5 lines, -25 lines 0 comments Download
M chrome/common/extensions/docs/server2/template_data_source.py View 1 2 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/common/extensions/docs/server2/template_data_source_test.py View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
A chrome/common/extensions/docs/server2/test_data/test_json/fake_data_source.json View 1 2 3 1 chunk +96 lines, -0 lines 0 comments Download
M chrome/common/extensions/docs/server2/test_data/test_json/ref_test.json View 1 chunk +30 lines, -0 lines 0 comments Download
A chrome/common/extensions/docs/server2/test_data/test_json/ref_test_data_source.json View 1 chunk +23 lines, -0 lines 0 comments Download
A chrome/common/extensions/docs/server2/test_data/test_json/test_file_data_source.json View 1 chunk +13 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
cduvall
8 years, 1 month ago (2012-10-26 23:38:22 UTC) #1
Aaron Boodman
I'd like to let kalman review this when he returns.
8 years, 1 month ago (2012-10-30 05:48:10 UTC) #2
not at google - send to devlin
Thanks for being patient :) http://codereview.chromium.org/11315018/diff/1/chrome/common/extensions/docs/server2/api_data_source.py File chrome/common/extensions/docs/server2/api_data_source.py (right): http://codereview.chromium.org/11315018/diff/1/chrome/common/extensions/docs/server2/api_data_source.py#newcode59 chrome/common/extensions/docs/server2/api_data_source.py:59: self._api_list = api_list_data_source.GetAllNames() These ...
8 years, 1 month ago (2012-11-01 22:00:49 UTC) #3
not at google - send to devlin
http://codereview.chromium.org/11315018/diff/1/chrome/common/extensions/docs/server2/docs_server_utils.py File chrome/common/extensions/docs/server2/docs_server_utils.py (right): http://codereview.chromium.org/11315018/diff/1/chrome/common/extensions/docs/server2/docs_server_utils.py#newcode40 chrome/common/extensions/docs/server2/docs_server_utils.py:40: return None > And also, we need to search ...
8 years, 1 month ago (2012-11-01 22:05:15 UTC) #4
cduvall
Welcome back! https://codereview.chromium.org/11315018/diff/1/chrome/common/extensions/docs/server2/api_data_source.py File chrome/common/extensions/docs/server2/api_data_source.py (right): https://codereview.chromium.org/11315018/diff/1/chrome/common/extensions/docs/server2/api_data_source.py#newcode59 chrome/common/extensions/docs/server2/api_data_source.py:59: self._api_list = api_list_data_source.GetAllNames() On 2012/11/01 22:00:49, kalman ...
8 years, 1 month ago (2012-11-02 01:53:53 UTC) #5
not at google - send to devlin
Cheers :) http://codereview.chromium.org/11315018/diff/1/chrome/common/extensions/docs/server2/docs_server_utils.py File chrome/common/extensions/docs/server2/docs_server_utils.py (right): http://codereview.chromium.org/11315018/diff/1/chrome/common/extensions/docs/server2/docs_server_utils.py#newcode29 chrome/common/extensions/docs/server2/docs_server_utils.py:29: if type_['name'] == node_name: On 2012/11/02 01:53:53, ...
8 years, 1 month ago (2012-11-02 17:26:47 UTC) #6
cduvall
https://codereview.chromium.org/11315018/diff/8017/chrome/common/extensions/docs/server2/api_data_source.py File chrome/common/extensions/docs/server2/api_data_source.py (right): https://codereview.chromium.org/11315018/diff/8017/chrome/common/extensions/docs/server2/api_data_source.py#newcode64 chrome/common/extensions/docs/server2/api_data_source.py:64: def _GetLinkToRefType(self, ref, ref_resolver): On 2012/11/02 17:26:48, kalman wrote: ...
8 years, 1 month ago (2012-11-03 01:30:05 UTC) #7
not at google - send to devlin
lgtm https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/docs/server2/api_data_source.py File chrome/common/extensions/docs/server2/api_data_source.py (right): https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/docs/server2/api_data_source.py#newcode165 chrome/common/extensions/docs/server2/api_data_source.py:165: for action in event.actions] these can be inlined ...
8 years, 1 month ago (2012-11-05 19:47:50 UTC) #8
cduvall
8 years, 1 month ago (2012-11-06 00:58:54 UTC) #9
https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/...
File chrome/common/extensions/docs/server2/api_data_source.py (right):

https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/...
chrome/common/extensions/docs/server2/api_data_source.py:165: for action in
event.actions]
On 2012/11/05 19:47:50, kalman wrote:
> these can be inlined again?

Done.

https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/...
chrome/common/extensions/docs/server2/api_data_source.py:279:
self._json_cache_no_refs = cache_factory.Create(
On 2012/11/05 19:47:50, kalman wrote:
> Nice. Quick comment on why having separate caches with refs vs no refs is
> necessary?

Done.

https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/...
chrome/common/extensions/docs/server2/api_data_source.py:294:
self._ref_resolver_factory = None
On 2012/11/05 19:47:50, kalman wrote:
> # These must be set later via the SetFooDataSourceFactory methods.

Done.

https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/...
File chrome/common/extensions/docs/server2/intro_data_source.py (right):

https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/...
chrome/common/extensions/docs/server2/intro_data_source.py:16: _VERSION = 2
On 2012/11/05 19:47:50, kalman wrote:
> why does this need to change?

This is just to satisfy the presubmit check.

https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/...
File chrome/common/extensions/docs/server2/reference_resolver.py (right):

https://codereview.chromium.org/11315018/diff/16001/chrome/common/extensions/...
chrome/common/extensions/docs/server2/reference_resolver.py:56: parts =
ref.split('.')
On 2012/11/05 19:47:50, kalman wrote:
> It would be nice to write it in such a way that the two special cases above
> weren't necessary.
> 
> Firstly there's nothing particularly wrong with generating an anchor to
> "foo.html#blah" from within foo.html itself. It will be equivalent to "#blah".
> 
> And secondly perhaps the code below here can be written such that it works if
> parts is a singleton list.
> 
> Anyway, no biggie if not.

I ended up needing a special case for $refs not prefixed by the namespace name.
This allows it to handle things like $ref:StorageArea.get (in the storage API).
I can't think of a clean way to eliminate this special case.

Powered by Google App Engine
This is Rietveld 408576698