For example for:
enum AliasedEnum {
option allow_alias = true;
ALIAS_FOO = 0;
ALIAS_BAR = 1;
ALIAS_BAZ = 2;
MOO = 2;
moo = 2;
bAz = 2;
}
pbjson_build generates:
impl serde::Serialize for AliasedEnum {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::AliasFoo => "ALIAS_FOO",
Self::AliasBar => "ALIAS_BAR",
Self::AliasBaz => "ALIAS_BAZ",
Self::Moo => "MOO",
Self::Moo => "moo",
Self::BAz => "bAz",
};
serializer.serialize_str(variant)
}
}
while prost-build generates:
#[repr(i32)]
pub enum AliasedEnum {
AliasFoo = 0,
AliasBar = 1,
AliasBaz = 2,
}
i.e. pbjson_build incorrectly assumes that there are no aliases and thinks that each alias has its own rust enum variant.
For example for:
pbjson_build generates:
while prost-build generates:
i.e. pbjson_build incorrectly assumes that there are no aliases and thinks that each alias has its own rust enum variant.