feat: added product level fields to product type attributes #598
+247
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
level
field to the product type attributes incommercetools/resource_product_type.go
, allowing specification of whether an attribute is defined at the product or variant level. This includes validation to restrict values toAttributeLevelEnumProduct
orAttributeLevelEnumVariant
. [1] [2]flattenProductTypeAttributes
,resourceProductTypeAttributeChangeActions
, andexpandProductTypeAttributeDefinitionItem
) to handle the newlevel
field. Validation prevents changing the level of an existing attribute. [1] [2] [3]Testing Enhancements:
commercetools/resource_product_type_test.go
to include scenarios for the newlevel
field, ensuring proper functionality for both product-level and variant-level attributes. Added a new test caseTestAccProductTypes_ProductVariant
to validate attribute level changes and error handling. [1] [2]level
field. [1] [2]Taskfile Enhancements:
Taskfile.yml
for listing all tasks and includedterraform fmt
in theformat
task for recursive formatting of example files. [1] [2]Utility Functions:
ref
function incommercetools/utils.go
to simplify pointer creation for any type.Documentation and Metadata:
Added-20250711-133538.yaml
) documenting the addition of support for the product type attribute level field.