feat(typebox-validator): support Hono v3.1.0 (#65)

* feat(typebox-validator): support Hono v3.1.0

* add changeset
pull/66/head
Yusuke Wada 2023-03-17 17:11:24 +09:00 committed by GitHub
parent 481310aedb
commit 5723cc08c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 7 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/typebox-validator': minor
---
feat: Support Hono v3.1.0

View File

@ -28,11 +28,11 @@
},
"homepage": "https://github.com/honojs/middleware",
"peerDependencies": {
"hono": "3.*",
"@sinclair/typebox": "^0.25.24"
"@sinclair/typebox": "^0.25.24",
"hono": "3.*"
},
"devDependencies": {
"hono": "^3.0.0",
"@sinclair/typebox": "^0.25.24"
"@sinclair/typebox": "^0.25.24",
"hono": "^3.1.0"
}
}

View File

@ -63,7 +63,11 @@ export function tbValidator<
target: Target,
schema: T,
hook?: Hook<Static<T>>
): MiddlewareHandler<E, P, { [K in Target]: Static<T> }> {
): MiddlewareHandler<
E,
P,
{ in: { [K in Target]: Static<T> }; out: { [K in Target]: Static<T> } }
> {
// Compile the provided schema once rather than per validation. This could be optimized further using a shared schema
// compilation pool similar to the Fastify implementation.
const compiled = TypeCompiler.Compile(schema)

View File

@ -33,7 +33,7 @@ describe('Basic', () => {
}
}
output: {
success: boolean
success: true
message: string
}
}

View File

@ -5232,7 +5232,7 @@ hono@^3.0.2:
resolved "https://registry.yarnpkg.com/hono/-/hono-3.0.2.tgz#807a1b0514c6563917d8c278e6da7101bdac1d19"
integrity sha512-jhb0eCiUTOzbOXZyXQCOk1gf3MKjV4ZXY3PRT6lzma0XPsnnHuDOHYF7RCMHYe7jhl4Y0IAzrmWXneXhOMHypA==
hono@^3.1.0:
hono@^3.0.3, hono@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/hono/-/hono-3.1.0.tgz#4b29bcaddc489015b99d0a89b68133ccf72b2cf1"
integrity sha512-5hVyzp3mrAjxRwy6Uj7su0pIISGTKVX2tE4YiYO81V3w1KoYZEmz3g6X6P9nRLQmaABDWXmnL9GqEzBhTAPeog==