Skip to content

Conversation

@rayokota
Copy link
Member

@rayokota rayokota commented Sep 10, 2025

What

Add better Avro validation.

Fixes #364

Checklist

  • [Y] Contains customer facing changes? Including API/behavior changes
  • [Y] Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

References

JIRA:

Test & Review

Open questions / Follow-ups

Copilot AI review requested due to automatic review settings September 10, 2025 21:57
@rayokota rayokota requested review from a team as code owners September 10, 2025 21:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds validation to the AvroSerializer to ensure messages conform to their schema before serialization. The validation uses the Avro library's isValid method to check message structure and throws a SerializationError when validation fails.

  • Adds Avro message validation before serialization
  • Includes a test case for validation error handling
  • Imports SerializationError for validation error reporting

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
schemaregistry/serde/avro.ts Adds validation logic and imports SerializationError
schemaregistry/test/serde/avro.spec.ts Adds test schema and validation test case

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sonarqube-confluent
Copy link

Passed

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 100.00% Coverage (70.80% Estimated after merge)
  • Duplications No duplication information (2.00% Estimated after merge)

Project ID: confluent-kafka-javascript

View in SonarQube

@rayokota rayokota merged commit 6bad239 into master Sep 11, 2025
3 checks passed
@rayokota rayokota deleted the avro-validation branch September 11, 2025 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Field-Level Error Context in Avro Serialization for String types

3 participants