Skip to content

Commit 58693dd

Browse files
committed
feat(standard-validator): cleanup tests, adjust comments
1 parent f926fc5 commit 58693dd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/standard-validator/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ const sValidator = <
5555
validator(target, async (value, c) => {
5656
let validatorValue = value
5757

58-
// in case where our `target` === `header`, Hono parses all of the headers into lowercase.
59-
// this might not match the Zod schema, so we want to make sure that we account for that when parsing the schema.
58+
/**
59+
* For headers, all keys are lower-cased, so we have to transform them.
60+
*/
6061
if (target === 'header' && isStandardSchemaValidator(schema) && schema['~standard'].types) {
61-
// create an object that maps lowercase schema keys to lowercase
6262
const schemaKeys = Object.keys(schema['~standard'].types)
6363
const caseInsensitiveKeymap = Object.fromEntries(
6464
schemaKeys.map((key) => [key.toLowerCase(), key])

packages/standard-validator/test/__schemas__/valibot.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { object, string, number, optional, enum_, pipe, unknown, transform, union, const, picklist } from 'valibot'
1+
import { object, string, number, optional, pipe, unknown, transform, picklist } from 'valibot'
22

33
const personJSONSchema = object({
44
name: string(),

0 commit comments

Comments
 (0)