Search code examples
javascriptyuijavadoc

How do I comment object literals in YUIDoc


In YUIDoc, I want to comment object literals that are passed as parameters. See the following snippet of code:

@param {Array} colDefs Array of object literal column definitions for the grid<ul>
    <li>title -  Column header display</li>
    <li>key -  The key of the column from the JSON data array</li>
    <li>type - The data type of the column.  </li></ul>

What tags do I add to list items so I can specify the type of property (String, Object, etc)? If I add {String} it just shows up as the text, not the nice formatting that I get with @param tags.

Perhaps this is not even possible?


Solution

  • You can document configuration objects by specifying first the configuration object and then all the properties as object.property parameters. It looks like this:

     /**
     @param {Object}  config          Object literal containing configuration parameters
     @param {Boolean} config.useFoo   Whether to use Foo or not
     @param {String}  [config.option] An optional string parameter
     */