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

Refactor and cleanup Any? json deserialization #19

Merged
merged 9 commits into from
Nov 25, 2024

Conversation

darronschall
Copy link
Contributor

Extracts the generic AnySerializer (that our ErrorResponse serializable data class relies on) into its own package and file.

Adds some additional test coverage to ensure doubles and longs in JSON responses are converted properly. (Note that we don't test serialization as it's not relevant to our use case.)

I find it easier to read and comprehend a single assert that validates that the `meta` JSON dictionary parses as expected, vs. many asserts that cover each individual key/value.
This is re-usable generic code that `ErrorResponse` happens to rely on.
I didn't like how it split the map key/value types on newlines because annotations default to requiring newlines. Suppress the rule, and adjust the formatting to make the map key/value types easier to read.
Additionally, keep the main entry point helpers as `internal` but make additional support helpers `private`.
@darronschall darronschall merged commit d87b6f4 into main Nov 25, 2024
2 checks passed
@darronschall darronschall deleted the refactor-any-json-deserialization branch November 25, 2024 21:47
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