Skip to content

fix(swagger): guard against undefined module routes in SwaggerScanner #3731

@hibo-developer

Description

@hibo-developer

Hello maintainers,

I found a runtime TypeError in SwaggerScanner where it calls .values() on an undefined routes when deep scanning related modules. This causes startup failures in apps that have modules without controller routes.

I prepared a fix that:

  • Skips related modules without routes when deep scanning
  • Guards scanModuleRoutes to return [] if routes is undefined

A full patch and tests are available in my repo here: https://github.com/hibo-developer/hibo_cocina/pull/1

Patch file (suggested):

(see attached patch in backend/patches/@nestjs+swagger+6.3.0.patch)

Please let me know if you'd like a PR with the change applied directly to the codebase; I can fork and open a PR (currently attempted, waiting on fork readiness). Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions