Skip to content

feat: Add class-validator decorators to update DTOs with PartialType inheritance and CI enforcement#1081

Merged
RUKAYAT-CODER merged 4 commits into
rinafcode:mainfrom
onajidavid87-web:main
Jul 26, 2026
Merged

feat: Add class-validator decorators to update DTOs with PartialType inheritance and CI enforcement#1081
RUKAYAT-CODER merged 4 commits into
rinafcode:mainfrom
onajidavid87-web:main

Conversation

@onajidavid87-web

Copy link
Copy Markdown
Contributor

Applied class-validator decorators (@IsString, @isarray, @IsOptional, @isboolean, @IsEnum, @isnumber, @isnotempty, @ValidateNested, @type) to seven update/request DTOs that previously accepted arbitrary payloads, enabling the global ValidationPipe (configured with whitelist: true and forbidNonWhitelisted: true) to reject unknown and mistyped properties with 400 responses.

  • sync-action.dto.ts — Added missing class-validator imports so existing @IsString()/@isObject() decorators work at runtime.
  • sync-batch.dto.ts — Added @isarray(), @ValidateNested({ each: true }), @type(() => SyncActionDto), and required imports for proper nested validation.
  • gdpr-export.dto.ts — Added @IsOptional() and type decorators on all excluded fields to establish a non-empty whitelist while preserving @exclude() serialization behavior.
  • achievement.dto.ts — Decorated CreateAchievementDto with full validation and converted UpdateAchievementDto to extends PartialType(CreateAchievementDto) with additional optional fields, keeping validation in sync automatically.
  • Created scripts/validate-dto-decorators.js — a CI check that asserts every *.dto.ts file has class-validator decorators, uses PartialType, or is a class-level @exclude() response DTO. Added as lint:dto script and included in the verify pipeline.
  • Added 5 spec files (23 total tests) verifying valid payloads pass, invalid types are rejected, and PartialType inheritance works correctly.

Closes #1040

…inheritance and CI enforcement

Applied class-validator decorators (@IsString, @isarray, @IsOptional, @isboolean, @IsEnum, @isnumber, @isnotempty, @ValidateNested, @type) to seven update/request DTOs that previously accepted arbitrary payloads, enabling the global ValidationPipe (configured with whitelist: true and forbidNonWhitelisted: true) to reject unknown and mistyped properties with 400 responses.
- sync-action.dto.ts — Added missing class-validator imports so existing @IsString()/@isObject() decorators work at runtime.
- sync-batch.dto.ts — Added @isarray(), @ValidateNested({ each: true }), @type(() => SyncActionDto), and required imports for proper nested validation.
- gdpr-export.dto.ts — Added @IsOptional() and type decorators on all excluded fields to establish a non-empty whitelist while preserving @exclude() serialization behavior.
- achievement.dto.ts — Decorated CreateAchievementDto with full validation and converted UpdateAchievementDto to extends PartialType(CreateAchievementDto) with additional optional fields, keeping validation in sync automatically.
- Created scripts/validate-dto-decorators.js — a CI check that asserts every *.dto.ts file has class-validator decorators, uses PartialType, or is a class-level @exclude() response DTO. Added as lint:dto script and included in the verify pipeline.
- Added 5 spec files (23 total tests) verifying valid payloads pass, invalid types are rejected, and PartialType inheritance works correctly.

Closes rinafcode#1040
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@onajidavid87-web Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Well done on the job done so far!
Kindly fix workflow to pass.

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 7a73fad into rinafcode:main Jul 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add class-validator decorators to the update DTOs that currently accept any payload

2 participants