Skip to content

Commit 473f844

Browse files
committed
Use valid schema related to null default based on specification in
RecordEvolutionTest during investigation upgrading Avro to 1.9+, the test was failing. the code has enforced the rule from the specification that `when a default value is specified for a record field whose type is a union, the type of the default value must match the first element of the union. Thus, for unions containing "null", the "null" is usually listed first, since the default value of such unions is typically null.` it was part of specification in 1.8 already https://avro.apache.org/docs/1.8.0/spec.html#Unions , just not enforced in the codebase. relates to FasterXML#167 Signed-off-by: Aurélien Pupier <[email protected]>
1 parent 23f40d9 commit 473f844

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

avro/src/test/java/com/fasterxml/jackson/dataformat/avro/schemaev/RecordEvolutionTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class RecordEvolutionTest extends AvroTestBase
1717
+ " \"fields\": [\n"
1818
+ " {\n"
1919
+ " \"name\": \"name\",\n"
20-
+ " \"type\": [\"string\", \"null\"],\n"
20+
+ " \"type\": [\"null\", \"string\"],\n"
2121
+ " \"default\": null\n"
2222
+ " },\n"
2323
+ " {\n"
@@ -39,7 +39,7 @@ public class RecordEvolutionTest extends AvroTestBase
3939
+ " \"fields\": [\n"
4040
+ " {\n"
4141
+ " \"name\": \"fullName\",\n"
42-
+ " \"type\": [\"string\", \"null\"],\n"
42+
+ " \"type\": [\"null\", \"string\"],\n"
4343
+ " \"default\": null,\n"
4444
+ " \"aliases\": [\"name\"]\n"
4545
+ " },\n"

0 commit comments

Comments
 (0)