Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Address missing type in for SDK-based type conforming #299

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tap_postgres/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,17 @@ def to_jsonschema_type(
type_name = type(sql_type).__name__

if type_name is not None and type_name in ("JSONB", "JSON"):
return {}
return {
"anyOf": [
{"type": "object"},
{"type": "array"},
{"type": "string"},
{"type": "number"},
{"type": "integer"},
{"type": "boolean"},
{"type": "null"},
],
}

if (
type_name is not None
Expand Down
14 changes: 12 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,18 @@ def test_jsonb_json():
"stream" in schema_message
and schema_message["stream"] == altered_table_name
):
assert schema_message["schema"]["properties"]["column_jsonb"] == {}
assert schema_message["schema"]["properties"]["column_json"] == {}
props = schema_message["schema"]["properties"]
all_types = [
{"type": "object"},
{"type": "array"},
{"type": "string"},
{"type": "number"},
{"type": "integer"},
{"type": "boolean"},
{"type": "null"},
]
assert props["column_jsonb"]["anyOf"] == all_types
assert props["column_json"]["anyOf"] == all_types
assert test_runner.records[altered_table_name][0] == {
"column_jsonb": {"foo": "bar"},
"column_json": {"baz": "foo"},
Expand Down
Loading