Extract validateSchema into overridable hook on AbstractSchemaRegistry#4278
Open
Toluwa Jibodu (djibodu) wants to merge 1 commit into
Open
Extract validateSchema into overridable hook on AbstractSchemaRegistry#4278Toluwa Jibodu (djibodu) wants to merge 1 commit into
Toluwa Jibodu (djibodu) wants to merge 1 commit into
Conversation
Move the parsedSchema.validate(...) call out of maybeValidateAndNormalizeSchema into a protected validateSchema(ParsedSchema, Schema, Config) method. The default implementation preserves the existing IMPORT-mode gate, so behavior is bit-identical for every current caller. Subclasses can now override the hook to alter validation semantics (e.g. migration replay paths that must not re-run validate on already-persisted schemas). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
Member
|
do we still need this given what we discovered yesterday Toluwa Jibodu (@djibodu) ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parsedSchema.validate(...)call out ofmaybeValidateAndNormalizeSchemainto a newprotected void validateSchema(ParsedSchema, Schema, Config)onAbstractSchemaRegistry. Default implementation preserves the existing IMPORT-mode gate, so behavior is bit-identical for every current caller.Extract association logicandExtract store query logic into overridable hookscommits on this branch.Semantics
parsedSchema.validate(...)has exactly one call site inAbstractSchemaRegistry(the one being moved). All four callers ofcanonicalizeSchemaroute throughmaybeValidateAndNormalizeSchema→ the new hook.KafkaSchemaRegistryis the only in-repo subclass and doesn't overridecanonicalizeSchemain a way that touches validation. ThemaybeValidateAndNormalizeSchemamethod isprivateand cannot be overridden, so the hook is purely additive.Test plan
AbstractSchemaRegistryTest— new file. Asserts (a) the default hook is invoked duringregister(...), and (b) a subclass that throws fromvalidateSchemacauses registration to fail with the thrown message wrapped inInvalidSchemaException. Documents the extension point and locks the contract.coretests — unchanged; no behavior drift expected.mvn -pl core testhit a CodeArtifact dependency-resolution error (kafka-schema-registry-client:8.0.5-0cached-miss inthird-party-artifacts), so the suite was not run locally. Relying on CI.🤖 Generated with Claude Code