How do I document this nested object?

70 views
Skip to first unread message

Sky

unread,
Feb 23, 2012, 4:01:37 AM2/23/12
to JSDoc Users
My project receives JSON data in an expected format. I want to
document that format in the definition of the function that receives
the data. The data is deeply nested. I've managed to resolve most of
the quandaries that I've had, but I'm not sure how to go about the
following:

Sometimes an object does not have a single name, but is a type of
names, which in turn has sub properties. How do I document this
situation?

EG:

// The JSON data passed in. Pasted here for demonstration.
an_obj = {
users : {
username1 : {
param1 : "a value",
param2 : "a value"
},
username2 : {
param1 : "a value",
param2 : "a value"
}
//... more usernames here
}
}

/**
* A function description.
* @param {object} obj
* @param {object} obj.users A collection of user data.
* @param {object} obj.users.username !!!! This is not the object
name, but a name type. How do I signify this !!!!
* @param {string} obj.users.username.param1 Desc..
* @param {string} obj.users.username.param2 Desc...
*/
var myFunc = function(obj){
//...
};
Reply all
Reply to author
Forward
0 new messages