angular/dgeni-packages

codeNameProcessor throws warning when parsing "@ngdoc property"

Antontelesh opened this issue · 2 comments

Using @ngdoc property sometimes throws warning when compiling.

For example

{
  /** 
   * @ngdoc property
   * @name SomeService#filesize
   * @type {Number}
   */
  filesize: 5 * 1024,

  /** 
   * @ngdoc property
   * @name SomeService#some_instance
   * @type {Object}
   */
  some_instance: new SomeClass()
}

Each of these properties will throw warnings when being compiled, because codeNameProcessor tries to calculate property type depending on the property value, no matter what is the @type directive value.

How can I set up Dgeni to prevent it to parse my real code?

The codeNameProcessor only looks into the code for the name if there is not already a codeName property on the doc. See https://github.com/angular/dgeni-packages/blob/master/jsdoc/processors/code-name.js#L11

So you could prevent this from happening by defining a @codeName tag or by implementing a processor that runs before codeNameProcessor which computes the codeName property from the name property.

Thank you, @petebacondarwin, for your response.