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 shorthand encoding of Payloads #154

Merged
merged 4 commits into from
Mar 22, 2024
Merged

Fix shorthand encoding of Payloads #154

merged 4 commits into from
Mar 22, 2024

Conversation

dnr
Copy link
Member

@dnr dnr commented Mar 22, 2024

What changed?
Marshal/unmarshal empty Payloads as [] in shorthand encoding (also accept null on unmarshal).
Handle the case where one or more Payload within Payloads can't be encoded as shorthand.

Why?
These cases were producing invalid json.

How did you test it?
unit tests

@dnr dnr requested review from a team as code owners March 22, 2024 00:14
@dnr dnr changed the title Fix shorthand payloads handling of empty payloads Fix shorthand encoding handling of empty Payloads Mar 22, 2024
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

Looks great! Let's let @tdeebswihart review too before merging.

}, {
name: "empty payloads",
longformJSON: `{}`,
shorthandJSON: `null`,
Copy link
Member

Choose a reason for hiding this comment

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

Hrmm, arguably this could be []

Copy link
Contributor

Choose a reason for hiding this comment

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

An empty array seems "correct" as it is an empty array, but we should support parsing either

@dnr dnr changed the title Fix shorthand encoding handling of empty Payloads Fix shorthand encoding of Payloads Mar 22, 2024
@dnr dnr merged commit 9ed9b64 into master Mar 22, 2024
3 checks passed
@dnr dnr deleted the david/fixemptypayloads branch March 22, 2024 18: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
3 participants