Skip to content
Snippets Groups Projects
Unverified Commit 9d9ae348 authored by polka.dom's avatar polka.dom Committed by GitHub
Browse files

Add Serialize & Deserialize to umbrella crate derive module (#7764)


When working with storage types that are to be set in the genesis block,
deriving serde::Serialize & serde::Deserialize is necessary (to my
knowledge). This PR introduces Serialize and Deserialize into the
umbrella crate derive (and indirectly prelude) module, allowing for
similar access as the other storage value derives.

---------

Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: default avatarBastian Köcher <git@kchr.de>
parent f9707b72
Branches
No related merge requests found
Pipeline #517649 waiting for manual action with stages
in 50 minutes and 42 seconds
......@@ -16203,6 +16203,7 @@ dependencies = [
"pallet-examples",
"parity-scale-codec",
"scale-info",
"serde",
"sp-api 26.0.0",
"sp-arithmetic 23.0.0",
"sp-block-builder",
......
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
title: Add Serialize & Deserialize to umbrella crate derive module
doc:
- audience: Runtime Dev
description: |
This PR adds serde::Serialize and serde::Deserialize to the frame umbrella crate
`derive` and indirectly `prelude` modules. They can now be accessed through those.
Note: serde will still need to be added as a dependency in consuming crates. That or
you'll need to specify th `#[serde(crate = "PATH_TO_SERDE::serde")]` attribute at the
location where Serialize/Deserialize are used.
crates:
- name: polkadot-sdk-frame
bump: minor
......@@ -24,6 +24,7 @@ codec = { features = [
scale-info = { features = [
"derive",
], workspace = true }
serde = { workspace = true }
# primitive deps, used for developing FRAME pallets.
sp-arithmetic = { workspace = true }
......@@ -95,6 +96,7 @@ std = [
"frame-try-runtime?/std",
"log/std",
"scale-info/std",
"serde/std",
"sp-api?/std",
"sp-arithmetic/std",
"sp-block-builder?/std",
......
......@@ -548,6 +548,13 @@ pub mod derive {
PartialOrdNoBound, RuntimeDebugNoBound,
};
pub use scale_info::TypeInfo;
pub use serde;
/// The `serde` `Serialize`/`Deserialize` derive macros and traits.
///
/// You will either need to add `serde` as a dependency in your crate's `Cargo.toml`
/// or specify the `#[serde(crate = "PATH_TO_THIS_CRATE::serde")]` attribute that points
/// to the path where serde can be found.
pub use serde::{Deserialize, Serialize};
pub use sp_runtime::RuntimeDebug;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment