From 3d89c91434177fd4f8f2206b58f0df76bb3545a1 Mon Sep 17 00:00:00 2001 From: PINYO PATTANAWASANPORN Date: Mon, 28 Sep 2026 13:12:00 +0700 Subject: [PATCH] fix(swagger): add @ApiProperty decorators to inline controller DTOs (#355) --- src/bounties/bounties.controller.ts | 3 ++- src/maintenance-pool/maintenance-pool.controller.ts | 8 +++++++- src/milestones/milestones.controller.ts | 5 ++++- src/users/users.controller.ts | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/bounties/bounties.controller.ts b/src/bounties/bounties.controller.ts index 752f28d..06e98d1 100644 --- a/src/bounties/bounties.controller.ts +++ b/src/bounties/bounties.controller.ts @@ -10,7 +10,7 @@ import { Req, UseGuards, } from '@nestjs/common'; -import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; +import { ApiProperty, ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; import { Throttle } from '@nestjs/throttler'; // Import the Throttle decorator import { BountiesService } from './bounties.service'; import { CreateBountyDto } from './dto/create-bounty.dto'; @@ -29,6 +29,7 @@ import { } from '../common/swagger/api-common-responses.decorator'; class FundBountyDto { + @ApiProperty({ description: 'Stellar public key of the funding sponsor' }) @IsStellarAddress() funderAddress: string; } diff --git a/src/maintenance-pool/maintenance-pool.controller.ts b/src/maintenance-pool/maintenance-pool.controller.ts index b7fbe99..0741933 100644 --- a/src/maintenance-pool/maintenance-pool.controller.ts +++ b/src/maintenance-pool/maintenance-pool.controller.ts @@ -7,7 +7,7 @@ import { Post, UseGuards, } from '@nestjs/common'; -import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; +import { ApiProperty, ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; import { Throttle } from '@nestjs/throttler'; import { IsOptional, IsUUID } from 'class-validator'; import { MaintenancePoolService } from './maintenance-pool.service'; @@ -25,23 +25,29 @@ import { } from '../common/swagger/api-common-responses.decorator'; class DepositDto { + @ApiProperty({ description: 'Amount to deposit into the maintenance pool' }) @IsMoneyAmount() amount: string; + @ApiProperty({ description: 'Stellar public key of the funder depositing into the pool' }) @IsStellarAddress() funderAddress: string; } class AssignRewardDto { + @ApiProperty({ description: 'ID of the issue being rewarded' }) @IsUUID() issueId: string; + @ApiProperty({ description: 'Reward amount allocated from the maintenance pool' }) @IsMoneyAmount() amount: string; + @ApiProperty({ description: 'Stellar public key of the reward recipient' }) @IsStellarAddress() recipientAddress: string; + @ApiProperty({ required: false, description: 'Optional internal user ID of the recipient' }) @IsOptional() @IsUUID() recipientId?: string; diff --git a/src/milestones/milestones.controller.ts b/src/milestones/milestones.controller.ts index fdf3307..84dd5d3 100644 --- a/src/milestones/milestones.controller.ts +++ b/src/milestones/milestones.controller.ts @@ -8,7 +8,7 @@ import { Req, UseGuards, } from '@nestjs/common'; -import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; +import { ApiProperty, ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; import { IsOptional, IsUUID } from 'class-validator'; import { Throttle } from '@nestjs/throttler'; import { MilestonesService } from './milestones.service'; @@ -26,14 +26,17 @@ import { } from '../common/swagger/api-common-responses.decorator'; class FundMilestoneDto { + @ApiProperty({ description: 'Stellar public key of the funding sponsor' }) @IsStellarAddress() funderAddress!: string; } class ResolveIssueDto { + @ApiProperty({ description: 'Stellar public key of the recipient' }) @IsStellarAddress() recipientAddress!: string; + @ApiProperty({ required: false, description: 'Optional internal user ID of the recipient' }) @IsOptional() @IsUUID() recipientId?: string; diff --git a/src/users/users.controller.ts b/src/users/users.controller.ts index a62689f..12255a3 100644 --- a/src/users/users.controller.ts +++ b/src/users/users.controller.ts @@ -7,7 +7,7 @@ import { Patch, UseGuards, } from '@nestjs/common'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; +import { ApiProperty, ApiBearerAuth, ApiTags } from '@nestjs/swagger'; import { UsersService } from './users.service'; import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'; import { IsStellarAddress } from '../common/validators/stellar-address.validator';