Skip to content

[fix][broker] Use compatible Avro name validator in JsonSchemaCompatibilityCheck - #25255

Merged
codelipenghui merged 1 commit into
masterfrom
fixes.json-schema-compatible-avro-name-validator
Feb 25, 2026
Merged

[fix][broker] Use compatible Avro name validator in JsonSchemaCompatibilityCheck#25255
codelipenghui merged 1 commit into
masterfrom
fixes.json-schema-compatible-avro-name-validator

Conversation

@mattisonchao

@mattisonchao mattisonchao commented Feb 24, 2026

Copy link
Copy Markdown
Member

Motivation

Follow-up to #25193 as noted by @codelipenghui in this review comment.

JsonSchemaCompatibilityCheck.isAvroSchema() still uses new Schema.Parser() with the default UTF_VALIDATOR, which rejects $ in record names. This means JSON schema compatibility checks would incorrectly fail for Protobuf-derived Avro schemas containing $ in nested type names.

Modifications

  • Apply StructSchemaDataValidator.COMPATIBLE_NAME_VALIDATOR to the Schema.Parser in JsonSchemaCompatibilityCheck.isAvroSchema(), consistent with the fix already applied to:
    • AvroSchemaBasedCompatibilityCheck
    • SchemaRegistryServiceImpl
    • StructSchemaDataValidator
  • Add a unit test verifying that Avro schemas with $ in record names are correctly recognized as valid Avro schemas in the JSON schema compatibility check path.

Verifying this change

  • Added testIsAvroSchemaWithDollarSignInRecordName test in JsonSchemaCompatibilityCheckTest.

Documentation

  • doc-not-needed

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Feb 24, 2026
@mattisonchao mattisonchao self-assigned this Feb 24, 2026
@mattisonchao mattisonchao reopened this Feb 24, 2026
…bilityCheck

Apply the same COMPATIBLE_NAME_VALIDATOR to JsonSchemaCompatibilityCheck's
isAvroSchema() method to allow '$' in schema record names, matching the
fix already applied to AvroSchemaBasedCompatibilityCheck, SchemaRegistryServiceImpl,
and StructSchemaDataValidator in #25193.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lhotari

lhotari commented Feb 24, 2026

Copy link
Copy Markdown
Member

This will only be needed to be cherry-picked in branch-4.1 since Avro 1.12 upgrade was reverted from branch-4.0.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.65%. Comparing base (82fcb18) to head (1d48096).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #25255       +/-   ##
=============================================
+ Coverage     37.64%   72.65%   +35.00%     
- Complexity    13387    34023    +20636     
=============================================
  Files          1902     1959       +57     
  Lines        151239   155418     +4179     
  Branches      17240    17731      +491     
=============================================
+ Hits          56939   112918    +55979     
+ Misses        86586    33498    -53088     
- Partials       7714     9002     +1288     
Flag Coverage Δ
inttests 25.68% <0.00%> (-0.20%) ⬇️
systests 22.38% <100.00%> (-0.09%) ⬇️
unittests 73.62% <100.00%> (+39.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...r/service/schema/JsonSchemaCompatibilityCheck.java 47.05% <100.00%> (+17.64%) ⬆️

... and 1416 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codelipenghui
codelipenghui merged commit 82846e5 into master Feb 25, 2026
102 of 106 checks passed
@Technoboy- Technoboy- added this to the 4.2.0 milestone Feb 26, 2026
Technoboy- pushed a commit that referenced this pull request Feb 26, 2026
…bilityCheck (#25255)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@merlimat
merlimat deleted the fixes.json-schema-compatible-avro-name-validator branch March 23, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants