Skip to content

fix: include product-level references and meta fields on projections - #404

Merged
mvantellingen merged 2 commits into
mainfrom
fix/product-projection-tax-category
Aug 3, 2026
Merged

fix: include product-level references and meta fields on projections#404
mvantellingen merged 2 commits into
mainfrom
fix/product-projection-tax-category

Conversation

@mvantellingen

Copy link
Copy Markdown
Member

Transforming a product into a ProductProjection dropped taxCategory,
state, priceMode, metaTitle, metaKeywords and searchKeywords, even though
the product resource already stored all of them -- ProductRepository
resolves taxCategory and state on create, and ProductData carries the meta
fields. Only the transform was leaving them out.

Fixed in both places that build a projection, so the product projection
and product search endpoints do not drift.

This makes expand=taxCategory resolve, so code that reads a projection's
tax category -- to compute net and gross prices at index time, say -- can
be tested against the mock rather than only against the real API.

searchKeywords is non-optional on ProductProjection, so the mock was
emitting a value that did not satisfy its own type. It now always carries
it, defaulting to {}. Tests asserting a whole projection with toEqual need
it added to their expected object; the fixture in this file is updated
accordingly.

Transforming a product into a ProductProjection dropped taxCategory,
state, priceMode, metaTitle, metaKeywords and searchKeywords, even though
the product resource already stored all of them -- ProductRepository
resolves taxCategory and state on create, and ProductData carries the meta
fields. Only the transform was leaving them out.

Fixed in both places that build a projection, so the product projection
and product search endpoints do not drift.

This makes expand=taxCategory resolve, so code that reads a projection's
tax category -- to compute net and gross prices at index time, say -- can
be tested against the mock rather than only against the real API.

searchKeywords is non-optional on ProductProjection, so the mock was
emitting a value that did not satisfy its own type. It now always carries
it, defaulting to {}. Tests asserting a whole projection with toEqual need
it added to their expected object; the fixture in this file is updated
accordingly.
@changeset-bot

changeset-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7a39a61

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@labdigital/commercetools-mock Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Full node/storage-engine coverage stays on ubuntu (now including node
26); Windows and macOS only run node 26 with the in-memory engine.
@mvantellingen
mvantellingen merged commit b09b41b into main Aug 3, 2026
9 checks passed
@mvantellingen
mvantellingen deleted the fix/product-projection-tax-category branch August 3, 2026 06:22
@github-actions github-actions Bot mentioned this pull request Aug 3, 2026
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.

1 participant