Created
February 9, 2012 04:47
-
-
Save isaacs/1777387 to your computer and use it in GitHub Desktop.
This is an example format for the API reference documentation for a node module, in json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ type: 'module', | |
name: 'cluster', | |
desc: 'The long html description thing at the beginning, examples, etc.', | |
events: | |
[ { type: 'event', | |
name: 'fork', | |
arguments: [ { name: 'worker', type: 'object', class: 'Worker' } ], | |
desc: 'blahblah long html description' }, | |
{ type: 'event', | |
name: 'ready', | |
arguments: [ { name: 'worker', type: 'object', class: 'Worker' } ], | |
desc: 'help all the humans' } ], | |
classes: | |
[ { type: 'class', | |
name: 'Worker', | |
classMethods: | |
[ { type: 'function', | |
name: 'someClassMethod', | |
return: | |
{ type: 'boolean', | |
desc: 'True if it worked. Otherwise false.' }, | |
arguments: | |
[ { type: 'string', name: 'foo', optional: true, default: 'blerg' }, | |
{ type: 'object', | |
name: 'settings', | |
options: | |
[ { name: 'src', type: 'string', description: 'The source string' }, | |
{ name: 'dest', | |
type: 'string', | |
desc: 'The destination string' } ] } ] } ], | |
methods: [ { type: 'function', name: 'sendMessage', arguments: [] } ], | |
properties: | |
[ { name: 'someProperty', type: 'number', default: 100 }, | |
{ name: 'otherProp', | |
type: 'object', | |
class: 'Worker', | |
desc: 'An \'other worker\' property' } ], | |
events: [ {} ] } ] } |
I think there need some internal boolean.
In this case Worker class is an internal constructor function, but you can using instanceof cluster.Worker and its methods and events is allowed.
Also properties like cluster.workers is a type:map but is values are Worker objects, how do we specify that.
It would also be nice with readable and writable labels.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an example of what would show up at http://nodejs.org/api/cluster.json.
Each of the globals (
process
,global
,errno
,console
,Buffer
, and the timeout stuff) will be an object oftype: 'global'
.module
,exports
,require
,__filename
, and__dirname
will be an object oftype: 'var'
, to indicate that it's module-local.The root at /all.json will have a
globals
section, amodules
section, and avars
section.Any object anywhere can have a
volatility
rating. See: https://gist.github.com/1776425