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

express-openapi-validation

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-openapi-validation - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

test/data-driven/accept-multiple-local-refs-in-body-as-array.js

42

index.js

@@ -28,28 +28,32 @@ var convert = require('openapi-jsonschema-parameters');

if (Array.isArray(args.schemas)) {
args.schemas.forEach(function(schema) {
var id = schema.id;
if (args.schemas) {
if (Array.isArray(args.schemas)) {
args.schemas.forEach(function(schema) {
var id = schema.id;
if (id) {
var localSchemaPath;
if (id) {
var localSchemaPath;
if (bodySchema) {
localSchemaPath = LOCAL_DEFINITION_REGEX.exec(id);
}
if (bodySchema) {
localSchemaPath = LOCAL_DEFINITION_REGEX.exec(id);
}
if (localSchemaPath) {
var localSchemas = bodySchema[localSchemaPath[1]];
if (localSchemaPath) {
var localSchemas = bodySchema[localSchemaPath[1]];
if (!localSchemas) {
localSchemas = bodySchema[localSchemaPath[1]] = {};
if (!localSchemas) {
localSchemas = bodySchema[localSchemaPath[1]] = {};
}
localSchemas[localSchemaPath[2]] = schema;
}
localSchemas[localSchemaPath[2]] = schema;
v.addSchema(schema, id);
} else {
console.warn(loggingKey, 'igorning schema without id property');
}
v.addSchema(schema, id);
} else {
console.warn(loggingKey, 'igorning schema without id property');
}
});
});
} else {
bodySchema.definitions = args.schemas;
}
}

@@ -56,0 +60,0 @@

{
"name": "express-openapi-validation",
"version": "0.4.0",
"version": "0.5.0",
"description": "Express middleware for openapi parameter validation.",

@@ -5,0 +5,0 @@ "scripts": {

@@ -33,3 +33,3 @@ # express-openapi-validation [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url]

],
schemas: null, // an optional array of jsonschemas used to dereference $ref
schemas: null, // an optional array or object of jsonschemas used to dereference $ref
version: 'swagger-2.0', // default optional value for future versions of openapi

@@ -56,3 +56,3 @@ errorTransformer: null // an optional transformer function to format errors

An array of schemas. Each schema must have an `id` property. See `./test/data-driven/`
If given as an array, each schema must have an `id` property. See `./test/data-driven/`
for tests with `schemas`. Ids may be schema local (i.e. `#/definitions/SomeType`),

@@ -62,2 +62,4 @@ or URL based (i.e. `/SomeType`). When supplied, `$ref` usage will map exactly to the

If given as an object, it will be assigned to `bodySchema.definitions`. Schemas may then be dereferenced in parameters by using `#/definitions/<key in args.schemas object>`.
#### args.version

@@ -64,0 +66,0 @@

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