@tsed/schema 7.10.0 → 7.11.0
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/lib/browser/schema.umd.min.js +1 -1
- package/lib/browser/schema.umd.min.js.map +1 -1
- package/lib/cjs/decorators/collections/maxItems.js +4 -3
- package/lib/cjs/decorators/collections/maxItems.js.map +1 -1
- package/lib/cjs/decorators/collections/maxProperties.js +4 -3
- package/lib/cjs/decorators/collections/maxProperties.js.map +1 -1
- package/lib/cjs/decorators/collections/minItems.js +4 -3
- package/lib/cjs/decorators/collections/minItems.js.map +1 -1
- package/lib/cjs/decorators/collections/minProperties.js +4 -3
- package/lib/cjs/decorators/collections/minProperties.js.map +1 -1
- package/lib/cjs/decorators/collections/uniqueItems.js +4 -3
- package/lib/cjs/decorators/collections/uniqueItems.js.map +1 -1
- package/lib/cjs/decorators/common/defaultMsg.js +41 -0
- package/lib/cjs/decorators/common/defaultMsg.js.map +1 -0
- package/lib/cjs/decorators/common/enum.js +100 -2
- package/lib/cjs/decorators/common/enum.js.map +1 -1
- package/lib/cjs/decorators/common/errorMsg.js +20 -0
- package/lib/cjs/decorators/common/errorMsg.js.map +1 -0
- package/lib/cjs/decorators/common/exclusiveMaximum.js +4 -3
- package/lib/cjs/decorators/common/exclusiveMaximum.js.map +1 -1
- package/lib/cjs/decorators/common/exclusiveMinimum.js +4 -3
- package/lib/cjs/decorators/common/exclusiveMinimum.js.map +1 -1
- package/lib/cjs/decorators/common/format.js +28 -27
- package/lib/cjs/decorators/common/format.js.map +1 -1
- package/lib/cjs/decorators/common/maxLength.js +4 -3
- package/lib/cjs/decorators/common/maxLength.js.map +1 -1
- package/lib/cjs/decorators/common/maximum.js +5 -7
- package/lib/cjs/decorators/common/maximum.js.map +1 -1
- package/lib/cjs/decorators/common/minLength.js +4 -3
- package/lib/cjs/decorators/common/minLength.js.map +1 -1
- package/lib/cjs/decorators/common/minimum.js +5 -7
- package/lib/cjs/decorators/common/minimum.js.map +1 -1
- package/lib/cjs/decorators/common/multipleOf.js +4 -3
- package/lib/cjs/decorators/common/multipleOf.js.map +1 -1
- package/lib/cjs/decorators/common/pattern.js +4 -3
- package/lib/cjs/decorators/common/pattern.js.map +1 -1
- package/lib/cjs/decorators/common/required.js +3 -3
- package/lib/cjs/decorators/common/required.js.map +1 -1
- package/lib/cjs/decorators/common/typeError.js +18 -0
- package/lib/cjs/decorators/common/typeError.js.map +1 -0
- package/lib/cjs/domain/JsonSchema.js +3 -0
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/index.js +4 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/withErrorMsg.js +18 -0
- package/lib/cjs/utils/withErrorMsg.js.map +1 -0
- package/lib/esm/decorators/collections/maxItems.js +4 -2
- package/lib/esm/decorators/collections/maxItems.js.map +1 -1
- package/lib/esm/decorators/collections/maxProperties.js +4 -2
- package/lib/esm/decorators/collections/maxProperties.js.map +1 -1
- package/lib/esm/decorators/collections/minItems.js +4 -2
- package/lib/esm/decorators/collections/minItems.js.map +1 -1
- package/lib/esm/decorators/collections/minProperties.js +4 -2
- package/lib/esm/decorators/collections/minProperties.js.map +1 -1
- package/lib/esm/decorators/collections/uniqueItems.js +4 -2
- package/lib/esm/decorators/collections/uniqueItems.js.map +1 -1
- package/lib/esm/decorators/common/defaultMsg.js +37 -0
- package/lib/esm/decorators/common/defaultMsg.js.map +1 -0
- package/lib/esm/decorators/common/enum.js +100 -1
- package/lib/esm/decorators/common/enum.js.map +1 -1
- package/lib/esm/decorators/common/errorMsg.js +16 -0
- package/lib/esm/decorators/common/errorMsg.js.map +1 -0
- package/lib/esm/decorators/common/exclusiveMaximum.js +4 -2
- package/lib/esm/decorators/common/exclusiveMaximum.js.map +1 -1
- package/lib/esm/decorators/common/exclusiveMinimum.js +4 -2
- package/lib/esm/decorators/common/exclusiveMinimum.js.map +1 -1
- package/lib/esm/decorators/common/format.js +22 -14
- package/lib/esm/decorators/common/format.js.map +1 -1
- package/lib/esm/decorators/common/maxLength.js +4 -2
- package/lib/esm/decorators/common/maxLength.js.map +1 -1
- package/lib/esm/decorators/common/maximum.js +5 -5
- package/lib/esm/decorators/common/maximum.js.map +1 -1
- package/lib/esm/decorators/common/minLength.js +4 -2
- package/lib/esm/decorators/common/minLength.js.map +1 -1
- package/lib/esm/decorators/common/minimum.js +5 -5
- package/lib/esm/decorators/common/minimum.js.map +1 -1
- package/lib/esm/decorators/common/multipleOf.js +4 -2
- package/lib/esm/decorators/common/multipleOf.js.map +1 -1
- package/lib/esm/decorators/common/pattern.js +4 -2
- package/lib/esm/decorators/common/pattern.js.map +1 -1
- package/lib/esm/decorators/common/required.js +3 -2
- package/lib/esm/decorators/common/required.js.map +1 -1
- package/lib/esm/decorators/common/typeError.js +14 -0
- package/lib/esm/decorators/common/typeError.js.map +1 -0
- package/lib/esm/domain/JsonSchema.js +3 -0
- package/lib/esm/domain/JsonSchema.js.map +1 -1
- package/lib/esm/index.js +4 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/withErrorMsg.js +14 -0
- package/lib/esm/utils/withErrorMsg.js.map +1 -0
- package/lib/types/decorators/collections/maxItems.d.ts +2 -1
- package/lib/types/decorators/collections/maxProperties.d.ts +2 -1
- package/lib/types/decorators/collections/minItems.d.ts +2 -1
- package/lib/types/decorators/collections/minProperties.d.ts +2 -1
- package/lib/types/decorators/collections/uniqueItems.d.ts +2 -1
- package/lib/types/decorators/common/defaultMsg.d.ts +32 -0
- package/lib/types/decorators/common/enum.d.ts +4 -1
- package/lib/types/decorators/common/errorMsg.d.ts +8 -0
- package/lib/types/decorators/common/exclusiveMaximum.d.ts +2 -1
- package/lib/types/decorators/common/exclusiveMinimum.d.ts +2 -1
- package/lib/types/decorators/common/format.d.ts +14 -7
- package/lib/types/decorators/common/maxLength.d.ts +2 -1
- package/lib/types/decorators/common/maximum.d.ts +3 -2
- package/lib/types/decorators/common/minLength.d.ts +2 -1
- package/lib/types/decorators/common/minimum.d.ts +3 -2
- package/lib/types/decorators/common/multipleOf.d.ts +2 -1
- package/lib/types/decorators/common/pattern.d.ts +2 -1
- package/lib/types/decorators/common/required.d.ts +1 -1
- package/lib/types/decorators/common/typeError.d.ts +8 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/utils/withErrorMsg.d.ts +6 -0
- package/package.json +6 -6
|
@@ -72,8 +72,9 @@ import { JsonFormatTypes } from "../../domain/JsonFormatTypes";
|
|
|
72
72
|
* @swagger
|
|
73
73
|
* @schema
|
|
74
74
|
* @input
|
|
75
|
+
* @ajv-errors
|
|
75
76
|
*/
|
|
76
|
-
export declare
|
|
77
|
+
export declare const Format: import("../../utils/withErrorMsg").ErrorChainedDecorator<(format: JsonFormatTypes | ValueOf<JsonFormatTypes>) => (...args: any[]) => any>;
|
|
77
78
|
/**
|
|
78
79
|
* Apply an email validation on property.
|
|
79
80
|
*
|
|
@@ -139,8 +140,9 @@ export declare function Format(format: JsonFormatTypes | ValueOf<JsonFormatTypes
|
|
|
139
140
|
* @schema
|
|
140
141
|
* @swagger
|
|
141
142
|
* @input
|
|
143
|
+
* @ajv-errors
|
|
142
144
|
*/
|
|
143
|
-
export declare
|
|
145
|
+
export declare const Email: import("../../utils/withErrorMsg").ErrorChainedDecorator<() => import("../../utils/withErrorMsg").ErrorChainedMethods<(format: JsonFormatTypes | ValueOf<JsonFormatTypes>) => (...args: any[]) => any>>;
|
|
144
146
|
/**
|
|
145
147
|
* Apply a date-time validation on property.
|
|
146
148
|
*
|
|
@@ -203,8 +205,9 @@ export declare function Email(): (...args: any[]) => any;
|
|
|
203
205
|
* @parameter
|
|
204
206
|
* @schema
|
|
205
207
|
* @auto-map The data will be stored on the right place according to the type and collectionType (primitive or collection).
|
|
208
|
+
* @ajv-errors
|
|
206
209
|
*/
|
|
207
|
-
export declare
|
|
210
|
+
export declare const DateTime: import("../../utils/withErrorMsg").ErrorChainedDecorator<() => import("../../utils/withErrorMsg").ErrorChainedMethods<(format: JsonFormatTypes | ValueOf<JsonFormatTypes>) => (...args: any[]) => any>>;
|
|
208
211
|
/**
|
|
209
212
|
* Apply a time validation on property.
|
|
210
213
|
*
|
|
@@ -266,8 +269,9 @@ export declare function DateTime(): (...args: any[]) => any;
|
|
|
266
269
|
* @property
|
|
267
270
|
* @parameter
|
|
268
271
|
* @schema
|
|
272
|
+
* @ajv-errors
|
|
269
273
|
*/
|
|
270
|
-
export declare
|
|
274
|
+
export declare const DateFormat: import("../../utils/withErrorMsg").ErrorChainedDecorator<() => import("../../utils/withErrorMsg").ErrorChainedMethods<(format: JsonFormatTypes | ValueOf<JsonFormatTypes>) => (...args: any[]) => any>>;
|
|
271
275
|
/**
|
|
272
276
|
* Apply a time validation on property.
|
|
273
277
|
*
|
|
@@ -329,8 +333,9 @@ export declare function DateFormat(): (...args: any[]) => any;
|
|
|
329
333
|
* @property
|
|
330
334
|
* @parameter
|
|
331
335
|
* @schema
|
|
336
|
+
* @ajv-errors
|
|
332
337
|
*/
|
|
333
|
-
export declare
|
|
338
|
+
export declare const TimeFormat: import("../../utils/withErrorMsg").ErrorChainedDecorator<() => import("../../utils/withErrorMsg").ErrorChainedMethods<(format: JsonFormatTypes | ValueOf<JsonFormatTypes>) => (...args: any[]) => any>>;
|
|
334
339
|
/**
|
|
335
340
|
* Apply a uri validation on property.
|
|
336
341
|
*
|
|
@@ -392,8 +397,9 @@ export declare function TimeFormat(): (...args: any[]) => any;
|
|
|
392
397
|
* @property
|
|
393
398
|
* @parameter
|
|
394
399
|
* @schema
|
|
400
|
+
* @ajv-errors
|
|
395
401
|
*/
|
|
396
|
-
export declare
|
|
402
|
+
export declare const Uri: import("../../utils/withErrorMsg").ErrorChainedDecorator<() => import("../../utils/withErrorMsg").ErrorChainedMethods<(format: JsonFormatTypes | ValueOf<JsonFormatTypes>) => (...args: any[]) => any>>;
|
|
397
403
|
/**
|
|
398
404
|
* Apply a url validation on property.
|
|
399
405
|
*
|
|
@@ -455,5 +461,6 @@ export declare function Uri(): (...args: any[]) => any;
|
|
|
455
461
|
* @property
|
|
456
462
|
* @parameter
|
|
457
463
|
* @schema
|
|
464
|
+
* @ajv-errors
|
|
458
465
|
*/
|
|
459
|
-
export declare
|
|
466
|
+
export declare const Url: import("../../utils/withErrorMsg").ErrorChainedDecorator<() => import("../../utils/withErrorMsg").ErrorChainedMethods<(format: JsonFormatTypes | ValueOf<JsonFormatTypes>) => (...args: any[]) => any>>;
|
|
@@ -72,5 +72,6 @@
|
|
|
72
72
|
* @swagger
|
|
73
73
|
* @schema
|
|
74
74
|
* @input
|
|
75
|
+
* @ajv-errors
|
|
75
76
|
*/
|
|
76
|
-
export declare
|
|
77
|
+
export declare const MaxLength: import("../../utils/withErrorMsg").ErrorChainedDecorator<(maxLength: number) => (...args: any[]) => any>;
|
|
@@ -65,8 +65,9 @@
|
|
|
65
65
|
* @swagger
|
|
66
66
|
* @schema
|
|
67
67
|
* @input
|
|
68
|
+
* @ajv-errors
|
|
68
69
|
*/
|
|
69
|
-
export declare
|
|
70
|
+
export declare const Maximum: import("../../utils/withErrorMsg").ErrorChainedDecorator<(maximum: number, exclusive?: boolean) => (...args: any[]) => any>;
|
|
70
71
|
/**
|
|
71
72
|
* The value of `maximum` MUST be a number, representing an inclusive upper limit for a numeric instance.
|
|
72
73
|
*
|
|
@@ -135,4 +136,4 @@ export declare function Maximum(maximum: number, exclusive?: boolean): (...args:
|
|
|
135
136
|
* @schema
|
|
136
137
|
* @input
|
|
137
138
|
*/
|
|
138
|
-
export declare
|
|
139
|
+
export declare const Max: import("../../utils/withErrorMsg").ErrorChainedDecorator<(maximum: number, exclusive?: boolean) => (...args: any[]) => any>;
|
|
@@ -73,5 +73,6 @@
|
|
|
73
73
|
* @swagger
|
|
74
74
|
* @schema
|
|
75
75
|
* @input
|
|
76
|
+
* @ajv-errors
|
|
76
77
|
*/
|
|
77
|
-
export declare
|
|
78
|
+
export declare const MinLength: import("../../utils/withErrorMsg").ErrorChainedDecorator<(minLength: number) => (...args: any[]) => any>;
|
|
@@ -66,8 +66,9 @@
|
|
|
66
66
|
* @swagger
|
|
67
67
|
* @schema
|
|
68
68
|
* @input
|
|
69
|
+
* @ajv-errors
|
|
69
70
|
*/
|
|
70
|
-
export declare
|
|
71
|
+
export declare const Minimum: import("../../utils/withErrorMsg").ErrorChainedDecorator<(minimum: number, exclusive?: boolean) => (...args: any[]) => any>;
|
|
71
72
|
/**
|
|
72
73
|
* The value of `minimum` MUST be a number, representing an inclusive upper limit for a numeric instance.
|
|
73
74
|
*
|
|
@@ -133,4 +134,4 @@ export declare function Minimum(minimum: number, exclusive?: boolean): (...args:
|
|
|
133
134
|
* @schema
|
|
134
135
|
* @input
|
|
135
136
|
*/
|
|
136
|
-
export declare
|
|
137
|
+
export declare const Min: import("../../utils/withErrorMsg").ErrorChainedDecorator<(minimum: number, exclusive?: boolean) => (...args: any[]) => any>;
|
|
@@ -64,5 +64,6 @@
|
|
|
64
64
|
* @swagger
|
|
65
65
|
* @schema
|
|
66
66
|
* @input
|
|
67
|
+
* @ajv-errors
|
|
67
68
|
*/
|
|
68
|
-
export declare
|
|
69
|
+
export declare const MultipleOf: import("../../utils/withErrorMsg").ErrorChainedDecorator<(multipleOf: number) => (...args: any[]) => any>;
|
|
@@ -89,5 +89,6 @@
|
|
|
89
89
|
* @swagger
|
|
90
90
|
* @schema
|
|
91
91
|
* @input
|
|
92
|
+
* @ajv-errors
|
|
92
93
|
*/
|
|
93
|
-
export declare
|
|
94
|
+
export declare const Pattern: import("../../utils/withErrorMsg").ErrorChainedDecorator<(pattern: string | RegExp) => (...args: any[]) => any>;
|
|
@@ -41,4 +41,4 @@
|
|
|
41
41
|
* @schema
|
|
42
42
|
* @input
|
|
43
43
|
*/
|
|
44
|
-
export declare
|
|
44
|
+
export declare const Required: import("../../utils/withErrorMsg").ErrorChainedDecorator<(required?: boolean, ...allowedRequiredValues: any[]) => any>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -31,9 +31,11 @@ export * from "./decorators/common/anyOf";
|
|
|
31
31
|
export * from "./decorators/common/const";
|
|
32
32
|
export * from "./decorators/common/customKey";
|
|
33
33
|
export * from "./decorators/common/default";
|
|
34
|
+
export * from "./decorators/common/defaultMsg";
|
|
34
35
|
export * from "./decorators/common/description";
|
|
35
36
|
export * from "./decorators/common/discriminatorKey";
|
|
36
37
|
export * from "./decorators/common/enum";
|
|
38
|
+
export * from "./decorators/common/errorMsg";
|
|
37
39
|
export * from "./decorators/common/example";
|
|
38
40
|
export * from "./decorators/common/examples";
|
|
39
41
|
export * from "./decorators/common/exclusiveMaximum";
|
|
@@ -62,6 +64,7 @@ export * from "./decorators/common/required";
|
|
|
62
64
|
export * from "./decorators/common/requiredGroups";
|
|
63
65
|
export * from "./decorators/common/schema";
|
|
64
66
|
export * from "./decorators/common/title";
|
|
67
|
+
export * from "./decorators/common/typeError";
|
|
65
68
|
export * from "./decorators/common/writeOnly";
|
|
66
69
|
export * from "./decorators/config/jsonEntityComponent";
|
|
67
70
|
export * from "./decorators/generics/genericOf";
|
|
@@ -151,3 +154,4 @@ export * from "./utils/serializeEnumValues";
|
|
|
151
154
|
export * from "./utils/toJsonMapCollection";
|
|
152
155
|
export * from "./utils/toJsonRegex";
|
|
153
156
|
export * from "./utils/transformToOS2";
|
|
157
|
+
export * from "./utils/withErrorMsg";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ErrorChainedMethods<T> {
|
|
2
|
+
<T>(target: Object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<T> | number): any;
|
|
3
|
+
Error(msg: string): this;
|
|
4
|
+
}
|
|
5
|
+
export declare type ErrorChainedDecorator<Decorator extends (...args: any[]) => any> = (...args: Parameters<Decorator>) => ErrorChainedMethods<Decorator>;
|
|
6
|
+
export declare function withErrorMsg<Decorator extends (...args: any[]) => any>(errorKey: string, originalDecorator: Decorator): ErrorChainedDecorator<Decorator>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/schema",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.11.0",
|
|
4
4
|
"description": "JsonSchema module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"tsed"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tsed/openspec": "7.
|
|
38
|
+
"@tsed/openspec": "7.11.0",
|
|
39
39
|
"change-case": "^4.1.2",
|
|
40
40
|
"fs-extra": "^10.0.1",
|
|
41
41
|
"json-schema": "0.4.0",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
48
|
-
"@tsed/core": "7.
|
|
49
|
-
"@tsed/openspec": "7.
|
|
48
|
+
"@tsed/core": "7.11.0",
|
|
49
|
+
"@tsed/openspec": "7.11.0",
|
|
50
50
|
"@types/fs-extra": "9.0.13",
|
|
51
51
|
"@types/json-schema": "7.0.11",
|
|
52
52
|
"@types/picomatch": "2.3.0",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"picomatch-browser": "https://github.com/silverwind/picomatch#ee6ebcc5570a8846d81610c11ebb92a9e199b145"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@tsed/core": "^7.
|
|
58
|
-
"@tsed/openspec": "^7.
|
|
57
|
+
"@tsed/core": "^7.11.0",
|
|
58
|
+
"@tsed/openspec": "^7.11.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependenciesMeta": {
|
|
61
61
|
"@tsed/openspec": {
|