Code Example:
struct X {
#[serde(skip_serializing_if = "Option::is_none")]
y: Option<String>,
z: Option<i8>
}
Issue Description:
while trying to serialize an instance such as X { y: None, z: Some(0)} using Writer::append_ser(..), it panics with an index-out-of-bounds error pointing to: #/src/ser_schema.rs:376:45
RCA:
- Serde allows for field skipping using the
skip_serializing_if directive.
- current implementation assumes that schema field count matchs the number of
serializer.serialize(..) calls 100%.
- Use of unsafe random-access on a vec, panics when the assumption breaks.