We have extended a number of collections (Cart, Orders, Products) to make Reaction more customized to our needs. But many of the checks performed in the Inventory adjustment methods check only against a Single Schema. Especially in statusChange.js.
I expect when a Collection is extended with a schema, that the Checks look at all of the Collections's schemas not the default one.
Throws error: Error: Match error: Match error: variants.gender is not allowed by the schema in field [0]
"inventory/addReserve": function (cartItems) {
check(cartItems, [Schemas.CartItem]);
return Meteor.call("inventory/setStatus", cartItems);
},
I’ve got a couple ideas cooking here trying to work out this issue, but one thing that just occurred to me is I think we probably can’t ever have an arg check use a core schema directly...
// bad
check(cart, Schemas.Cart);
It really has to always use a final attached schema so we will always be checking the result of any custom schemas being added.
So something more like this instead…
// good
check(cart, Cart.simpleSchema());
Apparently there's an issue standing in the way of using that .simpleSchema() method when you have multiple schemas attached to the same collection...
https://github.com/aldeed/meteor-collection2-core/issues/6
And it's been there since March with no maintainer response. :(
Oh geez. Apparently this exists now...
https://github.com/aldeed/node-simple-schema
I smell an inevitable refactor...
of course there is....
I think we might want to keep this one open (or open another just for the transition to node-simple-schema?
@zenweasel you mean like #1343?
Hmmmm, yes. Very much like that.
Most helpful comment
Oh geez. Apparently this exists now...
https://github.com/aldeed/node-simple-schema
I smell an inevitable refactor...