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

Add support for parsing boolean strings #1686

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sandratatarevicova
Copy link

@sandratatarevicova sandratatarevicova commented Feb 21, 2024

Description

class-transformer is often used in NestJS projects to parse request bodies/params. The current version transforms the string 'false' to true and requires ugly workarounds to make it work as expected, see #626, https://stackoverflow.com/questions/59046629/boolean-parameter-in-request-body-is-always-true-in-nestjs-api an the other linked issues.

This PR adds configuration option parseBooleanStrings, which allows parsing boolean strings. It is disabled by default so that it does not break existing projects.

Checklist

  • [ x ] the pull request title describes what this PR does (not a vague title like Update index.md)
  • [ x ] the pull request targets the default branch of the repository (develop)
  • [ x ] the code follows the established code style of the repository
    • npm run prettier:check passes
    • npm run lint:check passes
  • [ x ] tests are added for the changes I made (if any source code was modified)
  • [ x ] documentation added or updated
  • [ x ] I have run the project locally and verified that there are no errors

Fixes

fixes #626
fixes #2170
fixes #306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant