Skip to content

Commit

Permalink
Merge branch '7.4.x' into 7.5.x by rayokota
Browse files Browse the repository at this point in the history
  • Loading branch information
ConfluentSemaphore committed Jun 14, 2024
2 parents b26c210 + 0b6699d commit 3b280c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,12 @@ public static Map<String, String> findParams(Optional<OptionElement> meta) {
if (result == null) {
return null;
} else if (result instanceof Map) {
return (Map<String, String>) result;
Map<String, String> params = new LinkedHashMap<>();
Map<String, String> keyValue = (Map<String, String>) result;
String key = keyValue.get(KEY_FIELD);
String value = keyValue.get(VALUE_FIELD);
params.put(key, value);
return params;
} else if (result instanceof List) {
List<Map<String, String>> keyValues = (List<Map<String, String>>) result;
Map<String, String> params = new LinkedHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
import io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaUtils.FormatContext;
import io.confluent.kafka.schemaregistry.protobuf.dynamic.DynamicSchema;
import io.confluent.kafka.schemaregistry.protobuf.dynamic.MessageDefinition;

import io.confluent.protobuf.MetaProto;
import io.confluent.protobuf.MetaProto.Meta;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -1665,6 +1666,10 @@ public void testParams() {
+ " }];\n"
+ "}";
ProtobufSchema schema = new ProtobufSchema(schemaString);
FieldDescriptor fd = schema.toDescriptor().findFieldByName("MIT_ACTUAL_PRICE");
Meta meta = fd.getOptions().getExtension(MetaProto.fieldMeta);
assertEquals("2", meta.getParamsOrThrow("scale"));

// Ensure we can process params when creating a dynamic schema
assertNotNull(schema.toDynamicSchema());
}
Expand Down

0 comments on commit 3b280c4

Please sign in to comment.