2727 ({"type" : "number" , "airbyte_type" : "integer" }, types .BIGINT ),
2828 ({"type" : "number" }, types .DECIMAL ),
2929 ({"type" : "array" , "items" : {"type" : "object" }}, types .JSON ),
30+ ({"type" : ["null" , "array" ], "items" : {"type" : "object" }}, types .JSON ),
3031 ({"type" : "object" , "properties" : {}}, types .JSON ),
32+ ({"type" : ["null" , "object" ], "properties" : {}}, types .JSON ),
33+ # Malformed JSON schema seen in the wild:
34+ ({'type' : 'array' , 'items' : {}}, types .JSON ),
35+ ({'type' : ['null' , 'array' ], 'items' : {'items' : {}}}, types .JSON ),
3136 ],
3237)
3338def test_to_sql_type (json_schema_property_def , expected_sql_type ):
@@ -53,8 +58,15 @@ def test_to_sql_type(json_schema_property_def, expected_sql_type):
5358 ({"type" : "integer" }, "integer" ),
5459 ({"type" : "number" , "airbyte_type" : "integer" }, "integer" ),
5560 ({"type" : "number" }, "number" ),
61+ # Array type:
5662 ({"type" : "array" }, "array" ),
63+ ({"type" : "array" , "items" : {"type" : "object" }}, "array" ),
64+ ({"type" : ["null" , "array" ], "items" : {"type" : "object" }}, "array" ),
65+ # Object type:
5766 ({"type" : "object" }, "object" ),
67+ # Malformed JSON schema seen in the wild:
68+ ({'type' : 'array' , 'items' : {'items' : {}}}, "array" ),
69+ ({'type' : ['null' , 'array' ], 'items' : {'items' : {}}}, "array" ),
5870 ],
5971)
6072def test_to_airbyte_type (json_schema_property_def , expected_airbyte_type ):
@@ -71,6 +83,9 @@ def test_to_airbyte_type(json_schema_property_def, expected_airbyte_type):
7183 ({"type" : "object" }, "object" , None ),
7284 ({"type" : "array" , "items" : {"type" : ["null" , "string" ]}}, "array" , "string" ),
7385 ({"type" : "array" , "items" : {"type" : ["boolean" ]}}, "array" , "boolean" ),
86+ # Malformed JSON schema seen in the wild:
87+ ({'type' : 'array' , 'items' : {'items' : {}}}, "array" , None ),
88+ ({'type' : ['null' , 'array' ], 'items' : {'items' : {}}}, "array" , None ),
7489 ],
7590)
7691def test_to_airbyte_subtype (
0 commit comments