KAFKA-16870: Avoid schemaless containers from Values.parseString - #23055
Open
lh0156 wants to merge 2 commits into
Open
KAFKA-16870: Avoid schemaless containers from Values.parseString#23055lh0156 wants to merge 2 commits into
lh0156 wants to merge 2 commits into
Conversation
Return the original literal as a string when array or map parsing cannot infer a common inner schema. This prevents Values.parseString and SimpleHeaderConverter from producing container schemas that ConnectSchema cannot validate. Generated-by: OpenAI Codex (GPT-5) Signed-off-by: Yunseop Eom <62834176+lh0156@users.noreply.github.com>
Cover ConnectSchema validation for map literals whose entries do not share a common schema. Generated-by: OpenAI Codex (GPT-5) Signed-off-by: Yunseop Eom <62834176+lh0156@users.noreply.github.com>
Author
|
Follow-up test-only refinement in Verification:
|
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.
What
Values.parseStringno longer returns arrays or maps with missing inner schemas when it cannot infer a common schema. Instead, it falls back to the original literal as aSTRINGvalue. This also makesSimpleHeaderConvertersafe for empty and heterogeneous containers because it relies onValues.parseString.Why
Connect arrays and maps require inner schemas for validation. Returning a container with a null inner schema creates a
SchemaAndValuethat fails later inConnectSchema.validateValue, for example when used as a struct field value. Falling back to the original string preserves the input without manufacturing an invalid Connect value.Testing
SchemaAndValuewithConnectSchema.validateValue../gradlew :connect:api:test :connect:api:spotlessCheck :connect:api:checkstyleMain :connect:api:checkstyleTest :connect:api:spotbugsMain --no-build-cache --console=plain./gradlew :connect:transforms:test :connect:api:spotlessCheck :connect:api:checkstyleMain :connect:api:checkstyleTest :connect:api:spotbugsMain --no-build-cache --console=plainI confirm that this contribution is my original work and that I license it to Apache Kafka under the Apache License, Version 2.0.
JIRA: https://issues.apache.org/jira/browse/KAFKA-16870