Skip to content
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

Incorrect parsing of hierarchy using memberof and namespaces #13

Open
ahmadassaf opened this issue Jan 30, 2020 · 1 comment
Open

Incorrect parsing of hierarchy using memberof and namespaces #13

ahmadassaf opened this issue Jan 30, 2020 · 1 comment

Comments

@ahmadassaf
Copy link

Hello,

I am having issues understanding the parsing of annotations when using nested modules, namespaces, etc. The usage of memberof .. etc. renders the content properly using jsdoc but not in docma which uses jsdoc-x.

I will be pasting screenshots from docma as it easily shows the intended behaviour and will paste the output from running jsdoc-x as well in the end.

I have a main namespace defined as:

/**
 * @namespace bmrExtension
 * @requires bmrExtension.uikit
 * @requires bmrExtension.profile
 */

And then two namespaces bmrExtension.uikit and bmrExtension.profile and modules acl and loggers defined as:

/**
 * @namespace bmrExtension.profile
 * @requires acl
*/
/**
 * @namespace bmrExtension.uikit
*/
/**
 * @module
 * @name acl
 * @memberof bmrExtension
*/
/**
 * @module loggers
 * @memberof bmrExtension
*/

The module loggers itself has members and so far everything renders nicely.

/**
 * @name reduxLogger
 * @memberof bmrExtension.module:loggers
 * @type {Function}
 */

image

Now, I want to add a new module that is a memberof the main namespace bmrExtension and has a bunch of members.

/**
 * @module stores
 * @memberof bmrExtension
 */

and then I have:

/**
 * @name contactStore
 * @memberof bmrExtension.module:stores
 * @type {Object}
 */

/**
 * @name fieldsStore
 * @memberof bmrExtension.module:stores
 * @type {Object}
 */

/**
 * @name flagsStore
 * @memberof bmrExtension.module:stores
 * @type {Object}
 */

/**
 * @name notificationsStore
 * @memberof bmrExtension.module:stores
 * @type {Object}
 */

/**
 * @name pageStore
 * @memberof bmrExtension.module:stores
 * @type {Object}
 */

/**
 * @name usersStore
 * @memberof bmrExtension.module:stores
 * @type {Object}
 */

and this is where it becomes interesting:

image

only two are nested properly, one is completely missing and two are nested wrongly.

When I try and render using jsdoc I get the correct member hierarchy:

image

Running the parser directly

const jsdocx = require('jsdoc-x');

(async() => {

	try {

		const docs = await jsdocx.parse({
			access: null,
			allowUnknownTags: true,
			encoding: 'utf8',
			files: [ './code/js/stores/*.js', './code/js/modules/**/*.js', './code/js/loggers/*.js' ],
			filter: null,
			hierarchy: true,
			ignored: false,
			module: true,
			package: null,
			pedantic: false,
			plugins: [ 'plugins/markdown', 'jsdoc-mermaid' ],
			recurse: false,
			relativePath: null,
			sort: 'grouped',
			undescribed: false,
			undocumented: false
		});

		console.log(docs);

	} catch (error) {

		console.log(error.stack);

	}

})();
[
  {
    comment: '/**\n' +
      ' * @namespace bmrExtension\n' +
      ' * @description\n' +
      ' * The Extension has the JSDoc namespace `bmrExtension` which is also used in registering the Angular.js module\n' +
      " * `angular.module('bmrExtension')`.\n" +
      ' *\n' +
      ' * @requires bmrExtension.uikit\n' +
      ' * @requires bmrExtension.profile\n' +
      ' */',
    meta: {
      filename: 'index.js',
      lineno: 1,
      columnno: 0,
      path: '/Users/ahmadassaf/Downloads/Projects/app-extension/code/js/modules/bmr-extension',
      code: {}
    },
    kind: 'namespace',
    name: 'bmrExtension',
    description: '<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script><p>The Extension has the JSDoc namespace <code>bmrExtension</code> which is also used in registering the Angular.js module\n' +
      "<code>angular.module('bmrExtension')</code>.</p>",
    requires: [ 'module:bmrExtension.uikit', 'module:bmrExtension.profile' ],
    longname: 'bmrExtension',
    scope: 'global',
    '$longname': 'bmrExtension',
    '$kind': 'namespace',
    '$members': [ [Object], [Object], [Object], [Object], [Object] ]
  },
  {
    comment: '/**\n' +
      ' * @name contactStore\n' +
      ' * @memberof bmrExtension.module:stores\n' +
      ' * @description Information about the contact creation, profile, etc.\n' +
      ' * @type {Object}\n' +
      ' */',
    meta: {
      filename: 'contactStore.js',
      lineno: 1,
      columnno: 0,
      path: '/Users/ahmadassaf/Downloads/Projects/app-extension/code/js/stores',
      code: {}
    },
    name: 'contactStore',
    memberof: 'bmrExtension.module:stores',
    description: '<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script><p>Information about the contact creation, profile, etc.</p>',
    type: { names: [Array] },
    scope: 'static',
    longname: 'bmrExtension.module:stores.contactStore',
    kind: 'member',
    '$longname': 'bmrExtension.module:stores.contactStore',
    '$kind': 'property'
  },
  {
    comment: '/**\n' +
      ' * @name fieldsStore\n' +
      ' * @memberof bmrExtension.module:stores\n' +
      ' * @description Company fields information e.g., custom fields, global tags, users, etc.\n' +
      ' * @type {Object}\n' +
      ' */',
    meta: {
      filename: 'fieldsStore.js',
      lineno: 1,
      columnno: 0,
      path: '/Users/ahmadassaf/Downloads/Projects/app-extension/code/js/stores',
      code: {}
    },
    name: 'fieldsStore',
    memberof: 'bmrExtension.module:stores',
    description: '<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script><p>Company fields information e.g., custom fields, global tags, users, etc.</p>',
    type: { names: [Array] },
    scope: 'static',
    longname: 'bmrExtension.module:stores.fieldsStore',
    kind: 'member',
    '$longname': 'bmrExtension.module:stores.fieldsStore',
    '$kind': 'property'
  },
  {
    comment: '/**\n' +
      ' * @name flagsStore\n' +
      ' * @memberof bmrExtension.module:stores\n' +
      ' * @description Necessary flags to control the various states in the extension\n' +
      ' * @type {Object}\n' +
      ' */',
    meta: {
      filename: 'flagsStore.js',
      lineno: 1,
      columnno: 0,
      path: '/Users/ahmadassaf/Downloads/Projects/app-extension/code/js/stores',
      code: {}
    },
    name: 'flagsStore',
    memberof: 'bmrExtension.module:stores',
    description: '<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script><p>Necessary flags to control the various states in the extension</p>',
    type: { names: [Array] },
    scope: 'static',
    longname: 'bmrExtension.module:stores.flagsStore',
    kind: 'member',
    '$longname': 'bmrExtension.module:stores.flagsStore',
    '$kind': 'property'
  }
]

Would love to hear your thoughts on this.

@onury
Copy link
Owner

onury commented Feb 3, 2020

in the jsdoc-x output, the memberof field decides where the symbol will go as a child. You might also have to use memberof! (with exclamation) to force hierarchy on object properties. Do you have a bmrExtension.module:stores symbol in the output?

For missing symbols, try enabling undescribed option (and maybe undocumented option too).

If none of these help, pls send me a sample project, or full jsdoc-x output (json file). I'll have a look.

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

No branches or pull requests

2 participants