diff --git a/lang/java/avro/src/main/java/org/apache/avro/Schema.java b/lang/java/avro/src/main/java/org/apache/avro/Schema.java index 2f0711ed401..23ee5ce7f41 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/Schema.java +++ b/lang/java/avro/src/main/java/org/apache/avro/Schema.java @@ -1862,7 +1862,6 @@ private static Schema parseRecord(JsonNode schema, ParseContext context, String Name name = parseName(schema, currentNameSpace); String doc = parseDoc(schema); Schema result = new RecordSchema(name, doc, isTypeError); - context.put(result); JsonNode fieldsNode = schema.get("fields"); if (fieldsNode == null || !fieldsNode.isArray()) @@ -1877,6 +1876,7 @@ private static Schema parseRecord(JsonNode schema, ParseContext context, String name, f.name(), getOptionalText(field, "logicalType")); } result.setFields(fields); + context.put(result); parsePropertiesAndLogicalType(schema, result, SCHEMA_RESERVED); parseAliases(schema, result); return result;