From ad804acc5b776aa21ae79f4b52ea3fd9f36a5755 Mon Sep 17 00:00:00 2001 From: Kethan Cherukuri <105211331+kethan1122@users.noreply.github.com> Date: Wed, 31 May 2023 20:50:08 +0530 Subject: [PATCH] TDL-21114 add tags property for submitted_landings stream (#75) * add tags property * update unitests * changelog and version bump * add null as possible value * use .get to fetch tags data * formatting * remove null datatype * keep null as datatype --- CHANGELOG.md | 3 +++ setup.py | 2 +- tap_typeform/schemas/submitted_landings.json | 6 ++++++ tap_typeform/streams.py | 1 + tests/unittests/test_sync_obj.py | 6 ++++-- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0d668b..df480ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 2.2.0 + * Adds `tags` property to `submitted_landings` stream [#75](https://github.com/singer-io/tap-typeform/pull/75) + ## 2.1.0 * Fixes/Handles following [#73](https://github.com/singer-io/tap-typeform/pull/73) * Syncs data for all forms if `forms` field is missing in config and makes the field as optional diff --git a/setup.py b/setup.py index f1723be..c9e3d56 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name="tap-typeform", - version="2.1.0", + version="2.2.0", description="Singer.io tap for extracting data from the TypeForm Responses API", author="bytcode.io", url="http://singer.io", diff --git a/tap_typeform/schemas/submitted_landings.json b/tap_typeform/schemas/submitted_landings.json index 0f07af8..ab23c63 100644 --- a/tap_typeform/schemas/submitted_landings.json +++ b/tap_typeform/schemas/submitted_landings.json @@ -34,6 +34,12 @@ "hidden": { "type": ["null", "string"] }, + "tags": { + "type": ["null", "array"], + "items": { + "type": ["null", "string"] + } + }, "_sdc_form_id": { "type": ["null", "string"] } diff --git a/tap_typeform/streams.py b/tap_typeform/streams.py index b1beb48..d6c90aa 100644 --- a/tap_typeform/streams.py +++ b/tap_typeform/streams.py @@ -276,6 +276,7 @@ def add_fields_at_1st_level(self, record, additional_data={}): Add additional data and nested fields to top level """ record.update({ + "tags": record.get("tags"), "_sdc_form_id": additional_data["_sdc_form_id"], "user_agent": record["metadata"]["user_agent"], "platform": record["metadata"]["platform"], diff --git a/tests/unittests/test_sync_obj.py b/tests/unittests/test_sync_obj.py index 5c4cfef..9bf88d2 100644 --- a/tests/unittests/test_sync_obj.py +++ b/tests/unittests/test_sync_obj.py @@ -222,7 +222,8 @@ class TestAddFieldAt1StLevel(unittest.TestCase): "referer": "", "network_id": "", "browser": "default" - } + }, + "tags": ["noodle", "weekly"] } sub_landings_exp_record = { **sub_landings_record, @@ -232,7 +233,8 @@ class TestAddFieldAt1StLevel(unittest.TestCase): "network_id": "", "browser": "default", "hidden": "", - "_sdc_form_id": "form1" + "tags": ["noodle", "weekly"], + "_sdc_form_id": "form1", } unsub_landings_record = { "metadata": {