Skip to content

field_order attribute causes weird behavior #786

@DavidMcGurkTNG

Description

@DavidMcGurkTNG

Describe the bug
When trying to define field_order for classes which inherit from AvroBaseModel, this can cause some weird side-effects. Field order seems to work like a private attribute, since it is created when running .avro_schema(), and this field_order created by running this method overwrites the field_order which is explicitly defined. This can also have the effect that if one pytest checks that each schema inheriting from AvroBaseModel has a complete (user defined) field order, and then a subsequent test checks that .avro_schema() successfully generates the schema, then these tests will catch the error if run in this order, but not if run in a different order.

It was also found that on >= 0.63.2, sometimes editing the field order of a child class could affect the field order of instances of the parent class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions