@tsed/schema 7.10.1 → 7.12.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.
Files changed (108) hide show
  1. package/lib/browser/schema.umd.min.js +1 -1
  2. package/lib/browser/schema.umd.min.js.map +1 -1
  3. package/lib/cjs/decorators/collections/maxItems.js +4 -3
  4. package/lib/cjs/decorators/collections/maxItems.js.map +1 -1
  5. package/lib/cjs/decorators/collections/maxProperties.js +4 -3
  6. package/lib/cjs/decorators/collections/maxProperties.js.map +1 -1
  7. package/lib/cjs/decorators/collections/minItems.js +4 -3
  8. package/lib/cjs/decorators/collections/minItems.js.map +1 -1
  9. package/lib/cjs/decorators/collections/minProperties.js +4 -3
  10. package/lib/cjs/decorators/collections/minProperties.js.map +1 -1
  11. package/lib/cjs/decorators/collections/uniqueItems.js +4 -3
  12. package/lib/cjs/decorators/collections/uniqueItems.js.map +1 -1
  13. package/lib/cjs/decorators/common/defaultMsg.js +41 -0
  14. package/lib/cjs/decorators/common/defaultMsg.js.map +1 -0
  15. package/lib/cjs/decorators/common/enum.js +100 -2
  16. package/lib/cjs/decorators/common/enum.js.map +1 -1
  17. package/lib/cjs/decorators/common/errorMsg.js +20 -0
  18. package/lib/cjs/decorators/common/errorMsg.js.map +1 -0
  19. package/lib/cjs/decorators/common/exclusiveMaximum.js +4 -3
  20. package/lib/cjs/decorators/common/exclusiveMaximum.js.map +1 -1
  21. package/lib/cjs/decorators/common/exclusiveMinimum.js +4 -3
  22. package/lib/cjs/decorators/common/exclusiveMinimum.js.map +1 -1
  23. package/lib/cjs/decorators/common/format.js +28 -27
  24. package/lib/cjs/decorators/common/format.js.map +1 -1
  25. package/lib/cjs/decorators/common/maxLength.js +4 -3
  26. package/lib/cjs/decorators/common/maxLength.js.map +1 -1
  27. package/lib/cjs/decorators/common/maximum.js +5 -7
  28. package/lib/cjs/decorators/common/maximum.js.map +1 -1
  29. package/lib/cjs/decorators/common/minLength.js +4 -3
  30. package/lib/cjs/decorators/common/minLength.js.map +1 -1
  31. package/lib/cjs/decorators/common/minimum.js +5 -7
  32. package/lib/cjs/decorators/common/minimum.js.map +1 -1
  33. package/lib/cjs/decorators/common/multipleOf.js +4 -3
  34. package/lib/cjs/decorators/common/multipleOf.js.map +1 -1
  35. package/lib/cjs/decorators/common/pattern.js +4 -3
  36. package/lib/cjs/decorators/common/pattern.js.map +1 -1
  37. package/lib/cjs/decorators/common/required.js +3 -3
  38. package/lib/cjs/decorators/common/required.js.map +1 -1
  39. package/lib/cjs/decorators/common/typeError.js +18 -0
  40. package/lib/cjs/decorators/common/typeError.js.map +1 -0
  41. package/lib/cjs/index.js +4 -0
  42. package/lib/cjs/index.js.map +1 -1
  43. package/lib/cjs/utils/withErrorMsg.js +18 -0
  44. package/lib/cjs/utils/withErrorMsg.js.map +1 -0
  45. package/lib/esm/decorators/collections/maxItems.js +4 -2
  46. package/lib/esm/decorators/collections/maxItems.js.map +1 -1
  47. package/lib/esm/decorators/collections/maxProperties.js +4 -2
  48. package/lib/esm/decorators/collections/maxProperties.js.map +1 -1
  49. package/lib/esm/decorators/collections/minItems.js +4 -2
  50. package/lib/esm/decorators/collections/minItems.js.map +1 -1
  51. package/lib/esm/decorators/collections/minProperties.js +4 -2
  52. package/lib/esm/decorators/collections/minProperties.js.map +1 -1
  53. package/lib/esm/decorators/collections/uniqueItems.js +4 -2
  54. package/lib/esm/decorators/collections/uniqueItems.js.map +1 -1
  55. package/lib/esm/decorators/common/defaultMsg.js +37 -0
  56. package/lib/esm/decorators/common/defaultMsg.js.map +1 -0
  57. package/lib/esm/decorators/common/enum.js +100 -1
  58. package/lib/esm/decorators/common/enum.js.map +1 -1
  59. package/lib/esm/decorators/common/errorMsg.js +16 -0
  60. package/lib/esm/decorators/common/errorMsg.js.map +1 -0
  61. package/lib/esm/decorators/common/exclusiveMaximum.js +4 -2
  62. package/lib/esm/decorators/common/exclusiveMaximum.js.map +1 -1
  63. package/lib/esm/decorators/common/exclusiveMinimum.js +4 -2
  64. package/lib/esm/decorators/common/exclusiveMinimum.js.map +1 -1
  65. package/lib/esm/decorators/common/format.js +22 -14
  66. package/lib/esm/decorators/common/format.js.map +1 -1
  67. package/lib/esm/decorators/common/maxLength.js +4 -2
  68. package/lib/esm/decorators/common/maxLength.js.map +1 -1
  69. package/lib/esm/decorators/common/maximum.js +5 -5
  70. package/lib/esm/decorators/common/maximum.js.map +1 -1
  71. package/lib/esm/decorators/common/minLength.js +4 -2
  72. package/lib/esm/decorators/common/minLength.js.map +1 -1
  73. package/lib/esm/decorators/common/minimum.js +5 -5
  74. package/lib/esm/decorators/common/minimum.js.map +1 -1
  75. package/lib/esm/decorators/common/multipleOf.js +4 -2
  76. package/lib/esm/decorators/common/multipleOf.js.map +1 -1
  77. package/lib/esm/decorators/common/pattern.js +4 -2
  78. package/lib/esm/decorators/common/pattern.js.map +1 -1
  79. package/lib/esm/decorators/common/required.js +3 -2
  80. package/lib/esm/decorators/common/required.js.map +1 -1
  81. package/lib/esm/decorators/common/typeError.js +14 -0
  82. package/lib/esm/decorators/common/typeError.js.map +1 -0
  83. package/lib/esm/index.js +4 -0
  84. package/lib/esm/index.js.map +1 -1
  85. package/lib/esm/utils/withErrorMsg.js +14 -0
  86. package/lib/esm/utils/withErrorMsg.js.map +1 -0
  87. package/lib/types/decorators/collections/maxItems.d.ts +2 -1
  88. package/lib/types/decorators/collections/maxProperties.d.ts +2 -1
  89. package/lib/types/decorators/collections/minItems.d.ts +2 -1
  90. package/lib/types/decorators/collections/minProperties.d.ts +2 -1
  91. package/lib/types/decorators/collections/uniqueItems.d.ts +2 -1
  92. package/lib/types/decorators/common/defaultMsg.d.ts +32 -0
  93. package/lib/types/decorators/common/enum.d.ts +4 -1
  94. package/lib/types/decorators/common/errorMsg.d.ts +8 -0
  95. package/lib/types/decorators/common/exclusiveMaximum.d.ts +2 -1
  96. package/lib/types/decorators/common/exclusiveMinimum.d.ts +2 -1
  97. package/lib/types/decorators/common/format.d.ts +14 -7
  98. package/lib/types/decorators/common/maxLength.d.ts +2 -1
  99. package/lib/types/decorators/common/maximum.d.ts +3 -2
  100. package/lib/types/decorators/common/minLength.d.ts +2 -1
  101. package/lib/types/decorators/common/minimum.d.ts +3 -2
  102. package/lib/types/decorators/common/multipleOf.d.ts +2 -1
  103. package/lib/types/decorators/common/pattern.d.ts +2 -1
  104. package/lib/types/decorators/common/required.d.ts +1 -1
  105. package/lib/types/decorators/common/typeError.d.ts +8 -0
  106. package/lib/types/index.d.ts +4 -0
  107. package/lib/types/utils/withErrorMsg.d.ts +6 -0
  108. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"minLength.js","sourceRoot":"","sources":["../../../../src/decorators/common/minLength.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,MAAM,UAAU,SAAS,CAAC,SAAiB;IACzC,IAAI,SAAS,GAAG,CAAC,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC3E;IAED,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n *\n * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.\n *\n * The length of a string instance is defined as the number of its characters as defined by [RFC 7159](http://json-schema.org/latest/json-schema-validation.html#RFC7159).\n *\n * ::: warning\n * The value of minLength MUST be a non-negative integer.\n * :::\n *\n * ::: tip\n * Omitting this keyword has the same behavior as a value of 0.\n * :::\n *\n * ::: warning\n * For v6 user, use @@MinLength@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @MinLength(10)\n * property: number;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"string\",\n * \"maxLength\": 10\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @MinLength(10)\n * @CollectionOf(String)\n * property: string[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"string\",\n * \"minLength\": 10\n * }\n * }\n * }\n * }\n * ```\n *\n * @param {number} minLength\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport function MinLength(minLength: number) {\n if (minLength < 0) {\n throw new Error(\"The value of minLength MUST be a non-negative integer.\");\n }\n\n return JsonEntityFn((store) => {\n store.itemSchema.minLength(minLength);\n });\n}\n"]}
