Kriskras99 opened a new pull request, #448:
URL: https://github.com/apache/avro-rs/pull/448
When a type was used both via `flatten` and directly, the schema generated
would contain duplicate names (and schemas). This is because `flatten` would
use an empty `named_schemas` to get the record schema. If the existing
`named_schemas` was used, `flatten` might get a `Schema::Ref` if the type was
already used. Or when `flatten` was used first, if the type was used after it
would create a `Schema::Ref` to a schema that does not exist.
This is solved by adding a new function to the `AvroSchemaComponent` that
returns the fields directly. To not break code currently implementing this
trait, it has a default implementation that will work around the issues above.
This default implementation is also used for fields with the `#[avro(with =
||)]` and `#[avro(with = path)]` attributes, as they don't have a way to
provide the field directly. Users of `#[avro(with)]` will need to implement
`get_record_fields_in_ctxt` in their module.
TODO:
- [ ] Create tests for the logic of the default `get_record_fields_in_ctxt`
implementation
- [ ] Test interactions with `transparent`
- [ ] Test interactions with `with`
- [ ] Update the documentation in the branch `feat/documentation`
--
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]