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

omitempty for NULL attribute values from custom marshalers #2739

Merged
merged 4 commits into from
Aug 24, 2024

Conversation

babattles
Copy link
Contributor

Adds an EncoderOption that allows the encoder to omit NULL attribute values when marshaling a field tagged with omitempty.

Related issues:

@babattles babattles requested a review from a team as a code owner August 9, 2024 07:20
@lucix-aws
Copy link
Contributor

Once CI passes I'm going to push a clarification to the doc string on this new field, since omitempty does chop out NULLs for values in the normal marshaling workflow e.g.

type Foo struct {
	A string
	B *string `dynamodbav:",omitempty"` // will get omitted today if B == nil
}

Basically it'll be something like

	// When enabled, the encoder will omit null (NULL) attribute values returned
	// from custom marshalers tagged with `omitempty`.

@lucix-aws lucix-aws merged commit 84ca95e into aws:main Aug 24, 2024
11 of 12 checks passed
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.

2 participants