Repository navigation
Open
Description
Our current Serde and derive implementation works, but has room for improvement. This is a unordered list of improvements I'm planning to work on.
- Add documentation for the derive macro (https://github.com/apache/avro-rs/tree/feat/improve_documentation)
- All supported attributes
- Compatibility and interaction with Serde
- Make
avro(default)(no specific value) useDefault::<T>::default()instead of always usingNone - Add
append_sersupport toGenericSingleObjectWriter/to_avro_datum - Move all Serde related documentation and functions to the
serdemodule (and make that public), so the main documentation is less cluttered (https://github.com/apache/avro-rs/tree/feat/improve_documentation)- Also add a short explainer of how Avro works to the Serde part
- Schema aware deserialisation (see feat: Serde driven schema aware deserialization #237)
- Implement
SerializeMap::serialize_entry - Allow disabling getting the rustdoc via
doc = false - In the derived
get_schema_with_ctxtvalidate that the schema is valid (Enums don't serialize correctly #365 (comment)) - Support newtype structs
- Support tuples
- Make clear that errors come from AvroSchema, as that is not visible to the user
- Support
char(as aSchema::Stringor aSchema::Fixed(4)) - Cleanup derive tests to be more like
avro_3687_basic_enum_with_defaultinstead oftest_avro_3709_record_field_attributes - Implement
AvroSchemaComponentfor all types thatSerdeimplementsSerializefor - Allow overwriting the schema type for a field (i.e.
avro(type = "bytes"), see apache-avro-derive: how to handle bytes data? #350) (feat(derive): allow overriding the schema for a field and change the schema foruuid::Uuid#397) - Support
#[serde(transparent)](feat(derive): Support#[serde(transparent)]#398) - Make
AvroSchemaComponentalways available (feat!:Make AvroSchemaComponent available withoutderivefeature #394) - Try to use as many Serde attributes as possible so that user doesn't have duplicate attributes (
avro+serde) (feat: Use the Serde attributes and check for conflicting attributes #377) - Check Serde attributes so we can error on incompatible attributes (i.e.
skip_serializing_ifwithout aavro(default)(feat: Use the Serde attributes and check for conflicting attributes #377)
Future work:
- Support simple closures for the
withattribute (i.e.#[avro(with = || Schema::Bytes)])
Not possible:
- Use LazyLock to only create the schema once (inspired by feat: Use LazyLock for static schema caching in AvroSchema impl lerouxrgd/rsgen-avro#90)
- This does not work for types with generics or lifetimes, as the
const/staticwould be shared between all implementations - It also doesn't work for types without generics or lifetimes as the output can change based on the
namesandenclosing_namespacearguments
- This does not work for types with generics or lifetimes, as the
- Add a test for every derive that runs
T::get_schema()- This does not work for types with generics or lifetimes, we don't know what bounds are required on the types so we can't name the type.
- This also doesn't work for types without generics of lifetimes, because derives are only allowed to emit
implblocks, so we can't emit a test function
Reacted by Martin Grigorov and Theophile du Laz
Metadata
Metadata
Assignees
Labels
No labels
Activity