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

Fix JSON Serializer generating json with attributes with a null value #442

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

santiagorodriguez96
Copy link
Contributor

Attempts to fix #441.

In Rails, nil responds to as_json therefore the attributes whose value is nil are added to the result of as_json, which may end up causing issues with some authenticators – as described in the associated issue.

This PR attempts to fix this by adding another condition to the if to skip if the value for the attribute is nil.

Instead of checking that its value is `nil` which will return true even
if the key is not included in the hash.
In Rails, `nil` responds to `as_json` therefore the attributes whose
value is `nil` are added to the result of `as_json`, which may end up
causing issues with some authenticators – see #441.

This commits adds another condition to the if in order to prevent
this from happening.
@brauliomartinezlm brauliomartinezlm merged commit e76d35c into master Nov 14, 2024
11 checks passed
@brauliomartinezlm brauliomartinezlm deleted the sr--fix-serializer branch November 14, 2024 16:22
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.

After upgrading to 3.2.0, both attestation and userVerification value are null and being included
2 participants