Closed karaarda closed 2 years ago
All validation is done against simpleSchema. The same schema is available via context. Any change in schema that has to be validated should be added/updated to simpleSchema.js
@MohanNarayana what @karaarda is referring to is that our code is using the version of the schema directly imported from the original definition, not the version that gets extended which is available via the context, therefore even when properly extended schema validation will fail. I think they properly suggest the fix there which is to change the validation in the cart code to use the extended schema via the context. This should be best practice everywhere.
It does not matter for me anymore to be honest.
Is that because you are no longer using Open Commerce? Or you found another solution?
The one I shared in the original post is a valid solution I think.
After trying to find someone to get in touch for a year without luck and finding ourselves re-writing or overriding almost everything, reaction commerce costed us a lot.
@karaarda Would you be willing to talk to me about your experiences? https://discord.gg/aqnvYFZc
:tada: This issue has been resolved in version 1.3.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
@zenweasel joined the discord server but couldn't find you. feel free to find me in the server and text me
In the transformAndValidateCart mutation the cart schema is loaded directly from file as
import { Cart as CartSchema } from "../simpleSchemas.js";
. It makes it impossible to extend the cart schema as the validation fails. The schema should be retrieved from the context as follows:const CartSchema = context.simpleSchemas.Cart;