New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 717827 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 717828



Sign in to add a comment

json_schema_compiler doesn't typedef Objects in a .json API

Project Member Reported by michae...@chromium.org, May 3 2017

Issue description

When generating externs from a .json extension API via json_schema_compiler, types with no properties aren't handled well.

Example (from bookmark_manager_private.json):

   "types": [...
      {
        "id": "MetaInfoFields",
        "type": "object",
        "description": "Collection of meta info fields.",
        "additionalProperties": {"type": "string"}
      }...

Here, we don't specify any concrete properties on the MetaInfoFields type. It's just a bag of an arbitrary number of arbitrary properties. In other words, an {Object}.

(Note: additionalProperties means the type can include arbitrary properties, in this case of type string, but AFAICT, these are ignored in generating the externs.)

When it sees that MetaInfoFields has no properties, js_externs_generator.py skips adding the @typedef to the jsdoc comment:

    /**
     * Collection of meta info fields.
     * @see https://developer.chrome.com/extensions/bookmarkManagerPrivate#type-MetaInfoFields
     */
    chrome.bookmarkManagerPrivate.MetaInfoFields;

The result is a Closure error when other parts of the externs file reference MetaInfoFields:

  ## ../../../../third_party/closure_compiler/externs/bookmark_manager_private.js:160: ERROR - 
  Bad type annotation. Unknown type chrome.bookmarkManagerPrivate.MetaInfoFields
  ##  * @param {!chrome.bookmarkManagerPrivate.MetaInfoFields} metaInfo

Manually adding @typedef {Object} resolves the above error.
 
Blocking: 717828
Blocking: -717828
Cc: paezagon@chromium.org calamity@chromium.org
I tried fixing this in js_externs_generator.py: https://codereview.chromium.org/2854183005

but it broke a test (it causes an Object member of a Dictionary in an IDL file to get an additional @typedef line). Not sure if the externs generator is the right place to put it anyway.
Blocking: 717828
...?
Project Member

Comment 4 by sheriffbot@chromium.org, May 4 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment