Skip to content

Commit 350577d

Browse files
authored
MINOR: Add doc for external schemas in JSONConverter (#20429)
This is a follow-up to #19449, which do the following things: 1. Add document to explain `schema.content` only work for sink connector when `schemas.enable` set to true. 2. Handle the case that while jsonValue contains the `schema` and `payload` fields, we should use the corresponding value. Reviewers: Priyanka K U <[email protected]>, Chia-Ping Tsai <[email protected]>
1 parent f6f6172 commit 350577d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

connect/json/src/main/java/org/apache/kafka/connect/json/JsonConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public Object toConnect(final Schema schema, final JsonNode value) {
222222
private JsonConverterConfig config;
223223
private Cache<Schema, ObjectNode> fromConnectSchemaCache;
224224
private Cache<JsonNode, Schema> toConnectSchemaCache;
225-
private Schema schema = null; // if a schema is provided in config, this schema will be used for all messages
225+
private Schema schema = null; // if a schema is provided in config, this schema will be used for all messages for sink connector
226226

227227
private final JsonSerializer serializer;
228228
private final JsonDeserializer deserializer;

connect/json/src/main/java/org/apache/kafka/connect/json/JsonConverterConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public final class JsonConverterConfig extends ConverterConfig {
3838

3939
public static final String SCHEMA_CONTENT_CONFIG = "schema.content";
4040
public static final String SCHEMA_CONTENT_DEFAULT = null;
41-
private static final String SCHEMA_CONTENT_DOC = "When set, this is used as the schema for all messages. Otherwise, the schema will be included in the content of each message.";
41+
private static final String SCHEMA_CONTENT_DOC = "When set, this is used as the schema for all messages, and the schemas within each of the message will be ignored."
42+
+ "Otherwise, the schema will be included in the content of each message. This configuration applies only 'schemas.enable' is true, and it exclusively affects the sink connector.";
4243
private static final String SCHEMA_CONTENT_DISPLAY = "Schema Content";
4344

4445
public static final String SCHEMAS_CACHE_SIZE_CONFIG = "schemas.cache.size";

0 commit comments

Comments
 (0)