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 nullable primitive lists #2042

Merged
merged 17 commits into from
Jun 16, 2023
Merged

Conversation

skarimo
Copy link
Member

@skarimo skarimo commented Jun 9, 2023

Motivation
Previously, the sdk did not support nullable arrays. With introduction of new nullable properties and promotion of old properties to nullable, we now have use cases where we need to differentiate between explicit null vs zero value.

Changes in the PR
This PR introduces a new wrapper around nullable primitive lists NullableList[T any]. This is a backward incompatible change but one that is necessary to add support for explicit null lists.

A previously nullable list with type []string will now be converted to datadog.NullableList[string]. There is a helper function NewNullableList. As an example:

RestrictedRoles: []string{
	"1234-567-8910",
}

Would now be configured as:

RestrictedRoles: *datadog.NewNullableList(&[]string{
	"1234-567-8910",
})

@skarimo skarimo added the changelog/Added Added features results into a minor version bump label Jun 9, 2023
@skarimo skarimo requested a review from a team as a code owner June 9, 2023 18:49
@skarimo skarimo force-pushed the sherz/nullable-primitive-list branch from 921e0b0 to 6628b08 Compare June 9, 2023 18:54
@skarimo skarimo force-pushed the sherz/nullable-primitive-list branch from 6628b08 to 3e3e70d Compare June 9, 2023 18:56
Copy link
Contributor

@therve therve left a comment

Choose a reason for hiding this comment

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

This looks good to me, but it's a breaking change so it should be marked as such. Can you also edit the PR description to explain the change a bit and what do to? This is our best way to document a migration, as it's linked in the changelog.

@therve therve added changelog/Fixed Fixed features results into a bug fix version bump backward-incompatible Warns for backward incompatible changes and removed changelog/Added Added features results into a minor version bump labels Jun 13, 2023
@skarimo skarimo requested a review from therve June 15, 2023 15:01
@skarimo skarimo merged commit 8160536 into master Jun 16, 2023
@skarimo skarimo deleted the sherz/nullable-primitive-list branch June 16, 2023 14:16
github-actions bot pushed a commit that referenced this pull request Jun 16, 2023
* add support for nullable primitive containers

---------

Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com> 8160536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backward-incompatible Warns for backward incompatible changes changelog/Fixed Fixed features results into a bug fix version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants