ojoanalogo / nestjs-redoc

📘 ReDoc frontend for you NestJS swagger API documentation
MIT License
146 stars 55 forks source link

Cannot run the 'app' in RedocModule.setup(); #18

Closed Ketibansapi closed 3 years ago

Ketibansapi commented 3 years ago

Hello Redoc, thank you for your awesome work. But i have a bit issue on how to install it.

So, I have already done all the installation and put some code inside my main.ts file exactly the same:

const options = new DocumentBuilder()
  .setTitle('Look, i have a title')
  .setDescription('A very nice description')
  .setBasePath('/api/v1')
  .build();
  const document = SwaggerModule.createDocument(app, options);

  const redocOptions: RedocOptions = {
    title: 'Hello Nest',
    logo: {
      url: 'https://redocly.github.io/redoc/petstore-logo.png',
      backgroundColor: '#F0F0F0',
      altText: 'PetStore logo'
    },
    sortPropsAlphabetically: true,
    hideDownloadButton: false,
    hideHostname: false
  };
  // Instead of using SwaggerModule.setup() you call this module
  await RedocModule.setup('/docs', app, document, redocOptions);

Focused on the line code : await RedocModule.setup('/docs', app, document, redocOptions);

I have an issue on 'app' such as:

Argument of type 'import("/Users/kcb/Documents/Projects/Sample/Deploy_zeit/deploy-zeit/node_modules/@nestjs/common/interfaces/nest-application.interface").INestApplication' is not assignable to parameter of type 'import("/Users/kcb/Documents/Projects/Sample/Deploy_zeit/deploy-zeit/node_modules/nestjs-redoc/node_modules/@nestjs/common/interfaces/nest-application.interface").INestApplication'.
  The types returned by 'getHttpAdapter().createMiddlewareFactory(...)' are incompatible between these types.

Perhaps, you guys can help me on this issue. Thanks!

ojoanalogo commented 3 years ago

Hi, which version of the module are you using?

Ketibansapi commented 3 years ago

Solved already, will update the package.json later on. Thanks!

kevinsproles commented 3 years ago

Having the same issue. How did you solve @Ketibansapi ?

I'm on nestjs 7.4.4.

When I look in node_modules/nestjs-redoc I see the package.json in there says "@nestjs/common": "^6.11.5". Seems you haven't pushed the latest from github to npm.

KumaCool commented 3 years ago

@kevinsproles I directly clone the github to the local and build, which can solve the problem.

Please sync github to npm @mxarc thankyou~

cerireyhan commented 3 years ago

The issue still exists, is there a new version coming soon?

ojoanalogo commented 3 years ago

@kevinsproles I directly clone the github to the local and build, which can solve the problem.

Please sync github to npm @mxarc thankyou~

Hi, will do it ASAP

ojoanalogo commented 3 years ago

@cerireyhan package will be updated real soon, I've fixed many issues and added authentication feature (optional)