Action Validator from Schema
Is there a way to derive an argument validator in an action from the schema itself? For example, I have the following table:
And an action that receives wins as an argument:
In the action I've only called out
description and winDate because that's all this action cares about, and most of the other type-safe systems I use just enforce "does it have what you need" and don't worry about "does it have extra stuff" in it. However, Convex throws a validation error every time I try to just pass win entries directly to this because it also has _id, _creationTime, etc.So, my question is two-fold:
1. (Ideal) Is there a way to just use the schema itself for the arg validator, something like
wins: v.array(validatorFromDoc(Doc<"wins">))?- I've tried a few forms of this, but since the data model contains only types, nothing in there can be used as a value when passing to the validator methods
2. (Workable) Is there a way to say "don't worry about extra properties"? Something like:
Thanks!