1
+ {"version":3,"file":"minLength.js","sourceRoot":"","sources":["../../../../src/decorators/common/minLength.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC,SAAiB,EAAE,EAAE;IACvE,IAAI,SAAS,GAAG,CAAC,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC3E;IAED,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {withErrorMsg} from \"../../utils/withErrorMsg\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n *\n * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.\n *\n * The length of a string instance is defined as the number of its characters as defined by [RFC 7159](http://json-schema.org/latest/json-schema-validation.html#RFC7159).\n *\n * ::: warning\n * The value of minLength MUST be a non-negative integer.\n * :::\n *\n * ::: tip\n * Omitting this keyword has the same behavior as a value of 0.\n * :::\n *\n * ::: warning\n * For v6 user, use @@MinLength@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @MinLength(10)\n * property: number;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"string\",\n * \"maxLength\": 10\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @MinLength(10)\n * @CollectionOf(String)\n * property: string[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"string\",\n * \"minLength\": 10\n * }\n * }\n * }\n * }\n * ```\n *\n * @param {number} minLength\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @ajv-errors\n */\nexport const MinLength = withErrorMsg(\"minLength\", (minLength: number) => {\n if (minLength < 0) {\n throw new Error(\"The value of minLength MUST be a non-negative integer.\");\n }\n\n return JsonEntityFn((store) => {\n store.itemSchema.minLength(minLength);\n });\n});\n"]}
@@ -1,3 +1,4 @@
1
+ import { withErrorMsg } from "../../utils/withErrorMsg.js";
1
2
  import { JsonEntityFn } from "./jsonEntityFn.js";
2
3
  /**
3
4
  * The value of `minimum` MUST be a number, representing an inclusive upper limit for a numeric instance.
@@ -67,12 +68,13 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
67
68
  * @swagger
68
69
  * @schema
69
70
  * @input
71
+ * @ajv-errors
70
72
  */
71
- export function Minimum(minimum, exclusive = false) {
73
+ export const Minimum = withErrorMsg("minimum", (minimum, exclusive = false) => {
72
74
  return JsonEntityFn((store) => {
73
75
  exclusive ? store.itemSchema.exclusiveMinimum(minimum) : store.itemSchema.minimum(minimum);
74
76
  });
75
- }
77
+ });
76
78
  /**
77
79
  * The value of `minimum` MUST be a number, representing an inclusive upper limit for a numeric instance.
78
80
  *
@@ -138,7 +140,5 @@ export function Minimum(minimum, exclusive = false) {
138
140
  * @schema
139
141
  * @input
140
142
  */
141
- export function Min(minimum, exclusive = false) {
142
- return Minimum(minimum, exclusive);
143
- }
143
+ export const Min = Minimum;
144
144
  //# sourceMappingURL=minimum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"minimum.js","sourceRoot":"","sources":["../../../../src/decorators/common/minimum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe,EAAE,YAAqB,KAAK;IACjE,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,YAAqB,KAAK;IAC7D,OAAO,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * The value of `minimum` MUST be a number, representing an inclusive upper limit for a numeric instance.\n *\n * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to `minimum`.\n *\n * ::: warning\n * This decorator will be removed in v7.\n * For v6 user, use @@Minimum@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @Minimum(10)\n * property: number;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"number\",\n * \"minimum\": 10\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @Minimum(10)\n * @CollectionOf(Number)\n * property: number[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"number\",\n * \"minimum\": 10\n * }\n * }\n * }\n * }\n * ```\n *\n * @param {number} minimum The minimum value allowed\n * @param {boolean} exclusive\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport function Minimum(minimum: number, exclusive: boolean = false) {\n return JsonEntityFn((store) => {\n exclusive ? store.itemSchema.exclusiveMinimum(minimum) : store.itemSchema.minimum(minimum);\n });\n}\n\n/**\n * The value of `minimum` MUST be a number, representing an inclusive upper limit for a numeric instance.\n *\n * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to `minimum`.\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @Min(10)\n * property: number;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"number\",\n * \"minimum\": 10\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @Min(10)\n * @CollectionOf(Number)\n * property: number[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"number\",\n * \"minimum\": 10\n * }\n * }\n * }\n * }\n * ```\n *\n * @alias Minimum\n * @param minimum The minimum value allowed\n * @param exclusive\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport function Min(minimum: number, exclusive: boolean = false) {\n return Minimum(minimum, exclusive);\n}\n"]}
1
+ {"version":3,"file":"minimum.js","sourceRoot":"","sources":["../../../../src/decorators/common/minimum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,OAAe,EAAE,YAAqB,KAAK,EAAE,EAAE;IAC7F,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC","sourcesContent":["import {withErrorMsg} from \"../../utils/withErrorMsg\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * The value of `minimum` MUST be a number, representing an inclusive upper limit for a numeric instance.\n *\n * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to `minimum`.\n *\n * ::: warning\n * This decorator will be removed in v7.\n * For v6 user, use @@Minimum@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @Minimum(10)\n * property: number;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"number\",\n * \"minimum\": 10\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @Minimum(10)\n * @CollectionOf(Number)\n * property: number[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"number\",\n * \"minimum\": 10\n * }\n * }\n * }\n * }\n * ```\n *\n * @param {number} minimum The minimum value allowed\n * @param {boolean} exclusive\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @ajv-errors\n */\nexport const Minimum = withErrorMsg(\"minimum\", (minimum: number, exclusive: boolean = false) => {\n return JsonEntityFn((store) => {\n exclusive ? store.itemSchema.exclusiveMinimum(minimum) : store.itemSchema.minimum(minimum);\n });\n});\n\n/**\n * The value of `minimum` MUST be a number, representing an inclusive upper limit for a numeric instance.\n *\n * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to `minimum`.\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @Min(10)\n * property: number;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"number\",\n * \"minimum\": 10\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @Min(10)\n * @CollectionOf(Number)\n * property: number[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"number\",\n * \"minimum\": 10\n * }\n * }\n * }\n * }\n * ```\n *\n * @alias Minimum\n * @param minimum The minimum value allowed\n * @param exclusive\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport const Min = Minimum;\n"]}
@@ -1,3 +1,4 @@
1
+ import { withErrorMsg } from "../../utils/withErrorMsg.js";
1
2
  import { JsonEntityFn } from "./jsonEntityFn.js";
2
3
  /**
3
4
  * A numeric instance is valid only if division by this keyword's value results in an integer.
@@ -65,13 +66,14 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
65
66
  * @swagger
66
67
  * @schema
67
68
  * @input
69
+ * @ajv-errors
68
70
  */
69
- export function MultipleOf(multipleOf) {
71
+ export const MultipleOf = withErrorMsg("multipleOf", (multipleOf) => {
70
72
  if (multipleOf <= 0) {
71
73
  throw new Error("The value of multipleOf MUST be a number, strictly greater than 0.");
72
74
  }
73
75
  return JsonEntityFn((store) => {
74
76
  store.itemSchema.multipleOf(multipleOf);
75
77
  });
76
- }
78
+ });
77
79
  //# sourceMappingURL=multipleOf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"multipleOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/multipleOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,MAAM,UAAU,UAAU,CAAC,UAAkB;IAC3C,IAAI,UAAU,IAAI,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;KACvF;IAED,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * A numeric instance is valid only if division by this keyword's value results in an integer.\n *\n * ::: warning\n * The value of `multipleOf` MUST be a number, strictly greater than 0.\n * :::\n *\n * ::: warning\n * For v6 user, use @@MultipleOf@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @MultipleOf(2)\n * property: Number;\n * }\n * ```\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"number\",\n * \"multipleOf\": 2\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @CollectionOf(number)\n * @MultipleOf(2)\n * property: number[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"number\",\n * \"multipleOf\": 2\n * }\n * }\n * }\n * }\n * ```\n *\n * @param {number} multipleOf The multiple value allowed\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport function MultipleOf(multipleOf: number) {\n if (multipleOf <= 0) {\n throw new Error(\"The value of multipleOf MUST be a number, strictly greater than 0.\");\n }\n\n return JsonEntityFn((store) => {\n store.itemSchema.multipleOf(multipleOf);\n });\n}\n"]}
1
+ {"version":3,"file":"multipleOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/multipleOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,UAAkB,EAAE,EAAE;IAC1E,IAAI,UAAU,IAAI,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;KACvF;IAED,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {withErrorMsg} from \"../../utils/withErrorMsg\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * A numeric instance is valid only if division by this keyword's value results in an integer.\n *\n * ::: warning\n * The value of `multipleOf` MUST be a number, strictly greater than 0.\n * :::\n *\n * ::: warning\n * For v6 user, use @@MultipleOf@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @MultipleOf(2)\n * property: Number;\n * }\n * ```\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"number\",\n * \"multipleOf\": 2\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @CollectionOf(number)\n * @MultipleOf(2)\n * property: number[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"number\",\n * \"multipleOf\": 2\n * }\n * }\n * }\n * }\n * ```\n *\n * @param {number} multipleOf The multiple value allowed\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @ajv-errors\n */\nexport const MultipleOf = withErrorMsg(\"multipleOf\", (multipleOf: number) => {\n if (multipleOf <= 0) {\n throw new Error(\"The value of multipleOf MUST be a number, strictly greater than 0.\");\n }\n\n return JsonEntityFn((store) => {\n store.itemSchema.multipleOf(multipleOf);\n });\n});\n"]}
@@ -1,3 +1,4 @@
1
+ import { withErrorMsg } from "../../utils/withErrorMsg.js";
1
2
  import { JsonEntityFn } from "./jsonEntityFn.js";
2
3
  /**
3
4
  * The pattern and Pattern Properties keywords use regular expressions to express constraints.
@@ -90,10 +91,11 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
90
91
  * @swagger
91
92
  * @schema
92
93
  * @input
94
+ * @ajv-errors
93
95
  */
94
- export function Pattern(pattern) {
96
+ export const Pattern = withErrorMsg("pattern", (pattern) => {
95
97
  return JsonEntityFn((store) => {
96
98
  store.itemSchema.pattern(pattern);
97
99
  });
98
- }
100
+ });
99
101
  //# sourceMappingURL=pattern.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../../src/decorators/common/pattern.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,MAAM,UAAU,OAAO,CAAC,OAAwB;IAC9C,OAAO,YAAY,CAAC,CAAC,KAAsB,EAAE,EAAE;QAC7C,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * The pattern and Pattern Properties keywords use regular expressions to express constraints.\n * The regular expression syntax used is from JavaScript (ECMA 262, specifically). However, that complete syntax is not widely supported, therefore it is recommended that you stick to the subset of that syntax described below.\n *\n * ::: warning\n * For v6 user, use @@Pattern@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * A single unicode character (other than the special characters below) matches itself.\n *\n * * `^`: Matches only at the beginning of the string.\n * * `$`: Matches only at the end of the string.\n * * `(...)`: Group a series of regular expressions into a single regular expression.\n * * `|`: Matches either the regular expression preceding or following the | symbol.\n * * `[abc]`: Matches any of the characters inside the square brackets.\n * * `[a-z]`: Matches the range of characters.\n * * `[^abc]`: Matches any character not listed.\n * * `[^a-z]`: Matches any character outside of the range.\n * * `+`: Matches one or more repetitions of the preceding regular expression.\n * * `*`: Matches zero or more repetitions of the preceding regular expression.\n * * `?`: Matches zero or one repetitions of the preceding regular expression.\n * * `+?`, *?`, ??`: The `*`, `+`, and `?` qualifiers are all greedy; they match as much text as possible. Sometimes this behavior isn’t desired and you want to match as few characters as possible.\n * * `{x}`: Match exactly x occurrences of the preceding regular expression.\n * * `{x,y}`: Match at least x and at most y occurrences of the preceding regular expression.\n * * `{x,}`: Match x occurrences or more of the preceding regular expression.\n * * `{x}?`, {x,y}?, {x,}?`: Lazy versions of the above expressions.\n *\n * ## Example\n *\n * ```typescript\n * class Model {\n * @Pattern(\"^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$\")\n * @Pattern(/^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$/)\n * property: string;\n * }\n * ```\n *\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @Pattern(/^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$/)\n * property: string;\n * }\n * ```\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"string\",\n * \"pattern\": \"^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$\"\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @CollectionOf(string)\n * @Pattern(/^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$/)\n * property: string[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"string\",\n * \"pattern\": \"^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$\"\n * }\n * }\n * }\n * }\n * ```\n *\n * @param {string} pattern\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport function Pattern(pattern: string | RegExp) {\n return JsonEntityFn((store: JsonEntityStore) => {\n store.itemSchema.pattern(pattern);\n });\n}\n"]}
