@tsed/schema 8.4.4 → 8.4.5
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.map +1 -1
- package/lib/esm/decorators/operations/operationPath.js +1 -1
- package/lib/esm/decorators/operations/tags.js +10 -1
- package/lib/esm/decorators/operations/tags.js.map +1 -1
- package/lib/types/decorators/generics/generics.d.ts +1 -1
- package/lib/types/decorators/operations/acceptMime.d.ts +1 -1
- package/lib/types/decorators/operations/consumes.d.ts +1 -1
- package/lib/types/decorators/operations/header.d.ts +1 -1
- package/lib/types/decorators/operations/operationId.d.ts +1 -1
- package/lib/types/decorators/operations/operationPath.d.ts +1 -1
- package/lib/types/decorators/operations/path.d.ts +1 -1
- package/lib/types/decorators/operations/produces.d.ts +1 -1
- package/lib/types/decorators/operations/redirect.d.ts +2 -2
- package/lib/types/decorators/operations/security.d.ts +2 -2
- package/lib/types/decorators/operations/summary.d.ts +1 -1
- package/lib/types/decorators/operations/tags.d.ts +11 -2
- package/package.json +10 -10
- package/src/decorators/generics/generics.ts +1 -1
- package/src/decorators/operations/acceptMime.ts +1 -1
- package/src/decorators/operations/consumes.spec.ts +1 -0
- package/src/decorators/operations/consumes.ts +1 -1
- package/src/decorators/operations/header.ts +1 -1
- package/src/decorators/operations/operationId.spec.ts +1 -0
- package/src/decorators/operations/operationId.ts +1 -1
- package/src/decorators/operations/operationPath.ts +1 -1
- package/src/decorators/operations/path.spec.ts +1 -0
- package/src/decorators/operations/path.ts +1 -1
- package/src/decorators/operations/produces.spec.ts +1 -0
- package/src/decorators/operations/produces.ts +1 -1
- package/src/decorators/operations/redirect.ts +3 -3
- package/src/decorators/operations/security.spec.ts +1 -0
- package/src/decorators/operations/security.ts +3 -3
- package/src/decorators/operations/summary.spec.ts +1 -0
- package/src/decorators/operations/summary.ts +1 -1
- package/src/decorators/operations/tags.spec.ts +1 -0
- package/src/decorators/operations/tags.ts +11 -2
|
@@ -6,7 +6,7 @@ import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
|
6
6
|
* ::: warning
|
|
7
7
|
* Don't use decorator with Ts.ED application.
|
|
8
8
|
*
|
|
9
|
-
* Use
|
|
9
|
+
* Use these decorators instead:
|
|
10
10
|
*
|
|
11
11
|
* <ApiList query="status.includes('decorator') && status.includes('httpMethod')" />
|
|
12
12
|
*
|
|
@@ -11,7 +11,7 @@ function mapTags(tags) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Add tags
|
|
14
|
+
* Add metadata tags to the decorated element (class or method).
|
|
15
15
|
*
|
|
16
16
|
* ## Examples
|
|
17
17
|
* ### On method
|
|
@@ -23,6 +23,15 @@ function mapTags(tags) {
|
|
|
23
23
|
* get() {}
|
|
24
24
|
* }
|
|
25
25
|
* ```
|
|
26
|
+
* ### On Class
|
|
27
|
+
*
|
|
28
|
+
* ```typescript
|
|
29
|
+
* @Controller("/")
|
|
30
|
+
* @Tags("api")
|
|
31
|
+
* class MyController {
|
|
32
|
+
* get() {}
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
26
35
|
*
|
|
27
36
|
* @param tags
|
|
28
37
|
* @decorator
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../../src/decorators/operations/tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAE,wBAAwB,EAAC,MAAM,YAAY,CAAC;AAGvF,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAEvD,SAAS,OAAO,CAAC,IAA8B;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACtB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO;gBACL,IAAI,EAAE,GAAG;aACV,CAAC;QACJ,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../../src/decorators/operations/tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAE,wBAAwB,EAAC,MAAM,YAAY,CAAC;AAGvF,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAEvD,SAAS,OAAO,CAAC,IAA8B;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACtB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO;gBACL,IAAI,EAAE,GAAG;aACV,CAAC;QACJ,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,IAAI,CAAC,GAAG,IAA8B;IACpD,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAClC,QAAQ,KAAK,CAAC,aAAa,EAAE,CAAC;YAC5B,KAAK,cAAc,CAAC,MAAM;gBACxB,KAAK,CAAC,SAAU,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;gBACxC,MAAM;YACR,KAAK,cAAc,CAAC,KAAK;gBACvB,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;gBAC1C,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -46,4 +46,4 @@ import { JsonHeader, JsonHeaders } from "../../interfaces/JsonOpenSpec.js";
|
|
|
46
46
|
* @operation
|
|
47
47
|
* @response
|
|
48
48
|
*/
|
|
49
|
-
export declare function Header(headers: string | number | JsonHeaders, value?: string | number | JsonHeader):
|
|
49
|
+
export declare function Header(headers: string | number | JsonHeaders, value?: string | number | JsonHeader): import("./returns.js").ReturnsChainedDecorators;
|
|
@@ -5,7 +5,7 @@ import { OperationVerbs } from "../../constants/OperationVerbs.js";
|
|
|
5
5
|
* ::: warning
|
|
6
6
|
* Don't use decorator with Ts.ED application.
|
|
7
7
|
*
|
|
8
|
-
* Use
|
|
8
|
+
* Use these decorators instead:
|
|
9
9
|
*
|
|
10
10
|
* <ApiList query="status.includes('decorator') && status.includes('httpMethod')" />
|
|
11
11
|
*
|
|
@@ -48,5 +48,5 @@ import { JsonHeader } from "../../interfaces/JsonOpenSpec.js";
|
|
|
48
48
|
* @response
|
|
49
49
|
* @headers
|
|
50
50
|
*/
|
|
51
|
-
export declare function Redirect(url: string, meta?: JsonHeader):
|
|
52
|
-
export declare function Redirect(status: number, url: string, meta?: JsonHeader):
|
|
51
|
+
export declare function Redirect(url: string, meta?: JsonHeader): MethodDecorator;
|
|
52
|
+
export declare function Redirect(status: number, url: string, meta?: JsonHeader): MethodDecorator;
|
|
@@ -21,7 +21,7 @@ import { OpenSpecSecurity } from "@tsed/openspec";
|
|
|
21
21
|
* @classDecorator
|
|
22
22
|
* @operation
|
|
23
23
|
*/
|
|
24
|
-
export declare function Security(name: string, ...scopes: string[]):
|
|
24
|
+
export declare function Security(name: string, ...scopes: string[]): ClassDecorator & MethodDecorator;
|
|
25
25
|
/**
|
|
26
26
|
* Add security metadata on the decorated method.
|
|
27
27
|
*
|
|
@@ -53,4 +53,4 @@ export declare function Security(name: string, ...scopes: string[]): Function;
|
|
|
53
53
|
* @classDecorator
|
|
54
54
|
* @operation
|
|
55
55
|
*/
|
|
56
|
-
export declare function Security(security: OpenSpecSecurity):
|
|
56
|
+
export declare function Security(security: OpenSpecSecurity): ClassDecorator & MethodDecorator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OpenSpecTag } from "@tsed/openspec";
|
|
2
2
|
/**
|
|
3
|
-
* Add tags
|
|
3
|
+
* Add metadata tags to the decorated element (class or method).
|
|
4
4
|
*
|
|
5
5
|
* ## Examples
|
|
6
6
|
* ### On method
|
|
@@ -12,6 +12,15 @@ import { OpenSpecTag } from "@tsed/openspec";
|
|
|
12
12
|
* get() {}
|
|
13
13
|
* }
|
|
14
14
|
* ```
|
|
15
|
+
* ### On Class
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* @Controller("/")
|
|
19
|
+
* @Tags("api")
|
|
20
|
+
* class MyController {
|
|
21
|
+
* get() {}
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
15
24
|
*
|
|
16
25
|
* @param tags
|
|
17
26
|
* @decorator
|
|
@@ -20,4 +29,4 @@ import { OpenSpecTag } from "@tsed/openspec";
|
|
|
20
29
|
* @classDecorator
|
|
21
30
|
* @operation
|
|
22
31
|
*/
|
|
23
|
-
export declare function Tags(...tags: (string | OpenSpecTag)[]):
|
|
32
|
+
export declare function Tags(...tags: (string | OpenSpecTag)[]): ClassDecorator & MethodDecorator;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/schema",
|
|
3
3
|
"description": "JsonSchema module for Ts.ED Framework",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.4.
|
|
5
|
+
"version": "8.4.5",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"tsed"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@tsed/openspec": "8.4.
|
|
40
|
+
"@tsed/openspec": "8.4.5",
|
|
41
41
|
"change-case": "^5.4.4",
|
|
42
42
|
"json-schema": "0.4.0",
|
|
43
43
|
"picomatch": "2.3.1",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@apidevtools/swagger-parser": "10.1.0",
|
|
49
|
-
"@tsed/barrels": "8.4.
|
|
50
|
-
"@tsed/core": "8.4.
|
|
51
|
-
"@tsed/hooks": "8.4.
|
|
52
|
-
"@tsed/openspec": "8.4.
|
|
53
|
-
"@tsed/typescript": "8.4.
|
|
49
|
+
"@tsed/barrels": "8.4.5",
|
|
50
|
+
"@tsed/core": "8.4.5",
|
|
51
|
+
"@tsed/hooks": "8.4.5",
|
|
52
|
+
"@tsed/openspec": "8.4.5",
|
|
53
|
+
"@tsed/typescript": "8.4.5",
|
|
54
54
|
"@types/fs-extra": "11.0.4",
|
|
55
55
|
"@types/json-schema": "7.0.15",
|
|
56
56
|
"@types/picomatch": "3.0.1",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"webpack": "^5.75.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@tsed/core": ">=8.4.
|
|
67
|
-
"@tsed/hooks": ">=8.4.
|
|
68
|
-
"@tsed/openspec": ">=8.4.
|
|
66
|
+
"@tsed/core": ">=8.4.5",
|
|
67
|
+
"@tsed/hooks": ">=8.4.5",
|
|
68
|
+
"@tsed/openspec": ">=8.4.5"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"@tsed/core": {
|
|
@@ -13,7 +13,7 @@ import {JsonEntityStore} from "../../domain/JsonEntityStore.js";
|
|
|
13
13
|
* @input
|
|
14
14
|
* @generics
|
|
15
15
|
*/
|
|
16
|
-
export function Generics(...generics: string[]) {
|
|
16
|
+
export function Generics(...generics: string[]): ClassDecorator {
|
|
17
17
|
return (target: any) => {
|
|
18
18
|
const storedSchema = JsonEntityStore.from(target);
|
|
19
19
|
|
|
@@ -20,6 +20,6 @@ import {Produces} from "./produces.js";
|
|
|
20
20
|
* @operation
|
|
21
21
|
* @response
|
|
22
22
|
*/
|
|
23
|
-
export function AcceptMime(...mimes: string[]):
|
|
23
|
+
export function AcceptMime(...mimes: string[]): ClassDecorator & MethodDecorator {
|
|
24
24
|
return useDecorators(Produces(...mimes), StoreSet("acceptMimes", mimes));
|
|
25
25
|
}
|
|
@@ -20,7 +20,7 @@ import {JsonEntityFn} from "../common/jsonEntityFn.js";
|
|
|
20
20
|
* @classDecorator
|
|
21
21
|
* @operation
|
|
22
22
|
*/
|
|
23
|
-
export function Consumes(...consumes: string[]) {
|
|
23
|
+
export function Consumes(...consumes: string[]): ClassDecorator & MethodDecorator {
|
|
24
24
|
return JsonEntityFn((store, args) => {
|
|
25
25
|
switch (store.decoratorType) {
|
|
26
26
|
case DecoratorTypes.METHOD:
|
|
@@ -50,7 +50,7 @@ import {Returns} from "./returns.js";
|
|
|
50
50
|
* @operation
|
|
51
51
|
* @response
|
|
52
52
|
*/
|
|
53
|
-
export function Header(headers: string | number | JsonHeaders, value?: string | number | JsonHeader)
|
|
53
|
+
export function Header(headers: string | number | JsonHeaders, value?: string | number | JsonHeader) {
|
|
54
54
|
if (value !== undefined) {
|
|
55
55
|
headers = {[headers as string]: value};
|
|
56
56
|
}
|
|
@@ -11,7 +11,7 @@ import {JsonEntityFn} from "../common/jsonEntityFn.js";
|
|
|
11
11
|
* @schema
|
|
12
12
|
* @operation
|
|
13
13
|
*/
|
|
14
|
-
export function OperationId(operationId: string) {
|
|
14
|
+
export function OperationId(operationId: string): MethodDecorator {
|
|
15
15
|
return JsonEntityFn((store, args) => {
|
|
16
16
|
if (store.decoratorType !== DecoratorTypes.METHOD) {
|
|
17
17
|
throw new UnsupportedDecoratorType(OperationId, args);
|
|
@@ -9,7 +9,7 @@ import {JsonEntityFn} from "../common/jsonEntityFn.js";
|
|
|
9
9
|
* ::: warning
|
|
10
10
|
* Don't use decorator with Ts.ED application.
|
|
11
11
|
*
|
|
12
|
-
* Use
|
|
12
|
+
* Use these decorators instead:
|
|
13
13
|
*
|
|
14
14
|
* <ApiList query="status.includes('decorator') && status.includes('httpMethod')" />
|
|
15
15
|
*
|
|
@@ -16,7 +16,7 @@ import {JsonEntityFn} from "../common/jsonEntityFn.js";
|
|
|
16
16
|
* @classDecorator
|
|
17
17
|
* @operation
|
|
18
18
|
*/
|
|
19
|
-
export function Path(path: string) {
|
|
19
|
+
export function Path(path: string): ClassDecorator {
|
|
20
20
|
return JsonEntityFn((store, args) => {
|
|
21
21
|
if (store.decoratorType !== DecoratorTypes.CLASS) {
|
|
22
22
|
throw new UnsupportedDecoratorType(Path, args);
|
|
@@ -27,7 +27,7 @@ import {JsonEntityFn} from "../common/jsonEntityFn.js";
|
|
|
27
27
|
* @operation
|
|
28
28
|
* @response
|
|
29
29
|
*/
|
|
30
|
-
export function Produces(...produces: string[]) {
|
|
30
|
+
export function Produces(...produces: string[]): ClassDecorator & MethodDecorator {
|
|
31
31
|
return JsonEntityFn((store, args) => {
|
|
32
32
|
switch (store.decoratorType) {
|
|
33
33
|
case DecoratorTypes.METHOD:
|
|
@@ -53,9 +53,9 @@ import {Returns} from "./returns.js";
|
|
|
53
53
|
* @response
|
|
54
54
|
* @headers
|
|
55
55
|
*/
|
|
56
|
-
export function Redirect(url: string, meta?: JsonHeader):
|
|
57
|
-
export function Redirect(status: number, url: string, meta?: JsonHeader):
|
|
58
|
-
export function Redirect(...args: any[]):
|
|
56
|
+
export function Redirect(url: string, meta?: JsonHeader): MethodDecorator;
|
|
57
|
+
export function Redirect(status: number, url: string, meta?: JsonHeader): MethodDecorator;
|
|
58
|
+
export function Redirect(...args: any[]): MethodDecorator {
|
|
59
59
|
const {status, url, meta} = args.reduce(
|
|
60
60
|
(options: any, value: any) => {
|
|
61
61
|
if (isNumber(value)) {
|
|
@@ -25,7 +25,7 @@ import {JsonEntityFn} from "../common/jsonEntityFn.js";
|
|
|
25
25
|
* @classDecorator
|
|
26
26
|
* @operation
|
|
27
27
|
*/
|
|
28
|
-
export function Security(name: string, ...scopes: string[]):
|
|
28
|
+
export function Security(name: string, ...scopes: string[]): ClassDecorator & MethodDecorator;
|
|
29
29
|
/**
|
|
30
30
|
* Add security metadata on the decorated method.
|
|
31
31
|
*
|
|
@@ -57,8 +57,8 @@ export function Security(name: string, ...scopes: string[]): Function;
|
|
|
57
57
|
* @classDecorator
|
|
58
58
|
* @operation
|
|
59
59
|
*/
|
|
60
|
-
export function Security(security: OpenSpecSecurity):
|
|
61
|
-
export function Security(nameOrSecurity: string | OpenSpecSecurity, ...scopes: string[]):
|
|
60
|
+
export function Security(security: OpenSpecSecurity): ClassDecorator & MethodDecorator;
|
|
61
|
+
export function Security(nameOrSecurity: string | OpenSpecSecurity, ...scopes: string[]): ClassDecorator & MethodDecorator {
|
|
62
62
|
return JsonEntityFn((store, args) => {
|
|
63
63
|
switch (store.decoratorType) {
|
|
64
64
|
case DecoratorTypes.METHOD:
|
|
@@ -21,7 +21,7 @@ import {JsonEntityFn} from "../common/jsonEntityFn.js";
|
|
|
21
21
|
* @schema
|
|
22
22
|
* @operation
|
|
23
23
|
*/
|
|
24
|
-
export function Summary(summary: string) {
|
|
24
|
+
export function Summary(summary: string): MethodDecorator {
|
|
25
25
|
return JsonEntityFn((store, args) => {
|
|
26
26
|
if (store.decoratorType !== DecoratorTypes.METHOD) {
|
|
27
27
|
throw new UnsupportedDecoratorType(Summary, args);
|
|
@@ -16,7 +16,7 @@ function mapTags(tags: (string | OpenSpecTag)[]) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Add tags
|
|
19
|
+
* Add metadata tags to the decorated element (class or method).
|
|
20
20
|
*
|
|
21
21
|
* ## Examples
|
|
22
22
|
* ### On method
|
|
@@ -28,6 +28,15 @@ function mapTags(tags: (string | OpenSpecTag)[]) {
|
|
|
28
28
|
* get() {}
|
|
29
29
|
* }
|
|
30
30
|
* ```
|
|
31
|
+
* ### On Class
|
|
32
|
+
*
|
|
33
|
+
* ```typescript
|
|
34
|
+
* @Controller("/")
|
|
35
|
+
* @Tags("api")
|
|
36
|
+
* class MyController {
|
|
37
|
+
* get() {}
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
31
40
|
*
|
|
32
41
|
* @param tags
|
|
33
42
|
* @decorator
|
|
@@ -36,7 +45,7 @@ function mapTags(tags: (string | OpenSpecTag)[]) {
|
|
|
36
45
|
* @classDecorator
|
|
37
46
|
* @operation
|
|
38
47
|
*/
|
|
39
|
-
export function Tags(...tags: (string | OpenSpecTag)[]) {
|
|
48
|
+
export function Tags(...tags: (string | OpenSpecTag)[]): ClassDecorator & MethodDecorator {
|
|
40
49
|
return JsonEntityFn((store, args) => {
|
|
41
50
|
switch (store.decoratorType) {
|
|
42
51
|
case DecoratorTypes.METHOD:
|