1

I register a Schema with the Schema registry as follows:

{ Prop1:val1,
prop2:val2,
prop3:val3}

all fields above are optional

When I send data payload via Rest Proxy that looks like the following:

{ "":val1, Prop2:val2, Prop3:val3 }

I expect the schema registry to throw an error. but that is not happening. the data goes through to the sink connector and the first key/value pair is ignored.

Is this expected behavior? How do I force an error if the properties are not present (the property is optional, but when we send a blank property, it should throw an error).

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

This seems to be the schema resolution in Avro.

if the writer's record contains a field with a name not present in the reader's record, the writer's value for that field is ignored.

from: https://avro.apache.org/docs/1.8.1/spec.html#Schema+Resolution

bascially in my schema repo in confluent - I reqistered a schema to take 3 properties - all optional.

{
propA:val1,
propB:val2,
propC:val3
}

if I send a data packet with additional properties or properties that do not exost in the registered schema, they are just ignored.

{
"":val1, //<- considered as new property and ignored
propB:val2,
propC:val3
}