|
59 | 59 |
|
60 | 60 | /** |
61 | 61 | * Implementation of {@link Converter} and {@link HeaderConverter} that uses JSON to store schemas and objects. By |
62 | | - * default, this converter will serialize Connect keys, values, and headers with schemas, although this can be disabled with |
| 62 | + * default this converter will serialize Connect keys, values, and headers with schemas, although this can be disabled with |
63 | 63 | * the {@link JsonConverterConfig#SCHEMAS_ENABLE_CONFIG schemas.enable} configuration option. |
64 | 64 | * <p> |
65 | 65 | * This implementation currently does nothing with the topic names or header keys. |
@@ -127,7 +127,7 @@ public class JsonConverter implements Converter, HeaderConverter, Versioned { |
127 | 127 | throw new DataException("Structs should be encoded as JSON objects, but found " + value.getNodeType()); |
128 | 128 |
|
129 | 129 | // We only have ISchema here but need Schema, so we need to materialize the actual schema. Using ISchema |
130 | | - // avoids having to materialize the schema for non-Struct types, but it cannot be avoided for Structs since |
| 130 | + // avoids having to materialize the schema for non-Struct types but it cannot be avoided for Structs since |
131 | 131 | // they require a schema to be provided at construction. However, the schema is only a SchemaBuilder during |
132 | 132 | // translation of schemas to JSON; during the more common translation of data to JSON, the call to schema.schema() |
133 | 133 | // just returns the schema Object and has no overhead. |
@@ -338,7 +338,7 @@ public SchemaAndValue toConnectData(String topic, byte[] value) { |
338 | 338 | " If you are trying to deserialize plain JSON data, set schemas.enable=false in your converter configuration."); |
339 | 339 |
|
340 | 340 | // The deserialized data should either be an envelope object containing the schema and the payload or the schema |
341 | | - // was stripped during serialization, and we need to fill in an all-encompassing schema. |
| 341 | + // was stripped during serialization and we need to fill in an all-encompassing schema. |
342 | 342 | if (!config.schemasEnabled()) { |
343 | 343 | ObjectNode envelope = JSON_NODE_FACTORY.objectNode(); |
344 | 344 | envelope.set(JsonSchema.ENVELOPE_SCHEMA_FIELD_NAME, null); |
@@ -569,7 +569,7 @@ private JsonNode convertToJsonWithoutEnvelope(Schema schema, Object value) { |
569 | 569 | */ |
570 | 570 | private JsonNode convertToJson(Schema schema, Object value) { |
571 | 571 | if (value == null) { |
572 | | - if (schema == null) // Any schema is valid, and we don't have a default, so treat this as an optional schema |
| 572 | + if (schema == null) // Any schema is valid and we don't have a default, so treat this as an optional schema |
573 | 573 | return null; |
574 | 574 | if (schema.defaultValue() != null && config.replaceNullWithDefault()) |
575 | 575 | return convertToJson(schema, schema.defaultValue()); |
|
0 commit comments