@hono/zod-openapi
Advanced tools
Comparing version 0.15.2 to 0.15.3
@@ -104,25 +104,33 @@ "use strict"; | ||
const validator = (0, import_zod_validator.zValidator)("json", schema, hook); | ||
const mw = async (c, next) => { | ||
if (c.req.header("content-type")) { | ||
if (isJSONContentType(c.req.header("content-type"))) { | ||
return await validator(c, next); | ||
if (route.request?.body?.required) { | ||
validators.push(validator); | ||
} else { | ||
const mw = async (c, next) => { | ||
if (c.req.header("content-type")) { | ||
if (isJSONContentType(c.req.header("content-type"))) { | ||
return await validator(c, next); | ||
} | ||
} | ||
} | ||
c.req.addValidatedData("json", {}); | ||
await next(); | ||
}; | ||
validators.push(mw); | ||
c.req.addValidatedData("json", {}); | ||
await next(); | ||
}; | ||
validators.push(mw); | ||
} | ||
} | ||
if (isFormContentType(mediaType)) { | ||
const validator = (0, import_zod_validator.zValidator)("form", schema, hook); | ||
const mw = async (c, next) => { | ||
if (c.req.header("content-type")) { | ||
if (isFormContentType(c.req.header("content-type"))) { | ||
return await validator(c, next); | ||
if (route.request?.body?.required) { | ||
validators.push(validator); | ||
} else { | ||
const mw = async (c, next) => { | ||
if (c.req.header("content-type")) { | ||
if (isFormContentType(c.req.header("content-type"))) { | ||
return await validator(c, next); | ||
} | ||
} | ||
} | ||
c.req.addValidatedData("form", {}); | ||
await next(); | ||
}; | ||
validators.push(mw); | ||
c.req.addValidatedData("form", {}); | ||
await next(); | ||
}; | ||
validators.push(mw); | ||
} | ||
} | ||
@@ -129,0 +137,0 @@ } |
{ | ||
"name": "@hono/zod-openapi", | ||
"version": "0.15.2", | ||
"version": "0.15.3", | ||
"description": "A wrapper class of Hono which supports OpenAPI.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
46536
646