@tsed/ajv 6.102.0 → 6.102.1
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/package.json +9 -9
- package/readme.md +31 -38
- package/tsconfig.compile.esm.json +1 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/ajv",
|
|
3
|
-
"version": "6.102.
|
|
3
|
+
"version": "6.102.1",
|
|
4
4
|
"description": "AJV package for Ts.ED framework",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"tslib": "2.2.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@tsed/core": "6.102.
|
|
25
|
-
"@tsed/di": "6.102.
|
|
26
|
-
"@tsed/exceptions": "6.102.
|
|
27
|
-
"@tsed/schema": "6.102.
|
|
24
|
+
"@tsed/core": "6.102.1",
|
|
25
|
+
"@tsed/di": "6.102.1",
|
|
26
|
+
"@tsed/exceptions": "6.102.1",
|
|
27
|
+
"@tsed/schema": "6.102.1",
|
|
28
28
|
"ajv": "8.9.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@tsed/core": "^6.102.
|
|
32
|
-
"@tsed/di": "^6.102.
|
|
33
|
-
"@tsed/exceptions": "^6.102.
|
|
34
|
-
"@tsed/schema": "^6.102.
|
|
31
|
+
"@tsed/core": "^6.102.1",
|
|
32
|
+
"@tsed/di": "^6.102.1",
|
|
33
|
+
"@tsed/exceptions": "^6.102.1",
|
|
34
|
+
"@tsed/schema": "^6.102.1",
|
|
35
35
|
"ajv": "7||8"
|
|
36
36
|
},
|
|
37
37
|
"repository": "https://github.com/tsedio/tsed",
|
package/readme.md
CHANGED
|
@@ -33,11 +33,9 @@ import {Configuration} from "@tsed/common";
|
|
|
33
33
|
import "@tsed/ajv"; // import ajv ts.ed module
|
|
34
34
|
|
|
35
35
|
@Configuration({
|
|
36
|
-
|
|
36
|
+
rootDir: __dirname
|
|
37
37
|
})
|
|
38
|
-
export class Server {
|
|
39
|
-
|
|
40
|
-
}
|
|
38
|
+
export class Server {}
|
|
41
39
|
```
|
|
42
40
|
|
|
43
41
|
### Decorators
|
|
@@ -53,39 +51,37 @@ be validated by Ajv.
|
|
|
53
51
|
import {Required, MaxLength, MinLength, Minimum, Maximum, Format, Enum, Pattern, Email} from "@tsed/common";
|
|
54
52
|
|
|
55
53
|
export class CalendarModel {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
customInput: "value1" | "value2";
|
|
54
|
+
@MaxLength(20)
|
|
55
|
+
@MinLength(3)
|
|
56
|
+
@Required()
|
|
57
|
+
title: string;
|
|
58
|
+
|
|
59
|
+
@Minimum(0)
|
|
60
|
+
@Maximum(10)
|
|
61
|
+
rating: number;
|
|
62
|
+
|
|
63
|
+
@Email()
|
|
64
|
+
email: string;
|
|
65
|
+
|
|
66
|
+
@Format("date") // or date-time, etc...
|
|
67
|
+
createDate: Date;
|
|
68
|
+
|
|
69
|
+
@Pattern(/hello/)
|
|
70
|
+
customInput: string;
|
|
71
|
+
|
|
72
|
+
@Enum("value1", "value2")
|
|
73
|
+
customInput: "value1" | "value2";
|
|
77
74
|
}
|
|
78
75
|
```
|
|
79
76
|
|
|
80
77
|
> All validation decorators are compatible with the Swagger documentation.
|
|
81
78
|
|
|
82
|
-
|
|
83
79
|
## Error configuration
|
|
84
80
|
|
|
85
81
|
The AJV module allows a few settings to be added through the ServerSettings (all are optional):
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
- _options_, are AJV specific options passed directly to the AJV constructor,
|
|
84
|
+
- _errorFormatter_, can be used to alter the output produced by the @tsed/ajv package.
|
|
89
85
|
|
|
90
86
|
The error message could be changed like:
|
|
91
87
|
|
|
@@ -94,24 +90,21 @@ import {Configuration} from "@tsed/common";
|
|
|
94
90
|
import "@tsed/ajv"; // import ajv ts.ed module
|
|
95
91
|
|
|
96
92
|
@Configuration({
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
rootDir: __dirname,
|
|
94
|
+
ajv: {
|
|
95
|
+
errorFormatter: (error) => `At ${error.modelName}${error.dataPath}, value '${error.data}' ${error.message}`,
|
|
96
|
+
options: {verbose: true}
|
|
97
|
+
}
|
|
102
98
|
})
|
|
103
|
-
export class Server {
|
|
104
|
-
|
|
105
|
-
}
|
|
99
|
+
export class Server {}
|
|
106
100
|
```
|
|
107
101
|
|
|
108
|
-
|
|
109
102
|
## Contributors
|
|
103
|
+
|
|
110
104
|
Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
|
|
111
105
|
|
|
112
106
|
<a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
|
|
113
107
|
|
|
114
|
-
|
|
115
108
|
## Backers
|
|
116
109
|
|
|
117
110
|
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
|
|
@@ -8,16 +8,5 @@
|
|
|
8
8
|
"declaration": true,
|
|
9
9
|
"declarationDir": "./lib/types"
|
|
10
10
|
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"node_modules",
|
|
13
|
-
"test",
|
|
14
|
-
"lib",
|
|
15
|
-
"benchmark",
|
|
16
|
-
"coverage",
|
|
17
|
-
"spec",
|
|
18
|
-
"**/*.benchmark.ts",
|
|
19
|
-
"**/*.spec.ts",
|
|
20
|
-
"keys",
|
|
21
|
-
"jest.config.js"
|
|
22
|
-
]
|
|
11
|
+
"exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
|
|
23
12
|
}
|