{ "name": "object", "tests": [ { "description": [ "Test that fields are sorted in a record.", "Sorting makes the output schema deterministic." ], "name": "test_object_with_atomics_is_sorted", "compatible": true, "test": { "avro": { "fields": [ { "default": null, "name": "field_1", "type": [ { "type": "null" }, { "type": "long" } ] }, { "default": null, "name": "field_2", "type": [ { "type": "null" }, { "type": "string" } ] }, { "default": null, "name": "field_3", "type": [ { "type": "null" }, { "type": "boolean" } ] }, { "default": null, "name": "field_4", "type": [ { "type": "null" }, { "type": "double" } ] } ], "name": "root", "type": "record" }, "bigquery": [ { "mode": "NULLABLE", "name": "field_1", "type": "INT64" }, { "mode": "NULLABLE", "name": "field_2", "type": "STRING" }, { "mode": "NULLABLE", "name": "field_3", "type": "BOOL" }, { "mode": "NULLABLE", "name": "field_4", "type": "FLOAT64" } ], "json": { "properties": { "field_1": { "type": "integer" }, "field_2": { "type": "string" }, "field_3": { "type": "boolean" }, "field_4": { "type": "number" } }, "type": "object" } } }, { "description": [ "Test that required fields have the required mode.", "This changes the mode of the underlying atomic field." ], "name": "test_object_with_atomics_required", "compatible": true, "test": { "avro": { "fields": [ { "name": "field_1", "type": { "type": "long" } }, { "default": null, "name": "field_2", "type": [ { "type": "null" }, { "type": "string" } ] }, { "name": "field_3", "type": { "type": "boolean" } } ], "name": "root", "type": "record" }, "bigquery": [ { "mode": "REQUIRED", "name": "field_1", "type": "INT64" }, { "mode": "NULLABLE", "name": "field_2", "type": "STRING" }, { "mode": "REQUIRED", "name": "field_3", "type": "BOOL" } ], "json": { "properties": { "field_1": { "type": "integer" }, "field_2": { "type": "string" }, "field_3": { "type": "boolean" } }, "required": [ "field_1", "field_3" ], "type": "object" } } }, { "description": [ "Test the output of a nullable required field.", "The field is casted from nullable to required at the object level.", "Since the underlying field is null, the field is then casted back to nullable." ], "name": "test_object_with_atomics_required_with_null", "compatible": true, "test": { "avro": { "fields": [ { "default": null, "name": "field_1", "type": [ { "type": "null" }, { "type": "long" } ] }, { "default": null, "name": "field_2", "type": [ { "type": "null" }, { "type": "string" } ] }, { "name": "field_3", "type": { "type": "boolean" } } ], "name": "root", "type": "record" }, "bigquery": [ { "mode": "NULLABLE", "name": "field_1", "type": "INT64" }, { "mode": "NULLABLE", "name": "field_2", "type": "STRING" }, { "mode": "REQUIRED", "name": "field_3", "type": "BOOL" } ], "json": { "properties": { "field_1": { "type": [ "integer", "null" ] }, "field_2": { "type": "string" }, "field_3": { "type": "boolean" } }, "required": [ "field_1", "field_3" ], "type": "object" } } }, { "name": "test_object_with_complex", "compatible": true, "test": { "avro": { "fields": [ { "default": null, "name": "namespace_1", "type": [ { "type": "null" }, { "fields": [ { "default": null, "name": "field_1", "type": [ { "type": "null" }, { "type": "string" } ] }, { "default": null, "name": "field_2", "type": [ { "type": "null" }, { "type": "long" } ] } ], "name": "namespace_1", "namespace": "root", "type": "record" } ] } ], "name": "root", "type": "record" }, "bigquery": [ { "fields": [ { "description": "field description", "mode": "NULLABLE", "name": "field_1", "type": "STRING" }, { "mode": "NULLABLE", "name": "field_2", "type": "INT64" } ], "mode": "NULLABLE", "name": "namespace_1", "type": "RECORD" } ], "json": { "properties": { "namespace_1": { "properties": { "field_1": { "description": "field description", "type": "string" }, "field_2": { "type": "integer" } }, "type": "object" } }, "type": "object" } } }, { "description": [ "Empty structs are not supported in BigQuery, so we treat them ", "as empty documents." ], "name": "test_object_empty_record", "compatible": false, "test": { "avro": { "type": "string" }, "bigquery": [ { "mode": "REQUIRED", "name": "root", "type": "STRING" } ], "json": { "properties": {}, "type": "object" } } } ] }