Skip to content

Conversation

samerdmaidi
Copy link

Previously, the product images validator only accepted the 'url' field, which caused the 'id' and 'metadata' fields to be silently stripped out during validation. This prevented users from updating image metadata via the admin API.

This change updates both CreateProduct and UpdateProduct validators to properly support the full image object structure:

  • id (optional): for updating existing images
  • url (optional for updates, required for creation)
  • metadata (optional): for storing custom key-value pairs

This aligns the API validation with the underlying ProductImageDTO type system which already supports these fields.

Previously, the product images validator only accepted the 'url' field,
which caused the 'id' and 'metadata' fields to be silently stripped out
during validation. This prevented users from updating image metadata via
the admin API.

This change updates both CreateProduct and UpdateProduct validators to
properly support the full image object structure:
- id (optional): for updating existing images
- url (optional for updates, required for creation)
- metadata (optional): for storing custom key-value pairs

This aligns the API validation with the underlying ProductImageDTO type
system which already supports these fields.

Fixes: Product image metadata being ignored in create/update endpoints
@samerdmaidi samerdmaidi requested a review from a team as a code owner October 10, 2025 12:42
Copy link

changeset-bot bot commented Oct 10, 2025

⚠️ No Changeset found

Latest commit: aa07354

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

vercel bot commented Oct 10, 2025

@samerdmaidi is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

@willbouch
Copy link
Contributor

Hey and thanks for the contribution! Should we maybe also update it in this file? For create and update? Otherwise, I believe Typescript will complain if we pass the params from the admin dashboard (which uses the SDK)

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