New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-zod-openapi

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-zod-openapi - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

12

lib/index.js

@@ -455,6 +455,7 @@ require('zod');

function setupResponseValidation(res, specInfo, segmentOrder) {
function setupResponseValidation(res, specInfo, segmentOrder, next) {
const originalSend = res.send;
res.send = function validateAndSendResponse(...args) {
res.send = originalSend;
const body = args[0];

@@ -469,3 +470,4 @@ const isJsonContent = /application\/json/.test(String(res.get('content-type')));

if (!schemaBySegment) {
throw new Error(`Validation Schema not found for Response(${res.statusCode})`);
next(new Error(`Validation Schema not found for Response(${res.statusCode})`));
return res;
}

@@ -483,3 +485,4 @@

if (!result.success) {
throw new ResponseValidationError(result.error, segment);
next(new ResponseValidationError(result.error, segment));
return res;
}

@@ -541,3 +544,3 @@

if (!skipResponseValidation && validationSchema.res) {
setupResponseValidation(res, specInfo, resSegmentOrder);
setupResponseValidation(res, specInfo, resSegmentOrder, next);
}

@@ -550,2 +553,3 @@

next(err);
return;
}

@@ -552,0 +556,0 @@ }

@@ -455,6 +455,7 @@ import 'zod';

function setupResponseValidation(res, specInfo, segmentOrder) {
function setupResponseValidation(res, specInfo, segmentOrder, next) {
const originalSend = res.send;
res.send = function validateAndSendResponse(...args) {
res.send = originalSend;
const body = args[0];

@@ -469,3 +470,4 @@ const isJsonContent = /application\/json/.test(String(res.get('content-type')));

if (!schemaBySegment) {
throw new Error(`Validation Schema not found for Response(${res.statusCode})`);
next(new Error(`Validation Schema not found for Response(${res.statusCode})`));
return res;
}

@@ -483,3 +485,4 @@

if (!result.success) {
throw new ResponseValidationError(result.error, segment);
next(new ResponseValidationError(result.error, segment));
return res;
}

@@ -541,3 +544,3 @@

if (!skipResponseValidation && validationSchema.res) {
setupResponseValidation(res, specInfo, resSegmentOrder);
setupResponseValidation(res, specInfo, resSegmentOrder, next);
}

@@ -550,2 +553,3 @@

next(err);
return;
}

@@ -552,0 +556,0 @@ }

{
"name": "express-zod-openapi",
"version": "0.0.2",
"version": "0.0.3",
"description": "Express Zod OpenAPI",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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