From da62f9aa22498f940b46fed30ba8ac0c2e9a0a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Mon, 19 Feb 2024 11:48:28 -0600 Subject: [PATCH] fix: Null type is now correctly appended as `{"type": "null"}` to `oneOf` types (#2252) --- singer_sdk/helpers/_typing.py | 2 +- tests/core/test_typing.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/singer_sdk/helpers/_typing.py b/singer_sdk/helpers/_typing.py index f3ea68e1b..fdaaecd6e 100644 --- a/singer_sdk/helpers/_typing.py +++ b/singer_sdk/helpers/_typing.py @@ -60,7 +60,7 @@ def append_type(type_dict: dict, new_type: str) -> dict: return result if "oneOf" in result: - result["oneOf"].append(new_type) + result["oneOf"].append({"type": new_type}) return result if "type" in result: diff --git a/tests/core/test_typing.py b/tests/core/test_typing.py index b985aeecc..59bfa41ab 100644 --- a/tests/core/test_typing.py +++ b/tests/core/test_typing.py @@ -341,7 +341,7 @@ def test_to_sql_type(jsonschema_type, expected): ), pytest.param( {"oneOf": [{"type": "integer"}, {"type": "number"}]}, - {"oneOf": [{"type": "integer"}, {"type": "number"}, "null"]}, + {"oneOf": [{"type": "integer"}, {"type": "number"}, {"type": "null"}]}, id="oneOf", ), ],