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

Improve encoding of values to handle null cases #1223

Merged
merged 1 commit into from Oct 17, 2022

Conversation

kevmoo
Copy link
Collaborator

@kevmoo kevmoo commented Oct 17, 2022

Specifically with enums and converter functions when
includeIfNull is false.

Enum values with null as an output where not properly wrapped.
This is now fixed.

Fixes #1202

Also 'unwrap' the cases where conversion functions never return null.

Specifically with enums and converter functions when
`includeIfNull` is `false`.

Enum values with `null` as an output where not properly wrapped.
This is now fixed.

Fixes #1202

Also 'unwrap' the cases where conversion functions never return `null`.
@kevmoo kevmoo enabled auto-merge (squash) October 17, 2022 18:04
Copy link
Collaborator

@jakemac53 jakemac53 left a comment

Choose a reason for hiding this comment

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

Feel free to not accept the suggestions, up to you

Comment on lines +24 to +26
if (enumMap == null) return null;

return enumMap.values.contains(null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (enumMap == null) return null;
return enumMap.values.contains(null);
return enumMap?.values.contains(null);

Comment on lines +157 to +161
if (data == null) {
return null;
}

return data.jsonType.isNullableType;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (data == null) {
return null;
}
return data.jsonType.isNullableType;
return data?.jsonType.isNullableType;

@kevmoo kevmoo merged commit 5107ac1 into master Oct 17, 2022
@kevmoo kevmoo deleted the i1202_null_enum_output branch October 17, 2022 18:13
@jakemac53
Copy link
Collaborator

Oh rofl, auto merge for the lose....

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.

Arg includeIfNull is ignored when type is not nullable
2 participants