Skip to content

Docs parser crashes when prop.tags is undefined #15764

@THE-Amrit-mahto-05

Description

@THE-Amrit-mahto-05

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

7.6.3

Node.js version

18.x

MongoDB server version

6.0.x

Typescript version (if applicable)

Not using TypeScript

Description

While working on Mongoose documentation generation, I found that the docs parser crashes when a property does not contain the tags array.

In docs/source/api.js, the loop assumes prop.tags always exists.
However, in some parsed doc blocks, prop.tags is undefined, which causes a runtime error:

TypeError: Cannot read properties of undefined (reading 'Symbol(Symbol.iterator)')

The crash happens before documentation pages finish building.

Steps to Reproduce

  1. Clone the mongoose repository

  2. Install dependencies: npm install

  3. Run the docs build script: npm run docs:build

  4. Build fails with:

    TypeError: Cannot read properties of undefined (reading 'Symbol(Symbol.iterator)')
    at docs/source/api.js:XXX

Expected Behavior

The docs parser should safely skip properties without tags instead of crashing.
Documentation generation should complete without errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions