You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@hono/valibot-validator

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/valibot-validator

Validator middleware using Valibot

0.5.3
latest
Source
npm
Version published
Weekly downloads
15K
-6.87%
Maintainers
1
Weekly downloads
 
Created
Source

Valibot validator middleware for Hono

codecov

The validator middleware using Valibot for Hono applications. You can write a schema with Valibot and validate the incoming values.

Usage

import { number, object, string } from 'valibot'
import { vValidator } from '@hono/valibot-validator'

const schema = object({
  name: string(),
  age: number(),
})

app.post('/author', vValidator('json', schema), (c) => {
  const data = c.req.valid('json')
  return c.json({
    success: true,
    message: `${data.name} is ${data.age}`,
  })
})

Hook:

app.post(
  '/post',
  vValidator('json', schema, (result, c) => {
    if (!result.success) {
      return c.text('Invalid!', 400)
    }
  })
  //...
)

Author

Nico Franke https://github.com/ZerNico

License

MIT

FAQs

Package last updated on 07 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts