@tsed/schema 7.79.4 → 7.80.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 (206) hide show
  1. package/lib/browser/schema.umd.min.js.map +1 -1
  2. package/lib/cjs/components/default/inlineEnumsMapper.js +2 -2
  3. package/lib/cjs/components/default/inlineEnumsMapper.js.map +1 -1
  4. package/lib/cjs/components/default/nullableMapper.js +4 -4
  5. package/lib/cjs/components/default/nullableMapper.js.map +1 -1
  6. package/lib/cjs/components/default/requiredMapper.js +4 -4
  7. package/lib/cjs/components/default/requiredMapper.js.map +1 -1
  8. package/lib/cjs/components/open-spec/nullableMapper.js +4 -4
  9. package/lib/cjs/components/open-spec/nullableMapper.js.map +1 -1
  10. package/lib/cjs/utils/generateSpec.js +1 -24
  11. package/lib/cjs/utils/generateSpec.js.map +1 -1
  12. package/lib/esm/components/default/inlineEnumsMapper.js.map +1 -1
  13. package/lib/esm/components/default/nullableMapper.js.map +1 -1
  14. package/lib/esm/components/default/requiredMapper.js.map +1 -1
  15. package/lib/esm/components/open-spec/nullableMapper.js.map +1 -1
  16. package/lib/esm/utils/getJsonSchema.js +1 -1
  17. package/lib/types/components/default/inlineEnumsMapper.d.ts +2 -2
  18. package/lib/types/components/default/nullableMapper.d.ts +1 -1
  19. package/lib/types/components/default/requiredMapper.d.ts +2 -2
  20. package/lib/types/components/open-spec/nullableMapper.d.ts +1 -1
  21. package/lib/types-esm/components/async-api/channelsMapper.d.ts +2 -0
  22. package/lib/types-esm/components/async-api/generate.d.ts +1 -0
  23. package/lib/types-esm/components/async-api/messageMapper.d.ts +6 -0
  24. package/lib/types-esm/components/async-api/payloadMapper.d.ts +4 -0
  25. package/lib/types-esm/components/async-api/responseMapper.d.ts +6 -0
  26. package/lib/types-esm/components/default/anyMapper.d.ts +2 -0
  27. package/lib/types-esm/components/default/classMapper.d.ts +3 -0
  28. package/lib/types-esm/components/default/genericsMapper.d.ts +5 -0
  29. package/lib/types-esm/components/default/inheritedClassMapper.d.ts +5 -0
  30. package/lib/types-esm/components/default/inlineEnumsMapper.d.ts +3 -0
  31. package/lib/types-esm/components/default/itemMapper.d.ts +2 -0
  32. package/lib/types-esm/components/default/lazyRefMapper.d.ts +3 -0
  33. package/lib/types-esm/components/default/mapMapper.d.ts +9 -0
  34. package/lib/types-esm/components/default/nullableMapper.d.ts +2 -0
  35. package/lib/types-esm/components/default/objectMapper.d.ts +8 -0
  36. package/lib/types-esm/components/default/ofMapper.d.ts +3 -0
  37. package/lib/types-esm/components/default/propertiesMapper.d.ts +3 -0
  38. package/lib/types-esm/components/default/requiredMapper.d.ts +3 -0
  39. package/lib/types-esm/components/default/schemaMapper.d.ts +3 -0
  40. package/lib/types-esm/components/index.d.ts +33 -0
  41. package/lib/types-esm/components/open-spec/generate.d.ts +1 -0
  42. package/lib/types-esm/components/open-spec/nullableMapper.d.ts +2 -0
  43. package/lib/types-esm/components/open-spec/operationInFilesMapper.d.ts +2 -0
  44. package/lib/types-esm/components/open-spec/operationInParameterMapper.d.ts +10 -0
  45. package/lib/types-esm/components/open-spec/operationInParametersMapper.d.ts +3 -0
  46. package/lib/types-esm/components/open-spec/operationInQueryMapper.d.ts +2 -0
  47. package/lib/types-esm/components/open-spec/operationMapper.d.ts +3 -0
  48. package/lib/types-esm/components/open-spec/operationMediaMapper.d.ts +3 -0
  49. package/lib/types-esm/components/open-spec/operationRequestBodyMapper.d.ts +3 -0
  50. package/lib/types-esm/components/open-spec/operationResponseMapper.d.ts +3 -0
  51. package/lib/types-esm/components/open-spec/pathsMapper.d.ts +2 -0
  52. package/lib/types-esm/constants/OperationVerbs.d.ts +20 -0
  53. package/lib/types-esm/constants/httpStatusMessages.d.ts +11 -0
  54. package/lib/types-esm/constants/jsonSchemaProperties.d.ts +7 -0
  55. package/lib/types-esm/decorators/class/children.d.ts +11 -0
  56. package/lib/types-esm/decorators/class/discriminatorValue.d.ts +42 -0
  57. package/lib/types-esm/decorators/collections/collectionContains.d.ts +21 -0
  58. package/lib/types-esm/decorators/collections/collectionOf.d.ts +101 -0
  59. package/lib/types-esm/decorators/collections/maxItems.d.ts +48 -0
  60. package/lib/types-esm/decorators/collections/maxProperties.d.ts +71 -0
  61. package/lib/types-esm/decorators/collections/minItems.d.ts +52 -0
  62. package/lib/types-esm/decorators/collections/minProperties.d.ts +70 -0
  63. package/lib/types-esm/decorators/collections/uniqueItems.d.ts +51 -0
  64. package/lib/types-esm/decorators/common/additionalProperties.d.ts +11 -0
  65. package/lib/types-esm/decorators/common/allOf.d.ts +13 -0
  66. package/lib/types-esm/decorators/common/allow.d.ts +28 -0
  67. package/lib/types-esm/decorators/common/any.d.ts +38 -0
  68. package/lib/types-esm/decorators/common/anyOf.d.ts +17 -0
  69. package/lib/types-esm/decorators/common/const.d.ts +61 -0
  70. package/lib/types-esm/decorators/common/customKey.d.ts +26 -0
  71. package/lib/types-esm/decorators/common/default.d.ts +41 -0
  72. package/lib/types-esm/decorators/common/defaultMsg.d.ts +32 -0
  73. package/lib/types-esm/decorators/common/description.d.ts +53 -0
  74. package/lib/types-esm/decorators/common/discriminatorKey.d.ts +1 -0
  75. package/lib/types-esm/decorators/common/enum.d.ts +101 -0
  76. package/lib/types-esm/decorators/common/errorMsg.d.ts +6 -0
  77. package/lib/types-esm/decorators/common/example.d.ts +11 -0
  78. package/lib/types-esm/decorators/common/examples.d.ts +12 -0
  79. package/lib/types-esm/decorators/common/exclusiveMaximum.d.ts +70 -0
  80. package/lib/types-esm/decorators/common/exclusiveMinimum.d.ts +70 -0
  81. package/lib/types-esm/decorators/common/format.d.ts +466 -0
  82. package/lib/types-esm/decorators/common/forwardGroups.d.ts +10 -0
  83. package/lib/types-esm/decorators/common/groups.d.ts +12 -0
  84. package/lib/types-esm/decorators/common/hidden.d.ts +32 -0
  85. package/lib/types-esm/decorators/common/ignore.d.ts +59 -0
  86. package/lib/types-esm/decorators/common/integer.d.ts +61 -0
  87. package/lib/types-esm/decorators/common/jsonEntityFn.d.ts +21 -0
  88. package/lib/types-esm/decorators/common/maxLength.d.ts +77 -0
  89. package/lib/types-esm/decorators/common/maximum.d.ts +139 -0
  90. package/lib/types-esm/decorators/common/minLength.d.ts +78 -0
  91. package/lib/types-esm/decorators/common/minimum.d.ts +137 -0
  92. package/lib/types-esm/decorators/common/multipleOf.d.ts +69 -0
  93. package/lib/types-esm/decorators/common/name.d.ts +32 -0
  94. package/lib/types-esm/decorators/common/nullable.d.ts +25 -0
  95. package/lib/types-esm/decorators/common/oneOf.d.ts +17 -0
  96. package/lib/types-esm/decorators/common/optional.d.ts +10 -0
  97. package/lib/types-esm/decorators/common/pattern.d.ts +94 -0
  98. package/lib/types-esm/decorators/common/property.d.ts +11 -0
  99. package/lib/types-esm/decorators/common/readOnly.d.ts +11 -0
  100. package/lib/types-esm/decorators/common/recordOf.d.ts +46 -0
  101. package/lib/types-esm/decorators/common/required.d.ts +44 -0
  102. package/lib/types-esm/decorators/common/requiredGroups.d.ts +10 -0
  103. package/lib/types-esm/decorators/common/schema.d.ts +53 -0
  104. package/lib/types-esm/decorators/common/title.d.ts +39 -0
  105. package/lib/types-esm/decorators/common/typeError.d.ts +8 -0
  106. package/lib/types-esm/decorators/common/writeOnly.d.ts +11 -0
  107. package/lib/types-esm/decorators/config/jsonEntityComponent.d.ts +10 -0
  108. package/lib/types-esm/decorators/generics/genericOf.d.ts +76 -0
  109. package/lib/types-esm/decorators/generics/generics.d.ts +14 -0
  110. package/lib/types-esm/decorators/operations/acceptMime.d.ts +19 -0
  111. package/lib/types-esm/decorators/operations/consumes.d.ts +19 -0
  112. package/lib/types-esm/decorators/operations/contentType.d.ts +20 -0
  113. package/lib/types-esm/decorators/operations/deprecated.d.ts +23 -0
  114. package/lib/types-esm/decorators/operations/header.d.ts +49 -0
  115. package/lib/types-esm/decorators/operations/in.d.ts +64 -0
  116. package/lib/types-esm/decorators/operations/inFile.d.ts +25 -0
  117. package/lib/types-esm/decorators/operations/location.d.ts +22 -0
  118. package/lib/types-esm/decorators/operations/operation.d.ts +60 -0
  119. package/lib/types-esm/decorators/operations/operationId.d.ts +10 -0
  120. package/lib/types-esm/decorators/operations/operationPath.d.ts +21 -0
  121. package/lib/types-esm/decorators/operations/partial.d.ts +10 -0
  122. package/lib/types-esm/decorators/operations/path.d.ts +15 -0
  123. package/lib/types-esm/decorators/operations/produces.d.ts +26 -0
  124. package/lib/types-esm/decorators/operations/publish.d.ts +1 -0
  125. package/lib/types-esm/decorators/operations/redirect.d.ts +52 -0
  126. package/lib/types-esm/decorators/operations/returns.d.ts +267 -0
  127. package/lib/types-esm/decorators/operations/route.d.ts +133 -0
  128. package/lib/types-esm/decorators/operations/security.d.ts +23 -0
  129. package/lib/types-esm/decorators/operations/status.d.ts +127 -0
  130. package/lib/types-esm/decorators/operations/subscribe.d.ts +1 -0
  131. package/lib/types-esm/decorators/operations/summary.d.ts +20 -0
  132. package/lib/types-esm/decorators/operations/tags.d.ts +23 -0
  133. package/lib/types-esm/decorators/operations/view.d.ts +23 -0
  134. package/lib/types-esm/domain/DecoratorContext.d.ts +28 -0
  135. package/lib/types-esm/domain/JsonAliasMap.d.ts +12 -0
  136. package/lib/types-esm/domain/JsonClassStore.d.ts +12 -0
  137. package/lib/types-esm/domain/JsonDiscriminator.d.ts +18 -0
  138. package/lib/types-esm/domain/JsonEntityStore.d.ts +110 -0
  139. package/lib/types-esm/domain/JsonFormatTypes.d.ts +17 -0
  140. package/lib/types-esm/domain/JsonLazyRef.d.ts +9 -0
  141. package/lib/types-esm/domain/JsonMap.d.ts +9 -0
  142. package/lib/types-esm/domain/JsonMedia.d.ts +11 -0
  143. package/lib/types-esm/domain/JsonMethodStore.d.ts +92 -0
  144. package/lib/types-esm/domain/JsonOperation.d.ts +51 -0
  145. package/lib/types-esm/domain/JsonOperationPathsMap.d.ts +7 -0
  146. package/lib/types-esm/domain/JsonOperationRoute.d.ts +25 -0
  147. package/lib/types-esm/domain/JsonParameter.d.ts +22 -0
  148. package/lib/types-esm/domain/JsonParameterStore.d.ts +52 -0
  149. package/lib/types-esm/domain/JsonParameterTypes.d.ts +16 -0
  150. package/lib/types-esm/domain/JsonPropertyStore.d.ts +32 -0
  151. package/lib/types-esm/domain/JsonRequestBody.d.ts +12 -0
  152. package/lib/types-esm/domain/JsonResponse.d.ts +18 -0
  153. package/lib/types-esm/domain/JsonSchema.d.ts +340 -0
  154. package/lib/types-esm/domain/SpecTypes.d.ts +6 -0
  155. package/lib/types-esm/hooks/alterIgnore.d.ts +10 -0
  156. package/lib/types-esm/hooks/alterOneOf.d.ts +3 -0
  157. package/lib/types-esm/hooks/alterRequiredGroups.d.ts +6 -0
  158. package/lib/types-esm/index.d.ts +182 -0
  159. package/lib/types-esm/interfaces/IgnoreCallback.d.ts +4 -0
  160. package/lib/types-esm/interfaces/JsonHookContext.d.ts +17 -0
  161. package/lib/types-esm/interfaces/JsonOpenSpec.d.ts +9 -0
  162. package/lib/types-esm/interfaces/JsonSchemaOptions.d.ts +30 -0
  163. package/lib/types-esm/registries/JsonSchemaMapperContainer.d.ts +21 -0
  164. package/lib/types-esm/registries/enumRegistries.d.ts +2 -0
  165. package/lib/types-esm/utils/buildPath.d.ts +6 -0
  166. package/lib/types-esm/utils/concatParameters.d.ts +4 -0
  167. package/lib/types-esm/utils/concatPath.d.ts +1 -0
  168. package/lib/types-esm/utils/defineStatusModel.d.ts +3 -0
  169. package/lib/types-esm/utils/from.d.ts +190 -0
  170. package/lib/types-esm/utils/generateSpec.d.ts +16 -0
  171. package/lib/types-esm/utils/generics.d.ts +50 -0
  172. package/lib/types-esm/utils/getComputedType.d.ts +5 -0
  173. package/lib/types-esm/utils/getInheritedStores.d.ts +8 -0
  174. package/lib/types-esm/utils/getJsonEntityStore.d.ts +15 -0
  175. package/lib/types-esm/utils/getJsonPathParameters.d.ts +7 -0
  176. package/lib/types-esm/utils/getJsonSchema.d.ts +4 -0
  177. package/lib/types-esm/utils/getJsonType.d.ts +5 -0
  178. package/lib/types-esm/utils/getOperationsRoutes.d.ts +10 -0
  179. package/lib/types-esm/utils/getOperationsStores.d.ts +6 -0
  180. package/lib/types-esm/utils/getPropertiesStores.d.ts +20 -0
  181. package/lib/types-esm/utils/getSpec.d.ts +34 -0
  182. package/lib/types-esm/utils/getSpecType.d.ts +12 -0
  183. package/lib/types-esm/utils/isSuccessStatus.d.ts +2 -0
  184. package/lib/types-esm/utils/mapHeaders.d.ts +9 -0
  185. package/lib/types-esm/utils/mapOpenSpec.d.ts +10 -0
  186. package/lib/types-esm/utils/mapOpenSpec2.d.ts +9 -0
  187. package/lib/types-esm/utils/mapOpenSpec3.d.ts +8 -0
  188. package/lib/types-esm/utils/mapOpenSpecInfo.d.ts +6 -0
  189. package/lib/types-esm/utils/mapOperationOptions.d.ts +5 -0
  190. package/lib/types-esm/utils/matchGroups.d.ts +4 -0
  191. package/lib/types-esm/utils/mergeSpec.d.ts +23 -0
  192. package/lib/types-esm/utils/operationIdFormatter.d.ts +6 -0
  193. package/lib/types-esm/utils/ref.d.ts +14 -0
  194. package/lib/types-esm/utils/removeHiddenOperation.d.ts +2 -0
  195. package/lib/types-esm/utils/serializeEnumValues.d.ts +5 -0
  196. package/lib/types-esm/utils/somethingOf.d.ts +1 -0
  197. package/lib/types-esm/utils/toJsonMapCollection.d.ts +7 -0
  198. package/lib/types-esm/utils/toJsonRegex.d.ts +5 -0
  199. package/lib/types-esm/utils/transformToOS2.d.ts +25 -0
  200. package/lib/types-esm/utils/withErrorMsg.d.ts +6 -0
  201. package/package.json +21 -17
  202. package/vitest.config.mts +21 -0
  203. package/jest.config.js +0 -21
  204. package/lib/cjs/package.json +0 -3
  205. package/lib/esm/package.json +0 -3
  206. package/tsconfig.esm.json +0 -36
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Constructs a json schema object type whose property keys are keys and whose property values are type.
3
+ *
4
+ * ## Example
5
+ *
6
+ * ```typescript
7
+ * type keys = 'one' | 'two';
8
+ *
9
+ * class Part {
10
+ * prop: string;
11
+ * }
12
+ *
13
+ * type Parts = Record<keys, Part>;
14
+ *
15
+ * class Test {
16
+ * @RecordOf(Part, 'one', 'two')
17
+ * parts: Parts;
18
+ * }
19
+ * ```
20
+ *
21
+ * Will produce:
22
+ *
23
+ * ```json
24
+ * {
25
+ * "type": "object",
26
+ * "properties": {
27
+ * "one": {
28
+ * "$ref": "#/components/schemas/Part"
29
+ * },
30
+ * "two": {
31
+ * "$ref": "#/components/schemas/Part"
32
+ * },
33
+ * },
34
+ * }
35
+ * ```
36
+ *
37
+ * @param model
38
+ * @param keys
39
+ * @decorator
40
+ * @validation
41
+ * @swagger
42
+ * @schema
43
+ * @classDecorator
44
+ * @input
45
+ */
46
+ export declare function RecordOf(model: any, ...keys: string[]): (...args: any[]) => any;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Add required annotation on Property or Parameter.
3
+ *
4
+ * The @@Required@@ decorator can be used on two cases.
5
+ *
6
+ * To decorate a parameters:
7
+ *
8
+ * ```typescript
9
+ * @Post("/")
10
+ * async method(@Required() @BodyParams("field") field: string) {}
11
+ * ```
12
+ *
13
+ * To decorate a model:
14
+ *
15
+ * ```typescript
16
+ * class Model {
17
+ * @Required()
18
+ * field: string;
19
+ * }
20
+ * ```
21
+ *
22
+ * ::: tip
23
+ * Required will throw a BadRequest when the given value is `null`, an empty string or `undefined`.
24
+ * :::
25
+ *
26
+ * ### Allow values
27
+ *
28
+ * In some case, you didn't want trigger a BadRequest when the value is an empty string for example.
29
+ * The decorator `@Allow()`, allow you to configure a value list for which there will be no exception.
30
+ *
31
+ * ```typescript
32
+ * class Model {
33
+ * @Allow("") // add automatically required flag
34
+ * field: string;
35
+ * }
36
+ * ```
37
+ *
38
+ * @decorator
39
+ * @validation
40
+ * @swagger
41
+ * @schema
42
+ * @input
43
+ */
44
+ export declare const Required: import("../../utils/withErrorMsg.js").ErrorChainedDecorator<(required?: boolean, ...allowedRequiredValues: any[]) => any>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Apply groups validation strategy for required property.
3
+ *
4
+ * @decorator
5
+ * @validation
6
+ * @swagger
7
+ * @schema
8
+ * @input
9
+ */
10
+ export declare function RequiredGroups(...groups: string[]): PropertyDecorator;
@@ -0,0 +1,53 @@
1
+ import { JsonSchema, JsonSchemaObject } from "../../domain/JsonSchema.js";
2
+ import { SpecTypes } from "../../domain/SpecTypes.js";
3
+ /**
4
+ * Write data formatted to JsonSchema.
5
+ *
6
+ * ## Example
7
+ *
8
+ * ```typescript
9
+ * @Schema({title: "test"})
10
+ * class Model {
11
+ * @Schema({formatMinimum: "1987-10-24"})
12
+ * @Format("date")
13
+ * birthDate: Date
14
+ * }
15
+ * ```
16
+ *
17
+ * Will produce:
18
+ *
19
+ * ```json
20
+ * {
21
+ * "type": "object",
22
+ * "title": "test",
23
+ * "properties": {
24
+ * "birthdate": {
25
+ * "type": "string",
26
+ * "format": "date",
27
+ * "formatMinimum": "1987-10-24"
28
+ * }
29
+ * }
30
+ * }
31
+ * ```
32
+ *
33
+ * @param partialSchema
34
+ * @decorator
35
+ * @validation
36
+ * @swagger
37
+ * @schema
38
+ * @classDecorator
39
+ * @input
40
+ */
41
+ export declare function Schema(partialSchema: Partial<JsonSchemaObject> | JsonSchema): (...args: any[]) => any;
42
+ /**
43
+ * Apply specific schema depending on the spec version
44
+ * @param specType
45
+ * @param schema
46
+ * @decorator
47
+ * @validation
48
+ * @swagger
49
+ * @schema
50
+ * @classDecorator
51
+ * @input
52
+ */
53
+ export declare function For(specType: SpecTypes, schema: any): (...args: any[]) => any;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Add title metadata on the decorated element.
3
+ *
4
+ * ::: warning
5
+ * For v6 user, use @@Title@@ from @tsed/schema instead of @tsed/common.
6
+ * :::
7
+ *
8
+ * ## Example
9
+ *
10
+ * ```typescript
11
+ * class Model {
12
+ * @Title("title")
13
+ * id: string;
14
+ * }
15
+ * ```
16
+ *
17
+ * Will produce:
18
+ *
19
+ * ```json
20
+ * {
21
+ * "type": "object",
22
+ * "properties": {
23
+ * "id": {
24
+ * "type": "string",
25
+ * "title": "title"
26
+ * }
27
+ * }
28
+ * }
29
+ * ```
30
+ *
31
+ * @param {string} title
32
+ * @decorator
33
+ * @validation
34
+ * @swagger
35
+ * @schema
36
+ * @classDecorator
37
+ * @input
38
+ */
39
+ export declare function Title(title: string): (...args: 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;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Set the property as WriteOnly.
3
+ *
4
+ * @returns {Function}
5
+ * @decorator
6
+ * @validation
7
+ * @property
8
+ * @parameter
9
+ * @schema
10
+ */
11
+ export declare function WriteOnly(writeOnly?: boolean): (...args: any[]) => any;
@@ -0,0 +1,10 @@
1
+ import { DecoratorTypes, Type } from "@tsed/core";
2
+ import { JsonEntityStore } from "../../domain/JsonEntityStore.js";
3
+ /**
4
+ * Declare a new JsonEntityStore class for a specific decorator type.
5
+ *
6
+ * @ignore
7
+ * @param type
8
+ * @decorator
9
+ */
10
+ export declare function JsonEntityComponent(type: DecoratorTypes): (target: Type<JsonEntityStore>) => void;
@@ -0,0 +1,76 @@
1
+ import { GenericValue } from "../../utils/generics.js";
2
+ export interface GenericOfChainedDecorators {
3
+ (...args: any): any;
4
+ /**
5
+ * Declare a nested generic models
6
+ * @param generics
7
+ */
8
+ Nested(...generics: GenericValue[]): this;
9
+ }
10
+ /**
11
+ * Set the types of a Generic class.
12
+ *
13
+ * ## Example
14
+ *
15
+ * ```typescript
16
+ * class Product {
17
+ * @Property()
18
+ * label: string;
19
+ * }
20
+ *
21
+ * @Generics("T")
22
+ * class Paginated<T> {
23
+ * @CollectionOf("T")
24
+ * data: T[];
25
+ *
26
+ * @Property()
27
+ * totalCount: number;
28
+ * }
29
+ *
30
+ * class Payload {
31
+ * @GenericOf(Product)
32
+ * products: Paginated<Product>;
33
+ * }
34
+ * ```
35
+ *
36
+ * ## Example with nested generics
37
+ *
38
+ * ```typescript
39
+ * class Product {
40
+ * @Property()
41
+ * label: string;
42
+ * }
43
+ *
44
+ * @Generics("T")
45
+ * class Paginated<T> {
46
+ * @CollectionOf("T")
47
+ * data: T[];
48
+ *
49
+ * @Property()
50
+ * totalCount: number;
51
+ * }
52
+ *
53
+ * @Generics("D")
54
+ * class Submission<D> {
55
+ * @Property()
56
+ * _id: string;
57
+ *
58
+ * @Property("D")
59
+ * data: D;
60
+ * }
61
+ *
62
+ * class Payload {
63
+ * @GenericOf(Submissions).Nested(Product)
64
+ * submissions: Paginated<Submission<Product>>;
65
+ * }
66
+ * ```
67
+ *
68
+ * @param {Type<any>[]} generics
69
+ * @decorator
70
+ * @validation
71
+ * @swagger
72
+ * @schema
73
+ * @input
74
+ * @generics
75
+ */
76
+ export declare function GenericOf(...generics: GenericValue[]): GenericOfChainedDecorators;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Define generics list. This list is used by @@GenericOf@@ and the @@getJsonSchema@@ function to build the correct JsonSchema.
3
+ *
4
+ * See @@GenericOf@@ decorator for more details.
5
+ *
6
+ * @param generics
7
+ * @decorator
8
+ * @validation
9
+ * @swagger
10
+ * @schema
11
+ * @input
12
+ * @generics
13
+ */
14
+ export declare function Generics(...generics: string[]): (target: any) => void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.
3
+ *
4
+ * ```typescript
5
+ * @Controller('/mypath')
6
+ * export class MyCtrl {
7
+ *
8
+ * @Get('/')
9
+ * @AcceptMime('application/json')
10
+ * public getResource(){}
11
+ * }
12
+ * ```
13
+ *
14
+ * @param mimes
15
+ * @decorator
16
+ * @operation
17
+ * @response
18
+ */
19
+ export declare function AcceptMime(...mimes: string[]): Function;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Add consumes metadata on the decorated element.
3
+ *
4
+ * ## Examples
5
+ *
6
+ * ```typescript
7
+ * class Model {
8
+ * @Consumes("application/x-www-form-urlencoded")
9
+ * id: string;
10
+ * }
11
+ * ```
12
+ *
13
+ * @param consumes
14
+ * @decorator
15
+ * @swagger
16
+ * @classDecorator
17
+ * @operation
18
+ */
19
+ export declare function Consumes(...consumes: string[]): (...args: any[]) => any;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Sets the Content-Type HTTP header to the MIME type as determined by mime.lookup() for the specified type.
3
+ * If type contains the “/” character, then it sets the `Content-Type` to type.
4
+ *
5
+ * ```typescript
6
+ * @ContentType('.html'); // => 'text/html'
7
+ * @ContentType('html'); // => 'text/html'
8
+ * @ContentType('json'); // => 'application/json'
9
+ * @ContentType('application/json'); // => 'application/json'
10
+ * @ContentType('png'); // => image/png
11
+ * private myMethod() {}
12
+ * ```
13
+ *
14
+ * @param type
15
+ * @decorator
16
+ * @operation
17
+ * @response
18
+ * @headers
19
+ */
20
+ export declare function ContentType(type: string): import("./returns.js").ReturnsChainedDecorators;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Add deprecated metadata on the decorated element.
3
+ *
4
+ * ## Examples
5
+ *
6
+ * ```typescript
7
+ *
8
+ * @Deprecated()
9
+ * class MyCtrl {
10
+ * @Deprecated()
11
+ * @Get("/")
12
+ * method(){
13
+ * }
14
+ * }
15
+ * ```
16
+ *
17
+ * @param deprecated
18
+ * @decorator
19
+ * @swagger
20
+ * @schema
21
+ * @operation
22
+ */
23
+ export declare function Deprecated(deprecated?: boolean): (...args: any[]) => any;
@@ -0,0 +1,49 @@
1
+ import { JsonHeader, JsonHeaders } from "../../interfaces/JsonOpenSpec.js";
2
+ /**
3
+ * Sets the response’s HTTP header field to value. To set multiple fields at once, pass an object as the parameter.
4
+ *
5
+ * ```typescript
6
+ * @Header('Content-Type', 'text/plain');
7
+ * private myMethod() {}
8
+ *
9
+ * @Status(204)
10
+ * @Header({
11
+ * "Content-Type": "text/plain",
12
+ * "Content-Length": 123,
13
+ * "ETag": {
14
+ * "value": "12345",
15
+ * "description": "header description"
16
+ * }
17
+ * })
18
+ * private myMethod() {}
19
+ * ```
20
+ *
21
+ * This example will produce the swagger responses object:
22
+ *
23
+ * ```json
24
+ * {
25
+ * "responses": {
26
+ * "204": {
27
+ * "description": "Description",
28
+ * "headers": {
29
+ * "Content-Type": {
30
+ * "type": "string"
31
+ * },
32
+ * "Content-Length": {
33
+ * "type": "number"
34
+ * },
35
+ * "ETag": {
36
+ * "type": "string",
37
+ * "description": "header description"
38
+ * }
39
+ * }
40
+ * }
41
+ * }
42
+ * }
43
+ * ```
44
+ *
45
+ * @decorator
46
+ * @operation
47
+ * @response
48
+ */
49
+ export declare function Header(headers: string | number | JsonHeaders, value?: string | number | JsonHeader): Function;
@@ -0,0 +1,64 @@
1
+ import { Type } from "@tsed/core";
2
+ import { JsonParameterTypes } from "../../domain/JsonParameterTypes.js";
3
+ import { JsonSchema, JsonSchemaObject } from "../../domain/JsonSchema.js";
4
+ export interface InChainedDecorators {
5
+ <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
6
+ (target: Object, propertyKey: string | symbol, parameterIndex: number): void;
7
+ (target: Function): void;
8
+ /**
9
+ * Type of this in parameter
10
+ * @param type
11
+ */
12
+ Type(type: Type<any>): this;
13
+ /**
14
+ *
15
+ * @param name
16
+ */
17
+ Name(name: string): this;
18
+ /**
19
+ *
20
+ * @param description
21
+ */
22
+ Description(description: string): this;
23
+ /**
24
+ *
25
+ * @param required
26
+ */
27
+ Required(required?: boolean): this;
28
+ /**
29
+ * Add pattern constraint. Only available for OPENAPI.
30
+ * @param pattern
31
+ */
32
+ Pattern(pattern: string | RegExp): this;
33
+ /**
34
+ * Add custom schema.
35
+ * @param schema
36
+ */
37
+ Schema(schema: Partial<JsonSchemaObject | JsonSchema>): this;
38
+ }
39
+ /**
40
+ * Add a input parameter.
41
+ *
42
+ * ::: warning
43
+ * Don't use decorator with Ts.ED application to decorate parameters. Use @@BodyParams@@, @@PathParams@@, etc... instead.
44
+ * But you can use this decorator on Method, to add extra in parameters like Authorization header.
45
+ *
46
+ * ```typescript
47
+ * @Controller("/")
48
+ * class MyController {
49
+ * @Get("/")
50
+ * @In("header").Type(String).Name("Authorization").Required()
51
+ * method() {
52
+ * }
53
+ * }
54
+ * ```
55
+ * :::
56
+ *
57
+ * @param inType
58
+ * @decorator
59
+ * @swagger
60
+ * @schema
61
+ * @input
62
+ * @operation
63
+ */
64
+ export declare function In(inType: JsonParameterTypes | string): InChainedDecorators;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Add a input file parameter.
3
+ *
4
+ * ::: warning
5
+ * Don't use decorator with Ts.ED application to decorate parameters. Use @@BodyParams@@, @@PathParams@@, etc... instead.
6
+ * But you can use this decorator on Method, to add extra in parameters like Authorization header.
7
+ *
8
+ * ```typescript
9
+ * @Controller("/")
10
+ * class MyController {
11
+ * @Post("/")
12
+ * method(@InFile("file1") file: any) {
13
+ * }
14
+ * }
15
+ * ```
16
+ * :::
17
+ *
18
+ * @decorator
19
+ * @swagger
20
+ * @schema
21
+ * @input
22
+ * @operation
23
+ * @param name
24
+ */
25
+ export declare function InFile(name: string): ParameterDecorator;
@@ -0,0 +1,22 @@
1
+ import { JsonHeader } from "../../interfaces/JsonOpenSpec.js";
2
+ /**
3
+ * Sets the response Location HTTP header to the specified path parameter.
4
+ *
5
+ * ```typescript
6
+ * @Location('/foo/bar', {description: 'Location to the next step'})
7
+ * @Location('http://example.com')
8
+ * @Location('back')
9
+ * private myMethod() {
10
+ *
11
+ * }
12
+ * ```
13
+ *
14
+ * A path value of “back” has a special meaning, it refers to the URL specified in the `Referer` header of the request. If the `Referer` header was not specified, it refers to “/”.
15
+ *
16
+ * @param location
17
+ * @param meta
18
+ * @returns {Function}
19
+ * @decorator
20
+ * @operation
21
+ */
22
+ export declare function Location(location: string, meta?: JsonHeader): import("./returns.js").ReturnsChainedDecorators;
@@ -0,0 +1,60 @@
1
+ import { OperationVerbs } from "../../constants/OperationVerbs.js";
2
+ export interface RouteChainedDecorators {
3
+ <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
4
+ /**
5
+ * @param string
6
+ * @constructor
7
+ */
8
+ Path(string: string): this;
9
+ /**
10
+ * Set the operation method
11
+ * @param method
12
+ */
13
+ Method(method: OperationVerbs | string): this;
14
+ /**
15
+ * Set the operation id
16
+ * @param id
17
+ */
18
+ Id(id: string): this;
19
+ /**
20
+ * Set the operation id
21
+ * @param name
22
+ */
23
+ Name(name: string): this;
24
+ /**
25
+ *
26
+ * @param description
27
+ */
28
+ Description(description: string): this;
29
+ /**
30
+ * Summary
31
+ * @constructor
32
+ * @param Summary
33
+ */
34
+ Summary(Summary: string): this;
35
+ Use(...args: any[]): this;
36
+ UseAfter(...args: any[]): this;
37
+ UseBefore(...args: any[]): this;
38
+ }
39
+ /**
40
+ * Describe a new route with a method and path.
41
+ *
42
+ * ```typescript
43
+ * @Controller('/')
44
+ * export class Ctrl {
45
+ *
46
+ * @Route('GET', '/')
47
+ * get() { }
48
+ * }
49
+ *
50
+ * ```
51
+ *
52
+ * @returns {Function}
53
+ * @param method
54
+ * @param path
55
+ * @param args
56
+ * @decorator
57
+ * @operation
58
+ */
59
+ export declare function Operation(method: string, path: string, ...args: any[]): RouteChainedDecorators;
60
+ export declare function Operation(...args: any[]): RouteChainedDecorators;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Set a swagger operationId explicitly.
3
+ *
4
+ * @param operationId
5
+ * @decorator
6
+ * @swagger
7
+ * @schema
8
+ * @operation
9
+ */
10
+ export declare function OperationId(operationId: string): (...args: any[]) => any;
@@ -0,0 +1,21 @@
1
+ import { OperationVerbs } from "../../constants/OperationVerbs.js";
2
+ /**
3
+ * Declare new Operation with his path and http method.
4
+ *
5
+ * ::: warning
6
+ * Don't use decorator with Ts.ED application.
7
+ *
8
+ * Use theses decorators instead:
9
+ *
10
+ * <ApiList query="status.includes('decorator') && status.includes('httpMethod')" />
11
+ *
12
+ * :::
13
+ *
14
+ * @param method
15
+ * @param path
16
+ * @decorator
17
+ * @swagger
18
+ * @schema
19
+ * @operation
20
+ */
21
+ export declare function OperationPath(method: OperationVerbs | string, path?: string | RegExp): (...args: any[]) => any;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Apply Partial group strategy on the input model
3
+ *
4
+ * @decorator
5
+ * @validation
6
+ * @swagger
7
+ * @schema
8
+ * @input
9
+ */
10
+ export declare function Partial(): ParameterDecorator;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Set class path to expose all endpoints
3
+ *
4
+ * ::: warning
5
+ * Don't use this decorator to change the path if you develop your application with Ts.ED.
6
+ * :::
7
+ *
8
+ * @param path
9
+ * @decorator
10
+ * @swagger
11
+ * @schema
12
+ * @classDecorator
13
+ * @operation
14
+ */
15
+ export declare function Path(path: string): (...args: any[]) => any;