You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2026/01/13 13:46:00 UTC
(superset) 01/05: fix: remove unwanted info from tags REST API (#36266)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch pulse
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 102df5f4d3880fe6561b686e6d0aadf3ab992d06
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Tue Nov 25 16:22:31 2025 +0000
fix: remove unwanted info from tags REST API (#36266)
(cherry picked from commit cd36845d568a3d91c592f00d7b26083c0450c51e)
---
superset/tags/api.py | 1 -
tests/integration_tests/tags/api_tests.py | 40 +++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/superset/tags/api.py b/superset/tags/api.py
index 7351a39a04..3c28f86c16 100644
--- a/superset/tags/api.py
+++ b/superset/tags/api.py
@@ -109,7 +109,6 @@ class TagRestApi(BaseSupersetModelRestApi):
"created_on_delta_humanized",
"created_by.first_name",
"created_by.last_name",
- "created_by",
]
base_related_field_filters = {
diff --git a/tests/integration_tests/tags/api_tests.py b/tests/integration_tests/tags/api_tests.py
index 79022d2805..a46a0eebed 100644
--- a/tests/integration_tests/tags/api_tests.py
+++ b/tests/integration_tests/tags/api_tests.py
@@ -151,6 +151,46 @@ class TestTagApi(SupersetTestCase):
db.session.delete(tag)
db.session.commit()
+ def test_get_tag_user_fields(self):
+ """
+ Query API: Test get tag only returns first_name and last_name for
+ created_by and changed_by fields
+ """
+ self.login(ADMIN_USERNAME)
+ # Create tag via API to ensure created_by is set
+ uri = "api/v1/tag/"
+ rv = self.client.post(
+ uri,
+ json={"name": "test_user_fields_tag", "objects_to_tag": []},
+ )
+ assert rv.status_code == 201
+
+ # Get the created tag
+ tag = db.session.query(Tag).filter(Tag.name == "test_user_fields_tag").first()
+ assert tag is not None
+
+ # Fetch the tag via GET API
+ uri = f"api/v1/tag/{tag.id}"
+ rv = self.client.get(uri)
+ assert rv.status_code == 200
+
+ data = json.loads(rv.data.decode("utf-8"))
+ result = data["result"]
+
+ # Verify created_by only contains first_name and last_name
+ assert result["created_by"] is not None
+ assert set(result["created_by"].keys()) == {"first_name", "last_name"}
+ assert result["created_by"]["first_name"] is not None
+ assert result["created_by"]["last_name"] is not None
+
+ # Verify changed_by only contains first_name and last_name (or is None)
+ if result["changed_by"] is not None:
+ assert set(result["changed_by"].keys()) == {"first_name", "last_name"}
+
+ # Cleanup
+ db.session.delete(tag)
+ db.session.commit()
+
def test_get_tag_not_found(self):
"""
Query API: Test get query not found