documentationjs / documentationjs/documentation
Object declarations omit default values
- Dominant language
- JavaScript
- Stars
- 5.8k
- Forks
- 481
- PR merge metrics
- No merged PRs in 30d
Description
**If you're reporting a bug, please include _input code_, _output documentation_,
a description of what you expected to happen, and what happened instead.**
Given the following input:
```
/**
* @type {Object}
* @property {Boolean} [bool=true]
*/
```
The property declaration in the output `properties` member does not include the default value. The default value _does_ render into the `tags` section.
The same happens for `@typedef`, though I suppose one could argue that typedefs shouldn't have default values anyhow. I suppose maybe it's being treated as a typedef. In any case, if this is _not_ the right way to document an object, tips would be appreciated.
Output:
```
...
"tags": [
{
"title": "type",
"description": null,
"lineNumber": 1,
"type": {
"type": "NameExpression",
"name": "Object"
}
},
{
"title": "property",
"description": null,
"lineNumber": 2,
"type": {
"type": "OptionalType",
"expression": {
"type": "NameExpression",
"name": "Boolean"
}
},
"name": "bool",
"default": "true"
}
],
...
"properties": [
{
"title": "property",
"name": "bool",
"lineNumber": 2,
"type": {
"type": "OptionalType",
"expression": {
"type": "NameExpression",
"name": "Boolean"
}
}
}
],
...
```
* What version of documentation.js are you using?: 8.1.2
* How are you running documentation.js (on the CLI, Node.js API, Grunt, other?): cli, node
Contributor guide
Assessment
This issue has not been assessed yet.