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

exegesis

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exegesis - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

4

lib/oas3/Parameter.js

@@ -58,3 +58,3 @@ "use strict";

this.parser = generateSchemaParser(this, schema);
this.validate = validators_1.generateRequestValidator(schemaContext, this.location, resOaParameter.required || false);
this.validate = validators_1.generateRequestValidator(schemaContext, this.location, resOaParameter.required || false, 'application/x-www-form-urlencoded');
}

@@ -85,3 +85,3 @@ else if (resOaParameter.content) {

if (oaMediaType.schema) {
this.validate = validators_1.generateRequestValidator(mediaTypeContext.childContext('schema'), this.location, resOaParameter.required || false);
this.validate = validators_1.generateRequestValidator(mediaTypeContext.childContext('schema'), this.location, resOaParameter.required || false, mediaTypeString);
}

@@ -88,0 +88,0 @@ }

@@ -62,3 +62,3 @@ "use strict";

const schemaContext = context.childContext('schema');
this.validator = validators_1.generateRequestValidator(schemaContext, parameterLocation, parameterRequired);
this.validator = validators_1.generateRequestValidator(schemaContext, parameterLocation, parameterRequired, mediaType);
}

@@ -65,0 +65,0 @@ else {

@@ -5,3 +5,3 @@ import { ParameterLocation, ValidatorFunction } from '../../types';

export declare function _filterRequiredProperties(schema: any, propNameToFilter: string): void;
export declare function generateRequestValidator(schemaContext: Oas3CompileContext, parameterLocation: ParameterLocation, parameterRequired: boolean): ValidatorFunction;
export declare function generateRequestValidator(schemaContext: Oas3CompileContext, parameterLocation: ParameterLocation, parameterRequired: boolean, mediaType: string): ValidatorFunction;
export declare function generateResponseValidator(schemaContext: Oas3CompileContext, parameterLocation: ParameterLocation, parameterRequired: boolean): ValidatorFunction;

@@ -17,2 +17,11 @@ "use strict";

const jsonSchema = __importStar(require("../../utils/jsonSchema"));
const mime_1 = require("../../utils/mime");
// urlencoded and form-data requests do not contain any type information;
// for example `?foo=9` doesn't tell us if `foo` is the number 9, or the string
// "9", so we need to use type coercion to make sure the data passed in matches
// our schema.
const REQUEST_TYPE_COERCION_ALLOWED = new mime_1.MimeTypeRegistry({
"application/x-www-form-urlencoded": true,
"multipart/form-data": true,
});
// TODO tests

@@ -188,4 +197,5 @@ // * readOnly

}
function generateRequestValidator(schemaContext, parameterLocation, parameterRequired) {
return generateValidator(schemaContext, parameterLocation, parameterRequired, 'readOnly', true);
function generateRequestValidator(schemaContext, parameterLocation, parameterRequired, mediaType) {
const allowTypeCoercion = mediaType ? REQUEST_TYPE_COERCION_ALLOWED.get(mediaType) || false : false;
return generateValidator(schemaContext, parameterLocation, parameterRequired, 'readOnly', allowTypeCoercion);
}

@@ -192,0 +202,0 @@ exports.generateRequestValidator = generateRequestValidator;

{
"name": "exegesis",
"version": "1.4.0",
"version": "1.4.1",
"description": "Parses OpenAPI documents",

@@ -62,12 +62,12 @@ "main": "lib/index.js",

"@types/qs": "^6.5.1",
"@types/semver": "^5.5.0",
"@types/semver": "^6.0.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"coveralls": "^3.0.2",
"husky": "^1.3.1",
"husky": "^2.0.0",
"lint-staged": "^8.1.4",
"markdownlint-cli": "^0.14.1",
"mocha": "^6.0.2",
"nyc": "^13.3.0",
"semantic-release": "^15.13.3",
"markdownlint-cli": "^0.15.0",
"mocha": "^6.1.4",
"nyc": "^14.0.0",
"semantic-release": "^15.13.12",
"supertest-fetch": "^1.2.2",

@@ -74,0 +74,0 @@ "ts-node": "^8.0.2",

Sorry, the diff of this file is not supported yet

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