-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
additional_data Causes Admin API to Fail #9681
Labels
Comments
@mk0y, thanks for the report. We'll look into this tomorrow and revert back. Your expectation of the behavior seems reasonable. |
Thanks @olivermrbl, i think it's the problem of middleware, my example: import { defineMiddlewares } from "@medusajs/medusa";
import { z } from "zod";
export default defineMiddlewares({
routes: [
{
method: "POST",
matcher: "/admin/products",
additionalDataValidator: {
title_de: z.string().nullable(),
description_de: z.string().nullable(),
},
},
{
method: "POST",
matcher: "/admin/products/:id",
additionalDataValidator: {
title_de: z.string().nullish(),
description_de: z.string().nullish(),
},
},
],
}); Seems that |
Unfortunately this issue was closed automatically without being resolved. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Describe the bug
I wanted to extend the product module and followed the docs here: https://docs.medusajs.com/v2/resources/commerce-modules/product/extend.
I added my custom props, like title_de (for titles in German language), and
curl
works withadditional_data
. But, when pass the body in the POST request without theadditional_data
the request will fail.This also causes admin failing to publish a product saying something like "additional_data" is missing.
System information
Medusa version (including plugins): rc
Node.js version: 20.17.0
Database: Postgres
Operating system: macos
Browser (if relevant): Not relevant, this is backend issue.
Steps to reproduce the behavior
additional_data
property.{"type":"invalid_data","message":"Invalid request: Field 'additional_data' is required"}
Expected behavior
CRUD operations on products should still function even without
additional_data
prop.Code snippets
This request fails:
The text was updated successfully, but these errors were encountered: