prost-wkt icon indicating copy to clipboard operation
prost-wkt copied to clipboard

Workaround for macro imports in one_ofs is unnecessary

Open Sushisource opened this issue 2 years ago • 1 comments

The readme currently recommends manually adding use statements for oneofs with

   .type_attribute(
            ".my.pkg.SomeOne.body",
            "use serde::{Serialize,Deserialize}; #[derive(Serialize,Deserialize)]"
        )

This obviously is a huge pain if you have a lot of oneofs. Luckily it's also totally unnecessary.

Simply changing:

  .type_attribute(
            ".",
            "#[derive(Serialize,Deserialize)]"
        )

To

  .type_attribute(
            ".",
            "#[derive(::serde::Serialize, ::serde::Deserialize)]"
        )

Is a much easier fix

Sushisource avatar Jan 10 '22 21:01 Sushisource

Thanks for raising this issue! This would make things a lot simpler. I can't remember exactly why I documented it this way, but I will have to check (might be it was due to the way macros imports were handled before but not sure anymore)...

fdeantoni avatar Jan 25 '22 01:01 fdeantoni