parent
c63470e491
commit
f30f7ee28c
|
@ -1,35 +0,0 @@
|
||||||
---
|
|
||||||
'@hono/typia-validator': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
Enables handling of `number`, `boolean`, and `bigint` types in query parameters and headers.
|
|
||||||
|
|
||||||
```diff
|
|
||||||
- import { typiaValidator } from '@hono/typia-validator';
|
|
||||||
+ import { typiaValidator } from '@hono/typia-validator/http';
|
|
||||||
import { Hono } from 'hono';
|
|
||||||
import typia, { type tags } from 'typia';
|
|
||||||
|
|
||||||
interface Schema {
|
|
||||||
- pages: `${number}`[];
|
|
||||||
+ pages: (number & tags.Type<'uint32'>)[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const app = new Hono()
|
|
||||||
.get(
|
|
||||||
'/books',
|
|
||||||
typiaValidator(
|
|
||||||
- typia.createValidate<Schema>(),
|
|
||||||
+ typia.http.createValidateQuery<Schema>(),
|
|
||||||
async (result, c) => {
|
|
||||||
if (!result.success)
|
|
||||||
return c.text('Invalid query parameters', 400);
|
|
||||||
- return { pages: result.data.pages.map(Number) };
|
|
||||||
}
|
|
||||||
),
|
|
||||||
async c => {
|
|
||||||
const { pages } = c.req.valid('query'); // { pages: number[] }
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
)
|
|
||||||
```
|
|
|
@ -1,5 +1,41 @@
|
||||||
# @hono/typia-validator
|
# @hono/typia-validator
|
||||||
|
|
||||||
|
## 0.1.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- [#888](https://github.com/honojs/middleware/pull/888) [`c63470e4915a0680c624bf97d52487572185a2d5`](https://github.com/honojs/middleware/commit/c63470e4915a0680c624bf97d52487572185a2d5) Thanks [@miyaji255](https://github.com/miyaji255)! - Enables handling of `number`, `boolean`, and `bigint` types in query parameters and headers.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- import { typiaValidator } from '@hono/typia-validator';
|
||||||
|
+ import { typiaValidator } from '@hono/typia-validator/http';
|
||||||
|
import { Hono } from 'hono';
|
||||||
|
import typia, { type tags } from 'typia';
|
||||||
|
|
||||||
|
interface Schema {
|
||||||
|
- pages: `${number}`[];
|
||||||
|
+ pages: (number & tags.Type<'uint32'>)[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const app = new Hono()
|
||||||
|
.get(
|
||||||
|
'/books',
|
||||||
|
typiaValidator(
|
||||||
|
- typia.createValidate<Schema>(),
|
||||||
|
+ typia.http.createValidateQuery<Schema>(),
|
||||||
|
async (result, c) => {
|
||||||
|
if (!result.success)
|
||||||
|
return c.text('Invalid query parameters', 400);
|
||||||
|
- return { pages: result.data.pages.map(Number) };
|
||||||
|
}
|
||||||
|
),
|
||||||
|
async c => {
|
||||||
|
const { pages } = c.req.valid('query'); // { pages: number[] }
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
## 0.0.5
|
## 0.0.5
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@hono/typia-validator",
|
"name": "@hono/typia-validator",
|
||||||
"version": "0.0.5",
|
"version": "0.1.0",
|
||||||
"description": "Validator middleware using Typia",
|
"description": "Validator middleware using Typia",
|
||||||
"main": "dist/cjs/index.js",
|
"main": "dist/cjs/index.js",
|
||||||
"module": "dist/esm/index.js",
|
"module": "dist/esm/index.js",
|
||||||
|
|
Loading…
Reference in New Issue