Skip to content

Tracking issue: Serde and #[derive(AvroSchema)] improvements #361

Description

@Kriskras99

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.

Future work:

  • Support simple closures for the with attribute (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/static would be shared between all implementations
    • It also doesn't work for types without generics or lifetimes as the output can change based on the names and enclosing_namespace arguments
  • 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 impl blocks, so we can't emit a test function

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions