Skip to content

Added nested global fields support #95

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

Merged
merged 7 commits into from
Jun 5, 2025
Merged

Conversation

sunil-lakshman
Copy link
Contributor

No description provided.

@sunil-lakshman sunil-lakshman requested a review from a team as a code owner June 5, 2025 06:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for nested global fields by allowing an api_version option to be passed through stack/global_fields methods and updating tests and documentation accordingly. Key changes include:

  • Introduced options parameter to global_fields and GlobalFields to set api_version header per request.
  • Updated unit and integration tests to cover nested global fields create, update, delete, and fetch operations.
  • Bumped SDK version to 1.5.0, updated changelog, and adjusted .talismanrc ignores.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/global_fields/test_global_fields_unittest.py Added nested global_fields unit tests
tests/api/global_fields/test_global_fields_api.py Added nested global_fields API tests and placeholder UID
contentstack_management/stack/stack.py Updated global_fields signature to accept options
contentstack_management/global_fields/global_fields.py Added header logic and cleanup for api_version in CRUD
contentstack_management/init.py Bumped version to 1.5.0
CHANGELOG.md Documented v1.5.0 release note
.talismanrc Added new test files to ignore list
Comments suppressed due to low confidence (3)

tests/unit/global_fields/test_global_fields_unittest.py:80

  • Missing assertion for response.request.body, you should verify that the payload is correctly serialized to JSON to ensure the nested fields data is sent.
response = self.client.stack(api_key).global_fields(options={"api_version": 3.2}).create(read_mock_global_fileds_data)

contentstack_management/global_fields/global_fields.py:181

  • The empty-string check is ineffective. To also catch '', use if not self.global_field_uid: or explicitly compare self.global_field_uid == ''.
if self.global_field_uid is None or '':

contentstack_management/stack/stack.py:296

  • The previous API key header validation was removed. Consider re-adding a check to raise an error if api_key is missing to prevent silent misconfiguration.
def global_fields(self, global_field_uid=None, options=None):

@sunil-lakshman sunil-lakshman merged commit 9bc3c6a into development Jun 5, 2025
8 checks passed
@sunil-lakshman sunil-lakshman deleted the enh/dx-3048 branch June 5, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants