Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hono/zod-openapi

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/zod-openapi - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

dist/index.d.mts

71

dist/index.js

@@ -0,12 +1,34 @@

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
import {
OpenApiGeneratorV3,
OpenApiGeneratorV31,
OpenAPIRegistry
} from "@asteasolutions/zod-to-openapi";
import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
import { zValidator } from "@hono/zod-validator";
import { Hono } from "hono";
import { z, ZodType } from "zod";
var OpenAPIHono = class _OpenAPIHono extends Hono {
var src_exports = {};
__export(src_exports, {
OpenAPIHono: () => OpenAPIHono,
createRoute: () => createRoute,
z: () => import_zod.z
});
module.exports = __toCommonJS(src_exports);
var import_zod_to_openapi = require("@asteasolutions/zod-to-openapi");
var import_zod_to_openapi2 = require("@asteasolutions/zod-to-openapi");
var import_zod_validator = require("@hono/zod-validator");
var import_hono = require("hono");
var import_zod = require("zod");
var OpenAPIHono = class _OpenAPIHono extends import_hono.Hono {
openAPIRegistry;

@@ -16,3 +38,3 @@ defaultHook;

super(init);
this.openAPIRegistry = new OpenAPIRegistry();
this.openAPIRegistry = new import_zod_to_openapi.OpenAPIRegistry();
this.defaultHook = init?.defaultHook;

@@ -24,15 +46,15 @@ }

if (route.request?.query) {
const validator = zValidator("query", route.request.query, hook);
const validator = (0, import_zod_validator.zValidator)("query", route.request.query, hook);
validators.push(validator);
}
if (route.request?.params) {
const validator = zValidator("param", route.request.params, hook);
const validator = (0, import_zod_validator.zValidator)("param", route.request.params, hook);
validators.push(validator);
}
if (route.request?.headers) {
const validator = zValidator("header", route.request.headers, hook);
const validator = (0, import_zod_validator.zValidator)("header", route.request.headers, hook);
validators.push(validator);
}
if (route.request?.cookies) {
const validator = zValidator("cookie", route.request.cookies, hook);
const validator = (0, import_zod_validator.zValidator)("cookie", route.request.cookies, hook);
validators.push(validator);

@@ -45,4 +67,4 @@ }

const schema = bodyContent[mediaType]["schema"];
if (schema instanceof ZodType) {
const validator = zValidator("json", schema, hook);
if (schema instanceof import_zod.ZodType) {
const validator = (0, import_zod_validator.zValidator)("json", schema, hook);
validators.push(validator);

@@ -53,4 +75,4 @@ }

const schema = bodyContent[mediaType]["schema"];
if (schema instanceof ZodType) {
const validator = zValidator("form", schema, hook);
if (schema instanceof import_zod.ZodType) {
const validator = (0, import_zod_validator.zValidator)("form", schema, hook);
validators.push(validator);

@@ -65,3 +87,3 @@ }

getOpenAPIDocument = (config) => {
const generator = new OpenApiGeneratorV3(this.openAPIRegistry.definitions);
const generator = new import_zod_to_openapi.OpenApiGeneratorV3(this.openAPIRegistry.definitions);
const document = generator.generateDocument(config);

@@ -71,3 +93,3 @@ return document;

getOpenAPI31Document = (config) => {
const generator = new OpenApiGeneratorV31(this.openAPIRegistry.definitions);
const generator = new import_zod_to_openapi.OpenApiGeneratorV31(this.openAPIRegistry.definitions);
const document = generator.generateDocument(config);

@@ -134,7 +156,8 @@ return document;

};
extendZodWithOpenApi(z);
export {
(0, import_zod_to_openapi2.extendZodWithOpenApi)(import_zod.z);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
OpenAPIHono,
createRoute,
z
};
});
{
"name": "@hono/zod-openapi",
"version": "0.7.1",
"version": "0.7.2",
"description": "A wrapper class of Hono which supports OpenAPI.",
"type": "module",
"main": "dist/index.js",

@@ -18,2 +17,9 @@ "module": "dist/index.mjs",

},
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"license": "MIT",

@@ -46,2 +52,2 @@ "private": false,

}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc