SchemaRegistry serialization logic moved to one class, manual serializer creation removed

This commit is contained in:
iliax 2023-08-14 17:27:48 +04:00
parent cbb0b023e2
commit 74d2b7fdbb

View file

@ -49,7 +49,7 @@ class Serialize {
throw new ValidationException(
String.format("'%s' does not fit schema: %s", value, e.getAllMessages()));
}
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
try (var out = new ByteArrayOutputStream()) {
out.write(MAGIC);
out.write(schemaId(schemaId));
out.write(JSON_SERIALIZE_MAPPER.writeValueAsBytes(json));
@ -95,7 +95,7 @@ class Serialize {
@SneakyThrows
static byte[] serializeAvro(AvroSchema schema, int schemaId, String input) {
var avroObject = JsonAvroConversion.convertJsonToAvro(input, schema.rawSchema());
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
try (var out = new ByteArrayOutputStream()) {
out.write(MAGIC);
out.write(schemaId(schemaId));
Schema rawSchema = schema.rawSchema();