angular / dgeni-packages

A collection of dgeni packages for generating documentation from source code.
MIT License
142 stars 101 forks source link

Nested Properties in ngDoc #126

Open sebastienbarbier opened 9 years ago

sebastienbarbier commented 9 years ago

Hi everyone,

I am having an issue with nested properties description using ngdoc. jsDoc suppose to deal with such case but impossible to make it work in my project.

What I try to do (exemple from JSDoc website) :

/**
 * @namespace
 * @property {object}  defaults               - The default values for parties.
 * @property {number}  defaults.players       - The default number of players.
 * @property {string}  defaults.level         - The default level for the party.
 * @property {object}  defaults.treasure      - The default treasure.
 * @property {number}  defaults.treasure.gold - How much gold the party starts with.
 */
var config = {
    defaults: {
        players: 1,
        level:   'beginner',
        treasure: {
            gold: 0
        }
    }
};

And this is what I am trying to do :

/**
 * @ngdoc property
 * @name user#config
 * @property {object}  config               - The default values for parties.
 * @property {number}  config.players       - The default number of players.
 * @property {string}  config.level         - The default level for the party.
 * @property {object}  config.treasure      - The default treasure.
 * @property {number}  config.treasure.gold - How much gold the party starts with.
 */
var config = {
    defaults: {
        players: 1,
        level:   'beginner',
        treasure: {
            gold: 0
        }
    }
};

But no way ... I looked a bit in dgeni package source code and found the template I use which does not support such behaviour.

/dgeni-packages/ngdoc/templates/lib/properties.template.html

{%- if doc.properties %}
<h2>Properties</h2>
<ul class="properties">
  {%- for property in doc.properties %}
  <li id="{$ property.name $}">
    <h3>{$ property.name | code $}</h3>
    {$ typeInfo(property) $}
  </li>
  {% endfor -%}
</ul>
{%- endif -%}

So my current conclusion is : not possible. sadly.

Can someone confirm that to me, and ... would it make sense to implement such feature ? I guess it is expected from me to create a dedicated service for this nested object but ... sometimes I just want to keep it like that.

Thanks for reading.

petebacondarwin commented 8 years ago

This is currently not supported. I don't think I will get round to implementing this. If someone else wished to do so that would be fine!