fluent-json-schema
fluent-json-schema copied to clipboard
.string() method validate all type values
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.1.0
Plugin version
3.1.0
Node.js version
16.14.12
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
Monterey
Description
i try to validate my body prop "name" as a required string, but if i sent a number value from POSTMAN json, i've got an successful validation... it's very strange.
Steps to Reproduce
S.prop('name', S.string().required())
Expected Behavior
No response
It is not because the value is coerced.
https://github.com/fastify/fastify/blob/main/docs/Reference/Validation-and-Serialization.md#validation
Try:
const fastify = Fastify({
ajv: {
customOptions: {
coerceTypes: false
}
}
})
Not related to fluent-json-schema