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

@adonisjs/validator

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adonisjs/validator - npm Package Compare versions

Comparing version 6.2.0 to 6.2.1

build/src/ErrorReporter/JsonApi.d.ts

20

build/src/Bindings/Request.js

@@ -10,3 +10,11 @@ "use strict";

*/
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const ErrorReporters = __importStar(require("../ErrorReporter"));
/**

@@ -18,8 +26,18 @@ * Extends the request class by adding `validate` method

Request.macro('validate', function validateRequest(schema, messages, config) {
/**
* Attempt to find the best error reporter for validation
*/
let Reporter = ErrorReporters.VanillaErrorReporter;
if (this.accepts(['json']) === 'json') {
Reporter = ErrorReporters.ApiErrorReporter;
}
if (this.accepts(['application/vnd.api+json']) === 'application/vnd.api+json') {
Reporter = ErrorReporters.JsonApiErrorReporter;
}
return validate(schema, {
...this.all(),
...this.allFiles(),
}, messages, config);
}, messages, Object.assign({ reporter: Reporter }, config));
});
}
exports.default = extendRequest;

2

build/src/ErrorReporter/Api.js

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

toError() {
return new ValidationException_1.ValidationException(true, this.errors);
return new ValidationException_1.ValidationException(false, this.toJSON());
}

@@ -64,0 +64,0 @@ /**

export { ApiErrorReporter } from './Api';
export { VanillaErrorReporter } from './Vanilla';
export { JsonApiErrorReporter } from './JsonApi';

@@ -15,1 +15,3 @@ "use strict";

exports.VanillaErrorReporter = Vanilla_1.VanillaErrorReporter;
var JsonApi_1 = require("./JsonApi");
exports.JsonApiErrorReporter = JsonApi_1.JsonApiErrorReporter;

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

toError() {
return new ValidationException_1.ValidationException(true, this.errors);
return new ValidationException_1.ValidationException(true, this.toJSON());
}

@@ -68,0 +68,0 @@ /**

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

session.flashExcept(['_csrf_token']);
ctx['session'].flash(error.messages);
ctx['session'].flash('errors', error.messages);
ctx.response.redirect('back', true);

@@ -28,0 +28,0 @@ }

{
"name": "@adonisjs/validator",
"version": "6.2.0",
"version": "6.2.1",
"description": "Validator for adonis framework",

@@ -5,0 +5,0 @@ "main": "build/providers/ValidatorProvider.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