File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,17 @@ def to_jsonschema_type(
125
125
type_name = type (sql_type ).__name__
126
126
127
127
if type_name is not None and type_name in ("JSONB" , "JSON" ):
128
- return {}
128
+ return {
129
+ "anyOf" : [
130
+ {"type" : "object" },
131
+ {"type" : "array" },
132
+ {"type" : "string" },
133
+ {"type" : "number" },
134
+ {"type" : "integer" },
135
+ {"type" : "boolean" },
136
+ {"type" : "null" },
137
+ ],
138
+ }
129
139
130
140
if (
131
141
type_name is not None
Original file line number Diff line number Diff line change @@ -237,8 +237,18 @@ def test_jsonb_json():
237
237
"stream" in schema_message
238
238
and schema_message ["stream" ] == altered_table_name
239
239
):
240
- assert schema_message ["schema" ]["properties" ]["column_jsonb" ] == {}
241
- assert schema_message ["schema" ]["properties" ]["column_json" ] == {}
240
+ props = schema_message ["schema" ]["properties" ]
241
+ all_types = [
242
+ {"type" : "object" },
243
+ {"type" : "array" },
244
+ {"type" : "string" },
245
+ {"type" : "number" },
246
+ {"type" : "integer" },
247
+ {"type" : "boolean" },
248
+ {"type" : "null" },
249
+ ]
250
+ assert props ["column_jsonb" ]["anyOf" ] == all_types
251
+ assert props ["column_json" ]["anyOf" ] == all_types
242
252
assert test_runner .records [altered_table_name ][0 ] == {
243
253
"column_jsonb" : {"foo" : "bar" },
244
254
"column_json" : {"baz" : "foo" },
You can’t perform that action at this time.
0 commit comments