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

potential fix for boolean elem alteration #929

Closed
wants to merge 5 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions singer_sdk/helpers/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ def conform_record_data_types( # noqa: C901
boolean_representation = None
elif elem == 0:
boolean_representation = False
elif isinstance(elem, str):
if elem.lower() in ['false', 'f']:
boolean_representation = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlloyd-widen what happens if the value is a string but not one of the checked options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then it would force it to true ... so that's not good either

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlloyd-widen even if True was an acceptable value, it seems to me that boolean_representation wouldn't have a value because there's no else here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edgarrmondragon just added a new commit. I tried to make the logic inclusive of true scenarios. Where the input element isn't obviously true or false, I pass it along as the final property value unaltered.

else:
boolean_representation = True
rec[property_name] = boolean_representation
Expand Down