File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
This includes PostgresStream and PostgresConnector.
4
4
"""
5
+
5
6
from __future__ import annotations
6
7
7
8
import datetime
@@ -123,7 +124,17 @@ def to_jsonschema_type(
123
124
type_name = type (sql_type ).__name__
124
125
125
126
if type_name is not None and type_name in ("JSONB" , "JSON" ):
126
- return {}
127
+ return {
128
+ "anyOf" : [
129
+ {"type" : "object" },
130
+ {"type" : "array" },
131
+ {"type" : "string" },
132
+ {"type" : "number" },
133
+ {"type" : "integer" },
134
+ {"type" : "boolean" },
135
+ {"type" : "null" },
136
+ ],
137
+ }
127
138
128
139
if (
129
140
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