-
Notifications
You must be signed in to change notification settings - Fork 218
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
bug: Using the serde
attribute rename
fails since 0.14.0
with a missing field
error
#522
Comments
Thanks for filing this! |
You're welcome! And thanks for the quick response :) |
Same bug I believe: #531
|
serde
's rename macro attributeserde
attribute rename
fails since 0.14.0
with a missing field
error
I've encountered the same issue. When using [email protected] in combination with serde, applying #[serde(rename_all = "camelCase")] to handle the yaml configuration file does not work as expected. Below is the configuration file: dataBase:
url: "http://www.ss.com.cn"
userName: "张三"
password: "1233"
addr: "0.0.0.0:8887" #[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Conf {
pub data_base: Option<DataBase>,
pub addr: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct DataBase {
pub url: String,
pub user_name: String,
pub password: String,
#[serde(default)]
pub data_base_connection_poll: DataBaseConnectionPool,
} When I reverted the config to version 0.13, this code executed as expected. |
FYI I've posted a revert at #613 |
Starting at
[email protected]
,serde
renamed fields are no longer supported due to the "missing field" error.Consider the following minimal reproduceable example:
The output is as follows:
Reverting the dependency back to
[email protected]
works as expected:The text was updated successfully, but these errors were encountered: