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

feat: support omitempty in custom json de/encoder #1441

Merged
merged 1 commit into from
May 8, 2024
Merged

Conversation

deniseli
Copy link
Contributor

@deniseli deniseli commented May 8, 2024

Fixes #1262

minor cleanup

post merge cleanup
@deniseli deniseli requested a review from alecthomas as a code owner May 8, 2024 17:38
@deniseli deniseli requested review from a team and wesbillman and removed request for a team May 8, 2024 17:38
@alecthomas alecthomas mentioned this pull request May 8, 2024
@deniseli deniseli merged commit 23b18fa into main May 8, 2024
11 checks passed
@deniseli deniseli deleted the dli/omitempty branch May 8, 2024 17:42
Comment on lines +66 to +67
{name: "OmitEmptyNotNull", input: validateOmitempty{"foo", "bar", "baz"}, expected: `{"shouldOmit":"foo","shouldntOmit":"bar","notTagged":"baz"}`},
{name: "OmitEmptyNull", input: validateOmitempty{}, expected: `{"shouldntOmit":"","notTagged":""}`},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! I wonder if we should add some omitempty to test data .go files in a test as well to make sure it's working end-to-end?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea! I'll do that now

@wesbillman wesbillman added the approved Marks an already closed PR as approved label May 8, 2024
deniseli added a commit that referenced this pull request May 9, 2024
Addresses
#1441 (comment)

Tested with `go test --tags=integration ./integration/... -run
TestHTTPEncodeOmitempty`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Marks an already closed PR as approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write a completely custom JSON decoder/encoder
2 participants