1
+ {"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../../src/decorators/common/pattern.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,OAAwB,EAAE,EAAE;IAC1E,OAAO,YAAY,CAAC,CAAC,KAAsB,EAAE,EAAE;QAC7C,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {withErrorMsg} from \"../../utils/withErrorMsg\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * The pattern and Pattern Properties keywords use regular expressions to express constraints.\n * The regular expression syntax used is from JavaScript (ECMA 262, specifically). However, that complete syntax is not widely supported, therefore it is recommended that you stick to the subset of that syntax described below.\n *\n * ::: warning\n * For v6 user, use @@Pattern@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * A single unicode character (other than the special characters below) matches itself.\n *\n * * `^`: Matches only at the beginning of the string.\n * * `$`: Matches only at the end of the string.\n * * `(...)`: Group a series of regular expressions into a single regular expression.\n * * `|`: Matches either the regular expression preceding or following the | symbol.\n * * `[abc]`: Matches any of the characters inside the square brackets.\n * * `[a-z]`: Matches the range of characters.\n * * `[^abc]`: Matches any character not listed.\n * * `[^a-z]`: Matches any character outside of the range.\n * * `+`: Matches one or more repetitions of the preceding regular expression.\n * * `*`: Matches zero or more repetitions of the preceding regular expression.\n * * `?`: Matches zero or one repetitions of the preceding regular expression.\n * * `+?`, *?`, ??`: The `*`, `+`, and `?` qualifiers are all greedy; they match as much text as possible. Sometimes this behavior isn’t desired and you want to match as few characters as possible.\n * * `{x}`: Match exactly x occurrences of the preceding regular expression.\n * * `{x,y}`: Match at least x and at most y occurrences of the preceding regular expression.\n * * `{x,}`: Match x occurrences or more of the preceding regular expression.\n * * `{x}?`, {x,y}?, {x,}?`: Lazy versions of the above expressions.\n *\n * ## Example\n *\n * ```typescript\n * class Model {\n * @Pattern(\"^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$\")\n * @Pattern(/^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$/)\n * property: string;\n * }\n * ```\n *\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @Pattern(/^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$/)\n * property: string;\n * }\n * ```\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"string\",\n * \"pattern\": \"^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$\"\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @CollectionOf(string)\n * @Pattern(/^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$/)\n * property: string[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"string\",\n * \"pattern\": \"^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$\"\n * }\n * }\n * }\n * }\n * ```\n *\n * @param {string} pattern\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @ajv-errors\n */\nexport const Pattern = withErrorMsg(\"pattern\", (pattern: string | RegExp) => {\n return JsonEntityFn((store: JsonEntityStore) => {\n store.itemSchema.pattern(pattern);\n });\n});\n"]}
@@ -1,3 +1,4 @@
1
+ import { withErrorMsg } from "../../utils/withErrorMsg.js";
1
2
  import { Allow } from "./allow.js";
2
3
  import { Optional } from "./optional.js";
3
4
  /**
@@ -43,7 +44,7 @@ import { Optional } from "./optional.js";
43
44
  * @schema
44
45
  * @input
45
46
  */
46
- export function Required(required = true, ...allowedRequiredValues) {
47
+ export const Required = withErrorMsg("required", (required = true, ...allowedRequiredValues) => {
47
48
  return required ? Allow(...allowedRequiredValues) : Optional();
48
- }
49
+ });
49
50
  //# sourceMappingURL=required.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"required.js","sourceRoot":"","sources":["../../../../src/decorators/common/required.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,QAAQ,CAAC,WAAoB,IAAI,EAAE,GAAG,qBAA4B;IAChF,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACjE,CAAC","sourcesContent":["import {Allow} from \"./allow\";\nimport {Optional} from \"./optional\";\n\n/**\n * Add required annotation on Property or Parameter.\n *\n * The @@Required@@ decorator can be used on two cases.\n *\n * To decorate a parameters:\n *\n * ```typescript\n * @Post(\"/\")\n * async method(@Required() @BodyParams(\"field\") field: string) {}\n * ```\n *\n * To decorate a model:\n *\n * ```typescript\n * class Model {\n * @Required()\n * field: string;\n * }\n * ```\n *\n * ::: tip\n * Required will throw a BadRequest when the given value is `null`, an empty string or `undefined`.\n * :::\n *\n * ### Allow values\n *\n * In some case, you didn't want trigger a BadRequest when the value is an empty string for example.\n * The decorator `@Allow()`, allow you to configure a value list for which there will be no exception.\n *\n * ```typescript\n * class Model {\n * @Allow(\"\") // add automatically required flag\n * field: string;\n * }\n * ```\n *\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport function Required(required: boolean = true, ...allowedRequiredValues: any[]) {\n return required ? Allow(...allowedRequiredValues) : Optional();\n}\n"]}
