confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

Allow strict validation with `fastavro`, to fail when extra fields are present in the records

Open antopolskiy opened this issue 3 years ago • 4 comments

Description

Currently, if json data has extra fields in the record, AvroSerializer will not fail, it will silently ignore the extra fields, which can be detrimental in some applications, for example which rely on gathering data from 3rd party APIs.

Recenly, fastavro added options of strict and strict_allow_default to schemaless_writer (see source code here and here for discussion), which will make the validation fail if there are extra fields in the record.

I propose to add this feature in AvroSerializer, I guess these would be simply passthrough parameters to schemaless_writer.

antopolskiy avatar Sep 08 '22 12:09 antopolskiy

sounds good. i think we should be able to review this pretty quickly, else it's on the todo list.

mhowlett avatar Sep 21 '22 14:09 mhowlett

I'll give it a go!

antopolskiy avatar Sep 23 '22 17:09 antopolskiy

thanks - noted.

mhowlett avatar Oct 24 '22 17:10 mhowlett

When will it be merged? @mhowlett

majid1400 avatar May 10 '23 12:05 majid1400