Skip to content
Discussion options

You must be logged in to vote

Yes, Yokai does support nested validation, but not out of the box using dot notation like credentials.username.

Instead, you can define nested validation by using object-based schema definitions. Here’s an example of how you might structure it:

ts
Copy
const schema = {
database: {
host: { type: 'string' },
port: { type: 'number' },
credentials: {
username: { type: 'string' },
password: { type: 'string' }
}
}
};
If you're writing this schema in code, using the programmatic API is the most flexible. If you're writing it in YAML, try mirroring the structure.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dev-fu
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