Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add nullable option for IsNotEmptyObject decorator #678

Closed
NoNameProvided opened this issue Aug 7, 2020 · 2 comments
Closed

feature: add nullable option for IsNotEmptyObject decorator #678

NoNameProvided opened this issue Aug 7, 2020 · 2 comments
Labels
status: done/released Issue has been completed, no further action is needed. type: feature Issues related to new features.

Comments

@NoNameProvided
Copy link
Member

Description

This issue us copied and modified from PR #635 by @ytetsuro,

Currently, the @IsNotEmptyObject decorator allows objects with null values only. I would like an option for the @IsNotEmptyObject decorator to fail validation when all object property is null or undefined.

Proposed solution

Minimal example of proposed feature:

class MyClass {
  @IsNotEmptyObject()
  notStrictModeInvalid = { }; // invalid

  @IsNotEmptyObject()
  notStrictModeValid = { key1: null, key2: undefined }; // valid

  @IsNotEmptyObject({ nullable: false })
  strcitModeInvalid = { }; // invalid

  @IsNotEmptyObject({ nullable: false })
  strcitModeValid = { key1: null, key2: undefined }; // invalid

  @IsNotEmptyObject({ nullable: false })
  strcitModeValid = { key1: 'key', key2: undefined }; // valid
}
@NoNameProvided NoNameProvided added type: feature Issues related to new features. flag: needs discussion Issues which needs discussion before implementation. and removed flag: needs discussion Issues which needs discussion before implementation. labels Aug 7, 2020
@NoNameProvided NoNameProvided added status: has PR Issues which has a related PR closing the issue. status: fixed Issues with merged PRs, but not released yet. and removed status: has PR Issues which has a related PR closing the issue. labels Aug 7, 2020
@NoNameProvided
Copy link
Member Author

This has been fixed in develop and be included in the next release.

@github-actions
Copy link

github-actions bot commented Sep 7, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2020
@NoNameProvided NoNameProvided added status: done/released Issue has been completed, no further action is needed. and removed status: fixed Issues with merged PRs, but not released yet. labels Nov 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: done/released Issue has been completed, no further action is needed. type: feature Issues related to new features.
Development

No branches or pull requests

1 participant