@nestling/validator
v1.4.6
Published
Validator module for NestJS
Downloads
2
Readme
Validator Service for NestJS
Usage:
import * as path from 'path'
import { Module } from '@nest/common'
import { ValidatorModule, loadSchemas } from '@nestling/validator'
import { mongoDbKeywords } from '@nestling/validator-keywords-mongodb'
const schemaDir = path.resolve(__dirname, '../../schemas')
const schemas = loadSchemas(schemaDir)
// augment schemas with custom keywords for validation
@Module({
imports: [
ValidatorModule.forRoot({
schemas,
keywords: {
...mongoDbKeywords
}
}),
...
]
})
export class ApplicationModule {}
await this.validatorService.validate('login', user)