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

openapi.ApiResponse require is using a wrong path #3162

Closed
2 tasks done
linahou18 opened this issue Nov 13, 2024 · 1 comment
Closed
2 tasks done

openapi.ApiResponse require is using a wrong path #3162

linahou18 opened this issue Nov 13, 2024 · 1 comment

Comments

@linahou18
Copy link

Did you read the migration guide?

  • I have read the whole migration guide

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Potential Commit/PR that introduced the regression

No response

Versions

7.4.2 -> 8.0.5

Describe the regression

Our project was working fine with swagger 7.4.2. After the swagger version was upgraded to 8.0.5, nest start started to fail.

λ npm run start:nest

> my-nestjs-project@0.0.1 start:nest
> nest start

node:internal/modules/cjs/loader:1228
  throw err;
  ^

Error: Cannot find module '../../../C:/Users/lina/Downloads/my-nestjs-project/my-nestjs-project-main/src/dto/create-item.dto'
Require stack:
- C:\Users\lina\Downloads\my-nestjs-project\my-nestjs-project-main\dist\controllers\v1\items.controller.js
- C:\Users\lina\Downloads\my-nestjs-project\my-nestjs-project-main\dist\app.module.js
- C:\Users\lina\Downloads\my-nestjs-project\my-nestjs-project-main\dist\main.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Module._load (node:internal/modules/cjs/loader:1051:27)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (C:\Users\lina\Downloads\my-nestjs-project\my-nestjs-project-main\src\controllers\v1\items.controller.ts:14:5)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\lina\\Downloads\\my-nestjs-project\\my-nestjs-project-main\\dist\\controllers\\v1\\items.controller.js',
    'C:\\Users\\lina\\Downloads\\my-nestjs-project\\my-nestjs-project-main\\dist\\app.module.js',
    'C:\\Users\\lina\\Downloads\\my-nestjs-project\\my-nestjs-project-main\\dist\\main.js'
  ]
}

Node.js v20.17.0

The compiled file dist\controllers\v1\items.controller.js using 8.0.5 is having a wrong path which cannot be resolved.
openapi.ApiResponse({ status: 201, type: require("../../../C:/Users/lina/Downloads/my-nestjs-project/my-nestjs-project-main/src/dto/create-item.dto").CreateItemDto })

With 7.4.2, the compiled file dist\controllers\v1\items.controller.js had openapi.ApiResponse({ status: 201, type: require("../../dto/create-item.dto").CreateItemDto })

I have read #3154. But it seems the issue still persists.

Minimum reproduction code

I created a minimum reproduction repo https://github.com/linahou18/my-nestjs-project.

Expected behavior

openapi.ApiResponse require in the compiled file has a correct path. Running nest start has no issue.

Other

No response

@kamilmysliwiec
Copy link
Member

Fixed in 8.0.6

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

No branches or pull requests

2 participants