influxdata / influxdata/pbjson
enum aliases can not be deserialized
- Dominant language
- Rust
- Stars
- 116
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
E.g for
```proto
enum ImageType {
UNSPECIFIED = 0;
JPEG = 1;
jpeg = 1;
PNG = 2;
png = 2;
}
```
pbjson_build produces
```rust
fn visit_str(self, value: &str) -> std::result::Result
where
E: serde::de::Error,
{
match value {
"UNSPECIFIED" => Ok(ImageType::Unspecified),
"JPEG" => Ok(image::Type::Jpeg),
"PNG" => Ok(image::Type::Png),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
```
and the lower case values `jpeg` and `png` can not be deserialized.
Contributor guide
Research direction
Start at the pbjson_build code that generates the enum visitor shown in the issue, and inspect how enum names and aliases are collected for deserialization. Verify the generated Rust accepts both the canonical and lowercase names from the ImageType example, and run the relevant project tests or generated-code checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100