Skip to content

feat(product-type): support savedToLineItem on attribute definitions - #452

Merged
mvantellingen merged 1 commit into
labd:mainfrom
kapilbathija-ct:feat/product-type-saved-to-line-item
Oct 22, 2026
Merged

mvantellingen merged 1 commit into
labd:mainfrom
kapilbathija-ct:feat/product-type-saved-to-line-item

Conversation

@kapilbathija-ct

@kapilbathija-ct kapilbathija-ct commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Product types gain savedToLineItem on attribute definitions (released 2026-09-30): whether the attribute value is copied onto Line Items.

 attributeDefinitionFromAttributeDefinitionDraft(draft)
   isSearchable: draft.isSearchable ?? true
+  savedToLineItem: draft.savedToLineItem ?? true

 ProductTypeUpdateHandler
   setKey
+  setSavedToLineItem(attributeName, savedToLineItem)
  • AttributeDefinitionDraftSchema accepts savedToLineItem. The RAML spec has it, the OpenAPI spec (oas/api/openapi.yaml, api-reference f6f6f57) does not yet, so EXTRA_PROPERTIES in generate-schemas.ts patches it in. The schema line is what the generator emits with that patch; the rest of a full regeneration was left out.
  • Typed locally: @commercetools/platform-sdk 9.7.0 has the type, but bumping to it also makes Category.stores required, which is its own change.

Needed by the saved_to_line_item support in terraform-provider-commercetools (labd/terraform-provider-commercetools#679), whose acceptance tests run against this mock.

Evidence

  • Before: the draft field is stripped by the schema, the attribute reads back without it, and setSavedToLineItem is not handled.
    After: new test Update product type - setSavedToLineItem: create [false, unset] → reads [false, true]; update → [true, false]. Create product type now expects savedToLineItem: true.
  • pnpm check clean (the one biome warning is on main too); pnpm test: 87 files, 947 tests pass.
  • terraform-provider-commercetools TestAccProductTypes_* with saved_to_line_item pass against this branch.

Merge Danger

Door: two-way

Blast Radius: small

Product type attributes in mock responses gain savedToLineItem: true by default, matching the API. Consumers that toEqual whole attribute definitions in their own tests will need the field.

🤖 Generated with Claude Code

Accept savedToLineItem on AttributeDefinitionDraft (default true, as in
the API) and handle the setSavedToLineItem update action. The OpenAPI spec
does not carry the field yet, so the schema generator patches it in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mvantellingen mvantellingen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

@mvantellingen
mvantellingen merged commit 87109fa into labd:main Oct 22, 2026
10 checks passed
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