Currently, I am using @ApiExcludeEndpoint() ### on top of all methods to hide the end-point in the swagger-ui, like this:
import { Controller, Get, Query, Param } from '@nestjs/common';
import { ResourceService } from './resource.service';
import { Auth } from 'src/auth/auth.decorator';
import {
ApiTags,
ApiSecurity,
ApiOkResponse,
ApiForbiddenResponse,
ApiCreatedResponse,
ApiExcludeEndpoint
} from '@nestjs/swagger';
@Controller()
@ApiTags('Resources')
@ApiSecurity('apiKey')
export class ResourceController {
constructor(private readonly resourceService: ResourceService) {}
@Get('get_url')
@ApiExcludeEndpoint()
@Get()
@ApiOkResponse({
description: 'Resources list has succesfully been returned',
})
@ApiForbiddenResponse({ description: 'You are not allowed' })
@Auth(...common_privileges)
findAll(@Query() query: any): any {
......
}
@Get('get_url/:id')
@ApiExcludeEndpoint()
@ApiOkResponse({ description: 'Resource has succesfully been returned' })
@ApiForbiddenResponse({ description: 'You are not allowed' })
@Auth(...common_privileges)
findById(@Param('id') id: string, @Query() query: any): any {
......
}
}
I Need to know is there a way to hide all the end-point in the controller using a single decorator, I checked some documents it says to use @ApiIgnore() and @Hidden() but I can't find those in nestjs-swagger. Please comment on this