[TIMOB-9799] APIDoc: Need way to identify varargs
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-08-14T13:38:41.000+0000 |
Affected Version/s | Release 2.0.1 |
Fix Version/s | Sprint 2012-16 Core, Release 3.0.0 |
Components | Tooling |
Labels | core |
Reporter | Arthur Evans |
Assignee | Arthur Evans |
Created | 2012-06-25T23:05:51.000+0000 |
Updated | 2012-11-26T21:55:29.000+0000 |
Description
Would be good to add a format for this. JSDuck supports varargs so we can translate straight through for that format.
It appears to be supported in JSCA as well, using the "usage" field, which can be "required," "optional," "zero-or-more," or "one-or-more."
Perhaps we could just add a field to the parameter description like repeatable: true or vararg: true?
@ARTHUR: Do you happen to know one of the API methods with a varargs? I can't think of any off the top of my head, and it would be good for testing.
@ARTHUR: Also, do you think we'll need to specify some kind of typed varargs (i.e., varargs, but each element must be a particular type)? Or is just plain old varargs enough?
@BILL: Sorry for the late response. I think typed varargs would be good. Maybe just a flag to the parameter that says it's repeatable. This should be easy to map to the JsDuck or Google Closure compiler type.
TDoc spec update to review: https://wiki.appcelerator.org/display/guides2/TDoc+Specification#TDocSpecification-MethodParameterSpecification
Testing docgen.py html generation
* Open apidoc/Titanium/Titanium.yml in your bestest most favoritest editor in the wholesy worldsy. (aka vi). * Find the documentation for the method namedinclude
. * Addrepeatable: true
toinclude
'sname
parameter. * Save. * Runpython apidoc/docgen.py
. * When it's finished, open dist/apidoc/index.html in a browser. * Navigate to the Titanium module'sinclude
documentation. * For thename
argument you should see "..." after its name and "Repeatable" at the end of its summary.Testing docgen.py jsca generation
* Edit Titanium.yml per above if you haven't already (i.e., addrepeatable: true
to thename
parameter of theinclude
method.) * Runpython apidoc/docgen.py -f jsca -o dist/apidoc
. * When it's finished, open dist/apidoc/api.jsca in a text editor. * Use the text editor to search for "one-or-more". * You should find"usage": "one-or-more"
on the entry for thename
parameter of theinclude
method.Testing validate.py
* Edit Titanium.yml per above if you haven't already (i.e., addrepeatable: true
to thename
parameter of theinclude
method.) * Runpython apidoc/validate.py -e -s simple
. There should be no errors reported concerning the use ofrepeatable
. * Change the value of therepeatable
parameter in Titanium.yml'sinclude
method fromtrue
toabc
(an invalid value.) * Runpython apidoc/validate.py -e -s simple
. You should get an error telling you that "repeatable" should be either true or false.@ARTHUR: Not sure if you'll like what I generate in HTML for this. But I guess our html generator is kinda irrelevant now that we use jsduck, right?
PR ready: https://github.com/appcelerator/titanium_mobile/pull/2719
Testing docgen.py jsduck generation
* The String.yml file is updated in my PR so you can test with that. * Runpython apidoc/docgen.py -f jsduck -o dist/apidoc
. * When it's finished, open dist/apidoc/titanium.js in a text editor. * Use the text editor to search for "@method format". * You should find* @param {String/Number...} value
in the entry for theformat
method.PR Ready: https://github.com/appcelerator/titanium_mobile/pull/2742
Tested with 3.0.0.v20121121161553