key: {
type: 'String',
required: [true, 'Required'],
trim: true
}
Whenever i validate it with custom validator, it converts to "String", which results in always valid type. Like "key" should only accept "String", if "Number" it should throw validation instead of casting it.
(For those who are still stumbling across this question)
You can create a custom schema type for that, which doesn't allow casting. Then you can use this instead of String in your schemas (e.g.
type: NoCastString
).