You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: Support enums and tuples in SchemaAwareSerializer and implement SchemaAwareDeserializer (#512)
* doc: Document the mapping between the Serde and Avro data models
* feat: `SchemaAwareDeserializer` (no tests)
* feat: Use `SchemaAwareDeserializer` in the readers and add tests
* feat: Rework `SchemaAwareSerializer` to be more strict and follow the documented model (no tests)
* feat: Update tests and provide support for old ways of `BigDecimal` and `[T; N]`
* fix: Add missing license header and set PR number for tests
* fix: Don't call `T::field_default()` if the schema is overwritten using `#[avro(with)]`
* fix: Enable `rustdoc_internal` feature when `cfg(docsrs)` so we can use `fake_variadic`
* fix: Review feedback
---------
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
* fix: Apply suggestions from code review
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
* fix: Second round of code review
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
* fix: Use longs when serializing block item count and byte size
* fix: third round of review feedback
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
* fix: Don't allow serializing a unit variant inside the UnionSerializer as that would require a nested union
* chore: Enable and fix Clippy lints
* fix: fourth round of review feedback
* fix: Typo
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
---------
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
//! - `bytes`: [`Vec<u8>`](std::vec::Vec) (or any type that uses [`Serializer::serialize_bytes`](serde::Serializer), [`Deserializer::deserialize_bytes`](serde::Deserializer), [`Deserializer::deserialize_byte_buf`](serde::Deserializer))
34
+
//! - It is required to use [`apache_avro::serde::bytes`] as otherwise Serde will (de)serialize a `Vec` as an array of integers instead.
35
+
//! - `string`: [`String`] (or any type that uses [`Serializer::serialize_str`](serde::Serializer), [`Deserializer::deserialize_str`](serde::Deserializer), [`Deserializer::deserialize_string`](serde::Deserializer))
36
+
//!
37
+
//! ## Complex Types
38
+
//! - `records`: A struct with the same name and fields or a tuple with the same fields.
39
+
//! - Extra fields can be added to the struct if they are marked with `#[serde(skip)]`
40
+
//! - `enums`: A enum with the same name and unit variants for every symbol
41
+
//! - The index of the symbol must match the index of the variant
42
+
//! - `arrays`: [`Vec`] (or any type that uses [`Serializer::serialize_seq`](serde::Serializer), [`Deserializer::deserialize_seq`](serde::Deserializer))
43
+
//! - `[T; N]` is (de)serialized as a tuple by Serde, to (de)serialize them as an `array` use [`apache_avro::serde::array`]
44
+
//! - `maps`: [`HashMap<String, _>`](std::collections::HashMap) (or any type that uses [`Serializer::serialize_map`](serde::Serializer), [`Deserializer::deserialize_map`](serde::Deserializer))
45
+
//! - `unions`: An enum with a variant for each union variant
46
+
//! - The index of the union variant must match the enum variant
47
+
//! - A `null` can be a unit variant or a newtype variant with a unit type
48
+
//! - All other variants must be newtype variants, struct variants, or tuple variants.
49
+
//! - `fixed`: [`Vec<u8>`](std::vec::Vec) (or any type that uses [`Serializer::serialize_bytes`](serde::Serializer), [`Deserializer::deserialize_bytes`](serde::Deserializer), [`Deserializer::deserialize_byte_buf`](serde::Deserializer))
50
+
//! - It is required to use [`apache_avro::serde::fixed`] as otherwise Serde will (de)serialize a `Vec` as an array of integers instead.
0 commit comments