I would like to use your tool to check my config input for consistency with the expectation :-).
They contain a lot of key value pairs (sometimes called maps), so i just want to check for that user type,
that ALL key have one defined datatype.
Is there a little bit more sophistic solution than this
const model = SchemaModel({
map: ObjectType().addRule((value, data) => {
let result = true;
for (const k in value) {
if (typeof value[k] != "string") result = false;
}
return result;
},"must be a set of keys with strings as values")
});
What would be nice, to use your type checking possiblities, so not the native ones, and the error message is now for the complete map and not for the key. As i although have maps of config objects a recursion would be great.
I would like to use your tool to check my config input for consistency with the expectation :-). They contain a lot of key value pairs (sometimes called maps), so i just want to check for that user type, that ALL key have one defined datatype.
Is there a little bit more sophistic solution than this
What would be nice, to use your type checking possiblities, so not the native ones, and the error message is now for the complete map and not for the key. As i although have maps of config objects a recursion would be great.