1
+ {"version":3,"file":"required.js","sourceRoot":"","sources":["../../../../src/decorators/common/required.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC,WAAoB,IAAI,EAAE,GAAG,qBAA4B,EAAE,EAAE;IAC7G,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACjE,CAAC,CAAC,CAAC","sourcesContent":["import {withErrorMsg} from \"../../utils/withErrorMsg\";\nimport {Allow} from \"./allow\";\nimport {Optional} from \"./optional\";\n\n/**\n * Add required annotation on Property or Parameter.\n *\n * The @@Required@@ decorator can be used on two cases.\n *\n * To decorate a parameters:\n *\n * ```typescript\n * @Post(\"/\")\n * async method(@Required() @BodyParams(\"field\") field: string) {}\n * ```\n *\n * To decorate a model:\n *\n * ```typescript\n * class Model {\n * @Required()\n * field: string;\n * }\n * ```\n *\n * ::: tip\n * Required will throw a BadRequest when the given value is `null`, an empty string or `undefined`.\n * :::\n *\n * ### Allow values\n *\n * In some case, you didn't want trigger a BadRequest when the value is an empty string for example.\n * The decorator `@Allow()`, allow you to configure a value list for which there will be no exception.\n *\n * ```typescript\n * class Model {\n * @Allow(\"\") // add automatically required flag\n * field: string;\n * }\n * ```\n *\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport const Required = withErrorMsg(\"required\", (required: boolean = true, ...allowedRequiredValues: any[]) => {\n return required ? Allow(...allowedRequiredValues) : Optional();\n});\n"]}
@@ -0,0 +1,14 @@
1
+ import { useDecorators } from "@tsed/core";
2
+ import { ErrorMsg } from "./errorMsg.js";
3
+ import { JsonEntityFn } from "./jsonEntityFn.js";
4
+ /**
5
+ * Create a new custom formats validator
6
+ * @param name
7
+ * @param options
8
+ * @decorator
9
+ * @ajv
10
+ */
11
+ export function TypeError(msg) {
12
+ return JsonEntityFn(() => useDecorators(ErrorMsg({ type: msg })));
13
+ }
14
+ //# sourceMappingURL=typeError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeError.js","sourceRoot":"","sources":["../../../../src/decorators/common/typeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,YAAY,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import {useDecorators} from \"@tsed/core\";\nimport {ErrorMsg} from \"./errorMsg\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * Create a new custom formats validator\n * @param name\n * @param options\n * @decorator\n * @ajv\n */\nexport function TypeError(msg: string): ClassDecorator {\n return JsonEntityFn(() => useDecorators(ErrorMsg({type: msg})));\n}\n"]}
package/lib/esm/index.js CHANGED
@@ -31,9 +31,11 @@ export * from "./decorators/common/anyOf.js";
31
31
  export * from "./decorators/common/const.js";
32
32
  export * from "./decorators/common/customKey.js";
33
33
  export * from "./decorators/common/default.js";
34
+ export * from "./decorators/common/defaultMsg.js";
34
35
  export * from "./decorators/common/description.js";
35
36
  export * from "./decorators/common/discriminatorKey.js";
36
37
  export * from "./decorators/common/enum.js";
38
+ export * from "./decorators/common/errorMsg.js";
37
39
  export * from "./decorators/common/example.js";
38
40
  export * from "./decorators/common/examples.js";
39
41
  export * from "./decorators/common/exclusiveMaximum.js";
@@ -62,6 +64,7 @@ export * from "./decorators/common/required.js";
62
64
  export * from "./decorators/common/requiredGroups.js";
63
65
  export * from "./decorators/common/schema.js";
64
66
  export * from "./decorators/common/title.js";
67
+ export * from "./decorators/common/typeError.js";
65
68
  export * from "./decorators/common/writeOnly.js";
66
69
  export * from "./decorators/config/jsonEntityComponent.js";
67
70
  export * from "./decorators/generics/genericOf.js";
@@ -151,4 +154,5 @@ export * from "./utils/serializeEnumValues.js";
151
154
  export * from "./utils/toJsonMapCollection.js";
152
155
  export * from "./utils/toJsonRegex.js";
153
156
  export * from "./utils/transformToOS2.js";
157
+ export * from "./utils/withErrorMsg.js";
154
158
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,wCAAwC,CAAC;AACvD,cAA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Ac,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wCAAwC,CAAC;AACvD,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/anyMapper\";\nexport * from \"./components/classMapper\";\nexport * from \"./components/genericsMapper\";\nexport * from \"./components/inheritedClassMapper\";\nexport * from \"./components/itemMapper\";\nexport * from \"./components/lazyRefMapper\";\nexport * from \"./components/mapMapper\";\nexport * from \"./components/objectMapper\";\nexport * from \"./components/ofMapper\";\nexport * from \"./components/propertiesMapper\";\nexport * from \"./components/schemaMapper\";\nexport * from \"./constants/httpMethods\";\nexport * from \"./constants/httpStatusMessages\";\nexport * from \"./decorators/class/children\";\nexport * from \"./decorators/class/discriminatorValue\";\nexport * from \"./decorators/collections/collectionContains\";\nexport * from \"./decorators/collections/collectionOf\";\nexport * from \"./decorators/collections/maxItems\";\nexport * from \"./decorators/collections/maxProperties\";\nexport * from \"./decorators/collections/minItems\";\nexport * from \"./decorators/collections/minProperties\";\nexport * from \"./decorators/collections/uniqueItems\";\nexport * from \"./decorators/common/additionalProperties\";\nexport * from \"./decorators/common/allOf\";\nexport * from \"./decorators/common/allow\";\nexport * from \"./decorators/common/any\";\nexport * from \"./decorators/common/anyOf\";\nexport * from \"./decorators/common/const\";\nexport * from \"./decorators/common/customKey\";\nexport * from \"./decorators/common/default\";\nexport * from \"./decorators/common/description\";\nexport * from \"./decorators/common/discriminatorKey\";\nexport * from \"./decorators/common/enum\";\nexport * from \"./decorators/common/example\";\nexport * from \"./decorators/common/examples\";\nexport * from \"./decorators/common/exclusiveMaximum\";\nexport * from \"./decorators/common/exclusiveMinimum\";\nexport * from \"./decorators/common/format\";\nexport * from \"./decorators/common/forwardGroups\";\nexport * from \"./decorators/common/groups\";\nexport * from \"./decorators/common/hidden\";\nexport * from \"./decorators/common/ignore\";\nexport * from \"./decorators/common/integer\";\nexport * from \"./decorators/common/jsonEntityFn\";\nexport * from \"./decorators/common/maxLength\";\nexport * from \"./decorators/common/maximum\";\nexport * from \"./decorators/common/minLength\";\nexport * from \"./decorators/common/minimum\";\nexport * from \"./decorators/common/multipleOf\";\nexport * from \"./decorators/common/name\";\nexport * from \"./decorators/common/nullable\";\nexport * from \"./decorators/common/oneOf\";\nexport * from \"./decorators/common/optional\";\nexport * from \"./decorators/common/pattern\";\nexport * from \"./decorators/common/property\";\nexport * from \"./decorators/common/readOnly\";\nexport * from \"./decorators/common/recordOf\";\nexport * from \"./decorators/common/required\";\nexport * from \"./decorators/common/requiredGroups\";\nexport * from \"./decorators/common/schema\";\nexport * from \"./decorators/common/title\";\nexport * from \"./decorators/common/writeOnly\";\nexport * from \"./decorators/config/jsonEntityComponent\";\nexport * from \"./decorators/generics/genericOf\";\nexport * from \"./decorators/generics/generics\";\nexport * from \"./decorators/operations/acceptMime\";\nexport * from \"./decorators/operations/consumes\";\nexport * from \"./decorators/operations/contentType\";\nexport * from \"./decorators/operations/deprecated\";\nexport * from \"./decorators/operations/header\";\nexport * from \"./decorators/operations/in\";\nexport * from \"./decorators/operations/inFile\";\nexport * from \"./decorators/operations/location\";\nexport * from \"./decorators/operations/operationId\";\nexport * from \"./decorators/operations/operationPath\";\nexport * from \"./decorators/operations/partial\";\nexport * from \"./decorators/operations/path\";\nexport * from \"./decorators/operations/produces\";\nexport * from \"./decorators/operations/redirect\";\nexport * from \"./decorators/operations/returns\";\nexport * from \"./decorators/operations/route\";\nexport * from \"./decorators/operations/security\";\nexport * from \"./decorators/operations/status\";\nexport * from \"./decorators/operations/summary\";\nexport * from \"./decorators/operations/tags\";\nexport * from \"./decorators/operations/view\";\nexport * from \"./domain/DecoratorContext\";\nexport * from \"./domain/JsonAliasMap\";\nexport * from \"./domain/JsonClassStore\";\nexport * from \"./domain/JsonDiscriminator\";\nexport * from \"./domain/JsonEntityStore\";\nexport * from \"./domain/JsonFormatTypes\";\nexport * from \"./domain/JsonLazyRef\";\nexport * from \"./domain/JsonMap\";\nexport * from \"./domain/JsonMethodStore\";\nexport * from \"./domain/JsonOperation\";\nexport * from \"./domain/JsonOperationPathsMap\";\nexport * from \"./domain/JsonOperationRoute\";\nexport * from \"./domain/JsonParameter\";\nexport * from \"./domain/JsonParameterStore\";\nexport * from \"./domain/JsonParameterTypes\";\nexport * from \"./domain/JsonPropertyStore\";\nexport * from \"./domain/JsonRequestBody\";\nexport * from \"./domain/JsonResponse\";\nexport * from \"./domain/JsonSchema\";\nexport * from \"./domain/SpecTypes\";\nexport * from \"./hooks/alterIgnore\";\nexport * from \"./hooks/alterOneOf\";\nexport * from \"./hooks/alterRequiredGroups\";\nexport * from \"./interfaces/IgnoreCallback\";\nexport * from \"./interfaces/JsonHookContext\";\nexport * from \"./interfaces/JsonOpenSpec\";\nexport * from \"./interfaces/JsonSchemaOptions\";\nexport * from \"./registries/JsonSchemaMapperContainer\";\nexport * from \"./utils/buildPath\";\nexport * from \"./utils/concatParameters\";\nexport * from \"./utils/concatPath\";\nexport * from \"./utils/defineStatusModel\";\nexport * from \"./utils/from\";\nexport * from \"./utils/generateSpec\";\nexport * from \"./utils/generics\";\nexport * from \"./utils/getComputedType\";\nexport * from \"./utils/getInheritedStores\";\nexport * from \"./utils/getJsonEntityStore\";\nexport * from \"./utils/getJsonPathParameters\";\nexport * from \"./utils/getJsonSchema\";\nexport * from \"./utils/getJsonType\";\nexport * from \"./utils/getOperationsRoutes\";\nexport * from \"./utils/getOperationsStores\";\nexport * from \"./utils/getPropertiesStores\";\nexport * from \"./utils/getRequiredProperties\";\nexport * from \"./utils/getSpec\";\nexport * from \"./utils/getSpecType\";\nexport * from \"./utils/isSuccessStatus\";\nexport * from \"./utils/mapHeaders\";\nexport * from \"./utils/mapNullableType\";\nexport * from \"./utils/mapOpenSpec\";\nexport * from \"./utils/mapOpenSpec2\";\nexport * from \"./utils/mapOpenSpec3\";\nexport * from \"./utils/mapOpenSpecInfo\";\nexport * from \"./utils/mapRouteOptions\";\nexport * from \"./utils/matchGroups\";\nexport * from \"./utils/mergeOperation\";\nexport * from \"./utils/mergeSpec\";\nexport * from \"./utils/operationIdFormatter\";\nexport * from \"./utils/ref\";\nexport * from \"./utils/serializeEnumValues\";\nexport * from \"./utils/toJsonMapCollection\";\nexport * from \"./utils/toJsonRegex\";\nexport * from \"./utils/transformToOS2\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;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Ac,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/anyMapper\";\nexport * from \"./components/classMapper\";\nexport * from \"./components/genericsMapper\";\nexport * from \"./components/inheritedClassMapper\";\nexport * from \"./components/itemMapper\";\nexport * from \"./components/lazyRefMapper\";\nexport * from \"./components/mapMapper\";\nexport * from \"./components/objectMapper\";\nexport * from \"./components/ofMapper\";\nexport * from \"./components/propertiesMapper\";\nexport * from \"./components/schemaMapper\";\nexport * from \"./constants/httpMethods\";\nexport * from \"./constants/httpStatusMessages\";\nexport * from \"./decorators/class/children\";\nexport * from \"./decorators/class/discriminatorValue\";\nexport * from \"./decorators/collections/collectionContains\";\nexport * from \"./decorators/collections/collectionOf\";\nexport * from \"./decorators/collections/maxItems\";\nexport * from \"./decorators/collections/maxProperties\";\nexport * from \"./decorators/collections/minItems\";\nexport * from \"./decorators/collections/minProperties\";\nexport * from \"./decorators/collections/uniqueItems\";\nexport * from \"./decorators/common/additionalProperties\";\nexport * from \"./decorators/common/allOf\";\nexport * from \"./decorators/common/allow\";\nexport * from \"./decorators/common/any\";\nexport * from \"./decorators/common/anyOf\";\nexport * from \"./decorators/common/const\";\nexport * from \"./decorators/common/customKey\";\nexport * from \"./decorators/common/default\";\nexport * from \"./decorators/common/defaultMsg\";\nexport * from \"./decorators/common/description\";\nexport * from \"./decorators/common/discriminatorKey\";\nexport * from \"./decorators/common/enum\";\nexport * from \"./decorators/common/errorMsg\";\nexport * from \"./decorators/common/example\";\nexport * from \"./decorators/common/examples\";\nexport * from \"./decorators/common/exclusiveMaximum\";\nexport * from \"./decorators/common/exclusiveMinimum\";\nexport * from \"./decorators/common/format\";\nexport * from \"./decorators/common/forwardGroups\";\nexport * from \"./decorators/common/groups\";\nexport * from \"./decorators/common/hidden\";\nexport * from \"./decorators/common/ignore\";\nexport * from \"./decorators/common/integer\";\nexport * from \"./decorators/common/jsonEntityFn\";\nexport * from \"./decorators/common/maxLength\";\nexport * from \"./decorators/common/maximum\";\nexport * from \"./decorators/common/minLength\";\nexport * from \"./decorators/common/minimum\";\nexport * from \"./decorators/common/multipleOf\";\nexport * from \"./decorators/common/name\";\nexport * from \"./decorators/common/nullable\";\nexport * from \"./decorators/common/oneOf\";\nexport * from \"./decorators/common/optional\";\nexport * from \"./decorators/common/pattern\";\nexport * from \"./decorators/common/property\";\nexport * from \"./decorators/common/readOnly\";\nexport * from \"./decorators/common/recordOf\";\nexport * from \"./decorators/common/required\";\nexport * from \"./decorators/common/requiredGroups\";\nexport * from \"./decorators/common/schema\";\nexport * from \"./decorators/common/title\";\nexport * from \"./decorators/common/typeError\";\nexport * from \"./decorators/common/writeOnly\";\nexport * from \"./decorators/config/jsonEntityComponent\";\nexport * from \"./decorators/generics/genericOf\";\nexport * from \"./decorators/generics/generics\";\nexport * from \"./decorators/operations/acceptMime\";\nexport * from \"./decorators/operations/consumes\";\nexport * from \"./decorators/operations/contentType\";\nexport * from \"./decorators/operations/deprecated\";\nexport * from \"./decorators/operations/header\";\nexport * from \"./decorators/operations/in\";\nexport * from \"./decorators/operations/inFile\";\nexport * from \"./decorators/operations/location\";\nexport * from \"./decorators/operations/operationId\";\nexport * from \"./decorators/operations/operationPath\";\nexport * from \"./decorators/operations/partial\";\nexport * from \"./decorators/operations/path\";\nexport * from \"./decorators/operations/produces\";\nexport * from \"./decorators/operations/redirect\";\nexport * from \"./decorators/operations/returns\";\nexport * from \"./decorators/operations/route\";\nexport * from \"./decorators/operations/security\";\nexport * from \"./decorators/operations/status\";\nexport * from \"./decorators/operations/summary\";\nexport * from \"./decorators/operations/tags\";\nexport * from \"./decorators/operations/view\";\nexport * from \"./domain/DecoratorContext\";\nexport * from \"./domain/JsonAliasMap\";\nexport * from \"./domain/JsonClassStore\";\nexport * from \"./domain/JsonDiscriminator\";\nexport * from \"./domain/JsonEntityStore\";\nexport * from \"./domain/JsonFormatTypes\";\nexport * from \"./domain/JsonLazyRef\";\nexport * from \"./domain/JsonMap\";\nexport * from \"./domain/JsonMethodStore\";\nexport * from \"./domain/JsonOperation\";\nexport * from \"./domain/JsonOperationPathsMap\";\nexport * from \"./domain/JsonOperationRoute\";\nexport * from \"./domain/JsonParameter\";\nexport * from \"./domain/JsonParameterStore\";\nexport * from \"./domain/JsonParameterTypes\";\nexport * from \"./domain/JsonPropertyStore\";\nexport * from \"./domain/JsonRequestBody\";\nexport * from \"./domain/JsonResponse\";\nexport * from \"./domain/JsonSchema\";\nexport * from \"./domain/SpecTypes\";\nexport * from \"./hooks/alterIgnore\";\nexport * from \"./hooks/alterOneOf\";\nexport * from \"./hooks/alterRequiredGroups\";\nexport * from \"./interfaces/IgnoreCallback\";\nexport * from \"./interfaces/JsonHookContext\";\nexport * from \"./interfaces/JsonOpenSpec\";\nexport * from \"./interfaces/JsonSchemaOptions\";\nexport * from \"./registries/JsonSchemaMapperContainer\";\nexport * from \"./utils/buildPath\";\nexport * from \"./utils/concatParameters\";\nexport * from \"./utils/concatPath\";\nexport * from \"./utils/defineStatusModel\";\nexport * from \"./utils/from\";\nexport * from \"./utils/generateSpec\";\nexport * from \"./utils/generics\";\nexport * from \"./utils/getComputedType\";\nexport * from \"./utils/getInheritedStores\";\nexport * from \"./utils/getJsonEntityStore\";\nexport * from \"./utils/getJsonPathParameters\";\nexport * from \"./utils/getJsonSchema\";\nexport * from \"./utils/getJsonType\";\nexport * from \"./utils/getOperationsRoutes\";\nexport * from \"./utils/getOperationsStores\";\nexport * from \"./utils/getPropertiesStores\";\nexport * from \"./utils/getRequiredProperties\";\nexport * from \"./utils/getSpec\";\nexport * from \"./utils/getSpecType\";\nexport * from \"./utils/isSuccessStatus\";\nexport * from \"./utils/mapHeaders\";\nexport * from \"./utils/mapNullableType\";\nexport * from \"./utils/mapOpenSpec\";\nexport * from \"./utils/mapOpenSpec2\";\nexport * from \"./utils/mapOpenSpec3\";\nexport * from \"./utils/mapOpenSpecInfo\";\nexport * from \"./utils/mapRouteOptions\";\nexport * from \"./utils/matchGroups\";\nexport * from \"./utils/mergeOperation\";\nexport * from \"./utils/mergeSpec\";\nexport * from \"./utils/operationIdFormatter\";\nexport * from \"./utils/ref\";\nexport * from \"./utils/serializeEnumValues\";\nexport * from \"./utils/toJsonMapCollection\";\nexport * from \"./utils/toJsonRegex\";\nexport * from \"./utils/transformToOS2\";\nexport * from \"./utils/withErrorMsg\";\n"]}
@@ -0,0 +1,14 @@
1
+ import { useDecorators } from "@tsed/core";
2
+ import { ErrorMsg } from "../decorators/common/errorMsg.js";
3
+ export function withErrorMsg(errorKey, originalDecorator) {
4
+ const schema = {};
5
+ return ((...decoratorOptions) => {
6
+ const decorator = useDecorators(originalDecorator(...decoratorOptions));
7
+ decorator.Error = (message) => {
8
+ schema.message = message;
9
+ return useDecorators(decorator, schema.message && ErrorMsg({ [errorKey]: message }));
10
+ };
11
+ return decorator;
12
+ });
13
+ }
14
+ //# sourceMappingURL=withErrorMsg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withErrorMsg.js","sourceRoot":"","sources":["../../../src/utils/withErrorMsg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AAYvD,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,iBAA4B;IAE5B,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,OAAO,CAAC,CAAC,GAAG,gBAAuB,EAAE,EAAE;QACrC,MAAM,SAAS,GAAG,aAAa,CAAC,iBAAiB,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;QACvE,SAAiB,CAAC,KAAK,GAAG,CAAC,OAAe,EAAE,EAAE;YAC7C,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;YACzB,OAAO,aAAa,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,IAAI,QAAQ,CAAC,EAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC,CAAQ,CAAC;AACZ,CAAC","sourcesContent":["import {useDecorators} from \"@tsed/core\";\nimport {ErrorMsg} from \"../decorators/common/errorMsg\";\n\nexport interface ErrorChainedMethods<T> {\n <T>(target: Object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<T> | number): any;\n\n Error(msg: string): this;\n}\n\nexport type ErrorChainedDecorator<Decorator extends (...args: any[]) => any> = (\n ...args: Parameters<Decorator>\n) => ErrorChainedMethods<Decorator>;\n\nexport function withErrorMsg<Decorator extends (...args: any[]) => any>(\n errorKey: string,\n originalDecorator: Decorator\n): ErrorChainedDecorator<Decorator> {\n const schema: any = {};\n\n return ((...decoratorOptions: any[]) => {\n const decorator = useDecorators(originalDecorator(...decoratorOptions));\n (decorator as any).Error = (message: string) => {\n schema.message = message;\n return useDecorators(decorator, schema.message && ErrorMsg({[errorKey]: message}));\n };\n\n return decorator;\n }) as any;\n}\n"]}
@@ -43,5 +43,6 @@
43
43
  * @schema
