Skip to content

feat(decorators): add @AtLeastOneField class-level decorator#2680

Open
francoabottaro wants to merge 1 commit into
typestack:developfrom
francoabottaro:feat/at-least-one-field-decorator
Open

feat(decorators): add @AtLeastOneField class-level decorator#2680
francoabottaro wants to merge 1 commit into
typestack:developfrom
francoabottaro:feat/at-least-one-field-decorator

Conversation

@francoabottaro
Copy link
Copy Markdown

@francoabottaro francoabottaro commented May 8, 2026

Related issue

Closes #2676

What does this PR do?

Adds @AtLeastOneField, a class-level decorator that validates at least
one field of a DTO has a non-empty value. Useful for PATCH endpoints
where all fields are optional but the body cannot be empty.

Example Usage

@AtLeastOneField()

class UpdateUserDto extends PartialType(CreateUserDto) {}

Changes

  • feat: src/decorator/object/AtLeastOneField.ts
  • test: src/decorator/object/AtLeastOneField.spec.ts
  • export: src/decorator/object.ts

@francoabottaro
Copy link
Copy Markdown
Author

francoabottaro commented May 8, 2026

Hi! I've opened a PR for this feature: #2680

It includes:

  • The @AtLeastOneField decorator implementation
  • Unit tests
  • Export in src/object/decorators.ts

@braaar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

feature: Add @AtLeastOneField decorator

1 participant