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

Switch from deprecated serde_yaml to forked serde_yml #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ default = ["env"]
json = ["serde_json"]
test = ["tempfile", "parking_lot"]
toml = ["toml_edit"]
yaml = ["serde_yaml"]
yaml = ["serde_yml"]
env = [] # does nothing; here for backwards compat

[dependencies]
serde = "1.0"
uncased = "0.9.3"
toml_edit = { version = "0.22", optional = true, default-features = false, features = ["parse", "serde"] }
serde_json = { version = "1.0", optional = true }
serde_yaml = { version = "0.9", optional = true }
serde_yml = { version = "0.0.12", optional = true }
tempfile = { version = "3", optional = true }
parking_lot = { version = "0.12", optional = true }

Expand Down
10 changes: 5 additions & 5 deletions src/providers/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ impl YamlExtended {
/// This "YAML Extended" format parser implements the draft ["Merge Key
/// Language-Independent Type for YAML™ Version
/// 1.1"](https://yaml.org/type/merge.html) spec via
/// [`serde_yaml::Value::apply_merge()`]. This method is _not_ intended to
/// [`serde_yml::Value::apply_merge()`]. This method is _not_ intended to
/// be used directly but rather indirectly by making use of `YamlExtended`
/// as a provider. The extension is not part of any officially supported
/// YAML release and is deprecated entirely since YAML 1.2. Using
Expand Down Expand Up @@ -603,14 +603,14 @@ impl YamlExtended {
/// Ok(())
/// });
/// ```
pub fn from_str<'de, T: DeserializeOwned>(s: &'de str) -> serde_yaml::Result<T> {
let mut value: serde_yaml::Value = serde_yaml::from_str(s)?;
pub fn from_str<'de, T: DeserializeOwned>(s: &'de str) -> serde_yml::Result<T> {
let mut value: serde_yml::Value = serde_yml::from_str(s)?;
value.apply_merge()?;
T::deserialize(value)
}
}

impl_format!(Toml "TOML"/"toml": toml_edit::de::from_str, toml_edit::de::Error);
impl_format!(Yaml "YAML"/"yaml": serde_yaml::from_str, serde_yaml::Error);
impl_format!(Yaml "YAML"/"yaml": serde_yml::from_str, serde_yml::Error);
impl_format!(Json "JSON"/"json": serde_json::from_str, serde_json::error::Error);
impl_format!(YamlExtended "YAML Extended"/"yaml": YamlExtended::from_str, serde_yaml::Error);
impl_format!(YamlExtended "YAML Extended"/"yaml": YamlExtended::from_str, serde_yml::Error);