Crud: Swagger doc still shows routes that are excluded

Created on 27 Jan 2020  路  8Comments  路  Source: nestjsx/crud

Problem

With the following configuration in my controller, my swagger documentation still shows all Create Update and Delete routes.

CatController.ts

@Crud({
    model: {
        type: Cat,
    },
    routes: {
        only: ['getOneBase', 'getManyBase']
    },
})

Versions:

  • @nestjs/typeorm: "^6.2.0"
  • @nestjsx/crud: "^4.4.1"
  • @nestjsx/crud-typeorm: "^4.4.1"
  • typeorm: "^0.2.22"

All 8 comments

    model: {
        type: Object,
    },

is this a real example? I mean do you really use it like that? With Object?

No sorry, that is obviously not the real model type, i'll change my pseudo code

@Jensderond what version of @nestjs/swagger do you use?
P.S.
I've couldn't replicate your bug with the latest swagger package

Versions:

  • @nestjs/typeorm: "^6.2.0"
  • @nestjs/swagger: "^4.2.1",
  • @nestjsx/crud: "^4.4.1"
  • @nestjsx/crud-typeorm: "^4.4.1"
  • typeorm: "^0.2.22"
  • swagger-ui-express: "^4.1.3",

Hmm maybe this is going beyond just swagger..

target-pipeline.controller.ts

@ApiTags('Target pipeline')
@Crud({
    model: {
        type: TargetPipeline,
    },
    routes: {
        only: ['getOneBase', 'getManyBase']
    },
})
@Controller('target-pipeline')
[Nest] 93076   - 01/27/2020, 15:13:50   [RoutesResolver] TargetPipelineController {/target-pipeline}: +0ms
[Nest] 93076   - 01/27/2020, 15:13:50   [RouterExplorer] Mapped {/:id, GET} route +0ms
[Nest] 93076   - 01/27/2020, 15:13:50   [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 93076   - 01/27/2020, 15:13:50   [RouterExplorer] Mapped {/, POST} route +0ms
[Nest] 93076   - 01/27/2020, 15:13:50   [RouterExplorer] Mapped {/bulk, POST} route +0ms
[Nest] 93076   - 01/27/2020, 15:13:50   [RouterExplorer] Mapped {/:id, PATCH} route +1ms
[Nest] 93076   - 01/27/2020, 15:13:50   [RouterExplorer] Mapped {/:id, PUT} route +0ms
[Nest] 93076   - 01/27/2020, 15:13:50   [RouterExplorer] Mapped {/:id, DELETE} route +0ms

I'm pretty much sure this functionality works. Could you please provide a GitHub repository that represents this issue so that I could play with it?

Hmm, indeed. While creating a demo repository I cannot reproduce the problem, even when I copy/paste the exact module/controller/services. Closing this for now! Sorry for wasting your time :'(

Removed dist and node_modules folders and the problem is gone 馃憤

Was this page helpful?
0 / 5 - 0 ratings