@tsed/schema 7.87.1 → 7.87.3
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/cjs/decorators/operations/returns.js +1 -8
- package/lib/cjs/decorators/operations/returns.js.map +1 -1
- package/lib/cjs/domain/JsonEntityStore.js +10 -4
- package/lib/cjs/domain/JsonEntityStore.js.map +1 -1
- package/lib/cjs/domain/JsonMap.js.map +1 -1
- package/lib/cjs/domain/JsonMedia.js.map +1 -1
- package/lib/cjs/domain/JsonMethodStore.js +30 -32
- package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
- package/lib/cjs/utils/mergeSchema.js +46 -28
- package/lib/cjs/utils/mergeSchema.js.map +1 -1
- package/lib/cjs/utils/toJsonMapCollection.js.map +1 -1
- package/lib/esm/decorators/operations/returns.js +1 -8
- package/lib/esm/decorators/operations/returns.js.map +1 -1
- package/lib/esm/domain/JsonEntityStore.js +10 -4
- package/lib/esm/domain/JsonEntityStore.js.map +1 -1
- package/lib/esm/domain/JsonMap.js.map +1 -1
- package/lib/esm/domain/JsonMedia.js.map +1 -1
- package/lib/esm/domain/JsonMethodStore.js +31 -33
- package/lib/esm/domain/JsonMethodStore.js.map +1 -1
- package/lib/esm/utils/mergeSchema.js +47 -29
- package/lib/esm/utils/mergeSchema.js.map +1 -1
- package/lib/esm/utils/toJsonMapCollection.js.map +1 -1
- package/lib/types/domain/JsonEntityStore.d.ts +7 -5
- package/lib/types/domain/JsonMedia.d.ts +1 -1
- package/lib/types/domain/JsonMethodStore.d.ts +7 -2
- package/lib/types/utils/toJsonMapCollection.d.ts +2 -1
- package/lib/types-esm/domain/JsonEntityStore.d.ts +7 -5
- package/lib/types-esm/domain/JsonMedia.d.ts +1 -1
- package/lib/types-esm/domain/JsonMethodStore.d.ts +7 -2
- package/lib/types-esm/utils/toJsonMapCollection.d.ts +2 -1
- package/package.json +6 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { DecoratorTypes, deepMerge, descriptorOf,
|
|
2
|
+
import { DecoratorTypes, deepMerge, descriptorOf, isFunction, prototypeOf, Store } from "@tsed/core";
|
|
3
3
|
import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent.js";
|
|
4
|
+
import { isSuccessStatus } from "../utils/isSuccessStatus.js";
|
|
4
5
|
import { JsonEntityStore } from "./JsonEntityStore.js";
|
|
5
6
|
import { JsonOperation } from "./JsonOperation.js";
|
|
6
7
|
import { JsonSchema } from "./JsonSchema.js";
|
|
@@ -49,6 +50,34 @@ let JsonMethodStore = class JsonMethodStore extends JsonEntityStore {
|
|
|
49
50
|
get operationPaths() {
|
|
50
51
|
return this.operation.operationPaths;
|
|
51
52
|
}
|
|
53
|
+
get collectionType() {
|
|
54
|
+
return this.schema.getTarget();
|
|
55
|
+
}
|
|
56
|
+
set collectionType(type) {
|
|
57
|
+
console.trace("collectionType is deprecated, use schema.collectionClass instead");
|
|
58
|
+
}
|
|
59
|
+
get isCollection() {
|
|
60
|
+
return this.schema.isCollection;
|
|
61
|
+
}
|
|
62
|
+
get schema() {
|
|
63
|
+
if (this._schema) {
|
|
64
|
+
return this._schema;
|
|
65
|
+
}
|
|
66
|
+
const responses = this.operation.getResponses();
|
|
67
|
+
const [, response] = [...responses.entries()].find(([key, response]) => {
|
|
68
|
+
return isSuccessStatus(key);
|
|
69
|
+
}) || [];
|
|
70
|
+
if (response) {
|
|
71
|
+
const firstMediaType = response.getContent().values().next().value;
|
|
72
|
+
if (firstMediaType) {
|
|
73
|
+
this._schema = firstMediaType.schema();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this._schema = new JsonSchema();
|
|
78
|
+
}
|
|
79
|
+
return this._schema;
|
|
80
|
+
}
|
|
52
81
|
/**
|
|
53
82
|
* Get an endpoint.
|
|
54
83
|
* @param target
|
|
@@ -75,7 +104,7 @@ let JsonMethodStore = class JsonMethodStore extends JsonEntityStore {
|
|
|
75
104
|
}
|
|
76
105
|
return { type: media.schema().collectionClass, groups };
|
|
77
106
|
}
|
|
78
|
-
return { type: this.type };
|
|
107
|
+
return { type: this.type || Object };
|
|
79
108
|
}
|
|
80
109
|
/**
|
|
81
110
|
* Append middlewares to the beforeMiddlewares list.
|
|
@@ -120,38 +149,7 @@ let JsonMethodStore = class JsonMethodStore extends JsonEntityStore {
|
|
|
120
149
|
}), {});
|
|
121
150
|
}
|
|
122
151
|
build() {
|
|
123
|
-
if (!this._type) {
|
|
124
|
-
let type = Metadata.getReturnType(this.target, this.propertyKey);
|
|
125
|
-
type = isPromise(type) ? undefined : type;
|
|
126
|
-
this.buildType(type);
|
|
127
|
-
}
|
|
128
|
-
this._type = this._type || Object;
|
|
129
152
|
this.parent.children.set(this.propertyName, this);
|
|
130
|
-
if (isCollection(this._type)) {
|
|
131
|
-
this.collectionType = this._type;
|
|
132
|
-
// @ts-ignore
|
|
133
|
-
delete this._type;
|
|
134
|
-
}
|
|
135
|
-
// TODO est-ce que c'est tjrs d'actualité car on doit utiliser le decorator @Returns pour affecter correctement les data
|
|
136
|
-
// peut etre que c'est pour les get/setter ou méthod n'étant pas un endpoint?
|
|
137
|
-
if (this.collectionType) {
|
|
138
|
-
this._schema = JsonSchema.from({
|
|
139
|
-
type: this.collectionType
|
|
140
|
-
});
|
|
141
|
-
this._schema.itemSchema(this.type);
|
|
142
|
-
}
|
|
143
|
-
else if (isClass(this.type)) {
|
|
144
|
-
this._schema = JsonSchema.from({
|
|
145
|
-
type: "object"
|
|
146
|
-
});
|
|
147
|
-
this._schema.itemSchema(this.type);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
this._schema = JsonSchema.from({
|
|
151
|
-
type: this.type
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
this.parent.schema.addProperty(this.propertyName, this.schema);
|
|
155
153
|
}
|
|
156
154
|
};
|
|
157
155
|
JsonMethodStore = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonMethodStore.js","sourceRoot":"","sources":["../../../src/domain/JsonMethodStore.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"JsonMethodStore.js","sourceRoot":"","sources":["../../../src/domain/JsonMethodStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAO,MAAM,YAAY,CAAC;AAEzG,OAAO,EAAC,mBAAmB,EAAC,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAC,eAAe,EAAyB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAapC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,eAAe;IAclD,YAAY,OAA+B;QACzC,KAAK,CAAC;YACJ,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAY,CAAC;YAC7D,UAAU,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAY,CAAC;YAC9D,GAAG,OAAO;SACX,CAAC,CAAC;QAlBI,WAAM,GAAmB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7D,gBAAW,GAAU,EAAE,CAAC;QACxB,sBAAiB,GAAU,EAAE,CAAC;QAC9B,qBAAgB,GAAU,EAAE,CAAC;QACpC;;WAEG;QACM,cAAS,GAAkB,IAAI,aAAa,EAAE,CAAC;QACxD;;WAEG;QACM,aAAQ,GAA6C,IAAI,GAAG,EAAE,CAAC;QAStE,MAAM,EAAC,iBAAiB,GAAG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,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEnD,OAAO,SAAS,CAAI,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAEM,aAAa;QAClB,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CACvC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YACd,GAAG,GAAG;YACN,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI;SACvB,CAAC,EACF,EAAE,CACH,CAAC;IACJ,CAAC;IAES,KAAK;QACb,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF,CAAA;AA3LY,eAAe;IAD3B,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC;;GAC9B,eAAe,CA2L3B;SA3LY,eAAe;AAiN5B,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isObject, uniq } from "@tsed/core";
|
|
1
|
+
import { cleanObject, isObject, uniq } from "@tsed/core";
|
|
2
2
|
function mergeProps(properties1, properties2) {
|
|
3
3
|
if (!properties1 || !properties2) {
|
|
4
4
|
return properties1 || properties2 || {};
|
|
@@ -17,40 +17,58 @@ function mergeProps(properties1, properties2) {
|
|
|
17
17
|
return acc;
|
|
18
18
|
}, {});
|
|
19
19
|
}
|
|
20
|
+
function getSchemaType(schema) {
|
|
21
|
+
return schema.type || (schema.items && "array") || ((schema.properties || schema.additionalProperties) && "object") || "$any";
|
|
22
|
+
}
|
|
20
23
|
function mergeManyOf(kind, schema1, schema2) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
const { [kind]: kind1, ...$rest1 } = schema1;
|
|
25
|
+
const { [kind]: kind2, ...$rest2 } = schema2;
|
|
26
|
+
let hasRef = false;
|
|
27
|
+
const map = [kind1, $rest1, kind2, $rest2]
|
|
28
|
+
.flat()
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.reduce((map, schema, index) => {
|
|
31
|
+
schema = cleanObject(schema);
|
|
32
|
+
if (schema.$ref) {
|
|
33
|
+
hasRef = true;
|
|
34
|
+
return map.set(schema.$ref, schema);
|
|
35
|
+
}
|
|
36
|
+
if (Object.keys(schema).length === 0) {
|
|
37
|
+
return map;
|
|
33
38
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
of = of.reduce((current, item, index) => {
|
|
38
|
-
if (item.$ref) {
|
|
39
|
-
return current.concat(item);
|
|
39
|
+
if (schema.type === "object" && Object.keys(schema).length === 2) {
|
|
40
|
+
if ("writeOnly" in schema || "readOnly" in schema || "deprecated" in schema) {
|
|
41
|
+
schema = { ...schema, type: undefined };
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
}
|
|
44
|
+
const type = getSchemaType(schema);
|
|
45
|
+
if (type === "array") {
|
|
46
|
+
map.set("array_" + index, schema);
|
|
47
|
+
return map;
|
|
48
|
+
}
|
|
49
|
+
if (map.has(type)) {
|
|
50
|
+
if (kind === "allOf") {
|
|
51
|
+
// we can merge allOf schemas to optimize the schema
|
|
52
|
+
map.set(type, mergeSchema(map.get(type), schema));
|
|
53
|
+
return map;
|
|
44
54
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
map.set(type + "_" + index, schema);
|
|
56
|
+
return map;
|
|
57
|
+
}
|
|
58
|
+
return map.set(type, schema);
|
|
59
|
+
}, new Map());
|
|
60
|
+
const rest = map.get("$any");
|
|
61
|
+
map.delete("$any");
|
|
62
|
+
const of = Array.from(map.values());
|
|
63
|
+
return cleanObject(of.length > 1 || (hasRef && rest)
|
|
49
64
|
? {
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
...rest,
|
|
66
|
+
[kind]: of
|
|
52
67
|
}
|
|
53
|
-
:
|
|
68
|
+
: {
|
|
69
|
+
...rest,
|
|
70
|
+
...of[0]
|
|
71
|
+
});
|
|
54
72
|
}
|
|
55
73
|
export function mergeSchema(schema1, schema2) {
|
|
56
74
|
if (schema1.$ref && schema2.$ref && schema1.$ref === schema2.$ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeSchema.js","sourceRoot":"","sources":["../../../src/utils/mergeSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"mergeSchema.js","sourceRoot":"","sources":["../../../src/utils/mergeSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAOvD,SAAS,UAAU,CAAC,WAAwB,EAAE,WAAwB;IACpE,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,EAAE;QAChC,OAAO,WAAW,IAAI,WAAW,IAAI,EAAE,CAAC;KACzC;IAED,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjG,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC9B,IAAI,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE;YAC5C,GAAG,CAAC,GAAG,CAA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ACf;IAED,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE;QAClC,OAAO,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;KAC/C;IAED,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE;QAChC,OAAO,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;KAC/C;IAED,MAAM,YAAY,GAAgB,EAAC,GAAG,OAAO,EAAE,GAAG,OAAO,EAAC,CAAC;IAE3D,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE;QAC5C,oBAAoB;QACpB,YAAY,CAAC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;KAC9E;IAED,IAAI,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE;QACpF,oFAAoF;QACpF,YAAY,CAAC,oBAAoB,GAAG;YAClC,GAAI,OAAO,CAAC,oBAAoC;YAChD,GAAI,OAAO,CAAC,oBAAoC;SACjD,CAAC;KACH;IAED,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE;QACxC,yBAAyB;QACzB,YAAY,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;KAC1F;IAED,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toJsonMapCollection.js","sourceRoot":"","sources":["../../../src/utils/toJsonMapCollection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toJsonMapCollection.js","sourceRoot":"","sources":["../../../src/utils/toJsonMapCollection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA6B,EAAE,QAA4B,OAAO;IACpG,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9D,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAEnC,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,IAAI,OAAO,EAAO,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -42,21 +42,23 @@ export declare abstract class JsonEntityStore implements JsonEntityStoreOptions
|
|
|
42
42
|
* Decorator type used to declare the JsonSchemaStore.
|
|
43
43
|
*/
|
|
44
44
|
readonly decoratorType: DecoratorTypes;
|
|
45
|
-
/**
|
|
46
|
-
* Type of the collection (Array, Map, Set, etc...)
|
|
47
|
-
*/
|
|
48
|
-
collectionType: Type<any>;
|
|
49
45
|
token: Type<any>;
|
|
50
46
|
readonly store: Store;
|
|
51
47
|
readonly isStore = true;
|
|
52
48
|
readonly parent: JsonEntityStore;
|
|
53
49
|
readonly target: Type<any>;
|
|
50
|
+
[key: string]: any;
|
|
54
51
|
constructor(options: JsonEntityStoreOptions);
|
|
52
|
+
/**
|
|
53
|
+
* Type of the collection (Array, Map, Set, etc...)
|
|
54
|
+
*/
|
|
55
|
+
private _collectionType;
|
|
56
|
+
get collectionType(): Type<any>;
|
|
57
|
+
set collectionType(value: Type<any>);
|
|
55
58
|
/**
|
|
56
59
|
*
|
|
57
60
|
*/
|
|
58
61
|
protected _type: Type<any>;
|
|
59
|
-
[key: string]: any;
|
|
60
62
|
get type(): Type<any> | any;
|
|
61
63
|
/**
|
|
62
64
|
* Get original type without transformation
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OS3MediaType } from "@tsed/openspec";
|
|
2
2
|
import { JsonMap } from "./JsonMap.js";
|
|
3
3
|
import { JsonSchema } from "./JsonSchema.js";
|
|
4
|
-
export declare class JsonMedia extends JsonMap<
|
|
4
|
+
export declare class JsonMedia extends JsonMap<any> {
|
|
5
5
|
$kind: string;
|
|
6
6
|
constructor(obj?: Partial<OS3MediaType<JsonSchema>>);
|
|
7
7
|
schema(schema?: JsonSchema): JsonSchema;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Type } from "@tsed/core";
|
|
2
|
-
import type
|
|
2
|
+
import { type JsonClassStore } from "./JsonClassStore.js";
|
|
3
3
|
import { JsonEntityStore, JsonEntityStoreOptions } from "./JsonEntityStore.js";
|
|
4
4
|
import { JsonOperation } from "./JsonOperation.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type JsonParameterStore } from "./JsonParameterStore.js";
|
|
6
|
+
import { JsonSchema } from "./JsonSchema.js";
|
|
6
7
|
export interface JsonViewOptions {
|
|
7
8
|
path: string;
|
|
8
9
|
options: any;
|
|
@@ -32,6 +33,10 @@ export declare class JsonMethodStore extends JsonEntityStore {
|
|
|
32
33
|
set acceptMimes(mimes: string[]);
|
|
33
34
|
get parameters(): JsonParameterStore[];
|
|
34
35
|
get operationPaths(): Map<string, import("./JsonOperation.js").JsonMethodPath>;
|
|
36
|
+
get collectionType(): Type<any>;
|
|
37
|
+
set collectionType(type: Type<any>);
|
|
38
|
+
get isCollection(): boolean;
|
|
39
|
+
get schema(): JsonSchema;
|
|
35
40
|
/**
|
|
36
41
|
* Get an endpoint.
|
|
37
42
|
* @param target
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { Type } from "@tsed/core";
|
|
1
2
|
import { JsonMap } from "../domain/JsonMap.js";
|
|
2
3
|
/**
|
|
3
4
|
* @ignore
|
|
4
5
|
*/
|
|
5
6
|
export declare function toJsonMapCollection(content: {
|
|
6
7
|
[key: string]: any;
|
|
7
|
-
}, klass?:
|
|
8
|
+
}, klass?: Type<JsonMap<any>>): JsonMap<any>;
|
|
@@ -42,21 +42,23 @@ export declare abstract class JsonEntityStore implements JsonEntityStoreOptions
|
|
|
42
42
|
* Decorator type used to declare the JsonSchemaStore.
|
|
43
43
|
*/
|
|
44
44
|
readonly decoratorType: DecoratorTypes;
|
|
45
|
-
/**
|
|
46
|
-
* Type of the collection (Array, Map, Set, etc...)
|
|
47
|
-
*/
|
|
48
|
-
collectionType: Type<any>;
|
|
49
45
|
token: Type<any>;
|
|
50
46
|
readonly store: Store;
|
|
51
47
|
readonly isStore = true;
|
|
52
48
|
readonly parent: JsonEntityStore;
|
|
53
49
|
readonly target: Type<any>;
|
|
50
|
+
[key: string]: any;
|
|
54
51
|
constructor(options: JsonEntityStoreOptions);
|
|
52
|
+
/**
|
|
53
|
+
* Type of the collection (Array, Map, Set, etc...)
|
|
54
|
+
*/
|
|
55
|
+
private _collectionType;
|
|
56
|
+
get collectionType(): Type<any>;
|
|
57
|
+
set collectionType(value: Type<any>);
|
|
55
58
|
/**
|
|
56
59
|
*
|
|
57
60
|
*/
|
|
58
61
|
protected _type: Type<any>;
|
|
59
|
-
[key: string]: any;
|
|
60
62
|
get type(): Type<any> | any;
|
|
61
63
|
/**
|
|
62
64
|
* Get original type without transformation
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OS3MediaType } from "@tsed/openspec";
|
|
2
2
|
import { JsonMap } from "./JsonMap.js";
|
|
3
3
|
import { JsonSchema } from "./JsonSchema.js";
|
|
4
|
-
export declare class JsonMedia extends JsonMap<
|
|
4
|
+
export declare class JsonMedia extends JsonMap<any> {
|
|
5
5
|
$kind: string;
|
|
6
6
|
constructor(obj?: Partial<OS3MediaType<JsonSchema>>);
|
|
7
7
|
schema(schema?: JsonSchema): JsonSchema;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Type } from "@tsed/core";
|
|
2
|
-
import type
|
|
2
|
+
import { type JsonClassStore } from "./JsonClassStore.js";
|
|
3
3
|
import { JsonEntityStore, JsonEntityStoreOptions } from "./JsonEntityStore.js";
|
|
4
4
|
import { JsonOperation } from "./JsonOperation.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type JsonParameterStore } from "./JsonParameterStore.js";
|
|
6
|
+
import { JsonSchema } from "./JsonSchema.js";
|
|
6
7
|
export interface JsonViewOptions {
|
|
7
8
|
path: string;
|
|
8
9
|
options: any;
|
|
@@ -32,6 +33,10 @@ export declare class JsonMethodStore extends JsonEntityStore {
|
|
|
32
33
|
set acceptMimes(mimes: string[]);
|
|
33
34
|
get parameters(): JsonParameterStore[];
|
|
34
35
|
get operationPaths(): Map<string, import("./JsonOperation.js").JsonMethodPath>;
|
|
36
|
+
get collectionType(): Type<any>;
|
|
37
|
+
set collectionType(type: Type<any>);
|
|
38
|
+
get isCollection(): boolean;
|
|
39
|
+
get schema(): JsonSchema;
|
|
35
40
|
/**
|
|
36
41
|
* Get an endpoint.
|
|
37
42
|
* @param target
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { Type } from "@tsed/core";
|
|
1
2
|
import { JsonMap } from "../domain/JsonMap.js";
|
|
2
3
|
/**
|
|
3
4
|
* @ignore
|
|
4
5
|
*/
|
|
5
6
|
export declare function toJsonMapCollection(content: {
|
|
6
7
|
[key: string]: any;
|
|
7
|
-
}, klass?:
|
|
8
|
+
}, klass?: Type<JsonMap<any>>): JsonMap<any>;
|
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": "commonjs",
|
|
5
|
-
"version": "7.87.
|
|
5
|
+
"version": "7.87.3",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/cjs/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"tsed"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@tsed/openspec": "7.87.
|
|
40
|
+
"@tsed/openspec": "7.87.3",
|
|
41
41
|
"change-case": "^4.1.2",
|
|
42
42
|
"fs-extra": "^11.2.0",
|
|
43
43
|
"json-schema": "0.4.0",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@apidevtools/swagger-parser": "10.1.0",
|
|
50
|
-
"@tsed/barrels": "7.87.
|
|
51
|
-
"@tsed/core": "7.87.
|
|
52
|
-
"@tsed/openspec": "7.87.
|
|
53
|
-
"@tsed/typescript": "7.87.
|
|
50
|
+
"@tsed/barrels": "7.87.3",
|
|
51
|
+
"@tsed/core": "7.87.3",
|
|
52
|
+
"@tsed/openspec": "7.87.3",
|
|
53
|
+
"@tsed/typescript": "7.87.3",
|
|
54
54
|
"@types/fs-extra": "11.0.4",
|
|
55
55
|
"@types/json-schema": "7.0.15",
|
|
56
56
|
"@types/picomatch": "2.3.3",
|