44
44
  * @input
45
45
  * @collections
46
+ * @ajv-errors
46
47
  */
47
- export declare function MaxItems(maxItems: number): (...args: any[]) => any;
48
+ export declare const MaxItems: import("../../utils/withErrorMsg").ErrorChainedDecorator<(maxItems: number) => (...args: any[]) => any>;
@@ -66,5 +66,6 @@
66
66
  * @schema
67
67
  * @input
68
68
  * @collections
69
+ * @ajv-errors
69
70
  */
70
- export declare function MaxProperties(maxProperties: number): (...args: any[]) => any;
71
+ export declare const MaxProperties: import("../../utils/withErrorMsg").ErrorChainedDecorator<(maxProperties: number) => (...args: any[]) => any>;
@@ -47,5 +47,6 @@
47
47
  * @schema
48
48
  * @input
49
49
  * @collections
50
+ * @ajv-errors
50
51
  */
51
- export declare function MinItems(minItems: number): (...args: any[]) => any;
52
+ export declare const MinItems: import("../../utils/withErrorMsg").ErrorChainedDecorator<(minItems: number) => (...args: any[]) => any>;
@@ -65,5 +65,6 @@
65
65
  * @schema
66
66
  * @input
67
67
  * @collections
68
+ * @ajv-errors
68
69
  */
