@middy/validator 7.3.2 → 7.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -4
- package/package.json +5 -5
- package/transpile.d.ts +1 -1
package/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { createError, validateOptions } from "@middy/util";
|
|
4
4
|
|
|
5
|
+
const name = "validator";
|
|
6
|
+
const pkg = `@middy/${name}`;
|
|
7
|
+
|
|
5
8
|
const defaults = {
|
|
6
9
|
eventSchema: undefined,
|
|
7
10
|
contextSchema: undefined,
|
|
@@ -26,7 +29,7 @@ const optionSchema = {
|
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
export const validatorValidateOptions = (options) =>
|
|
29
|
-
validateOptions(
|
|
32
|
+
validateOptions(pkg, optionSchema, options);
|
|
30
33
|
|
|
31
34
|
const validatorMiddleware = (opts = {}) => {
|
|
32
35
|
const {
|
|
@@ -50,7 +53,7 @@ const validatorMiddleware = (opts = {}) => {
|
|
|
50
53
|
// Bad Request
|
|
51
54
|
throw createError(400, "Event object failed validation", {
|
|
52
55
|
cause: {
|
|
53
|
-
package:
|
|
56
|
+
package: pkg,
|
|
54
57
|
data: eventSchema.errors,
|
|
55
58
|
},
|
|
56
59
|
});
|
|
@@ -64,7 +67,7 @@ const validatorMiddleware = (opts = {}) => {
|
|
|
64
67
|
// Internal Server Error
|
|
65
68
|
throw createError(500, "Context object failed validation", {
|
|
66
69
|
cause: {
|
|
67
|
-
package:
|
|
70
|
+
package: pkg,
|
|
68
71
|
data: contextSchema.errors,
|
|
69
72
|
},
|
|
70
73
|
});
|
|
@@ -79,7 +82,7 @@ const validatorMiddleware = (opts = {}) => {
|
|
|
79
82
|
// Internal Server Error
|
|
80
83
|
throw createError(500, "Response object failed validation", {
|
|
81
84
|
cause: {
|
|
82
|
-
package:
|
|
85
|
+
package: pkg,
|
|
83
86
|
data: responseSchema.errors,
|
|
84
87
|
},
|
|
85
88
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/validator",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.4",
|
|
4
4
|
"description": "Validator middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"url": "https://github.com/sponsors/willfarrell"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@middy/util": "7.3.
|
|
73
|
-
"ajv": "8.
|
|
72
|
+
"@middy/util": "7.3.4",
|
|
73
|
+
"ajv": "8.20.0",
|
|
74
74
|
"ajv-errors": "3.0.0",
|
|
75
75
|
"ajv-formats": "3.0.1",
|
|
76
76
|
"@silverbucket/ajv-formats-draft2019": "1.6.5",
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
"ajv-keywords": "5.1.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@middy/core": "7.3.
|
|
81
|
+
"@middy/core": "7.3.4",
|
|
82
82
|
"@types/aws-lambda": "^8.0.0",
|
|
83
83
|
"@types/http-errors": "^2.0.0",
|
|
84
84
|
"@types/node": "^22.0.0",
|
|
85
85
|
"ajv-bsontype": "^1.0.7",
|
|
86
|
-
"ajv-cmd": "^0.
|
|
86
|
+
"ajv-cmd": "^0.13.0"
|
|
87
87
|
}
|
|
88
88
|
}
|
package/transpile.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import type { Ajv,
|
|
3
|
+
import type { Ajv, Options as AjvOptions, ErrorObject } from "ajv";
|
|
4
4
|
|
|
5
5
|
export type LocalizeFunction = (
|
|
6
6
|
errors: ErrorObject[] | null | undefined,
|