Skip to content

Nested Properties throw lodash errors. #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LazerFX opened this issue Oct 7, 2016 · 5 comments · Fixed by #576
Closed

Nested Properties throw lodash errors. #559

LazerFX opened this issue Oct 7, 2016 · 5 comments · Fixed by #576

Comments

@LazerFX
Copy link

LazerFX commented Oct 7, 2016

Attempting to @typedef or @namespace nested properties (i.e. prop.val) will throw an error with lodash. Attempted with the JSDoc Tags Property demonstration code:

/**
 * @namespace
 * @property {object}  defaults               - The default values for parties.
 * @property {number}  defaults.players       - The default number of players.
 * @property {string}  defaults.level         - The default level for the party.
 * @property {object}  defaults.treasure      - The default treasure.
 * @property {number}  defaults.treasure.gold - How much gold the party starts with.
 */
var config = {
    defaults: {
        players: 1,
        level:   'beginner',
        treasure: {
            gold: 0
        }
    }
};

This throws the error:

lodash.templateSources[1]:136
__e( name) +
     ^

ReferenceError: name is not defined
    at eval (lodash.templateSources[1]:136:6)
    at Array.forEach (native)
    at eval (lodash.templateSources[1]:134:22)
    at Array.forEach (native)
    at eval (lodash.templateSources[1]:113:21)
    at eval (lodash.templateSources[3]:84:11)
    at Array.forEach (native)
    at eval (lodash.templateSources[3]:80:7)
    at C:\Users\PStreet\AppData\Roaming\npm\node_modules\documentation\default_theme\index.js:86:30
    at ConcatStream.<anonymous> (C:\Users\PStreet\AppData\Roaming\npm\node_modules\documentation\node_modules\concat-stream\index.js:36:43)

I've not had chance to go into the code to find out why it's failing, but I suspect there's a requirement for nesting in there that's not being met. Hope this is enough to reproduce/recreate the issue!

Running on:

  • Windows 10 Pro (1607 - 14393.222 'Anniversary Update')
  • NPM 3.10.8
  • Node 6.7.0
  • [email protected] (git://github.com/documentationjs/documentation.git#473a7a2dcecc67dc4addf68384561877eb871a3f)
  • [email protected]
@chadxz
Copy link
Contributor

chadxz commented Oct 26, 2016

@LazerFX were you using the html output with the default theme?

@LazerFX
Copy link
Author

LazerFX commented Oct 26, 2016

@chadxz Yes, I was...

--Edit--

If it helps, I've just downloaded the very latest build (npm install -g git+https://github.com/documentationjs/documentation.git#0fa38736cdc81172dde237f39f2e8d6168be9561e9561), and it's still happening, on both Windows 10 standard and Ubuntu Canonical 16.04 (Windows Subsystem for Linux).

@chadxz
Copy link
Contributor

chadxz commented Oct 26, 2016

#576 fixes the error you described. However, the example you posted has two levels of nesting (defaults.treasure.gold) which the default html template does not support rendering. To get the treasure property to correctly show in docs generated using the default html template, you'd have to break that out into a separate typedef. Alternatively, you could alter the template to add support for rendering properties that deep.

@LazerFX
Copy link
Author

LazerFX commented Oct 26, 2016

To be honest, I'm surprised the default template doesn't handle the default examples on the @jsdoc page... As it is, this and the lack of folder support for Windows (#335) have actually made my decision for documentation provider fo rme; I'm using jsdoc with the jaguarjs-jsdoc template, and so far it's going well.

If you do fix the templating issue, I may look back in... Unfortunately, while I could give some time to decide on templates, documentation providers, etc. I've gotten to the point where I need to show progress in the workload assigned, rather than looking at the providers available. I may be able to look at the templates some in my spare time, but I'm not holding out much home. Sorry! I'd like to have been able to put a pull request in for this...

@tmcw tmcw closed this as completed in #576 Oct 26, 2016
tmcw pushed a commit that referenced this issue Oct 26, 2016
@chadxz
Copy link
Contributor

chadxz commented Oct 26, 2016

@LazerFX that's understandable. best of luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants