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 <priyanka.ku@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
This commit is contained in:
jimmy 2025-09-06 23:51:59 +08:00 committed by GitHub
parent f6f6172bd1
commit 350577d0ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -222,7 +222,7 @@ public class JsonConverter implements Converter, HeaderConverter, Versioned {
private JsonConverterConfig config; private JsonConverterConfig config;
private Cache<Schema, ObjectNode> fromConnectSchemaCache; private Cache<Schema, ObjectNode> fromConnectSchemaCache;
private Cache<JsonNode, Schema> toConnectSchemaCache; private Cache<JsonNode, Schema> toConnectSchemaCache;
private Schema schema = null; // if a schema is provided in config, this schema will be used for all messages private Schema schema = null; // if a schema is provided in config, this schema will be used for all messages for sink connector
private final JsonSerializer serializer; private final JsonSerializer serializer;
private final JsonDeserializer deserializer; private final JsonDeserializer deserializer;

View File

@ -38,7 +38,8 @@ public final class JsonConverterConfig extends ConverterConfig {
public static final String SCHEMA_CONTENT_CONFIG = "schema.content"; public static final String SCHEMA_CONTENT_CONFIG = "schema.content";
public static final String SCHEMA_CONTENT_DEFAULT = null; public static final String SCHEMA_CONTENT_DEFAULT = null;
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."; 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."
+ "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.";
private static final String SCHEMA_CONTENT_DISPLAY = "Schema Content"; private static final String SCHEMA_CONTENT_DISPLAY = "Schema Content";
public static final String SCHEMAS_CACHE_SIZE_CONFIG = "schemas.cache.size"; public static final String SCHEMAS_CACHE_SIZE_CONFIG = "schemas.cache.size";