UNPKG

@nestjs/swagger

Version:

OpenAPI for NestJS: generate the API document from controllers and decorators, serve Swagger UI, and derive request types with mapped types.

15 lines (14 loc) • 572 B
import isUndefined from 'es-toolkit/compat/isUndefined'; import negate from 'es-toolkit/compat/negate'; import pickBy from 'es-toolkit/compat/pickBy'; import { DECORATORS } from '../constants.js'; import { createMethodDecorator } from './helpers.js'; const defaultOperationOptions = { summary: '' }; export function ApiOperation(options, { overrideExisting } = { overrideExisting: true }) { return createMethodDecorator(DECORATORS.API_OPERATION, pickBy({ ...defaultOperationOptions, ...options }, negate(isUndefined)), { overrideExisting }); }