@tsed/schema 8.0.0-beta.1 → 8.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/schema.umd.min.js +1 -1
- package/lib/browser/schema.umd.min.js.map +1 -1
- package/lib/esm/decorators/collections/maxItems.js +1 -1
- package/lib/esm/decorators/collections/maxProperties.js +1 -1
- package/lib/esm/decorators/collections/minItems.js +1 -1
- package/lib/esm/decorators/collections/minProperties.js +1 -1
- package/lib/esm/decorators/collections/uniqueItems.js +1 -1
- package/lib/esm/decorators/common/const.js +1 -1
- package/lib/esm/decorators/common/default.js +1 -1
- package/lib/esm/decorators/common/enum.js +1 -1
- package/lib/esm/decorators/common/exclusiveMaximum.js +1 -1
- package/lib/esm/decorators/common/exclusiveMinimum.js +1 -1
- package/lib/esm/decorators/common/format.js +2 -8
- package/lib/esm/decorators/common/format.js.map +1 -1
- package/lib/esm/decorators/common/ignore.js +1 -1
- package/lib/esm/decorators/common/integer.js +1 -1
- package/lib/esm/decorators/common/maxLength.js +1 -1
- package/lib/esm/decorators/common/maximum.js +2 -2
- package/lib/esm/decorators/common/minLength.js +1 -1
- package/lib/esm/decorators/common/minimum.js +1 -1
- package/lib/esm/decorators/common/multipleOf.js +1 -1
- package/lib/esm/decorators/common/pattern.js +1 -1
- package/lib/esm/decorators/common/title.js +1 -1
- package/lib/esm/utils/generateSpec.js +7 -16
- package/lib/esm/utils/generateSpec.js.map +1 -1
- package/lib/types/decorators/collections/maxItems.d.ts +1 -1
- package/lib/types/decorators/collections/maxProperties.d.ts +1 -1
- package/lib/types/decorators/collections/minItems.d.ts +1 -1
- package/lib/types/decorators/collections/minProperties.d.ts +1 -1
- package/lib/types/decorators/collections/uniqueItems.d.ts +1 -1
- package/lib/types/decorators/common/const.d.ts +1 -1
- package/lib/types/decorators/common/default.d.ts +1 -1
- package/lib/types/decorators/common/enum.d.ts +1 -1
- package/lib/types/decorators/common/exclusiveMaximum.d.ts +1 -1
- package/lib/types/decorators/common/exclusiveMinimum.d.ts +1 -1
- package/lib/types/decorators/common/format.d.ts +2 -8
- package/lib/types/decorators/common/ignore.d.ts +1 -1
- package/lib/types/decorators/common/integer.d.ts +1 -1
- package/lib/types/decorators/common/maxLength.d.ts +1 -1
- package/lib/types/decorators/common/maximum.d.ts +2 -2
- package/lib/types/decorators/common/minLength.d.ts +1 -1
- package/lib/types/decorators/common/minimum.d.ts +1 -1
- package/lib/types/decorators/common/multipleOf.d.ts +1 -1
- package/lib/types/decorators/common/pattern.d.ts +1 -1
- package/lib/types/decorators/common/title.d.ts +1 -1
- package/lib/types/decorators/operations/returns.d.ts +1 -1
- package/lib/types/utils/generateSpec.d.ts +3 -2
- package/package.json +8 -8
|
@@ -11,7 +11,7 @@ import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
|
11
11
|
*
|
|
12
12
|
* :: warning
|
|
13
13
|
* This decorator will be removed in v7.
|
|
14
|
-
* For v6 user, use @@MaxItems@@ from @tsed/schema instead of @tsed/
|
|
14
|
+
* For v6 user, use @@MaxItems@@ from @tsed/schema instead of @tsed/platform-http.
|
|
15
15
|
* :::
|
|
16
16
|
*
|
|
17
17
|
* ## Example
|
|
@@ -9,7 +9,7 @@ import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
|
9
9
|
*
|
|
10
10
|
* ::: warning
|
|
11
11
|
* This decorator will be removed in v7.
|
|
12
|
-
* For v6 user, use @@MaxProperties@@ from @tsed/schema instead of @tsed/
|
|
12
|
+
* For v6 user, use @@MaxProperties@@ from @tsed/schema instead of @tsed/platform-http.
|
|
13
13
|
* :::
|
|
14
14
|
*
|
|
15
15
|
* ## Example
|
|
@@ -12,7 +12,7 @@ import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
|
12
12
|
* :::
|
|
13
13
|
*
|
|
14
14
|
* ::: warning
|
|
15
|
-
* For v6 user, use @@MinItems@@ from @tsed/schema instead of @tsed/
|
|
15
|
+
* For v6 user, use @@MinItems@@ from @tsed/schema instead of @tsed/platform-http.
|
|
16
16
|
* :::
|
|
17
17
|
*
|
|
18
18
|
* ## Example
|
|
@@ -8,7 +8,7 @@ import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
|
8
8
|
* :::
|
|
9
9
|
*
|
|
10
10
|
* ::: warning
|
|
11
|
-
* For v6 user, use @@MinProperties@@ from @tsed/schema instead of @tsed/
|
|
11
|
+
* For v6 user, use @@MinProperties@@ from @tsed/schema instead of @tsed/platform-http.
|
|
12
12
|
* :::
|
|
13
13
|
*
|
|
14
14
|
* ## Example
|
|
@@ -4,7 +4,7 @@ import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
|
4
4
|
* If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.
|
|
5
5
|
*
|
|
6
6
|
* ::: warning
|
|
7
|
-
* For v6 user, use @@UniqueItems@@ from @tsed/schema instead of @tsed/
|
|
7
|
+
* For v6 user, use @@UniqueItems@@ from @tsed/schema instead of @tsed/platform-http.
|
|
8
8
|
* :::
|
|
9
9
|
*
|
|
10
10
|
* ## Example
|
|
@@ -3,7 +3,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
3
3
|
* The const keyword is used to restrict a value to a fixed value.
|
|
4
4
|
*
|
|
5
5
|
* ::: warning
|
|
6
|
-
* For v6 user, use @@Const@@ from @tsed/schema instead of @tsed/
|
|
6
|
+
* For v6 user, use @@Const@@ from @tsed/schema instead of @tsed/platform-http.
|
|
7
7
|
* :::
|
|
8
8
|
*
|
|
9
9
|
* ## Example
|
|
@@ -3,7 +3,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
3
3
|
* There are no restrictions placed on the value of this keyword.
|
|
4
4
|
*
|
|
5
5
|
* ::: warning
|
|
6
|
-
* For v6 user, use @@Default@@ from @tsed/schema instead of @tsed/
|
|
6
|
+
* For v6 user, use @@Default@@ from @tsed/schema instead of @tsed/platform-http.
|
|
7
7
|
* :::
|
|
8
8
|
*
|
|
9
9
|
* This keyword can be used to supply a default JSON value associated with a particular schema.
|
|
@@ -12,7 +12,7 @@ function EnumFn(enumValue, ...enumValues) {
|
|
|
12
12
|
* Elements in the array might be of any value, including null.
|
|
13
13
|
*
|
|
14
14
|
* ::: warning
|
|
15
|
-
* For v6 user, use @@Enum@@ from @tsed/schema instead of @tsed/
|
|
15
|
+
* For v6 user, use @@Enum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
16
16
|
* :::
|
|
17
17
|
*
|
|
18
18
|
* ## Example
|
|
@@ -6,7 +6,7 @@ import { Maximum } from "./maximum.js";
|
|
|
6
6
|
* If the instance is a number, then the instance is valid only if it has a value strictly less than (not equal to) `exclusiveMaximum`.
|
|
7
7
|
*
|
|
8
8
|
* ::: warning
|
|
9
|
-
* For v6 user, use @@ExclusiveMaximum@@ from @tsed/schema instead of @tsed/
|
|
9
|
+
* For v6 user, use @@ExclusiveMaximum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
10
10
|
* :::
|
|
11
11
|
*
|
|
12
12
|
* ## Example
|
|
@@ -6,7 +6,7 @@ import { Minimum } from "./minimum.js";
|
|
|
6
6
|
* If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) `exclusiveMinimum`.
|
|
7
7
|
*
|
|
8
8
|
* ::: warning
|
|
9
|
-
* For v6 user, use @@ExclusiveMinimum@@ from @tsed/schema instead of @tsed/
|
|
9
|
+
* For v6 user, use @@ExclusiveMinimum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
10
10
|
* :::
|
|
11
11
|
*
|
|
12
12
|
* ## Example
|
|
@@ -15,7 +15,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
15
15
|
* - **regex**: tests whether a string is a valid regular expression by passing it to RegExp constructor.
|
|
16
16
|
*
|
|
17
17
|
* ::: warning
|
|
18
|
-
* For v6 user, use @@Format@@ from @tsed/schema instead of @tsed/
|
|
18
|
+
* For v6 user, use @@Format@@ from @tsed/schema instead of @tsed/platform-http.
|
|
19
19
|
* :::
|
|
20
20
|
*
|
|
21
21
|
* ## Example
|
|
@@ -84,7 +84,7 @@ export const Format = withErrorMsg("format", (format) => {
|
|
|
84
84
|
* Apply an email validation on property.
|
|
85
85
|
*
|
|
86
86
|
* ::: warning
|
|
87
|
-
* For v6 user, use @@Email@@ from @tsed/schema instead of @tsed/
|
|
87
|
+
* For v6 user, use @@Email@@ from @tsed/schema instead of @tsed/platform-http.
|
|
88
88
|
* :::
|
|
89
89
|
*
|
|
90
90
|
* ## Example
|
|
@@ -138,7 +138,6 @@ export const Format = withErrorMsg("format", (format) => {
|
|
|
138
138
|
* }
|
|
139
139
|
* ```
|
|
140
140
|
*
|
|
141
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
142
141
|
* @returns {Function}
|
|
143
142
|
* @decorator
|
|
144
143
|
* @validation
|
|
@@ -204,7 +203,6 @@ export const Email = withErrorMsg("format", () => {
|
|
|
204
203
|
* }
|
|
205
204
|
* ```
|
|
206
205
|
*
|
|
207
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
208
206
|
* @returns {Function}
|
|
209
207
|
* @decorator
|
|
210
208
|
* @validation
|
|
@@ -271,7 +269,6 @@ export const DateTime = withErrorMsg("format", () => {
|
|
|
271
269
|
* }
|
|
272
270
|
* ```
|
|
273
271
|
*
|
|
274
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
275
272
|
* @returns {Function}
|
|
276
273
|
* @decorator
|
|
277
274
|
* @validation
|
|
@@ -337,7 +334,6 @@ export const DateFormat = withErrorMsg("format", () => {
|
|
|
337
334
|
* }
|
|
338
335
|
* ```
|
|
339
336
|
*
|
|
340
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
341
337
|
* @returns {Function}
|
|
342
338
|
* @decorator
|
|
343
339
|
* @validation
|
|
@@ -403,7 +399,6 @@ export const TimeFormat = withErrorMsg("format", () => {
|
|
|
403
399
|
* }
|
|
404
400
|
* ```
|
|
405
401
|
*
|
|
406
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
407
402
|
* @returns {Function}
|
|
408
403
|
* @decorator
|
|
409
404
|
* @validation
|
|
@@ -469,7 +464,6 @@ export const Uri = withErrorMsg("format", () => {
|
|
|
469
464
|
* }
|
|
470
465
|
* ```
|
|
471
466
|
*
|
|
472
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
473
467
|
* @returns {Function}
|
|
474
468
|
* @decorator
|
|
475
469
|
* @validation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/decorators/common/format.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAkD,EAAE,EAAE;IAClG,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/decorators/common/format.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE;IAC7C,OAAO,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE;IAC7C,OAAO,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC"}
|
|
@@ -24,7 +24,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
24
24
|
*
|
|
25
25
|
* The controller:
|
|
26
26
|
* ```typescript
|
|
27
|
-
* import {Controller, BodyParams} from "@tsed/
|
|
27
|
+
* import {Controller, BodyParams} from "@tsed/platform-http";
|
|
28
28
|
* import {Post} from "@tsed/schema";
|
|
29
29
|
* import {Person} from "../models/Person.js";
|
|
30
30
|
*
|
|
@@ -3,7 +3,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
3
3
|
* Set integer type.
|
|
4
4
|
*
|
|
5
5
|
* ::: warning
|
|
6
|
-
* For v6 user, use @@Integer@@ from @tsed/schema instead of @@Integer@@ from @tsed/
|
|
6
|
+
* For v6 user, use @@Integer@@ from @tsed/schema instead of @@Integer@@ from @tsed/platform-http.
|
|
7
7
|
* :::
|
|
8
8
|
*
|
|
9
9
|
* ## Example
|
|
@@ -14,7 +14,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
14
14
|
* :::
|
|
15
15
|
*
|
|
16
16
|
* ::: warning
|
|
17
|
-
* For v6 user, use @@MaxLength@@ from @tsed/schema instead of @tsed/
|
|
17
|
+
* For v6 user, use @@MaxLength@@ from @tsed/schema instead of @tsed/platform-http.
|
|
18
18
|
* :::
|
|
19
19
|
*
|
|
20
20
|
* ## Example
|
|
@@ -6,7 +6,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
6
6
|
* If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to `maximum`.
|
|
7
7
|
*
|
|
8
8
|
* ::: warning
|
|
9
|
-
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/
|
|
9
|
+
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
10
10
|
* :::
|
|
11
11
|
*
|
|
12
12
|
* ## Example
|
|
@@ -80,7 +80,7 @@ export const Maximum = withErrorMsg("maximum", (maximum, exclusive = false) => {
|
|
|
80
80
|
* If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to `maximum`.
|
|
81
81
|
*
|
|
82
82
|
* ::: warning
|
|
83
|
-
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/
|
|
83
|
+
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
84
84
|
* :::
|
|
85
85
|
*
|
|
86
86
|
* ## Example
|
|
@@ -15,7 +15,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
15
15
|
* :::
|
|
16
16
|
*
|
|
17
17
|
* ::: warning
|
|
18
|
-
* For v6 user, use @@MinLength@@ from @tsed/schema instead of @tsed/
|
|
18
|
+
* For v6 user, use @@MinLength@@ from @tsed/schema instead of @tsed/platform-http.
|
|
19
19
|
* :::
|
|
20
20
|
*
|
|
21
21
|
* ## Example
|
|
@@ -7,7 +7,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
7
7
|
*
|
|
8
8
|
* ::: warning
|
|
9
9
|
* This decorator will be removed in v7.
|
|
10
|
-
* For v6 user, use @@Minimum@@ from @tsed/schema instead of @tsed/
|
|
10
|
+
* For v6 user, use @@Minimum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
11
11
|
* :::
|
|
12
12
|
*
|
|
13
13
|
* ## Example
|
|
@@ -8,7 +8,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
8
8
|
* :::
|
|
9
9
|
*
|
|
10
10
|
* ::: warning
|
|
11
|
-
* For v6 user, use @@MultipleOf@@ from @tsed/schema instead of @tsed/
|
|
11
|
+
* For v6 user, use @@MultipleOf@@ from @tsed/schema instead of @tsed/platform-http.
|
|
12
12
|
* :::
|
|
13
13
|
*
|
|
14
14
|
* ## Example
|
|
@@ -5,7 +5,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
5
5
|
* 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.
|
|
6
6
|
*
|
|
7
7
|
* ::: warning
|
|
8
|
-
* For v6 user, use @@Pattern@@ from @tsed/schema instead of @tsed/
|
|
8
|
+
* For v6 user, use @@Pattern@@ from @tsed/schema instead of @tsed/platform-http.
|
|
9
9
|
* :::
|
|
10
10
|
*
|
|
11
11
|
* A single unicode character (other than the special characters below) matches itself.
|
|
@@ -3,7 +3,7 @@ import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
|
3
3
|
* Add title metadata on the decorated element.
|
|
4
4
|
*
|
|
5
5
|
* ::: warning
|
|
6
|
-
* For v6 user, use @@Title@@ from @tsed/schema instead of @tsed/
|
|
6
|
+
* For v6 user, use @@Title@@ from @tsed/schema instead of @tsed/platform-http.
|
|
7
7
|
* :::
|
|
8
8
|
*
|
|
9
9
|
* ## Example
|
|
@@ -5,27 +5,13 @@ import { getSpecTypeFromSpec } from "./getSpecType.js";
|
|
|
5
5
|
import { mapOpenSpec } from "./mapOpenSpec.js";
|
|
6
6
|
import { mergeSpec } from "./mergeSpec.js";
|
|
7
7
|
import { transformToOS2 } from "./transformToOS2.js";
|
|
8
|
-
/* node_env:start */
|
|
9
|
-
async function readSpec(path) {
|
|
10
|
-
const { default: fs } = await import("fs-extra");
|
|
11
|
-
if (fs.existsSync(path)) {
|
|
12
|
-
try {
|
|
13
|
-
return await fs.readJSON(path, { encoding: "utf8" });
|
|
14
|
-
}
|
|
15
|
-
catch (e) { }
|
|
16
|
-
}
|
|
17
|
-
/* istanbul ignore next */
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
/* node_env:end */
|
|
21
8
|
/**
|
|
22
9
|
* Generate OpenAPI spec from multiple sources (models, files, conf)
|
|
23
10
|
* @param tokens
|
|
24
11
|
* @param options
|
|
25
12
|
*/
|
|
26
|
-
export
|
|
27
|
-
const { version = "1.0.0", acceptMimes,
|
|
28
|
-
const fileSpec = /* node_env:start */ specPath ? await readSpec(specPath) : /* node_env:end */ {};
|
|
13
|
+
export function generateSpec({ tokens, ...options }) {
|
|
14
|
+
const { version = "1.0.0", acceptMimes, fileSpec = {}, specVersion } = options;
|
|
29
15
|
const defaultSpec = mapOpenSpec(getValue(options, "spec", {}), {
|
|
30
16
|
fileSpec,
|
|
31
17
|
version,
|
|
@@ -35,6 +21,11 @@ export async function generateSpec({ tokens, ...options }) {
|
|
|
35
21
|
const specType = getSpecTypeFromSpec(defaultSpec);
|
|
36
22
|
let controllersSpec = getSpec(tokens, options);
|
|
37
23
|
const spec = mergeSpec(defaultSpec, controllersSpec);
|
|
24
|
+
if (options.sortPaths) {
|
|
25
|
+
spec.paths = Object.fromEntries(Object.entries(spec.paths).sort(([k1], [k2]) => {
|
|
26
|
+
return k1.localeCompare(k2);
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
38
29
|
if (specType === SpecTypes.SWAGGER) {
|
|
39
30
|
return transformToOS2(spec);
|
|
40
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSpec.js","sourceRoot":"","sources":["../../../src/utils/generateSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,OAAO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OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAC7B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;YAC9C,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,cAAc,CAAC,IAAI,CAAQ,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.
|
|
3
3
|
*
|
|
4
4
|
* ::: warning
|
|
5
|
-
* For v6 user, use @@UniqueItems@@ from @tsed/schema instead of @tsed/
|
|
5
|
+
* For v6 user, use @@UniqueItems@@ from @tsed/schema instead of @tsed/platform-http.
|
|
6
6
|
* :::
|
|
7
7
|
*
|
|
8
8
|
* ## Example
|
|
@@ -3,7 +3,7 @@ import type { JSONSchema6Type } from "json-schema";
|
|
|
3
3
|
* The const keyword is used to restrict a value to a fixed value.
|
|
4
4
|
*
|
|
5
5
|
* ::: warning
|
|
6
|
-
* For v6 user, use @@Const@@ from @tsed/schema instead of @tsed/
|
|
6
|
+
* For v6 user, use @@Const@@ from @tsed/schema instead of @tsed/platform-http.
|
|
7
7
|
* :::
|
|
8
8
|
*
|
|
9
9
|
* ## Example
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* There are no restrictions placed on the value of this keyword.
|
|
3
3
|
*
|
|
4
4
|
* ::: warning
|
|
5
|
-
* For v6 user, use @@Default@@ from @tsed/schema instead of @tsed/
|
|
5
|
+
* For v6 user, use @@Default@@ from @tsed/schema instead of @tsed/platform-http.
|
|
6
6
|
* :::
|
|
7
7
|
*
|
|
8
8
|
* This keyword can be used to supply a default JSON value associated with a particular schema.
|
|
@@ -7,7 +7,7 @@ declare function EnumFn(...enumValues: (JSONSchema6Type | any)[]): Function;
|
|
|
7
7
|
* Elements in the array might be of any value, including null.
|
|
8
8
|
*
|
|
9
9
|
* ::: warning
|
|
10
|
-
* For v6 user, use @@Enum@@ from @tsed/schema instead of @tsed/
|
|
10
|
+
* For v6 user, use @@Enum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
11
11
|
* :::
|
|
12
12
|
*
|
|
13
13
|
* ## Example
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* If the instance is a number, then the instance is valid only if it has a value strictly less than (not equal to) `exclusiveMaximum`.
|
|
5
5
|
*
|
|
6
6
|
* ::: warning
|
|
7
|
-
* For v6 user, use @@ExclusiveMaximum@@ from @tsed/schema instead of @tsed/
|
|
7
|
+
* For v6 user, use @@ExclusiveMaximum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
8
8
|
* :::
|
|
9
9
|
*
|
|
10
10
|
* ## Example
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) `exclusiveMinimum`.
|
|
5
5
|
*
|
|
6
6
|
* ::: warning
|
|
7
|
-
* For v6 user, use @@ExclusiveMinimum@@ from @tsed/schema instead of @tsed/
|
|
7
|
+
* For v6 user, use @@ExclusiveMinimum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
8
8
|
* :::
|
|
9
9
|
*
|
|
10
10
|
* ## Example
|
|
@@ -14,7 +14,7 @@ import { JsonFormatTypes } from "../../domain/JsonFormatTypes.js";
|
|
|
14
14
|
* - **regex**: tests whether a string is a valid regular expression by passing it to RegExp constructor.
|
|
15
15
|
*
|
|
16
16
|
* ::: warning
|
|
17
|
-
* For v6 user, use @@Format@@ from @tsed/schema instead of @tsed/
|
|
17
|
+
* For v6 user, use @@Format@@ from @tsed/schema instead of @tsed/platform-http.
|
|
18
18
|
* :::
|
|
19
19
|
*
|
|
20
20
|
* ## Example
|
|
@@ -79,7 +79,7 @@ export declare const Format: import("../../utils/withErrorMsg.js").ErrorChainedD
|
|
|
79
79
|
* Apply an email validation on property.
|
|
80
80
|
*
|
|
81
81
|
* ::: warning
|
|
82
|
-
* For v6 user, use @@Email@@ from @tsed/schema instead of @tsed/
|
|
82
|
+
* For v6 user, use @@Email@@ from @tsed/schema instead of @tsed/platform-http.
|
|
83
83
|
* :::
|
|
84
84
|
*
|
|
85
85
|
* ## Example
|
|
@@ -133,7 +133,6 @@ export declare const Format: import("../../utils/withErrorMsg.js").ErrorChainedD
|
|
|
133
133
|
* }
|
|
134
134
|
* ```
|
|
135
135
|
*
|
|
136
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
137
136
|
* @returns {Function}
|
|
138
137
|
* @decorator
|
|
139
138
|
* @validation
|
|
@@ -197,7 +196,6 @@ export declare const Email: import("../../utils/withErrorMsg.js").ErrorChainedDe
|
|
|
197
196
|
* }
|
|
198
197
|
* ```
|
|
199
198
|
*
|
|
200
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
201
199
|
* @returns {Function}
|
|
202
200
|
* @decorator
|
|
203
201
|
* @validation
|
|
@@ -262,7 +260,6 @@ export declare const DateTime: import("../../utils/withErrorMsg.js").ErrorChaine
|
|
|
262
260
|
* }
|
|
263
261
|
* ```
|
|
264
262
|
*
|
|
265
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
266
263
|
* @returns {Function}
|
|
267
264
|
* @decorator
|
|
268
265
|
* @validation
|
|
@@ -326,7 +323,6 @@ export declare const DateFormat: import("../../utils/withErrorMsg.js").ErrorChai
|
|
|
326
323
|
* }
|
|
327
324
|
* ```
|
|
328
325
|
*
|
|
329
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
330
326
|
* @returns {Function}
|
|
331
327
|
* @decorator
|
|
332
328
|
* @validation
|
|
@@ -390,7 +386,6 @@ export declare const TimeFormat: import("../../utils/withErrorMsg.js").ErrorChai
|
|
|
390
386
|
* }
|
|
391
387
|
* ```
|
|
392
388
|
*
|
|
393
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
394
389
|
* @returns {Function}
|
|
395
390
|
* @decorator
|
|
396
391
|
* @validation
|
|
@@ -454,7 +449,6 @@ export declare const Uri: import("../../utils/withErrorMsg.js").ErrorChainedDeco
|
|
|
454
449
|
* }
|
|
455
450
|
* ```
|
|
456
451
|
*
|
|
457
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
458
452
|
* @returns {Function}
|
|
459
453
|
* @decorator
|
|
460
454
|
* @validation
|
|
@@ -24,7 +24,7 @@ import { IgnoreCallback } from "../../interfaces/IgnoreCallback.js";
|
|
|
24
24
|
*
|
|
25
25
|
* The controller:
|
|
26
26
|
* ```typescript
|
|
27
|
-
* import {Controller, BodyParams} from "@tsed/
|
|
27
|
+
* import {Controller, BodyParams} from "@tsed/platform-http";
|
|
28
28
|
* import {Post} from "@tsed/schema";
|
|
29
29
|
* import {Person} from "../models/Person.js";
|
|
30
30
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to `maximum`.
|
|
5
5
|
*
|
|
6
6
|
* ::: warning
|
|
7
|
-
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/
|
|
7
|
+
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
8
8
|
* :::
|
|
9
9
|
*
|
|
10
10
|
* ## Example
|
|
@@ -74,7 +74,7 @@ export declare const Maximum: import("../../utils/withErrorMsg.js").ErrorChained
|
|
|
74
74
|
* If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to `maximum`.
|
|
75
75
|
*
|
|
76
76
|
* ::: warning
|
|
77
|
-
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/
|
|
77
|
+
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/platform-http.
|
|
78
78
|
* :::
|
|
79
79
|
*
|
|
80
80
|
* ## Example
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 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.
|
|
4
4
|
*
|
|
5
5
|
* ::: warning
|
|
6
|
-
* For v6 user, use @@Pattern@@ from @tsed/schema instead of @tsed/
|
|
6
|
+
* For v6 user, use @@Pattern@@ from @tsed/schema instead of @tsed/platform-http.
|
|
7
7
|
* :::
|
|
8
8
|
*
|
|
9
9
|
* A single unicode character (other than the special characters below) matches itself.
|
|
@@ -171,7 +171,7 @@ export interface ReturnsChainedDecorators {
|
|
|
171
171
|
* Deprecated version:
|
|
172
172
|
*
|
|
173
173
|
* ```typescript
|
|
174
|
-
* import {ReturnsArray} from "@tsed/
|
|
174
|
+
* import {ReturnsArray} from "@tsed/platform-http";
|
|
175
175
|
* import {Returns} from "@tsed/schema";
|
|
176
176
|
*
|
|
177
177
|
* @Controller("/")
|
|
@@ -4,13 +4,14 @@ export interface GenerateSpecOptions extends Omit<SpecSerializerOptions, "specTy
|
|
|
4
4
|
tokens: JsonTokenOptions;
|
|
5
5
|
version?: string;
|
|
6
6
|
acceptMimes?: string;
|
|
7
|
-
specPath?: string;
|
|
8
7
|
specVersion?: string;
|
|
9
8
|
spec?: any;
|
|
9
|
+
fileSpec?: any;
|
|
10
|
+
sortPaths?: boolean;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Generate OpenAPI spec from multiple sources (models, files, conf)
|
|
13
14
|
* @param tokens
|
|
14
15
|
* @param options
|
|
15
16
|
*/
|
|
16
|
-
export declare function generateSpec({ tokens, ...options }: GenerateSpecOptions):
|
|
17
|
+
export declare function generateSpec({ tokens, ...options }: GenerateSpecOptions): OpenSpec2 | OpenSpec3;
|