69
- export declare function MinProperties(minProperties: number): (...args: any[]) => any;
70
+ export declare const MinProperties: import("../../utils/withErrorMsg").ErrorChainedDecorator<(minProperties: number) => (...args: any[]) => any>;
@@ -46,5 +46,6 @@
46
46
  * @schema
47
47
  * @input
48
48
  * @collections
49
+ * @ajv-errors
49
50
  */
50
- export declare function UniqueItems(uniqueItems?: boolean): (...args: any[]) => any;
51
+ export declare const UniqueItems: import("../../utils/withErrorMsg").ErrorChainedDecorator<(uniqueItems?: boolean) => (...args: any[]) => any>;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Set default error message.
3
+ *
4
+ * ## Example
5
+ *
6
+ * ```typescript
7
+ * @DefaultMessage("foo should be a string")
8
+ * class Model {
9
+ * property: number;
10
+ * }
11
+ * ```
12
+ *
13
+ * Will produce:
14
+ *
15
+ * ```json
16
+ * {
17
+ * "type": "object",
18
+ * "properties": {
19
+ * "property": "number"
20
+ * }
21
+ * "errorMessage": {
22
+ * "_": "foo should be a string"
23
+ * }
24
+ * }
25
+ * ```
26
+ *
27
+ * @decorator
28
+ * @validation
29
+ * @swagger
30
+ * @schema
31
+ */
32
+ export declare function DefaultMsg(message: string): ClassDecorator;
@@ -1,4 +1,5 @@
1
1
  import type { JSONSchema6Type } from "json-schema";
