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

build(deps): bump serde_with from 1.14.0 to 2.0.0 #4785

Merged
merged 1 commit into from
Aug 1, 2022

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jul 18, 2022

Bumps serde_with from 1.14.0 to 2.0.0.

Release notes

Sourced from serde_with's releases.

serde_with_macros v2.0.0

No changes compared to v2.0.0-rc.0.

Changed

  • Make #[serde_as] behave more intuitive on Option<T> fields.

    The #[serde_as] macro now detects if a #[serde_as(as = "Option<S>")] is used on a field of type Option<T> and applies #[serde(default)] to the field. This restores the ability to deserialize with missing fields and fixes a common annoyance (#183, #185, #311, #417). This is a breaking change, since now deserialization will pass where it did not before and this might be undesired.

    The Option field and transformation are detected by directly matching on the type name. These variants are detected as Option.

    • Option
    • std::option::Option, with or without leading ::
    • core::option::Option, with or without leading ::

    If an existing default attribute is detected, the attribute is not applied again. This behavior can be supressed by using #[serde_as(no_default)] or #[serde_as(as = "Option<S>", no_default)].

Fixed

  • Make the documentation clearer by stating that the #[serde_as] and #[skip_serializing_none] attributes must always be placed before #[derive].

serde_with v2.0.0

Added

  • Make JsonString<T> smarter by allowing nesting serde_as definitions. This allows applying custom serialization logic, before the value gets converted into a JSON string.

    // Rust
    #[serde_as(as = "JsonString<Vec<(JsonString, _)>>")]
    value: BTreeMap<[u8; 2], u32>,
    // JSON
    {"value":"[[&quot;[1,2]&quot;,3],[&quot;[4,5]&quot;,6]]"}

Changed

  • Make #[serde_as] behave more intuitive on Option<T> fields.

    The #[serde_as] macro now detects if a #[serde_as(as = "Option<S>")] is used on a field of type Option<T> and applies #[serde(default)] to the field. This restores the ability to deserialize with missing fields and fixes a common annoyance (#183, #185, #311, #417). This is a breaking change, since now deserialization will pass where it did not before and this might be undesired.

    The Option field and transformation are detected by directly matching on the type name. These variants are detected as Option.

    • Option

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot requested a review from a team as a code owner July 18, 2022 15:03
@dependabot dependabot bot requested review from conradoplg and removed request for a team July 18, 2022 15:03
@dependabot dependabot bot added A-dependencies Area: Dependency file updates A-rust Area: Updates to Rust code P-Low ❄️ labels Jul 18, 2022
@codecov
Copy link

codecov bot commented Jul 18, 2022

Codecov Report

Merging #4785 (9e647c6) into main (e9c9ea9) will increase coverage by 0.04%.
The diff coverage is n/a.

❗ Current head 9e647c6 differs from pull request most recent head 60d7c36. Consider uploading reports for the commit 60d7c36 to get more accurate results

@@            Coverage Diff             @@
##             main    #4785      +/-   ##
==========================================
+ Coverage   78.77%   78.81%   +0.04%     
==========================================
  Files         305      305              
  Lines       38742    38169     -573     
==========================================
- Hits        30518    30084     -434     
+ Misses       8224     8085     -139     

@dependabot dependabot bot force-pushed the dependabot/cargo/serde_with-2.0.0 branch from 24a45d2 to 9e647c6 Compare July 21, 2022 23:19
Copy link
Collaborator

@conradoplg conradoplg left a comment

Choose a reason for hiding this comment

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

This has a lot of changes but it looks fine, and does not seem to break existing code.

But can anyone double-check if this is safe?

@ZcashFoundation/unsafe-rust-reviewers

@conradoplg conradoplg requested review from a team and upbqdn and removed request for a team July 22, 2022 18:08
@teor2345
Copy link
Contributor

This has a lot of changes but it looks fine, and does not seem to break existing code.

But can anyone double-check if this is safe?

@ZcashFoundation/unsafe-rust-reviewers

It pretty much follows the recommended pattern in https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#initializing-an-array-element-by-element
(but with extra drop and error handling).

I checked that it drops the correct number of items.

(If anyone else wants to check, search the diff for "unsafe", the link didn't take me there automatically.)

teor2345
teor2345 previously approved these changes Jul 22, 2022
@teor2345
Copy link
Contributor

teor2345 commented Aug 1, 2022

@dependabot recreate

Bumps [serde_with](https://github.com/jonasbb/serde_with) from 1.14.0 to 2.0.0.
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](jonasbb/serde_with@v1.14.0...v2.0.0)

---
updated-dependencies:
- dependency-name: serde_with
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/cargo/serde_with-2.0.0 branch from 9e647c6 to 60d7c36 Compare August 1, 2022 02:42
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Re-approving

mergify bot added a commit that referenced this pull request Aug 1, 2022
@mergify mergify bot merged commit cc05f12 into main Aug 1, 2022
@mergify mergify bot deleted the dependabot/cargo/serde_with-2.0.0 branch August 1, 2022 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependencies Area: Dependency file updates A-rust Area: Updates to Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants