fastest-validator
fastest-validator copied to clipboard
Q: Object with random key:value validation
Hi,
In the validation here, I have the validation below for, since there are random key:value, that can be put on.
data: {
type: "object",
empty: true,
},
What I want to ask, is there a way to validate the value type in these random (key:value)?
Like have the random values only be type string | number | boolean.
e.g., in typescript { data: Record<string, string | number | boolean>; }
Maybe it will be a solution? https://github.com/icebob/fastest-validator/issues/276
It seems it's only making a way to expect the key to be one or the other, though if they support the multi validation type for the value, it could work.
I have a object with random data, that data is key string and value can be string, number, boolean, object or even an array. That's what I am looking to validate, have the options to set what kind of random values it can be expect in that object, in their random keys.