1- import { applyDecorators , Type as NestType } from '@nestjs/common' ;
1+ import { applyDecorators , Type as NestType } from '@nestjs/common' ;
22import {
33 ApiOperation ,
44 ApiUnauthorizedResponse ,
@@ -241,7 +241,7 @@ export function Api(options: ApiOptions): MethodDecorator {
241241
242242 // Add request body documentation if bodyType is specified
243243 if ( options . bodyType ) {
244- decorators . push ( ApiBody ( { type : options . bodyType } ) ) ;
244+ decorators . push ( ApiBody ( { type : options . bodyType } ) ) ;
245245 }
246246
247247 // ============================================================================
@@ -348,22 +348,22 @@ export function Api(options: ApiOptions): MethodDecorator {
348348 schema : {
349349 type : 'object' ,
350350 properties : {
351- success : { type : 'boolean' , example : true } ,
352- data : { $ref : getSchemaPath ( options . responseType ) } ,
351+ success : { type : 'boolean' , example : true } ,
352+ data : { $ref : getSchemaPath ( options . responseType ) } ,
353353 } ,
354354 } ,
355355 } )
356356 ) ;
357357 } else {
358358 // Direct response without envelope
359- decorators . push ( ApiResponse ( { status : 200 , description : 'Successful response' , type : options . responseType } ) ) ;
359+ decorators . push ( ApiResponse ( { status : 200 , description : 'Successful response' , type : options . responseType } ) ) ;
360360 }
361361 }
362362 // Array response
363363 else if ( options . responseArrayType ) {
364364 const arraySchema = {
365365 type : 'array' ,
366- items : { $ref : getSchemaPath ( options . responseArrayType ) } ,
366+ items : { $ref : getSchemaPath ( options . responseArrayType ) } ,
367367 } ;
368368 if ( options . envelope ) {
369369 // Wrapped in envelope: { success: true, data: [...] }
@@ -374,7 +374,7 @@ export function Api(options: ApiOptions): MethodDecorator {
374374 schema : {
375375 type : 'object' ,
376376 properties : {
377- success : { type : 'boolean' , example : true } ,
377+ success : { type : 'boolean' , example : true } ,
378378 data : arraySchema ,
379379 } ,
380380 } ,
@@ -398,18 +398,18 @@ export function Api(options: ApiOptions): MethodDecorator {
398398 properties : {
399399 items : {
400400 type : 'array' ,
401- items : { $ref : getSchemaPath ( options . paginatedResponseType ) } ,
401+ items : { $ref : getSchemaPath ( options . paginatedResponseType ) } ,
402402 } ,
403403 pageInfo : {
404404 type : 'object' ,
405405 properties : {
406- hasNextPage : { type : 'boolean' } ,
407- hasPreviousPage : { type : 'boolean' } ,
408- startCursor : { type : 'string' , nullable : true } ,
409- endCursor : { type : 'string' , nullable : true } ,
406+ hasNextPage : { type : 'boolean' } ,
407+ hasPreviousPage : { type : 'boolean' } ,
408+ startCursor : { type : 'string' , nullable : true } ,
409+ endCursor : { type : 'string' , nullable : true } ,
410410 } ,
411411 } ,
412- totalCount : { type : 'number' } ,
412+ totalCount : { type : 'number' } ,
413413 meta : {
414414 type : 'object' ,
415415 additionalProperties : true ,
@@ -427,7 +427,7 @@ export function Api(options: ApiOptions): MethodDecorator {
427427 schema : {
428428 type : 'object' ,
429429 properties : {
430- success : { type : 'boolean' , example : true } ,
430+ success : { type : 'boolean' , example : true } ,
431431 data : basePaginated ,
432432 } ,
433433 } ,
@@ -451,14 +451,14 @@ export function Api(options: ApiOptions): MethodDecorator {
451451 // ============================================================================
452452 // Add default error responses (401, 201, 403) if user hasn't provided custom responses
453453 if ( addDefaultSet ) {
454- decorators . push ( ApiUnauthorizedResponse ( { description : 'Unauthorized' } ) ) ;
455- decorators . push ( ApiCreatedResponse ( { description : 'The record has been successfully created.' } ) ) ;
456- decorators . push ( ApiForbiddenResponse ( { description : 'Forbidden.' } ) ) ;
454+ decorators . push ( ApiUnauthorizedResponse ( { description : 'Unauthorized' } ) ) ;
455+ decorators . push ( ApiCreatedResponse ( { description : 'The record has been successfully created.' } ) ) ;
456+ decorators . push ( ApiForbiddenResponse ( { description : 'Forbidden.' } ) ) ;
457457 } else {
458458 // If user provided custom responses, ensure 401 is still added for authenticated endpoints
459459 let has401 = userProvidedResponses . some ( ( r ) => r . status === 401 ) ;
460460 if ( options . authenticationRequired && ! has401 ) {
461- decorators . push ( ApiUnauthorizedResponse ( { description : 'Unauthorized' } ) ) ;
461+ decorators . push ( ApiUnauthorizedResponse ( { description : 'Unauthorized' } ) ) ;
462462 has401 = true ;
463463 }
464464 }
0 commit comments