Skip to content
Discussion options

You must be logged in to vote

Can you confirm if AJV is required for custom validation logic, or is there some way of doing this using Typebox alone? And I'm using 0.34.33.

You can use either TypeBox or Ajv for custom validation, but I would recommend using Ajv as the mechanisms for custom validation aligns better to how TypeBox 1.0 will be handling things in future. Here is how you can express custom validation schematics with 0.34.33 (but assumes you have setup the Ajv addKeyword correctly)

TypeScript Link Here

import { Type, Static, TSchema } from '@sinclair/typebox'

// ---------------------------------------------------------------
// TChecked
//
// This type just models whatever keyword you're adding to Ajv
//…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@carcigenicate
Comment options

Comment options

You must be logged in to vote
2 replies
@carcigenicate
Comment options

@carcigenicate
Comment options

Answer selected by carcigenicate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants