Version Packages (#889)

pull/893/head @hono/typia-validator@0.1.0
github-actions[bot] 2024-12-15 18:59:37 +09:00 committed by GitHub
parent c63470e491
commit f30f7ee28c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 36 deletions

View File

@ -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[] }
//...
}
)
```

View File

@ -1,5 +1,41 @@
# @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
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@hono/typia-validator",
"version": "0.0.5",
"version": "0.1.0",
"description": "Validator middleware using Typia",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",