Skip to content

Commit c49b633

Browse files
committed
Added schema_id value validation
1 parent 20c1397 commit c49b633

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • lib/codecs/src/encoding/format

lib/codecs/src/encoding/format/avro.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ impl AvroSerializerConfig {
2525
pub fn build(&self) -> Result<AvroSerializer, BuildError> {
2626
let schema = apache_avro::Schema::parse_str(&self.avro.schema)
2727
.map_err(|error| format!("Failed building Avro serializer: {error}"))?;
28+
29+
if let Some(schema_id) = self.avro.schema_id
30+
&& schema_id < 0
31+
{
32+
return Err("Confluent Avro schema id must be a positive i32 number".into());
33+
}
34+
2835
Ok(AvroSerializer {
2936
schema,
3037
schema_id: self.avro.schema_id,

0 commit comments

Comments
 (0)