2
+ declare function EnumFn(...enumValues: (JSONSchema6Type | any)[]): Function;
2
3
  /**
3
4
  * The enum keyword is used to restrict a value to a fixed set of values.
4
5
  * It must be an array with at least one element, where each element is unique.
@@ -94,5 +95,7 @@ import type { JSONSchema6Type } from "json-schema";
94
95
  * @swagger
95
96
  * @schema
96
97
  * @input
98
+ * @ajv-errors
97
99
  */
98
- export declare function Enum(...enumValues: (JSONSchema6Type | any)[]): Function;
100
+ export declare const Enum: import("../../utils/withErrorMsg").ErrorChainedDecorator<typeof EnumFn>;
101
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Create a new custom formats validator
3
+ * @param name
4
+ * @param options
5
+ * @decorator
6
+ * @ajv
7
+ */
8
+ export declare function ErrorMsg(obj: Record<string, string>): (...args: any[]) => any;
@@ -65,5 +65,6 @@
65
65
  * @swagger
66
66
  * @schema
67
67
  * @input
68
+ * @ajv-errors
68
69
  */
69
- export declare function ExclusiveMaximum(maximum: number, exclusiveMaximum?: boolean): (...args: any[]) => any;
70
+ export declare const ExclusiveMaximum: import("../../utils/withErrorMsg").ErrorChainedDecorator<(maximum: number, exclusiveMaximum?: boolean) => import("../../utils/withErrorMsg").ErrorChainedMethods<(maximum: number, exclusive?: boolean) => (...args: any[]) => any>>;
@@ -65,5 +65,6 @@
65
65
  * @swagger
66
66
  * @schema
67
67
  * @input
68
+ * @ajv-errors
68
69
  */
69
- export declare function ExclusiveMinimum(minimum: number, exclusiveMinimum?: boolean): (...args: any[]) => any;
70
+ export declare const ExclusiveMinimum: import("../../utils/withErrorMsg").ErrorChainedDecorator<(minimum: number, exclusiveMinimum?: boolean) => import("../../utils/withErrorMsg").ErrorChainedMethods<(minimum: number, exclusive?: boolean) => (...args: any[]) => any>>;
@@ -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 function Format(format: JsonFormatTypes | ValueOf<JsonFormatTypes>): (...args: any[]) => any;
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 function Email(): (...args: any[]) => any;
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 function DateTime(): (...args: any[]) => any;
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 function DateFormat(): (...args: any[]) => any;
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 function TimeFormat(): (...args: any[]) => any;
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 function Uri(): (...args: any[]) => any;
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 function Url(): (...args: any[]) => any;
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 function MaxLength(maxLength: number): (...args: any[]) => any;
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 function Maximum(maximum: number, exclusive?: boolean): (...args: any[]) => any;
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 function Max(maximum: number, exclusive?: boolean): (...args: any[]) => any;
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 function MinLength(minLength: number): (...args: any[]) => any;
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 function Minimum(minimum: number, exclusive?: boolean): (...args: any[]) => any;
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 function Min(minimum: number, exclusive?: boolean): (...args: any[]) => any;
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 function MultipleOf(multipleOf: number): (...args: any[]) => any;
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 function Pattern(pattern: string | RegExp): (...args: any[]) => any;
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 function Required(required?: boolean, ...allowedRequiredValues: any[]): any;
44
+ export declare const Required: import("../../utils/withErrorMsg").ErrorChainedDecorator<(required?: boolean, ...allowedRequiredValues: any[]) => any>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Create a new custom formats validator
3
+ * @param name
4
+ * @param options
5
+ * @decorator
6
+ * @ajv
7
+ */
8
+ export declare function TypeError(msg: string): ClassDecorator;