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

Allow null numbers and validate them correctly #182

Merged
merged 3 commits into from
Jun 8, 2022

Conversation

AramAlsabti
Copy link
Contributor

@AramAlsabti AramAlsabti commented Jun 7, 2022

This is a supplementary fix to this PR.

The issue with the class-transformer library is that it mutates the parameter deeply inside a private property. We need to default its value if none is passed; otherwise. it must be validated and sanitized.

In cases with editing a payload decoder, we want to fetch all applications. This PR updates the check by allowing null or "null" values, if it has been explicitly allowed. If it's allowed, then the decorator doesn't force it to a number if null or "null" is passed.

@AramAlsabti AramAlsabti requested a review from GufCab June 7, 2022 10:05
@AramAlsabti AramAlsabti self-assigned this Jun 7, 2022
src/helpers/string-to-number-validator.ts Outdated Show resolved Hide resolved
src/helpers/string-to-number-validator.ts Outdated Show resolved Hide resolved
@AramAlsabti
Copy link
Contributor Author

To keep the changes low-impact, I've moved the changes to the list applications dto and re-defined limit and offset. The dto is only used and validated on the application controller.

@AramAlsabti AramAlsabti merged commit 13e6ede into stage Jun 8, 2022
@AramAlsabti AramAlsabti deleted the feature/1311_option-for-null-numbers branch June 8, 2022 11:39
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.

2 participants