Vonage / vonage-java-sdk

Vonage Server SDK for Java. API support for SMS, Messages, Voice, Text-to-Speech, Numbers, Verify (2FA), Video and more.
https://developer.vonage.com/en/home
Apache License 2.0
97 stars 121 forks source link

refactor: Global Jackson configuration #521

Closed SMadani closed 5 months ago

SMadani commented 5 months ago

All classes in the SDK which model JSON objects use the annotations @JsonIgnoreProperties(ignoreUnknown = true) and @JsonInclude(value = JsonInclude.Include.NON_NULL). This adds needless overhead to creating new classes and nested classes, since they may be easily forgotten. It also makes classes less readable. Since this is the default policy applied across the SDK, it makes sense to configure this at the top level to avoid this repetition. The major refactoring that has occurred since v7.7.0, with the introduction of the Jsonable interface (and later, JsonableBaseObject class) that all domain classes now implement, there is a convenient way to do this using the Jsonable#createDefaultObjectMapper() method. For the rare cases where default configuration needs to be overriden, JsonableBaseObject#createJsonObjectMapper() has been added.

This PR also removes the unused and deprecated com.vonage.client.sms.HexUtil class as it is not part of the public API.

codecov-commenter commented 5 months ago

Codecov Report

Merging #521 (d67fa1e) into main (5f6687d) will increase coverage by 0.03%. The diff coverage is 96.15%.

:exclamation: Current head d67fa1e differs from pull request most recent head 2ec1405. Consider uploading reports for the commit 2ec1405 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #521 +/- ## ============================================ + Coverage 95.50% 95.54% +0.03% + Complexity 3348 3339 -9 ============================================ Files 502 501 -1 Lines 7972 7941 -31 Branches 440 433 -7 ============================================ - Hits 7614 7587 -27 + Misses 204 200 -4 Partials 154 154 ``` | [Files](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage) | Coverage Δ | | |---|---|---| | [src/main/java/com/vonage/client/HttpWrapper.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2FHttpWrapper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9IdHRwV3JhcHBlci5qYXZh) | `100.00% <ø> (ø)` | | | [src/main/java/com/vonage/client/Jsonable.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2FJsonable.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9Kc29uYWJsZS5qYXZh) | `93.33% <100.00%> (+2.02%)` | :arrow_up: | | [...ain/java/com/vonage/client/JsonableBaseObject.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2FJsonableBaseObject.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9Kc29uYWJsZUJhc2VPYmplY3QuamF2YQ==) | `100.00% <100.00%> (ø)` | | | [.../com/vonage/client/VonageApiResponseException.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2FVonageApiResponseException.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9Wb25hZ2VBcGlSZXNwb25zZUV4Y2VwdGlvbi5qYXZh) | `67.39% <100.00%> (ø)` | | | [...onage/client/account/AccountResponseException.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2Faccount%2FAccountResponseException.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0FjY291bnRSZXNwb25zZUV4Y2VwdGlvbi5qYXZh) | `100.00% <ø> (ø)` | | | [...ava/com/vonage/client/account/BalanceResponse.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2Faccount%2FBalanceResponse.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0JhbGFuY2VSZXNwb25zZS5qYXZh) | `100.00% <ø> (ø)` | | | [...c/main/java/com/vonage/client/account/Country.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2Faccount%2FCountry.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0NvdW50cnkuamF2YQ==) | `100.00% <ø> (ø)` | | | [...com/vonage/client/account/FullPricingResponse.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2Faccount%2FFullPricingResponse.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0Z1bGxQcmljaW5nUmVzcG9uc2UuamF2YQ==) | `100.00% <ø> (ø)` | | | [...com/vonage/client/account/ListSecretsResponse.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2Faccount%2FListSecretsResponse.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0xpc3RTZWNyZXRzUmVzcG9uc2UuamF2YQ==) | `33.33% <ø> (-16.67%)` | :arrow_down: | | [...c/main/java/com/vonage/client/account/Network.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fcom%2Fvonage%2Fclient%2Faccount%2FNetwork.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L05ldHdvcmsuamF2YQ==) | `100.00% <ø> (ø)` | | | ... and [280 more](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/521?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage) | |