Skip to content

feat: added product level fields to product type attributes #598

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 1 commit into from
Jul 11, 2025

Conversation

demeyerthom
Copy link
Member

@demeyerthom demeyerthom commented Jul 11, 2025

This pull request introduces support for an attribute level field in product types, enhances the Taskfile.yml with additional commands, and adds new validation and utility functions. The most significant changes focus on the implementation and testing of the new attribute level functionality, ensuring compatibility and validation throughout the codebase.

Product Type Attribute Level Support:

  • Added a new level field to the product type attributes in commercetools/resource_product_type.go, allowing specification of whether an attribute is defined at the product or variant level. This includes validation to restrict values to AttributeLevelEnumProduct or AttributeLevelEnumVariant. [1] [2]
  • Updated attribute-related functions (flattenProductTypeAttributes, resourceProductTypeAttributeChangeActions, and expandProductTypeAttributeDefinitionItem) to handle the new level field. Validation prevents changing the level of an existing attribute. [1] [2] [3]

Testing Enhancements:

  • Extended tests in commercetools/resource_product_type_test.go to include scenarios for the new level field, ensuring proper functionality for both product-level and variant-level attributes. Added a new test case TestAccProductTypes_ProductVariant to validate attribute level changes and error handling. [1] [2]
  • Updated test data structures and configurations to accommodate the new level field. [1] [2]

Taskfile Enhancements:

  • Added a default task to Taskfile.yml for listing all tasks and included terraform fmt in the format task for recursive formatting of example files. [1] [2]

Utility Functions:

  • Introduced a generic ref function in commercetools/utils.go to simplify pointer creation for any type.

Documentation and Metadata:

  • Added a changelog entry (Added-20250711-133538.yaml) documenting the addition of support for the product type attribute level field.

@demeyerthom demeyerthom requested a review from a team as a code owner July 11, 2025 11:53
@demeyerthom demeyerthom linked an issue Jul 11, 2025 that may be closed by this pull request
@demeyerthom demeyerthom merged commit c23b409 into main Jul 11, 2025
4 checks passed
@demeyerthom demeyerthom deleted the 597-support-for-product-level-attributes branch July 11, 2025 12:04
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.

Support for product level attributes
1 participant