Kriskras99 commented on PR #260:
URL: https://github.com/apache/avro-rs/pull/260#issuecomment-3178949614
Hmmm. I think I understand why `default` is stripped from the PCF. It is
because the PCF is supposed to be used to check the equality of the writer and
reader schema, not compatibility. As the writer does nothing with the `default`
field when writing, it's not relevant for equality (if a reader wants to use a
compatible schema it first needs to read with the original schema and then
convert to the compatible schema).
As the PFC (and the fingerprints that use it as a base) are only for
checking equality with the writer the don't include the `default` field.
For our testing purposes it's probably better to use something like this:
```rust
fn strict_schema_equality(expected: &str, schema: Schema) {
let expected: Value = serde_json::from_str(expected).unwrap();
let got = serde_json::to_value(schema).unwrap();
assert_eq!(got, expected)
}
```
This checks that all fields are as expected, including doc, default and
other fields.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]