Small Validator for Fluent JSON Schema
npm install fluent-schema-validator   
Don't let yourself handle validation, let the automation handle it.

For instance, having unintentionally field in the value but the schema bypass it, or having string format of email but also bypass by fastify default validator.
In fact, Fastify docs recommended that you use custom validator instead.
This library help just that
pattern for RegEx, string format, required field or an advances anyOf, allOf, not is supported.bash
npm install fluent-schema-validator fluent-json-schemaor yarn
yarn add fluent-schema-validator fluent-json-schemaor pnpm
pnpm add fluent-schema-validator fluent-json-schema
`Then write a sample validation.
`typescript
// Assumming you're using TypeScript or mjs
import S from 'fluent-json-schema'
import validate from 'fluent-schema-validator'const schema = S.object()
.prop('username', S.string().required())
.prop('password', S.string().required())
const value = {
username: "saltyaom",
password: "12345678"
}
validate(value, schema) // true
`$3
Field which is not define in schema will not be tolerate
`typescript
import S from 'fluent-json-schema'
import validate from 'fluent-schema-validator'const schema = S.object()
.prop('username', S.string().required())
.prop('password', S.string().required())
const value = {
username: "saltyaom",
password: "12345678",
"not-in-schema": true
}
validate(value, schema) // false
`$3
Field which is not mark required, will be fine if not presented
`typescript
import S from 'fluent-json-schema'
import validate from 'fluent-schema-validator'const schema = S.object()
.prop('username', S.string().required())
.prop('password', S.string())
const value = {
username: "saltyaom",
}
validate(value, schema) // true
``It would work the way you expected, see more in test cases or \__specs\__ folder.
