@tsed/schema 6.95.9 → 6.95.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/domain/JsonSchema.js +17 -4
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/esm/domain/JsonSchema.js +17 -4
- package/lib/esm/domain/JsonSchema.js.map +1 -1
- package/package.json +5 -5
- package/lib/cjs/components/anyMapper.d.ts +0 -2
- package/lib/cjs/components/classMapper.d.ts +0 -3
- package/lib/cjs/components/genericsMapper.d.ts +0 -5
- package/lib/cjs/components/index.d.ts +0 -11
- package/lib/cjs/components/inheritedClassMapper.d.ts +0 -5
- package/lib/cjs/components/itemMapper.d.ts +0 -2
- package/lib/cjs/components/lazyRefMapper.d.ts +0 -3
- package/lib/cjs/components/mapMapper.d.ts +0 -9
- package/lib/cjs/components/objectMapper.d.ts +0 -8
- package/lib/cjs/components/ofMapper.d.ts +0 -3
- package/lib/cjs/components/propertiesMapper.d.ts +0 -3
- package/lib/cjs/components/schemaMapper.d.ts +0 -3
- package/lib/cjs/constants/httpMethods.d.ts +0 -12
- package/lib/cjs/constants/httpStatusMessages.d.ts +0 -272
- package/lib/cjs/decorators/class/children.d.ts +0 -11
- package/lib/cjs/decorators/collections/collectionContains.d.ts +0 -21
- package/lib/cjs/decorators/collections/collectionOf.d.ts +0 -101
- package/lib/cjs/decorators/collections/maxItems.d.ts +0 -47
- package/lib/cjs/decorators/collections/maxProperties.d.ts +0 -70
- package/lib/cjs/decorators/collections/minItems.d.ts +0 -51
- package/lib/cjs/decorators/collections/minProperties.d.ts +0 -69
- package/lib/cjs/decorators/collections/uniqueItems.d.ts +0 -50
- package/lib/cjs/decorators/common/additionalProperties.d.ts +0 -11
- package/lib/cjs/decorators/common/allOf.d.ts +0 -13
- package/lib/cjs/decorators/common/allow.d.ts +0 -28
- package/lib/cjs/decorators/common/any.d.ts +0 -38
- package/lib/cjs/decorators/common/anyOf.d.ts +0 -17
- package/lib/cjs/decorators/common/const.d.ts +0 -61
- package/lib/cjs/decorators/common/customKey.d.ts +0 -26
- package/lib/cjs/decorators/common/default.d.ts +0 -41
- package/lib/cjs/decorators/common/description.d.ts +0 -53
- package/lib/cjs/decorators/common/enum.d.ts +0 -98
- package/lib/cjs/decorators/common/example.d.ts +0 -11
- package/lib/cjs/decorators/common/examples.d.ts +0 -12
- package/lib/cjs/decorators/common/exclusiveMaximum.d.ts +0 -69
- package/lib/cjs/decorators/common/exclusiveMinimum.d.ts +0 -69
- package/lib/cjs/decorators/common/format.d.ts +0 -459
- package/lib/cjs/decorators/common/forwardGroups.d.ts +0 -10
- package/lib/cjs/decorators/common/groups.d.ts +0 -11
- package/lib/cjs/decorators/common/hidden.d.ts +0 -32
- package/lib/cjs/decorators/common/ignore.d.ts +0 -58
- package/lib/cjs/decorators/common/integer.d.ts +0 -61
- package/lib/cjs/decorators/common/jsonEntityFn.d.ts +0 -21
- package/lib/cjs/decorators/common/maxLength.d.ts +0 -76
- package/lib/cjs/decorators/common/maximum.d.ts +0 -138
- package/lib/cjs/decorators/common/minLength.d.ts +0 -77
- package/lib/cjs/decorators/common/minimum.d.ts +0 -136
- package/lib/cjs/decorators/common/multipleOf.d.ts +0 -68
- package/lib/cjs/decorators/common/name.d.ts +0 -32
- package/lib/cjs/decorators/common/nullable.d.ts +0 -25
- package/lib/cjs/decorators/common/oneOf.d.ts +0 -17
- package/lib/cjs/decorators/common/optional.d.ts +0 -10
- package/lib/cjs/decorators/common/pattern.d.ts +0 -93
- package/lib/cjs/decorators/common/property.d.ts +0 -11
- package/lib/cjs/decorators/common/readOnly.d.ts +0 -11
- package/lib/cjs/decorators/common/required.d.ts +0 -44
- package/lib/cjs/decorators/common/requiredGroups.d.ts +0 -10
- package/lib/cjs/decorators/common/schema.d.ts +0 -53
- package/lib/cjs/decorators/common/title.d.ts +0 -39
- package/lib/cjs/decorators/common/writeOnly.d.ts +0 -11
- package/lib/cjs/decorators/config/jsonEntityComponent.d.ts +0 -10
- package/lib/cjs/decorators/generics/genericOf.d.ts +0 -76
- package/lib/cjs/decorators/generics/generics.d.ts +0 -14
- package/lib/cjs/decorators/index.d.ts +0 -68
- package/lib/cjs/decorators/operations/consumes.d.ts +0 -19
- package/lib/cjs/decorators/operations/contentType.d.ts +0 -20
- package/lib/cjs/decorators/operations/deprecated.d.ts +0 -23
- package/lib/cjs/decorators/operations/header.d.ts +0 -49
- package/lib/cjs/decorators/operations/in.d.ts +0 -64
- package/lib/cjs/decorators/operations/inFile.d.ts +0 -25
- package/lib/cjs/decorators/operations/location.d.ts +0 -22
- package/lib/cjs/decorators/operations/operationId.d.ts +0 -10
- package/lib/cjs/decorators/operations/operationPath.d.ts +0 -21
- package/lib/cjs/decorators/operations/partial.d.ts +0 -10
- package/lib/cjs/decorators/operations/path.d.ts +0 -15
- package/lib/cjs/decorators/operations/produces.d.ts +0 -26
- package/lib/cjs/decorators/operations/redirect.d.ts +0 -52
- package/lib/cjs/decorators/operations/returns.d.ts +0 -253
- package/lib/cjs/decorators/operations/route.d.ts +0 -188
- package/lib/cjs/decorators/operations/security.d.ts +0 -23
- package/lib/cjs/decorators/operations/status.d.ts +0 -127
- package/lib/cjs/decorators/operations/summary.d.ts +0 -20
- package/lib/cjs/decorators/operations/tags.d.ts +0 -23
- package/lib/cjs/domain/DecoratorContext.d.ts +0 -28
- package/lib/cjs/domain/JsonAliasMap.d.ts +0 -12
- package/lib/cjs/domain/JsonClassStore.d.ts +0 -12
- package/lib/cjs/domain/JsonEntityStore.d.ts +0 -135
- package/lib/cjs/domain/JsonFormatTypes.d.ts +0 -17
- package/lib/cjs/domain/JsonLazyRef.d.ts +0 -11
- package/lib/cjs/domain/JsonMap.d.ts +0 -7
- package/lib/cjs/domain/JsonMethodStore.d.ts +0 -40
- package/lib/cjs/domain/JsonOperation.d.ts +0 -51
- package/lib/cjs/domain/JsonOperationPathsMap.d.ts +0 -7
- package/lib/cjs/domain/JsonOperationRoute.d.ts +0 -24
- package/lib/cjs/domain/JsonParameter.d.ts +0 -22
- package/lib/cjs/domain/JsonParameterStore.d.ts +0 -30
- package/lib/cjs/domain/JsonParameterTypes.d.ts +0 -16
- package/lib/cjs/domain/JsonPropertyStore.d.ts +0 -23
- package/lib/cjs/domain/JsonRequestBody.d.ts +0 -11
- package/lib/cjs/domain/JsonResponse.d.ts +0 -22
- package/lib/cjs/domain/JsonSchema.d.ts +0 -337
- package/lib/cjs/domain/SpecTypes.d.ts +0 -5
- package/lib/cjs/domain/index.d.ts +0 -16
- package/lib/cjs/hooks/alterIgnore.d.ts +0 -9
- package/lib/cjs/hooks/alterOneOf.d.ts +0 -3
- package/lib/cjs/hooks/alterRequiredGroups.d.ts +0 -6
- package/lib/cjs/index.d.ts +0 -20
- package/lib/cjs/interfaces/IgnoreCallback.d.ts +0 -4
- package/lib/cjs/interfaces/JsonHookContext.d.ts +0 -17
- package/lib/cjs/interfaces/JsonOpenSpec.d.ts +0 -9
- package/lib/cjs/interfaces/JsonSchemaOptions.d.ts +0 -26
- package/lib/cjs/interfaces/index.d.ts +0 -4
- package/lib/cjs/registries/JsonSchemaMapperContainer.d.ts +0 -19
- package/lib/cjs/utils/buildPath.d.ts +0 -6
- package/lib/cjs/utils/concatParameters.d.ts +0 -4
- package/lib/cjs/utils/concatPath.d.ts +0 -1
- package/lib/cjs/utils/defineStatusModel.d.ts +0 -3
- package/lib/cjs/utils/from.d.ts +0 -189
- package/lib/cjs/utils/generics.d.ts +0 -50
- package/lib/cjs/utils/getComputedType.d.ts +0 -5
- package/lib/cjs/utils/getInheritedStores.d.ts +0 -8
- package/lib/cjs/utils/getJsonEntityStore.d.ts +0 -15
- package/lib/cjs/utils/getJsonPathParameters.d.ts +0 -7
- package/lib/cjs/utils/getJsonSchema.d.ts +0 -4
- package/lib/cjs/utils/getJsonType.d.ts +0 -5
- package/lib/cjs/utils/getOperationsRoutes.d.ts +0 -8
- package/lib/cjs/utils/getOperationsStores.d.ts +0 -6
- package/lib/cjs/utils/getPropertiesStores.d.ts +0 -20
- package/lib/cjs/utils/getRequiredProperties.d.ts +0 -6
- package/lib/cjs/utils/getSpec.d.ts +0 -49
- package/lib/cjs/utils/isJsonClass.d.ts +0 -4
- package/lib/cjs/utils/isSuccessStatus.d.ts +0 -2
- package/lib/cjs/utils/mapHeaders.d.ts +0 -9
- package/lib/cjs/utils/mapNullableType.d.ts +0 -3
- package/lib/cjs/utils/mapRouteOptions.d.ts +0 -5
- package/lib/cjs/utils/matchGroups.d.ts +0 -4
- package/lib/cjs/utils/mergeOperation.d.ts +0 -17
- package/lib/cjs/utils/mergeSpec.d.ts +0 -23
- package/lib/cjs/utils/operationIdFormatter.d.ts +0 -4
- package/lib/cjs/utils/ref.d.ts +0 -14
- package/lib/cjs/utils/toJsonMapCollection.d.ts +0 -7
- package/lib/cjs/utils/toJsonRegex.d.ts +0 -5
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
import { ValueOf } from "@tsed/core";
|
|
2
|
-
import { JsonFormatTypes } from "../../domain/JsonFormatTypes";
|
|
3
|
-
/**
|
|
4
|
-
* The following formats are supported for string validation with `format` keyword:
|
|
5
|
-
*
|
|
6
|
-
* - **date**: full-date according to [RFC3339](https://json-schema.org/latest/json-schema-validation.html#RFC3339).
|
|
7
|
-
* - **time**: time with optional time-zone.
|
|
8
|
-
* - **date-time**: date-time from the same source (time-zone is mandatory).
|
|
9
|
-
* - **uri**: full uri with optional protocol.
|
|
10
|
-
* - **email**: email address.
|
|
11
|
-
* - **hostname**: host name according to [RFC1034](https://tools.ietf.org/html/rfc1034#section-3.1).
|
|
12
|
-
* - **ipv4**: IP address v4.
|
|
13
|
-
* - **ipv6**: IP address v6.
|
|
14
|
-
* - **regex**: tests whether a string is a valid regular expression by passing it to RegExp constructor.
|
|
15
|
-
*
|
|
16
|
-
* ::: warning
|
|
17
|
-
* For v6 user, use @@Format@@ from @tsed/schema instead of @tsed/common.
|
|
18
|
-
* :::
|
|
19
|
-
*
|
|
20
|
-
* ## Example
|
|
21
|
-
* ### With primitive type
|
|
22
|
-
*
|
|
23
|
-
* ```typescript
|
|
24
|
-
* class Model {
|
|
25
|
-
* @Format("email")
|
|
26
|
-
* property: string;
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* ```json
|
|
31
|
-
* {
|
|
32
|
-
* "type": "object",
|
|
33
|
-
* "properties": {
|
|
34
|
-
* "property": {
|
|
35
|
-
* "type": "string",
|
|
36
|
-
* "format": "email"
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* ### With array type
|
|
43
|
-
*
|
|
44
|
-
* ```typescript
|
|
45
|
-
* class Model {
|
|
46
|
-
* @Format("email")
|
|
47
|
-
* @CollectionOf(String)
|
|
48
|
-
* property: string[];
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* Will produce:
|
|
53
|
-
*
|
|
54
|
-
* ```json
|
|
55
|
-
* {
|
|
56
|
-
* "type": "object",
|
|
57
|
-
* "properties": {
|
|
58
|
-
* "property": {
|
|
59
|
-
* "type": "array",
|
|
60
|
-
* "items": {
|
|
61
|
-
* "type": "string",
|
|
62
|
-
* "format": "email"
|
|
63
|
-
* }
|
|
64
|
-
* }
|
|
65
|
-
* }
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* @param {string} format
|
|
70
|
-
* @decorator
|
|
71
|
-
* @validation
|
|
72
|
-
* @swagger
|
|
73
|
-
* @schema
|
|
74
|
-
* @input
|
|
75
|
-
*/
|
|
76
|
-
export declare function Format(format: JsonFormatTypes | ValueOf<JsonFormatTypes>): (...args: any[]) => any;
|
|
77
|
-
/**
|
|
78
|
-
* Apply an email validation on property.
|
|
79
|
-
*
|
|
80
|
-
* ::: warning
|
|
81
|
-
* For v6 user, use @@Email@@ from @tsed/schema instead of @tsed/common.
|
|
82
|
-
* :::
|
|
83
|
-
*
|
|
84
|
-
* ## Example
|
|
85
|
-
* ### With primitive type
|
|
86
|
-
*
|
|
87
|
-
* ```typescript
|
|
88
|
-
* class Model {
|
|
89
|
-
* @Email()
|
|
90
|
-
* property: string;
|
|
91
|
-
* }
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* Will produce:
|
|
95
|
-
*
|
|
96
|
-
* ```json
|
|
97
|
-
* {
|
|
98
|
-
* "type": "object",
|
|
99
|
-
* "properties": {
|
|
100
|
-
* "property": {
|
|
101
|
-
* "type": "string",
|
|
102
|
-
* "format": "email"
|
|
103
|
-
* }
|
|
104
|
-
* }
|
|
105
|
-
* }
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* ### With array type
|
|
109
|
-
*
|
|
110
|
-
* ```typescript
|
|
111
|
-
* class Model {
|
|
112
|
-
* @Email()
|
|
113
|
-
* @CollectionOf(String)
|
|
114
|
-
* property: string[];
|
|
115
|
-
* }
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* Will produce:
|
|
119
|
-
*
|
|
120
|
-
* ```json
|
|
121
|
-
* {
|
|
122
|
-
* "type": "object",
|
|
123
|
-
* "properties": {
|
|
124
|
-
* "property": {
|
|
125
|
-
* "type": "array",
|
|
126
|
-
* "items": {
|
|
127
|
-
* "type": "string",
|
|
128
|
-
* "format": "email"
|
|
129
|
-
* }
|
|
130
|
-
* }
|
|
131
|
-
* }
|
|
132
|
-
* }
|
|
133
|
-
* ```
|
|
134
|
-
*
|
|
135
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
136
|
-
* @returns {Function}
|
|
137
|
-
* @decorator
|
|
138
|
-
* @validation
|
|
139
|
-
* @schema
|
|
140
|
-
* @swagger
|
|
141
|
-
* @input
|
|
142
|
-
*/
|
|
143
|
-
export declare function Email(): (...args: any[]) => any;
|
|
144
|
-
/**
|
|
145
|
-
* Apply a date-time validation on property.
|
|
146
|
-
*
|
|
147
|
-
* ## Example
|
|
148
|
-
* ### With primitive type
|
|
149
|
-
*
|
|
150
|
-
* ```typescript
|
|
151
|
-
* class Model {
|
|
152
|
-
* @DateTime()
|
|
153
|
-
* property: string;
|
|
154
|
-
* }
|
|
155
|
-
* ```
|
|
156
|
-
*
|
|
157
|
-
* Will produce:
|
|
158
|
-
*
|
|
159
|
-
* ```json
|
|
160
|
-
* {
|
|
161
|
-
* "type": "object",
|
|
162
|
-
* "properties": {
|
|
163
|
-
* "property": {
|
|
164
|
-
* "type": "string",
|
|
165
|
-
* "format": "date-time"
|
|
166
|
-
* }
|
|
167
|
-
* }
|
|
168
|
-
* }
|
|
169
|
-
* ```
|
|
170
|
-
*
|
|
171
|
-
* ### With array type
|
|
172
|
-
*
|
|
173
|
-
* ```typescript
|
|
174
|
-
* class Model {
|
|
175
|
-
* @DateTime()
|
|
176
|
-
* @CollectionOf(String)
|
|
177
|
-
* property: string[];
|
|
178
|
-
* }
|
|
179
|
-
* ```
|
|
180
|
-
*
|
|
181
|
-
* Will produce:
|
|
182
|
-
*
|
|
183
|
-
* ```json
|
|
184
|
-
* {
|
|
185
|
-
* "type": "object",
|
|
186
|
-
* "properties": {
|
|
187
|
-
* "property": {
|
|
188
|
-
* "type": "array",
|
|
189
|
-
* "items": {
|
|
190
|
-
* "type": "string",
|
|
191
|
-
* "format": "date-time"
|
|
192
|
-
* }
|
|
193
|
-
* }
|
|
194
|
-
* }
|
|
195
|
-
* }
|
|
196
|
-
* ```
|
|
197
|
-
*
|
|
198
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
199
|
-
* @returns {Function}
|
|
200
|
-
* @decorator
|
|
201
|
-
* @validation
|
|
202
|
-
* @property
|
|
203
|
-
* @parameter
|
|
204
|
-
* @schema
|
|
205
|
-
* @auto-map The data will be stored on the right place according to the type and collectionType (primitive or collection).
|
|
206
|
-
*/
|
|
207
|
-
export declare function DateTime(): (...args: any[]) => any;
|
|
208
|
-
/**
|
|
209
|
-
* Apply a time validation on property.
|
|
210
|
-
*
|
|
211
|
-
* ## Example
|
|
212
|
-
* ### With primitive type
|
|
213
|
-
*
|
|
214
|
-
* ```typescript
|
|
215
|
-
* class Model {
|
|
216
|
-
* @Time()
|
|
217
|
-
* property: string;
|
|
218
|
-
* }
|
|
219
|
-
* ```
|
|
220
|
-
*
|
|
221
|
-
* Will produce:
|
|
222
|
-
*
|
|
223
|
-
* ```json
|
|
224
|
-
* {
|
|
225
|
-
* "type": "object",
|
|
226
|
-
* "properties": {
|
|
227
|
-
* "property": {
|
|
228
|
-
* "type": "string",
|
|
229
|
-
* "format": "time"
|
|
230
|
-
* }
|
|
231
|
-
* }
|
|
232
|
-
* }
|
|
233
|
-
* ```
|
|
234
|
-
*
|
|
235
|
-
* ### With array type
|
|
236
|
-
*
|
|
237
|
-
* ```typescript
|
|
238
|
-
* class Model {
|
|
239
|
-
* @Time()
|
|
240
|
-
* @CollectionOf(String)
|
|
241
|
-
* property: string[];
|
|
242
|
-
* }
|
|
243
|
-
* ```
|
|
244
|
-
*
|
|
245
|
-
* Will produce:
|
|
246
|
-
*
|
|
247
|
-
* ```json
|
|
248
|
-
* {
|
|
249
|
-
* "type": "object",
|
|
250
|
-
* "properties": {
|
|
251
|
-
* "property": {
|
|
252
|
-
* "type": "array",
|
|
253
|
-
* "items": {
|
|
254
|
-
* "type": "string",
|
|
255
|
-
* "format": "time"
|
|
256
|
-
* }
|
|
257
|
-
* }
|
|
258
|
-
* }
|
|
259
|
-
* }
|
|
260
|
-
* ```
|
|
261
|
-
*
|
|
262
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
263
|
-
* @returns {Function}
|
|
264
|
-
* @decorator
|
|
265
|
-
* @validation
|
|
266
|
-
* @property
|
|
267
|
-
* @parameter
|
|
268
|
-
* @schema
|
|
269
|
-
*/
|
|
270
|
-
export declare function DateFormat(): (...args: any[]) => any;
|
|
271
|
-
/**
|
|
272
|
-
* Apply a time validation on property.
|
|
273
|
-
*
|
|
274
|
-
* ## Example
|
|
275
|
-
* ### With primitive type
|
|
276
|
-
*
|
|
277
|
-
* ```typescript
|
|
278
|
-
* class Model {
|
|
279
|
-
* @TimeFormat()
|
|
280
|
-
* property: string;
|
|
281
|
-
* }
|
|
282
|
-
* ```
|
|
283
|
-
*
|
|
284
|
-
* Will produce:
|
|
285
|
-
*
|
|
286
|
-
* ```json
|
|
287
|
-
* {
|
|
288
|
-
* "type": "object",
|
|
289
|
-
* "properties": {
|
|
290
|
-
* "property": {
|
|
291
|
-
* "type": "string",
|
|
292
|
-
* "format": "time"
|
|
293
|
-
* }
|
|
294
|
-
* }
|
|
295
|
-
* }
|
|
296
|
-
* ```
|
|
297
|
-
*
|
|
298
|
-
* ### With array type
|
|
299
|
-
*
|
|
300
|
-
* ```typescript
|
|
301
|
-
* class Model {
|
|
302
|
-
* @TimeFormat()
|
|
303
|
-
* @CollectionOf(String)
|
|
304
|
-
* property: string[];
|
|
305
|
-
* }
|
|
306
|
-
* ```
|
|
307
|
-
*
|
|
308
|
-
* Will produce:
|
|
309
|
-
*
|
|
310
|
-
* ```json
|
|
311
|
-
* {
|
|
312
|
-
* "type": "object",
|
|
313
|
-
* "properties": {
|
|
314
|
-
* "property": {
|
|
315
|
-
* "type": "array",
|
|
316
|
-
* "items": {
|
|
317
|
-
* "type": "string",
|
|
318
|
-
* "format": "time"
|
|
319
|
-
* }
|
|
320
|
-
* }
|
|
321
|
-
* }
|
|
322
|
-
* }
|
|
323
|
-
* ```
|
|
324
|
-
*
|
|
325
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
326
|
-
* @returns {Function}
|
|
327
|
-
* @decorator
|
|
328
|
-
* @validation
|
|
329
|
-
* @property
|
|
330
|
-
* @parameter
|
|
331
|
-
* @schema
|
|
332
|
-
*/
|
|
333
|
-
export declare function TimeFormat(): (...args: any[]) => any;
|
|
334
|
-
/**
|
|
335
|
-
* Apply a uri validation on property.
|
|
336
|
-
*
|
|
337
|
-
* ## Example
|
|
338
|
-
* ### With primitive type
|
|
339
|
-
*
|
|
340
|
-
* ```typescript
|
|
341
|
-
* class Model {
|
|
342
|
-
* @Uri()
|
|
343
|
-
* property: string;
|
|
344
|
-
* }
|
|
345
|
-
* ```
|
|
346
|
-
*
|
|
347
|
-
* Will produce:
|
|
348
|
-
*
|
|
349
|
-
* ```json
|
|
350
|
-
* {
|
|
351
|
-
* "type": "object",
|
|
352
|
-
* "properties": {
|
|
353
|
-
* "property": {
|
|
354
|
-
* "type": "string",
|
|
355
|
-
* "format": "uri"
|
|
356
|
-
* }
|
|
357
|
-
* }
|
|
358
|
-
* }
|
|
359
|
-
* ```
|
|
360
|
-
*
|
|
361
|
-
* ### With array type
|
|
362
|
-
*
|
|
363
|
-
* ```typescript
|
|
364
|
-
* class Model {
|
|
365
|
-
* @Uri()
|
|
366
|
-
* @CollectionOf(String)
|
|
367
|
-
* property: string[];
|
|
368
|
-
* }
|
|
369
|
-
* ```
|
|
370
|
-
*
|
|
371
|
-
* Will produce:
|
|
372
|
-
*
|
|
373
|
-
* ```json
|
|
374
|
-
* {
|
|
375
|
-
* "type": "object",
|
|
376
|
-
* "properties": {
|
|
377
|
-
* "property": {
|
|
378
|
-
* "type": "array",
|
|
379
|
-
* "items": {
|
|
380
|
-
* "type": "string",
|
|
381
|
-
* "format": "uri"
|
|
382
|
-
* }
|
|
383
|
-
* }
|
|
384
|
-
* }
|
|
385
|
-
* }
|
|
386
|
-
* ```
|
|
387
|
-
*
|
|
388
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
389
|
-
* @returns {Function}
|
|
390
|
-
* @decorator
|
|
391
|
-
* @validation
|
|
392
|
-
* @property
|
|
393
|
-
* @parameter
|
|
394
|
-
* @schema
|
|
395
|
-
*/
|
|
396
|
-
export declare function Uri(): (...args: any[]) => any;
|
|
397
|
-
/**
|
|
398
|
-
* Apply a url validation on property.
|
|
399
|
-
*
|
|
400
|
-
* ## Example
|
|
401
|
-
* ### With primitive type
|
|
402
|
-
*
|
|
403
|
-
* ```typescript
|
|
404
|
-
* class Model {
|
|
405
|
-
* @Url()
|
|
406
|
-
* property: string;
|
|
407
|
-
* }
|
|
408
|
-
* ```
|
|
409
|
-
*
|
|
410
|
-
* Will produce:
|
|
411
|
-
*
|
|
412
|
-
* ```json
|
|
413
|
-
* {
|
|
414
|
-
* "type": "object",
|
|
415
|
-
* "properties": {
|
|
416
|
-
* "property": {
|
|
417
|
-
* "type": "string",
|
|
418
|
-
* "format": "url"
|
|
419
|
-
* }
|
|
420
|
-
* }
|
|
421
|
-
* }
|
|
422
|
-
* ```
|
|
423
|
-
*
|
|
424
|
-
* ### With array type
|
|
425
|
-
*
|
|
426
|
-
* ```typescript
|
|
427
|
-
* class Model {
|
|
428
|
-
* @Url()
|
|
429
|
-
* @CollectionOf(String)
|
|
430
|
-
* property: string[];
|
|
431
|
-
* }
|
|
432
|
-
* ```
|
|
433
|
-
*
|
|
434
|
-
* Will produce:
|
|
435
|
-
*
|
|
436
|
-
* ```json
|
|
437
|
-
* {
|
|
438
|
-
* "type": "object",
|
|
439
|
-
* "properties": {
|
|
440
|
-
* "property": {
|
|
441
|
-
* "type": "array",
|
|
442
|
-
* "items": {
|
|
443
|
-
* "type": "string",
|
|
444
|
-
* "format": "url"
|
|
445
|
-
* }
|
|
446
|
-
* }
|
|
447
|
-
* }
|
|
448
|
-
* }
|
|
449
|
-
* ```
|
|
450
|
-
*
|
|
451
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
452
|
-
* @returns {Function}
|
|
453
|
-
* @decorator
|
|
454
|
-
* @validation
|
|
455
|
-
* @property
|
|
456
|
-
* @parameter
|
|
457
|
-
* @schema
|
|
458
|
-
*/
|
|
459
|
-
export declare function Url(): (...args: any[]) => any;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Apply groups validation strategy
|
|
3
|
-
*
|
|
4
|
-
* @decorator
|
|
5
|
-
* @validation
|
|
6
|
-
* @swagger
|
|
7
|
-
* @schema
|
|
8
|
-
* @input
|
|
9
|
-
*/
|
|
10
|
-
export declare function Groups<T>(groupsDefinition: Record<string, (keyof T)[]>): ClassDecorator;
|
|
11
|
-
export declare function Groups(...groups: string[]): Function;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Disable documentation for the class and his endpoint.
|
|
3
|
-
*
|
|
4
|
-
* ````typescript
|
|
5
|
-
* @Controller('/')
|
|
6
|
-
* export class Ctrl {
|
|
7
|
-
*
|
|
8
|
-
* @Get('/')
|
|
9
|
-
* @Hidden()
|
|
10
|
-
* hiddenRoute(){
|
|
11
|
-
*
|
|
12
|
-
* }
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* @Controller('/')
|
|
16
|
-
* @Hidden()
|
|
17
|
-
* export class Ctrl {
|
|
18
|
-
* @Get('/')
|
|
19
|
-
* hiddenRoute() {
|
|
20
|
-
*
|
|
21
|
-
* }
|
|
22
|
-
* @Get('/2')
|
|
23
|
-
* hiddenRoute2() {
|
|
24
|
-
*
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @decorator
|
|
30
|
-
* @ignore
|
|
31
|
-
*/
|
|
32
|
-
export declare function Hidden(): Function;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { IgnoreCallback } from "../../interfaces";
|
|
2
|
-
/**
|
|
3
|
-
* Ignore the property when JsonMapper serialize the class to a Plain Object JavaScript.
|
|
4
|
-
*
|
|
5
|
-
* ::: warning
|
|
6
|
-
* Swagger will not generate documentation for the ignored property.
|
|
7
|
-
* :::
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* class User {
|
|
11
|
-
* @Ignore()
|
|
12
|
-
* _id: string;
|
|
13
|
-
*
|
|
14
|
-
* @Property()
|
|
15
|
-
* firstName: string;
|
|
16
|
-
*
|
|
17
|
-
* @Property()
|
|
18
|
-
* lastName: string;
|
|
19
|
-
*
|
|
20
|
-
* @Ignore((value, ctx) => !ctx.mongoose) // don't ignore prop only if mongoose
|
|
21
|
-
* password: string;
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* The controller:
|
|
26
|
-
* ```typescript
|
|
27
|
-
* import {Post, Controller, BodyParams} from "@tsed/common";
|
|
28
|
-
* import {Person} from "../models/Person";
|
|
29
|
-
*
|
|
30
|
-
* @Controller("/")
|
|
31
|
-
* export class UsersCtrl {
|
|
32
|
-
* @Get("/")
|
|
33
|
-
* get(): User {
|
|
34
|
-
* const user = new User();
|
|
35
|
-
* user._id = "12345";
|
|
36
|
-
* user.firstName = "John";
|
|
37
|
-
* user.lastName = "Doe";
|
|
38
|
-
* user.password = "secretpassword";
|
|
39
|
-
* return
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* The expected json object:
|
|
45
|
-
*
|
|
46
|
-
* ```json
|
|
47
|
-
* {
|
|
48
|
-
* "firstName": "John",
|
|
49
|
-
* "lastName": "Doe"
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
* @param cb Callback to know if the property must be ignored
|
|
53
|
-
* @decorator
|
|
54
|
-
* @validation
|
|
55
|
-
* @swagger
|
|
56
|
-
* @schema
|
|
57
|
-
*/
|
|
58
|
-
export declare function Ignore(cb?: boolean | IgnoreCallback): (...args: any[]) => any;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Set integer type.
|
|
3
|
-
*
|
|
4
|
-
* ::: warning
|
|
5
|
-
* For v6 user, use @@Integer@@ from @tsed/schema instead of @@Integer@@ from @tsed/common.
|
|
6
|
-
* :::
|
|
7
|
-
*
|
|
8
|
-
* ## Example
|
|
9
|
-
*
|
|
10
|
-
* ```typescript
|
|
11
|
-
* class Model {
|
|
12
|
-
* @Integer()
|
|
13
|
-
* property: number;
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* Will produce:
|
|
18
|
-
*
|
|
19
|
-
* ```json
|
|
20
|
-
* {
|
|
21
|
-
* "type": "object",
|
|
22
|
-
* "properties": {
|
|
23
|
-
* "property": {
|
|
24
|
-
* "type": "integer"
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* ### With array of multiple types
|
|
31
|
-
*
|
|
32
|
-
* ```typescript
|
|
33
|
-
* class Model {
|
|
34
|
-
* @Integer()
|
|
35
|
-
* property: number[];
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* Will produce:
|
|
40
|
-
*
|
|
41
|
-
* ```json
|
|
42
|
-
* {
|
|
43
|
-
* "type": "object",
|
|
44
|
-
* "properties": {
|
|
45
|
-
* "property": {
|
|
46
|
-
* "type": "array",
|
|
47
|
-
* "items": {
|
|
48
|
-
* "type": "integer"
|
|
49
|
-
* }
|
|
50
|
-
* }
|
|
51
|
-
* }
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @decorator
|
|
56
|
-
* @validation
|
|
57
|
-
* @swagger
|
|
58
|
-
* @schema
|
|
59
|
-
* @input
|
|
60
|
-
*/
|
|
61
|
-
export declare function Integer(): (...args: any[]) => any;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { DecoratorParameters } from "@tsed/core";
|
|
2
|
-
import type { JsonEntityStore } from "../../domain";
|
|
3
|
-
/**
|
|
4
|
-
* Decorator util to compose another decorator. See @@Description@@ decorator implementation for more details.
|
|
5
|
-
*
|
|
6
|
-
* ## Usage
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* export function Description(description: any) {
|
|
10
|
-
* return JsonEntityFn((entity: JsonEntityStore, args: DecoratorParameters) => {
|
|
11
|
-
* entity.itemSchema.description(description)
|
|
12
|
-
* });
|
|
13
|
-
* }
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @param fn
|
|
17
|
-
* @decorator
|
|
18
|
-
* @utils
|
|
19
|
-
* @model
|
|
20
|
-
*/
|
|
21
|
-
export declare function JsonEntityFn<T extends JsonEntityStore = JsonEntityStore>(fn: (entity: T, parameters: DecoratorParameters) => any): (...args: any[]) => any;
|