I’m thrilled to announce Serde 0.7.0!
It’s been a long time coming, and has a number of long awaited new features,
breaking changes, and other notable changes. Serde 0.6.x is now deprecated,
and while I’ll try to keep serde_codegen and serde_macros while projects
switch over to 0.7, I’m going to shift more to a pull-based approach, so please
file a bug ticket if a nightly release has broken you.
On to the list on the major changes!
Serde
Removed the word Error from serde::de::Error variants.
Renamed visit_ methods to serialize_ and deserialize_.
Renamed serde::de::Error::syntax to serde::de::Error::custom.
Serde Codegen and Macros
Serde now by default ignores unknown fields when deserializing. The previous
behavior, where Serde will report unknown fields as an error, can be
opted in with the container annotation #[serde(deny_unknown_fields)],
as in:
Added the variantl annotation #[serde(rename="...")] to rename
variants, as in:
1234
enumValue{#[serde(rename="type")]Type}
Added rename annotation #[serde(rename(serialize="...", deserialize="..."))]
that supports crazy schemas like AWS that expect serialized fields with the
first character lower case, and the deserialized response with the first
character upper cased.
Removed support for the unused format-specific rename support.
Added the field annotation #[serde(default="$path")], where $path is a
reference to some function that returns a default value for a field if it’s
not present when deserializing. For example:
Added the field annotation #[serde(skip_serializing_if="$path")], where
$path is a path reference to some function that returns a bool, that if
true, should skip serializing the field.
Added the field annotations #[serde(serialize_with="$path")] and
#[serde(deserialize_with="$path")], where $path us a path reference to
some function that serializes a field, as in:
Added StreamDeserializer, that enables parsing a stream of JSON values optionally
separated by whitespace into an iterator of those deserialized values.
Thanks
I’d like to thank everyone that’s helped out over the past few months. Please
forgive me if I accidentally left you off the list: