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

openapi-enforcer

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-enforcer - npm Package Compare versions

Comparing version 0.9.3 to 0.9.4

12

bin/openapi.js

@@ -445,4 +445,9 @@ /**

function responseErrors(context, responses, data, config) {
let errors = [];
const errors = [];
if (data.error) {
errors.push(data.error);
return errors;
}
// check body for errors

@@ -477,2 +482,3 @@ if (config.hasOwnProperty('body')) {

function responseExample(context, responses, data, options) {
if (data.error) throw Error(data.error);
if (!responses) throw Error('Cannot build example response without schema');

@@ -494,2 +500,4 @@ if (!options) options = {};

function responsePopulate(context, responses, data, options) {
if (data.error) throw Error(data.error);
const config = Object.assign({}, options);

@@ -546,2 +554,4 @@ if (!config.headers) config.headers = {};

function responseSerialize(context, responses, data, config) {
if (data.error) throw Error(data.error);
const result = { headers: {} };

@@ -548,0 +558,0 @@ const version = store.get(context).version;

16

bin/v2/index.js

@@ -55,12 +55,18 @@ /**

* @param {{ code: string, contentType: string }} options
* @returns {{ accept: string, code: string, contentType?: string, headers: object, schema?: object }|undefined}
* @returns {{ accept?: string, code?: string, contentType?: string, error?: string, headers?: object, schema?: object }}
*/
Version.prototype.getResponseData = function(produces, responses, options) {
if (!responses) return;
if (!responses) return { error: 'No response definitions exists' };
const code = options.hasOwnProperty('code')
? options.code
let code = options.hasOwnProperty('code')
? '' + options.code
: responses.hasOwnProperty('default') ? 'default' : Object.keys(responses)[0];
if (!responses.hasOwnProperty(code)) {
if (responses.hasOwnProperty('default')) {
code = 'default';
} else {
return { error: 'Response code not valid' };
}
}
const schema = responses[code];
if (!schema) return;

@@ -67,0 +73,0 @@ const result = {

@@ -88,12 +88,18 @@ /**

* @param {{ code: string, contentType: string }} options
* @returns {{ accept: string, code: string, contentType?: string, headers: object, schema?: object }|undefined}
* @returns {{ accept?: string, code?: string, contentType?: string, error?: string, headers?: object, schema?: object }}
*/
Version.prototype.getResponseData = function(produces, responses, options) {
if (!responses) return;
if (!responses) return { error: 'No response definitions exists' };
const code = options.hasOwnProperty('code')
? options.code
let code = options.hasOwnProperty('code')
? '' + options.code
: responses.hasOwnProperty('default') ? 'default' : Object.keys(responses)[0];
if (!responses.hasOwnProperty(code)) {
if (responses.hasOwnProperty('default')) {
code = 'default';
} else {
return { error: 'Response code not valid' };
}
}
const schema = responses[code];
if (!schema) return;

@@ -100,0 +106,0 @@ const result = {

{
"name": "openapi-enforcer",
"version": "0.9.3",
"version": "0.9.4",
"description": "Library for validating, parsing, and formatting data against open api schemas.",

@@ -5,0 +5,0 @@ "main": "index.js",

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