@tsed/schema 6.114.15 → 6.114.18
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/components/lazyRefMapper.js +1 -2
- package/lib/cjs/components/lazyRefMapper.js.map +1 -1
- package/lib/cjs/components/objectMapper.js +1 -1
- package/lib/cjs/components/objectMapper.js.map +1 -1
- package/lib/cjs/constants/httpStatusMessages.js +2 -4
- package/lib/cjs/constants/httpStatusMessages.js.map +1 -1
- package/lib/cjs/decorators/common/description.js +1 -2
- package/lib/cjs/decorators/common/description.js.map +1 -1
- package/lib/cjs/decorators/operations/redirect.js +1 -2
- package/lib/cjs/decorators/operations/redirect.js.map +1 -1
- package/lib/cjs/decorators/operations/returns.js +20 -20
- package/lib/cjs/decorators/operations/returns.js.map +1 -1
- package/lib/cjs/decorators/operations/route.js +1 -4
- package/lib/cjs/decorators/operations/route.js.map +1 -1
- package/lib/cjs/domain/DecoratorContext.js +4 -1
- package/lib/cjs/domain/DecoratorContext.js.map +1 -1
- package/lib/cjs/domain/JsonClassStore.js +4 -7
- package/lib/cjs/domain/JsonClassStore.js.map +1 -1
- package/lib/cjs/domain/JsonEntityStore.js +37 -1
- package/lib/cjs/domain/JsonEntityStore.js.map +1 -1
- package/lib/cjs/domain/JsonLazyRef.js +2 -1
- package/lib/cjs/domain/JsonLazyRef.js.map +1 -1
- package/lib/cjs/domain/JsonMethodStore.js +12 -12
- package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
- package/lib/cjs/domain/JsonOperation.js +12 -16
- package/lib/cjs/domain/JsonOperation.js.map +1 -1
- package/lib/cjs/domain/JsonOperationPathsMap.js +1 -4
- package/lib/cjs/domain/JsonOperationPathsMap.js.map +1 -1
- package/lib/cjs/domain/JsonOperationRoute.js +8 -6
- package/lib/cjs/domain/JsonOperationRoute.js.map +1 -1
- package/lib/cjs/domain/JsonParameter.js +4 -4
- package/lib/cjs/domain/JsonParameter.js.map +1 -1
- package/lib/cjs/domain/JsonParameterStore.js +12 -5
- package/lib/cjs/domain/JsonParameterStore.js.map +1 -1
- package/lib/cjs/domain/JsonPropertyStore.js +1 -4
- package/lib/cjs/domain/JsonPropertyStore.js.map +1 -1
- package/lib/cjs/domain/JsonResponse.js +3 -6
- package/lib/cjs/domain/JsonResponse.js.map +1 -1
- package/lib/cjs/domain/JsonSchema.js +58 -60
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/hooks/alterIgnore.js +2 -3
- package/lib/cjs/hooks/alterIgnore.js.map +1 -1
- package/lib/cjs/hooks/alterRequiredGroups.js +1 -2
- package/lib/cjs/hooks/alterRequiredGroups.js.map +1 -1
- package/lib/cjs/utils/getJsonSchema.js +4 -5
- package/lib/cjs/utils/getJsonSchema.js.map +1 -1
- package/lib/cjs/utils/getRequiredProperties.js +3 -3
- package/lib/cjs/utils/getRequiredProperties.js.map +1 -1
- package/lib/cjs/utils/mapNullableType.js +1 -1
- package/lib/cjs/utils/mapNullableType.js.map +1 -1
- package/lib/cjs/utils/mergeOperation.js +1 -2
- package/lib/cjs/utils/mergeOperation.js.map +1 -1
- package/lib/cjs/utils/transformToOS2.js +2 -2
- package/lib/cjs/utils/transformToOS2.js.map +1 -1
- package/lib/esm/components/lazyRefMapper.js +1 -2
- package/lib/esm/components/lazyRefMapper.js.map +1 -1
- package/lib/esm/components/objectMapper.js +1 -1
- package/lib/esm/components/objectMapper.js.map +1 -1
- package/lib/esm/constants/httpStatusMessages.js +2 -4
- package/lib/esm/constants/httpStatusMessages.js.map +1 -1
- package/lib/esm/decorators/common/description.js +1 -2
- package/lib/esm/decorators/common/description.js.map +1 -1
- package/lib/esm/decorators/operations/redirect.js +1 -2
- package/lib/esm/decorators/operations/redirect.js.map +1 -1
- package/lib/esm/decorators/operations/returns.js +20 -20
- package/lib/esm/decorators/operations/returns.js.map +1 -1
- package/lib/esm/decorators/operations/route.js +1 -4
- package/lib/esm/decorators/operations/route.js.map +1 -1
- package/lib/esm/domain/DecoratorContext.js +4 -1
- package/lib/esm/domain/DecoratorContext.js.map +1 -1
- package/lib/esm/domain/JsonClassStore.js +4 -7
- package/lib/esm/domain/JsonClassStore.js.map +1 -1
- package/lib/esm/domain/JsonEntityStore.js +37 -1
- package/lib/esm/domain/JsonEntityStore.js.map +1 -1
- package/lib/esm/domain/JsonLazyRef.js +2 -1
- package/lib/esm/domain/JsonLazyRef.js.map +1 -1
- package/lib/esm/domain/JsonMethodStore.js +12 -12
- package/lib/esm/domain/JsonMethodStore.js.map +1 -1
- package/lib/esm/domain/JsonOperation.js +12 -16
- package/lib/esm/domain/JsonOperation.js.map +1 -1
- package/lib/esm/domain/JsonOperationPathsMap.js +1 -4
- package/lib/esm/domain/JsonOperationPathsMap.js.map +1 -1
- package/lib/esm/domain/JsonOperationRoute.js +8 -6
- package/lib/esm/domain/JsonOperationRoute.js.map +1 -1
- package/lib/esm/domain/JsonParameter.js +4 -4
- package/lib/esm/domain/JsonParameter.js.map +1 -1
- package/lib/esm/domain/JsonParameterStore.js +12 -5
- package/lib/esm/domain/JsonParameterStore.js.map +1 -1
- package/lib/esm/domain/JsonPropertyStore.js +1 -4
- package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
- package/lib/esm/domain/JsonResponse.js +3 -6
- package/lib/esm/domain/JsonResponse.js.map +1 -1
- package/lib/esm/domain/JsonSchema.js +58 -60
- package/lib/esm/domain/JsonSchema.js.map +1 -1
- package/lib/esm/hooks/alterIgnore.js +2 -3
- package/lib/esm/hooks/alterIgnore.js.map +1 -1
- package/lib/esm/hooks/alterRequiredGroups.js +1 -2
- package/lib/esm/hooks/alterRequiredGroups.js.map +1 -1
- package/lib/esm/utils/getJsonSchema.js +4 -5
- package/lib/esm/utils/getJsonSchema.js.map +1 -1
- package/lib/esm/utils/getRequiredProperties.js +3 -3
- package/lib/esm/utils/getRequiredProperties.js.map +1 -1
- package/lib/esm/utils/mapNullableType.js +1 -1
- package/lib/esm/utils/mapNullableType.js.map +1 -1
- package/lib/esm/utils/mergeOperation.js +1 -2
- package/lib/esm/utils/mergeOperation.js.map +1 -1
- package/lib/esm/utils/transformToOS2.js +2 -2
- package/lib/esm/utils/transformToOS2.js.map +1 -1
- package/lib/types/utils/getJsonSchema.d.ts +1 -1
- package/package.json +7 -7
- package/tsconfig.compile.esm.json +2 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _JsonSchema_nullable, _JsonSchema_genericLabels, _JsonSchema_nestedGenerics, _JsonSchema_alias, _JsonSchema_itemSchema, _JsonSchema_target, _JsonSchema_isGeneric, _JsonSchema_isCollection, _JsonSchema_ref;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.JsonSchema = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
4
|
const core_1 = require("@tsed/core");
|
|
7
5
|
const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
|
|
8
6
|
const getComputedType_1 = require("../utils/getComputedType");
|
|
@@ -36,55 +34,56 @@ function mapToJsonSchema(item) {
|
|
|
36
34
|
return item;
|
|
37
35
|
}
|
|
38
36
|
class JsonSchema extends Map {
|
|
37
|
+
isJsonSchema = true;
|
|
38
|
+
$hooks = new core_1.Hooks();
|
|
39
|
+
$required = new Set();
|
|
40
|
+
$allow = [];
|
|
41
|
+
$selfRequired;
|
|
42
|
+
$forwardGroups = false;
|
|
43
|
+
#nullable = false;
|
|
44
|
+
#genericLabels;
|
|
45
|
+
#nestedGenerics = [];
|
|
46
|
+
#alias = new Map();
|
|
47
|
+
#itemSchema;
|
|
48
|
+
#target;
|
|
49
|
+
#isGeneric = false;
|
|
50
|
+
#isCollection = false;
|
|
51
|
+
#ref = false;
|
|
39
52
|
constructor(obj = {}) {
|
|
40
53
|
super();
|
|
41
|
-
this.isJsonSchema = true;
|
|
42
|
-
this.$hooks = new core_1.Hooks();
|
|
43
|
-
this.$required = new Set();
|
|
44
|
-
this.$allow = [];
|
|
45
|
-
this.$forwardGroups = false;
|
|
46
|
-
_JsonSchema_nullable.set(this, false);
|
|
47
|
-
_JsonSchema_genericLabels.set(this, void 0);
|
|
48
|
-
_JsonSchema_nestedGenerics.set(this, []);
|
|
49
|
-
_JsonSchema_alias.set(this, new Map());
|
|
50
|
-
_JsonSchema_itemSchema.set(this, void 0);
|
|
51
|
-
_JsonSchema_target.set(this, void 0);
|
|
52
|
-
_JsonSchema_isGeneric.set(this, false);
|
|
53
|
-
_JsonSchema_isCollection.set(this, false);
|
|
54
|
-
_JsonSchema_ref.set(this, false);
|
|
55
54
|
if (obj) {
|
|
56
55
|
this.assign(obj);
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
get alias() {
|
|
60
|
-
return
|
|
59
|
+
return this.#alias;
|
|
61
60
|
}
|
|
62
61
|
get nestedGenerics() {
|
|
63
|
-
return
|
|
62
|
+
return this.#nestedGenerics;
|
|
64
63
|
}
|
|
65
64
|
set nestedGenerics(value) {
|
|
66
|
-
|
|
65
|
+
this.#nestedGenerics = value;
|
|
67
66
|
}
|
|
68
67
|
get genericLabels() {
|
|
69
|
-
return
|
|
68
|
+
return this.#genericLabels;
|
|
70
69
|
}
|
|
71
70
|
set genericLabels(value) {
|
|
72
|
-
|
|
71
|
+
this.#genericLabels = value;
|
|
73
72
|
}
|
|
74
73
|
get isClass() {
|
|
75
|
-
return (0, core_1.isClass)(this.class) && ![Map, Array, Set, Object, Date, Boolean, Number, String].includes(
|
|
74
|
+
return (0, core_1.isClass)(this.class) && ![Map, Array, Set, Object, Date, Boolean, Number, String].includes(this.#target);
|
|
76
75
|
}
|
|
77
76
|
/**
|
|
78
77
|
* Current schema is a collection
|
|
79
78
|
*/
|
|
80
79
|
get isCollection() {
|
|
81
|
-
return
|
|
80
|
+
return this.#isCollection;
|
|
82
81
|
}
|
|
83
82
|
/**
|
|
84
83
|
* Current schema is a generic
|
|
85
84
|
*/
|
|
86
85
|
get isGeneric() {
|
|
87
|
-
return
|
|
86
|
+
return this.#isGeneric;
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
89
|
* Current schema has generics items
|
|
@@ -99,10 +98,10 @@ class JsonSchema extends Map {
|
|
|
99
98
|
return this.getComputedType();
|
|
100
99
|
}
|
|
101
100
|
get canRef() {
|
|
102
|
-
return
|
|
101
|
+
return this.#ref;
|
|
103
102
|
}
|
|
104
103
|
get isNullable() {
|
|
105
|
-
return
|
|
104
|
+
return this.#nullable || this.$allow.includes(null);
|
|
106
105
|
}
|
|
107
106
|
get isReadOnly() {
|
|
108
107
|
return this.get("readOnly");
|
|
@@ -114,25 +113,25 @@ class JsonSchema extends Map {
|
|
|
114
113
|
return new JsonSchema(obj);
|
|
115
114
|
}
|
|
116
115
|
nullable(value) {
|
|
117
|
-
|
|
116
|
+
this.#nullable = value;
|
|
118
117
|
}
|
|
119
118
|
itemSchema(obj = {}) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return
|
|
119
|
+
this.#itemSchema = this.#itemSchema || mapToJsonSchema(obj);
|
|
120
|
+
this.#itemSchema.assign(obj);
|
|
121
|
+
return this.#itemSchema;
|
|
123
122
|
}
|
|
124
123
|
getAliasOf(property) {
|
|
125
|
-
return
|
|
124
|
+
return this.#alias.get(property);
|
|
126
125
|
}
|
|
127
126
|
addAlias(property, alias) {
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
this.#alias.set(property, alias);
|
|
128
|
+
this.#alias.set(alias, property);
|
|
130
129
|
return this;
|
|
131
130
|
}
|
|
132
131
|
removeAlias(property) {
|
|
133
|
-
const alias =
|
|
134
|
-
alias &&
|
|
135
|
-
|
|
132
|
+
const alias = this.#alias.get(property);
|
|
133
|
+
alias && this.#alias.delete(alias);
|
|
134
|
+
this.#alias.delete(property);
|
|
136
135
|
return this;
|
|
137
136
|
}
|
|
138
137
|
$id($id) {
|
|
@@ -152,7 +151,7 @@ class JsonSchema extends Map {
|
|
|
152
151
|
* @param name
|
|
153
152
|
*/
|
|
154
153
|
label(name) {
|
|
155
|
-
|
|
154
|
+
this.#ref = true;
|
|
156
155
|
super.set("name", name);
|
|
157
156
|
return this;
|
|
158
157
|
}
|
|
@@ -236,7 +235,7 @@ class JsonSchema extends Map {
|
|
|
236
235
|
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9
|
|
237
236
|
*/
|
|
238
237
|
items(items) {
|
|
239
|
-
super.set("items", (
|
|
238
|
+
super.set("items", (this.#itemSchema = mapToJsonSchema(items)));
|
|
240
239
|
return this;
|
|
241
240
|
}
|
|
242
241
|
/**
|
|
@@ -522,24 +521,24 @@ class JsonSchema extends Map {
|
|
|
522
521
|
switch (type) {
|
|
523
522
|
case Map:
|
|
524
523
|
super.set("type", (0, getJsonType_1.getJsonType)(type));
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
this.#target = type;
|
|
525
|
+
this.#isCollection = true;
|
|
527
526
|
if (!this.has("additionalProperties")) {
|
|
528
527
|
super.set("additionalProperties", this.itemSchema({}));
|
|
529
528
|
}
|
|
530
529
|
break;
|
|
531
530
|
case Array:
|
|
532
531
|
super.set("type", (0, getJsonType_1.getJsonType)(type));
|
|
533
|
-
|
|
534
|
-
|
|
532
|
+
this.#target = type;
|
|
533
|
+
this.#isCollection = true;
|
|
535
534
|
if (!this.has("items")) {
|
|
536
535
|
super.set("items", this.itemSchema({}));
|
|
537
536
|
}
|
|
538
537
|
break;
|
|
539
538
|
case Set:
|
|
540
539
|
super.set("type", (0, getJsonType_1.getJsonType)(type));
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
this.#target = type;
|
|
541
|
+
this.#isCollection = true;
|
|
543
542
|
this.uniqueItems(true);
|
|
544
543
|
if (!this.has("items")) {
|
|
545
544
|
super.set("items", this.itemSchema({}));
|
|
@@ -555,7 +554,7 @@ class JsonSchema extends Map {
|
|
|
555
554
|
case Number:
|
|
556
555
|
case String:
|
|
557
556
|
super.set("type", (0, getJsonType_1.getJsonType)(type));
|
|
558
|
-
|
|
557
|
+
this.#target = type;
|
|
559
558
|
if (!this.has("properties")) {
|
|
560
559
|
super.set("properties", {});
|
|
561
560
|
}
|
|
@@ -563,7 +562,7 @@ class JsonSchema extends Map {
|
|
|
563
562
|
default:
|
|
564
563
|
if ((0, core_1.isClass)(type) || (0, core_1.isFunction)(type)) {
|
|
565
564
|
super.set("type", undefined);
|
|
566
|
-
|
|
565
|
+
this.#target = type;
|
|
567
566
|
if (!this.has("properties")) {
|
|
568
567
|
super.set("properties", {});
|
|
569
568
|
}
|
|
@@ -571,7 +570,7 @@ class JsonSchema extends Map {
|
|
|
571
570
|
else {
|
|
572
571
|
const jsonType = (0, getJsonType_1.getJsonType)(type);
|
|
573
572
|
if (jsonType === "generic") {
|
|
574
|
-
|
|
573
|
+
this.#isGeneric = true;
|
|
575
574
|
super.set("$ref", type);
|
|
576
575
|
}
|
|
577
576
|
else {
|
|
@@ -660,14 +659,14 @@ class JsonSchema extends Map {
|
|
|
660
659
|
obj.$required.forEach((key) => {
|
|
661
660
|
this.$required.add(key);
|
|
662
661
|
});
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
662
|
+
this.#ref = obj.#ref;
|
|
663
|
+
this.#alias = new Map(this.#alias.entries());
|
|
664
|
+
obj.#genericLabels && (this.#genericLabels = [...obj.#genericLabels]);
|
|
665
|
+
this.#nestedGenerics = obj.#nestedGenerics.map((item) => [...item]);
|
|
666
|
+
this.#target = obj.#target;
|
|
667
|
+
this.#isGeneric = obj.#isGeneric;
|
|
668
|
+
this.#isCollection = obj.#isCollection;
|
|
669
|
+
this.#ref = obj.#ref;
|
|
671
670
|
super.set("type", obj.get("type"));
|
|
672
671
|
}
|
|
673
672
|
return this;
|
|
@@ -687,10 +686,10 @@ class JsonSchema extends Map {
|
|
|
687
686
|
* the function will be called to get the right type.
|
|
688
687
|
*/
|
|
689
688
|
getComputedType() {
|
|
690
|
-
return (0, getComputedType_1.getComputedType)(
|
|
689
|
+
return (0, getComputedType_1.getComputedType)(this.#target);
|
|
691
690
|
}
|
|
692
691
|
getComputedItemType() {
|
|
693
|
-
return
|
|
692
|
+
return this.#itemSchema ? this.#itemSchema.getComputedType() : this.getComputedType();
|
|
694
693
|
}
|
|
695
694
|
/**
|
|
696
695
|
* Return the Json type as string
|
|
@@ -699,18 +698,17 @@ class JsonSchema extends Map {
|
|
|
699
698
|
return this.get("type") || (0, getJsonType_1.getJsonType)(this.getComputedType());
|
|
700
699
|
}
|
|
701
700
|
getTarget() {
|
|
702
|
-
return
|
|
701
|
+
return this.#target;
|
|
703
702
|
}
|
|
704
703
|
/**
|
|
705
704
|
* Get the symbolic name of the entity
|
|
706
705
|
*/
|
|
707
706
|
getName() {
|
|
708
|
-
return this.get("name") || (
|
|
707
|
+
return this.get("name") || (this.#target ? (0, core_1.nameOf)((0, core_1.classOf)(this.getComputedType())) : "");
|
|
709
708
|
}
|
|
710
709
|
clone() {
|
|
711
710
|
return new JsonSchema(this);
|
|
712
711
|
}
|
|
713
712
|
}
|
|
714
713
|
exports.JsonSchema = JsonSchema;
|
|
715
|
-
_JsonSchema_nullable = new WeakMap(), _JsonSchema_genericLabels = new WeakMap(), _JsonSchema_nestedGenerics = new WeakMap(), _JsonSchema_alias = new WeakMap(), _JsonSchema_itemSchema = new WeakMap(), _JsonSchema_target = new WeakMap(), _JsonSchema_isGeneric = new WeakMap(), _JsonSchema_isCollection = new WeakMap(), _JsonSchema_ref = new WeakMap();
|
|
716
714
|
//# sourceMappingURL=JsonSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonSchema.js","sourceRoot":"","sources":["../../../src/domain/JsonSchema.ts"],"names":[],"mappings":";;;;;AAAA,qCAA+G;AAI/G,uFAAmE;AAEnE,8DAAyD;AACzD,sDAAiD;AACjD,sDAAiD;AAIjD,uDAAkD;AAClD,sEAAiE;AAWjE,SAAS,aAAa,CAAC,UAA+B;IACpD,uBAAuB;IACvB,IAAI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CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF;AAh1BD,gCAg1BC","sourcesContent":["import {classOf, Hooks, isArray, isClass, isFunction, isObject, nameOf, Type, uniq, ValueOf} from \"@tsed/core\";\nimport type {JSONSchema6, JSONSchema6Definition, JSONSchema6Type, JSONSchema6TypeName, JSONSchema6Version} from \"json-schema\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {IgnoreCallback} from \"../interfaces/IgnoreCallback\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {NestedGenerics} from \"../utils/generics\";\nimport {getComputedType} from \"../utils/getComputedType\";\nimport {getJsonType} from \"../utils/getJsonType\";\nimport {toJsonRegex} from \"../utils/toJsonRegex\";\nimport {AliasMap, AliasType} from \"./JsonAliasMap\";\nimport {JsonFormatTypes} from \"./JsonFormatTypes\";\nimport {JsonLazyRef} from \"./JsonLazyRef\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\nimport {serializeEnumValues} from \"../utils/serializeEnumValues\";\n\nexport interface JsonSchemaObject extends JSONSchema6, Record<string, any> {\n type: (any | JSONSchema6TypeName) | (any | JSONSchema6TypeName)[];\n additionalProperties?: boolean | JSONSchema6 | any;\n propertyNames?: boolean | JSONSchema6 | any;\n items?: (any | JSONSchema6Definition) | (any | JSONSchema6Definition)[];\n}\n\nexport type AnyJsonSchema = Partial<JsonSchemaObject> | JsonSchema | JsonLazyRef | any;\n\nfunction mapProperties(properties: Record<string, any>) {\n // istanbul ignore next\n if (properties instanceof JsonSchema) {\n return properties;\n }\n\n return Object.entries(properties).reduce<any>((properties, [key, schema]) => {\n properties[toJsonRegex(key)] = mapToJsonSchema(schema);\n\n return properties;\n }, {});\n}\n\nfunction mapToJsonSchema(item: any): any {\n if (isArray(item)) {\n return (item as any[]).map(mapToJsonSchema);\n }\n\n if (item.isStore || item.isJsonSchema || item.isLazyRef) {\n return item;\n }\n\n if (classOf(item) !== Object && isClass(item)) {\n return JsonEntityStore.from(item).schema;\n }\n\n if (isObject(item)) {\n return JsonSchema.from(item as any);\n }\n\n return item;\n}\n\nexport class JsonSchema extends Map<string, any> implements NestedGenerics {\n readonly isJsonSchema = true;\n readonly $hooks = new Hooks();\n readonly $required: Set<string> = new Set();\n readonly $allow: any[] = [];\n public $selfRequired: boolean;\n public $forwardGroups: boolean = false;\n\n #nullable: boolean = false;\n #genericLabels: string[];\n #nestedGenerics: Type<any>[][] = [];\n #alias: AliasMap = new Map();\n #itemSchema: JsonSchema;\n #target: Type<any>;\n #isGeneric: boolean = false;\n #isCollection: boolean = false;\n #ref: boolean = false;\n\n constructor(obj: JsonSchema | Partial<JsonSchemaObject> = {}) {\n super();\n\n if (obj) {\n this.assign(obj);\n }\n }\n\n get alias() {\n return this.#alias;\n }\n\n get nestedGenerics(): any[] {\n return this.#nestedGenerics;\n }\n\n set nestedGenerics(value: any[]) {\n this.#nestedGenerics = value;\n }\n\n get genericLabels(): string[] {\n return this.#genericLabels;\n }\n\n set genericLabels(value: string[]) {\n this.#genericLabels = value;\n }\n\n get isClass() {\n return isClass(this.class) && ![Map, Array, Set, Object, Date, Boolean, Number, String].includes(this.#target as any);\n }\n\n /**\n * Current schema is a collection\n */\n get isCollection() {\n return this.#isCollection;\n }\n\n /**\n * Current schema is a generic\n */\n get isGeneric() {\n return this.#isGeneric;\n }\n\n /**\n * Current schema has generics items\n */\n get hasGenerics(): boolean {\n return !!(this.nestedGenerics && this.nestedGenerics.length);\n }\n\n get genericType(): string {\n return this.get(\"$ref\");\n }\n\n get class() {\n return this.getComputedType();\n }\n\n get canRef(): boolean {\n return this.#ref;\n }\n\n get isNullable(): boolean {\n return this.#nullable || this.$allow.includes(null);\n }\n\n get isReadOnly() {\n return this.get(\"readOnly\");\n }\n\n get isWriteOnly() {\n return this.get(\"writeOnly\");\n }\n\n static from(obj: Partial<JsonSchemaObject> = {}) {\n return new JsonSchema(obj);\n }\n\n nullable(value: boolean) {\n this.#nullable = value;\n }\n\n itemSchema(obj: AnyJsonSchema = {}) {\n this.#itemSchema = this.#itemSchema || mapToJsonSchema(obj);\n this.#itemSchema.assign(obj);\n\n return this.#itemSchema;\n }\n\n getAliasOf(property: AliasType) {\n return this.#alias.get(property as any);\n }\n\n addAlias(property: AliasType, alias: AliasType) {\n this.#alias.set(property, alias);\n this.#alias.set(alias, property);\n\n return this;\n }\n\n removeAlias(property: AliasType) {\n const alias = this.#alias.get(property);\n alias && this.#alias.delete(alias);\n this.#alias.delete(property);\n\n return this;\n }\n\n $id($id: string) {\n super.set(\"$id\", $id);\n\n return this;\n }\n\n $ref($ref: string) {\n super.set(\"$ref\", $ref);\n\n return this;\n }\n\n $schema($schema: JSONSchema6Version) {\n super.set(\"$schema\", $schema);\n\n return this;\n }\n\n /**\n * Create a ref and use name to sharing schema\n * @param name\n */\n label(name: string) {\n this.#ref = true;\n\n super.set(\"name\", name);\n\n return this;\n }\n\n name(name: string) {\n super.set(\"name\", name);\n\n return this;\n }\n\n ignore(cb: boolean | IgnoreCallback) {\n if (typeof cb === \"boolean\") {\n const bool = cb;\n cb = () => bool;\n }\n\n this.$hooks.on(\"ignore\", cb);\n\n return this;\n }\n\n /**\n * This keyword can be used to supply a default JSON value associated with a particular schema.\n * It is RECOMMENDED that a default value be valid against the associated schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3\n */\n default(value: JSONSchema6Type) {\n super.set(\"default\", value);\n\n return this;\n }\n\n /**\n * More readible form of a one-element \"enum\"\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24\n */\n const(value: JSONSchema6Type) {\n super.set(\"const\", value);\n\n return this;\n }\n\n /**\n * This attribute is a string that provides a full description of the of purpose the instance property.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2\n */\n description(description: string) {\n super.set(\"description\", description);\n\n return this;\n }\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * If \"items\" is an array of schemas, validation succeeds if every instance element\n * at a position greater than the size of \"items\" validates against \"additionalItems\".\n * Otherwise, \"additionalItems\" MUST be ignored, as the \"items\" schema\n * (possibly the default value of an empty schema) is applied to all elements.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10\n */\n additionalItems(additionalItems: boolean | AnyJsonSchema) {\n super.set(\"additionalItems\", mapToJsonSchema(additionalItems));\n\n return this;\n }\n\n /**\n * An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14\n */\n contains(contains: JSONSchema6Definition) {\n super.set(\"contains\", mapToJsonSchema(contains));\n\n return this;\n }\n\n /**\n * Array of examples with no validation effect the value of \"default\" is usable as an example without repeating it under this keyword\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4\n */\n examples(examples: JSONSchema6Type[]) {\n super.set(\"examples\", examples);\n\n return this;\n }\n\n /**\n * Array of examples with no validation effect the value of \"default\" is usable as an example without repeating it under this keyword\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4\n */\n example(...examples: JSONSchema6Type[]) {\n return this.examples(examples);\n }\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9\n */\n items(items: AnyJsonSchema | AnyJsonSchema[]) {\n super.set(\"items\", (this.#itemSchema = mapToJsonSchema(items)));\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An array instance is valid against \"maxItems\" if its size is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11\n */\n maxItems(maxItems: number) {\n super.set(\"maxItems\", maxItems);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An array instance is valid against \"maxItems\" if its size is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12\n */\n minItems(minItems: number) {\n super.set(\"minItems\", minItems);\n\n return this;\n }\n\n /**\n * If this keyword has boolean value false, the instance validates successfully.\n * If it has boolean value true, the instance validates successfully if all of its elements are unique.\n * Omitting this keyword has the same behavior as a value of false.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13\n */\n uniqueItems(uniqueItems: boolean) {\n super.set(\"uniqueItems\", uniqueItems);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An object instance is valid against \"maxProperties\" if its number of properties is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15\n */\n maxProperties(maxProperties: number) {\n super.set(\"maxProperties\", maxProperties);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An object instance is valid against \"maxProperties\" if its number of properties is greater than,\n * or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16\n */\n minProperties(minProperties: number) {\n super.set(\"minProperties\", minProperties);\n\n return this;\n }\n\n allow(...allow: any[]) {\n this.$allow.push(...allow);\n return this;\n }\n\n /**\n * Elements of this array must be unique.\n * An object instance is valid against this keyword if every item in the array is the name of a property in the instance.\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17\n */\n required(required: boolean | string[] = true) {\n if (isArray(required)) {\n this.$required.clear();\n\n required.forEach((value: any) => this.$required.add(value));\n } else {\n const schema = this.clone();\n schema.$selfRequired = required;\n return schema;\n }\n\n return this;\n }\n\n addRequired(property: string) {\n this.$required.add(property);\n\n return this;\n }\n\n removeRequired(property: string) {\n this.$required.delete(property);\n\n return this;\n }\n\n isRequired(property: string): boolean {\n return this.$required.has(property);\n }\n\n /**\n * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.\n * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value,\n * the child instance for that name successfully validates against the corresponding schema.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18\n */\n properties(properties: AnyJsonSchema | Record<string, AnyJsonSchema>) {\n super.set(\"properties\", mapProperties(properties));\n\n return this;\n }\n\n addProperty(key: string, schema: AnyJsonSchema) {\n const properties = this.get(\"properties\") || {};\n\n properties[key] = schema;\n\n super.set(\"properties\", mapProperties(properties));\n\n return this;\n }\n\n /**\n * This attribute is an object that defines the schema for a set of property names of an object instance.\n * The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema.\n * If the pattern matches the name of a property on the instance object, the value of the instance's property\n * MUST be valid against the pattern name's schema value.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19\n */\n patternProperties(patternProperties: Record<string, AnyJsonSchema>) {\n super.set(\"patternProperties\", mapProperties(patternProperties));\n\n return this;\n }\n\n /**\n * This attribute defines a schema for all properties that are not explicitly defined in an object type definition.\n * If specified, the value MUST be a schema or a boolean.\n * If false is provided, no additional properties are allowed beyond the properties defined in the schema.\n * The default value is an empty schema which allows any value for additional properties.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20\n */\n additionalProperties(additionalProperties: boolean | AnyJsonSchema) {\n super.set(\"additionalProperties\", mapToJsonSchema(additionalProperties));\n\n return this;\n }\n\n /**\n * This attribute defines a schema for all properties that are not explicitly defined in an object type definition.\n * If specified, the value MUST be a schema or a boolean.\n * If false is provided, no additional properties are allowed beyond the properties defined in the schema.\n * The default value is an empty schema which allows any value for additional properties.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20\n * @alias additionalProperties\n * @param unknown\n */\n unknown(unknown: boolean = true) {\n return this.additionalProperties(unknown);\n }\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.\n * Each property specifies a dependency.\n * If the dependency value is an array, each element in the array must be unique.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21\n */\n dependencies(dependencies: {[p: string]: JSONSchema6Definition | JsonSchema | string[]}) {\n super.set(\"dependencies\", mapProperties(dependencies));\n\n return this;\n }\n\n /**\n * Takes a schema which validates the names of all properties rather than their values.\n * Note the property name that the schema is testing will always be a string.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22\n */\n propertyNames(propertyNames: JSONSchema6Definition | JsonSchema) {\n super.set(\"propertyNames\", mapToJsonSchema(propertyNames));\n\n return this;\n }\n\n /**\n * This provides an enumeration of all possible values that are valid\n * for the instance property. This MUST be an array, and each item in\n * the array represents a possible value for the instance value. If\n * this attribute is defined, the instance value MUST be one of the\n * values in the array in order for the schema to be valid.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23\n */\n enum(...enumValues: any[]): this;\n enum(enumValue: any | any[], ...enumValues: any[]): this {\n const {values, types} = serializeEnumValues([enumValue, enumValues].flat());\n\n super.set(\"enum\", values).any(...types);\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1\n */\n definitions(definitions: Record<string, AnyJsonSchema>) {\n super.set(\"definitions\", mapProperties(definitions));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26\n */\n allOf(allOf: AnyJsonSchema[]) {\n super.set(\"allOf\", allOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n */\n anyOf(anyOf: AnyJsonSchema[]) {\n super.set(\"anyOf\", anyOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n */\n oneOf(oneOf: AnyJsonSchema[]) {\n super.set(\"oneOf\", oneOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29\n */\n not(not: AnyJsonSchema) {\n super.set(\"not\", mapToJsonSchema(not));\n\n return this;\n }\n\n /**\n * Must be strictly greater than 0.\n * A numeric instance is valid only if division by this keyword's value results in an integer.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1\n */\n multipleOf(multipleOf: number): this {\n super.set(\"multipleOf\", multipleOf);\n\n return this;\n }\n\n /**\n * Representing an inclusive upper limit for a numeric instance.\n * This keyword validates only if the instance is less than or exactly equal to \"maximum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2\n */\n maximum(maximum: number): this {\n super.set(\"maximum\", maximum);\n\n return this;\n }\n\n /**\n * Representing an exclusive upper limit for a numeric instance.\n * This keyword validates only if the instance is strictly less than (not equal to) to \"exclusiveMaximum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3\n */\n exclusiveMaximum(exclusiveMaximum: number): this {\n super.set(\"exclusiveMaximum\", exclusiveMaximum);\n\n return this;\n }\n\n /**\n * Representing an inclusive lower limit for a numeric instance.\n * This keyword validates only if the instance is greater than or exactly equal to \"minimum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4\n */\n minimum(minimum: number): this {\n super.set(\"minimum\", minimum);\n\n return this;\n }\n\n /**\n * Representing an exclusive lower limit for a numeric instance.\n * This keyword validates only if the instance is strictly greater than (not equal to) to \"exclusiveMinimum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5\n */\n exclusiveMinimum(exclusiveMinimum: number): this {\n super.set(\"exclusiveMinimum\", exclusiveMinimum);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6\n */\n maxLength(maxLength: number): this {\n super.set(\"maxLength\", maxLength);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7\n */\n minLength(minLength: number): this {\n super.set(\"minLength\", minLength);\n\n return this;\n }\n\n /**\n * Should be a valid regular expression, according to the ECMA 262 regular expression dialect.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8\n */\n pattern(pattern: string | RegExp): this {\n super.set(\"pattern\", toJsonRegex(pattern));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8\n */\n format(format: JsonFormatTypes | ValueOf<JsonFormatTypes>): this {\n super.set(\"format\", format);\n\n return this;\n }\n\n /**\n * A single type, or a union of simple types\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25\n */\n type(type: any | JSONSchema6TypeName | JSONSchema6TypeName[]): this {\n switch (type) {\n case Map:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n if (!this.has(\"additionalProperties\")) {\n super.set(\"additionalProperties\", this.itemSchema({}));\n }\n break;\n\n case Array:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n\n if (!this.has(\"items\")) {\n super.set(\"items\", this.itemSchema({}));\n }\n break;\n\n case Set:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n this.uniqueItems(true);\n\n if (!this.has(\"items\")) {\n super.set(\"items\", this.itemSchema({}));\n }\n break;\n\n case \"integer\":\n super.set(\"type\", getJsonType(type));\n this.integer();\n break;\n\n case Object:\n case Date:\n case Boolean:\n case Number:\n case String:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n if (!this.has(\"properties\")) {\n super.set(\"properties\", {});\n }\n break;\n\n default:\n if (isClass(type) || isFunction(type)) {\n super.set(\"type\", undefined);\n this.#target = type;\n\n if (!this.has(\"properties\")) {\n super.set(\"properties\", {});\n }\n } else {\n const jsonType = getJsonType(type);\n if (jsonType === \"generic\") {\n this.#isGeneric = true;\n super.set(\"$ref\", type);\n } else {\n super.set(\"type\", jsonType);\n }\n }\n }\n\n return this;\n }\n\n any(...types: any[]) {\n const hasClasses = types.filter((type) => isClass(type));\n\n if (hasClasses.length >= 2) {\n this.oneOf(\n types.filter((value) => {\n if (value !== null) {\n this.nullable(true);\n return true;\n }\n return false;\n })\n );\n } else {\n // TODO when OS3 will the only minimal supported version, we'll can remove this code\n if (types.length) {\n types = uniq(types).map(getJsonType);\n\n if (types.includes(\"null\")) {\n this.nullable(true);\n types = types.filter((o) => o !== \"null\");\n }\n } else {\n types = [\"integer\", \"number\", \"string\", \"boolean\", \"array\", \"object\"];\n this.nullable(true);\n }\n\n this.type(types.length === 1 ? types[0] : types);\n }\n\n return this;\n }\n\n integer() {\n super.set(\"type\", \"integer\");\n super.set(\"multipleOf\", 1.0);\n\n return this;\n }\n\n /**\n * This attribute is a string that provides a short description of the instance property.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2\n */\n title(title: string): this {\n super.set(\"title\", title);\n\n return this;\n }\n\n readOnly(readOnly: boolean): this {\n super.set(\"readOnly\", readOnly);\n\n return this;\n }\n\n writeOnly(readOnly: boolean): this {\n super.set(\"writeOnly\", readOnly);\n\n return this;\n }\n\n customKey(key: string, value: any) {\n super.set(`#${key}`, value);\n\n return this;\n }\n\n toObject(options?: JsonSchemaOptions) {\n return this.toJSON(options);\n }\n\n toJSON(options?: JsonSchemaOptions) {\n let addDef = false;\n\n if (!options) {\n addDef = true;\n options = {schemas: {}};\n }\n\n const schema = execMapper(\"schema\", this, options);\n\n if (addDef && options.schemas && Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n return schema;\n }\n\n assign(obj: JsonSchema | Partial<JsonSchemaObject> = {}) {\n const entries = obj instanceof JsonSchema ? [...obj.entries()] : Object.entries(obj);\n entries.forEach(([key, value]) => {\n this.set(key, value);\n });\n\n if (obj instanceof JsonSchema) {\n this.$selfRequired = obj.$selfRequired;\n\n obj.$required.forEach((key) => {\n this.$required.add(key);\n });\n\n this.#ref = obj.#ref;\n this.#alias = new Map(this.#alias.entries());\n obj.#genericLabels && (this.#genericLabels = [...obj.#genericLabels]);\n this.#nestedGenerics = obj.#nestedGenerics.map((item) => [...item]);\n this.#target = obj.#target;\n this.#isGeneric = obj.#isGeneric;\n this.#isCollection = obj.#isCollection;\n this.#ref = obj.#ref;\n\n super.set(\"type\", obj.get(\"type\"));\n }\n\n return this;\n }\n\n set(key: string, value: any): this {\n if (key in this) {\n isFunction((this as any)[key]) && (this as any)[key](value);\n } else {\n super.set(key, value);\n }\n\n return this;\n }\n\n /**\n * Return the itemSchema computed type.\n * If the type is a function used for recursive model,\n * the function will be called to get the right type.\n */\n getComputedType(): any {\n return getComputedType(this.#target);\n }\n\n getComputedItemType(): any {\n return this.#itemSchema ? this.#itemSchema.getComputedType() : this.getComputedType();\n }\n\n /**\n * Return the Json type as string\n */\n getJsonType(): string | string[] {\n return this.get(\"type\") || getJsonType(this.getComputedType());\n }\n\n getTarget() {\n return this.#target;\n }\n\n /**\n * Get the symbolic name of the entity\n */\n getName() {\n return this.get(\"name\") || (this.#target ? nameOf(classOf(this.getComputedType())) : \"\");\n }\n\n clone() {\n return new JsonSchema(this);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"JsonSchema.js","sourceRoot":"","sources":["../../../src/domain/JsonSchema.ts"],"names":[],"mappings":";;;AAAA,qCAA+G;AAI/G,uFAAmE;AAEnE,8DAAyD;AACzD,sDAAiD;AACjD,sDAAiD;AAIjD,uDAAkD;AAClD,sEAAiE;AAWjE,SAAS,aAAa,CAAC,UAA+B;IACpD,uBAAuB;IACvB,IAAI,UAAU,YAAY,UAAU,EAAE;QACpC,OAAO,UAAU,CAAC;KACnB;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,M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,GAAG,CAAC,GAAW,EAAE,KAAU;QACzB,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,IAAA,iBAAU,EAAE,IAAY,CAAC,GAAG,CAAC,CAAC,IAAK,IAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;SAC7D;aAAM;YACL,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACvB;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,eAAe;QACb,OAAO,IAAA,iCAAe,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IACxF,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAA,yBAAW,EAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,aAAM,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,KAAK;QACH,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF;AAh1BD,gCAg1BC","sourcesContent":["import {classOf, Hooks, isArray, isClass, isFunction, isObject, nameOf, Type, uniq, ValueOf} from \"@tsed/core\";\nimport type {JSONSchema6, JSONSchema6Definition, JSONSchema6Type, JSONSchema6TypeName, JSONSchema6Version} from \"json-schema\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {IgnoreCallback} from \"../interfaces/IgnoreCallback\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {NestedGenerics} from \"../utils/generics\";\nimport {getComputedType} from \"../utils/getComputedType\";\nimport {getJsonType} from \"../utils/getJsonType\";\nimport {toJsonRegex} from \"../utils/toJsonRegex\";\nimport {AliasMap, AliasType} from \"./JsonAliasMap\";\nimport {JsonFormatTypes} from \"./JsonFormatTypes\";\nimport {JsonLazyRef} from \"./JsonLazyRef\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\nimport {serializeEnumValues} from \"../utils/serializeEnumValues\";\n\nexport interface JsonSchemaObject extends JSONSchema6, Record<string, any> {\n type: (any | JSONSchema6TypeName) | (any | JSONSchema6TypeName)[];\n additionalProperties?: boolean | JSONSchema6 | any;\n propertyNames?: boolean | JSONSchema6 | any;\n items?: (any | JSONSchema6Definition) | (any | JSONSchema6Definition)[];\n}\n\nexport type AnyJsonSchema = Partial<JsonSchemaObject> | JsonSchema | JsonLazyRef | any;\n\nfunction mapProperties(properties: Record<string, any>) {\n // istanbul ignore next\n if (properties instanceof JsonSchema) {\n return properties;\n }\n\n return Object.entries(properties).reduce<any>((properties, [key, schema]) => {\n properties[toJsonRegex(key)] = mapToJsonSchema(schema);\n\n return properties;\n }, {});\n}\n\nfunction mapToJsonSchema(item: any): any {\n if (isArray(item)) {\n return (item as any[]).map(mapToJsonSchema);\n }\n\n if (item.isStore || item.isJsonSchema || item.isLazyRef) {\n return item;\n }\n\n if (classOf(item) !== Object && isClass(item)) {\n return JsonEntityStore.from(item).schema;\n }\n\n if (isObject(item)) {\n return JsonSchema.from(item as any);\n }\n\n return item;\n}\n\nexport class JsonSchema extends Map<string, any> implements NestedGenerics {\n readonly isJsonSchema = true;\n readonly $hooks = new Hooks();\n readonly $required: Set<string> = new Set();\n readonly $allow: any[] = [];\n public $selfRequired: boolean;\n public $forwardGroups: boolean = false;\n\n #nullable: boolean = false;\n #genericLabels: string[];\n #nestedGenerics: Type<any>[][] = [];\n #alias: AliasMap = new Map();\n #itemSchema: JsonSchema;\n #target: Type<any>;\n #isGeneric: boolean = false;\n #isCollection: boolean = false;\n #ref: boolean = false;\n\n constructor(obj: JsonSchema | Partial<JsonSchemaObject> = {}) {\n super();\n\n if (obj) {\n this.assign(obj);\n }\n }\n\n get alias() {\n return this.#alias;\n }\n\n get nestedGenerics(): any[] {\n return this.#nestedGenerics;\n }\n\n set nestedGenerics(value: any[]) {\n this.#nestedGenerics = value;\n }\n\n get genericLabels(): string[] {\n return this.#genericLabels;\n }\n\n set genericLabels(value: string[]) {\n this.#genericLabels = value;\n }\n\n get isClass() {\n return isClass(this.class) && ![Map, Array, Set, Object, Date, Boolean, Number, String].includes(this.#target as any);\n }\n\n /**\n * Current schema is a collection\n */\n get isCollection() {\n return this.#isCollection;\n }\n\n /**\n * Current schema is a generic\n */\n get isGeneric() {\n return this.#isGeneric;\n }\n\n /**\n * Current schema has generics items\n */\n get hasGenerics(): boolean {\n return !!(this.nestedGenerics && this.nestedGenerics.length);\n }\n\n get genericType(): string {\n return this.get(\"$ref\");\n }\n\n get class() {\n return this.getComputedType();\n }\n\n get canRef(): boolean {\n return this.#ref;\n }\n\n get isNullable(): boolean {\n return this.#nullable || this.$allow.includes(null);\n }\n\n get isReadOnly() {\n return this.get(\"readOnly\");\n }\n\n get isWriteOnly() {\n return this.get(\"writeOnly\");\n }\n\n static from(obj: Partial<JsonSchemaObject> = {}) {\n return new JsonSchema(obj);\n }\n\n nullable(value: boolean) {\n this.#nullable = value;\n }\n\n itemSchema(obj: AnyJsonSchema = {}) {\n this.#itemSchema = this.#itemSchema || mapToJsonSchema(obj);\n this.#itemSchema.assign(obj);\n\n return this.#itemSchema;\n }\n\n getAliasOf(property: AliasType) {\n return this.#alias.get(property as any);\n }\n\n addAlias(property: AliasType, alias: AliasType) {\n this.#alias.set(property, alias);\n this.#alias.set(alias, property);\n\n return this;\n }\n\n removeAlias(property: AliasType) {\n const alias = this.#alias.get(property);\n alias && this.#alias.delete(alias);\n this.#alias.delete(property);\n\n return this;\n }\n\n $id($id: string) {\n super.set(\"$id\", $id);\n\n return this;\n }\n\n $ref($ref: string) {\n super.set(\"$ref\", $ref);\n\n return this;\n }\n\n $schema($schema: JSONSchema6Version) {\n super.set(\"$schema\", $schema);\n\n return this;\n }\n\n /**\n * Create a ref and use name to sharing schema\n * @param name\n */\n label(name: string) {\n this.#ref = true;\n\n super.set(\"name\", name);\n\n return this;\n }\n\n name(name: string) {\n super.set(\"name\", name);\n\n return this;\n }\n\n ignore(cb: boolean | IgnoreCallback) {\n if (typeof cb === \"boolean\") {\n const bool = cb;\n cb = () => bool;\n }\n\n this.$hooks.on(\"ignore\", cb);\n\n return this;\n }\n\n /**\n * This keyword can be used to supply a default JSON value associated with a particular schema.\n * It is RECOMMENDED that a default value be valid against the associated schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3\n */\n default(value: JSONSchema6Type) {\n super.set(\"default\", value);\n\n return this;\n }\n\n /**\n * More readible form of a one-element \"enum\"\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24\n */\n const(value: JSONSchema6Type) {\n super.set(\"const\", value);\n\n return this;\n }\n\n /**\n * This attribute is a string that provides a full description of the of purpose the instance property.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2\n */\n description(description: string) {\n super.set(\"description\", description);\n\n return this;\n }\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * If \"items\" is an array of schemas, validation succeeds if every instance element\n * at a position greater than the size of \"items\" validates against \"additionalItems\".\n * Otherwise, \"additionalItems\" MUST be ignored, as the \"items\" schema\n * (possibly the default value of an empty schema) is applied to all elements.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10\n */\n additionalItems(additionalItems: boolean | AnyJsonSchema) {\n super.set(\"additionalItems\", mapToJsonSchema(additionalItems));\n\n return this;\n }\n\n /**\n * An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14\n */\n contains(contains: JSONSchema6Definition) {\n super.set(\"contains\", mapToJsonSchema(contains));\n\n return this;\n }\n\n /**\n * Array of examples with no validation effect the value of \"default\" is usable as an example without repeating it under this keyword\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4\n */\n examples(examples: JSONSchema6Type[]) {\n super.set(\"examples\", examples);\n\n return this;\n }\n\n /**\n * Array of examples with no validation effect the value of \"default\" is usable as an example without repeating it under this keyword\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4\n */\n example(...examples: JSONSchema6Type[]) {\n return this.examples(examples);\n }\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9\n */\n items(items: AnyJsonSchema | AnyJsonSchema[]) {\n super.set(\"items\", (this.#itemSchema = mapToJsonSchema(items)));\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An array instance is valid against \"maxItems\" if its size is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11\n */\n maxItems(maxItems: number) {\n super.set(\"maxItems\", maxItems);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An array instance is valid against \"maxItems\" if its size is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12\n */\n minItems(minItems: number) {\n super.set(\"minItems\", minItems);\n\n return this;\n }\n\n /**\n * If this keyword has boolean value false, the instance validates successfully.\n * If it has boolean value true, the instance validates successfully if all of its elements are unique.\n * Omitting this keyword has the same behavior as a value of false.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13\n */\n uniqueItems(uniqueItems: boolean) {\n super.set(\"uniqueItems\", uniqueItems);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An object instance is valid against \"maxProperties\" if its number of properties is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15\n */\n maxProperties(maxProperties: number) {\n super.set(\"maxProperties\", maxProperties);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An object instance is valid against \"maxProperties\" if its number of properties is greater than,\n * or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16\n */\n minProperties(minProperties: number) {\n super.set(\"minProperties\", minProperties);\n\n return this;\n }\n\n allow(...allow: any[]) {\n this.$allow.push(...allow);\n return this;\n }\n\n /**\n * Elements of this array must be unique.\n * An object instance is valid against this keyword if every item in the array is the name of a property in the instance.\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17\n */\n required(required: boolean | string[] = true) {\n if (isArray(required)) {\n this.$required.clear();\n\n required.forEach((value: any) => this.$required.add(value));\n } else {\n const schema = this.clone();\n schema.$selfRequired = required;\n return schema;\n }\n\n return this;\n }\n\n addRequired(property: string) {\n this.$required.add(property);\n\n return this;\n }\n\n removeRequired(property: string) {\n this.$required.delete(property);\n\n return this;\n }\n\n isRequired(property: string): boolean {\n return this.$required.has(property);\n }\n\n /**\n * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.\n * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value,\n * the child instance for that name successfully validates against the corresponding schema.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18\n */\n properties(properties: AnyJsonSchema | Record<string, AnyJsonSchema>) {\n super.set(\"properties\", mapProperties(properties));\n\n return this;\n }\n\n addProperty(key: string, schema: AnyJsonSchema) {\n const properties = this.get(\"properties\") || {};\n\n properties[key] = schema;\n\n super.set(\"properties\", mapProperties(properties));\n\n return this;\n }\n\n /**\n * This attribute is an object that defines the schema for a set of property names of an object instance.\n * The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema.\n * If the pattern matches the name of a property on the instance object, the value of the instance's property\n * MUST be valid against the pattern name's schema value.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19\n */\n patternProperties(patternProperties: Record<string, AnyJsonSchema>) {\n super.set(\"patternProperties\", mapProperties(patternProperties));\n\n return this;\n }\n\n /**\n * This attribute defines a schema for all properties that are not explicitly defined in an object type definition.\n * If specified, the value MUST be a schema or a boolean.\n * If false is provided, no additional properties are allowed beyond the properties defined in the schema.\n * The default value is an empty schema which allows any value for additional properties.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20\n */\n additionalProperties(additionalProperties: boolean | AnyJsonSchema) {\n super.set(\"additionalProperties\", mapToJsonSchema(additionalProperties));\n\n return this;\n }\n\n /**\n * This attribute defines a schema for all properties that are not explicitly defined in an object type definition.\n * If specified, the value MUST be a schema or a boolean.\n * If false is provided, no additional properties are allowed beyond the properties defined in the schema.\n * The default value is an empty schema which allows any value for additional properties.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20\n * @alias additionalProperties\n * @param unknown\n */\n unknown(unknown: boolean = true) {\n return this.additionalProperties(unknown);\n }\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.\n * Each property specifies a dependency.\n * If the dependency value is an array, each element in the array must be unique.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21\n */\n dependencies(dependencies: {[p: string]: JSONSchema6Definition | JsonSchema | string[]}) {\n super.set(\"dependencies\", mapProperties(dependencies));\n\n return this;\n }\n\n /**\n * Takes a schema which validates the names of all properties rather than their values.\n * Note the property name that the schema is testing will always be a string.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22\n */\n propertyNames(propertyNames: JSONSchema6Definition | JsonSchema) {\n super.set(\"propertyNames\", mapToJsonSchema(propertyNames));\n\n return this;\n }\n\n /**\n * This provides an enumeration of all possible values that are valid\n * for the instance property. This MUST be an array, and each item in\n * the array represents a possible value for the instance value. If\n * this attribute is defined, the instance value MUST be one of the\n * values in the array in order for the schema to be valid.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23\n */\n enum(...enumValues: any[]): this;\n enum(enumValue: any | any[], ...enumValues: any[]): this {\n const {values, types} = serializeEnumValues([enumValue, enumValues].flat());\n\n super.set(\"enum\", values).any(...types);\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1\n */\n definitions(definitions: Record<string, AnyJsonSchema>) {\n super.set(\"definitions\", mapProperties(definitions));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26\n */\n allOf(allOf: AnyJsonSchema[]) {\n super.set(\"allOf\", allOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n */\n anyOf(anyOf: AnyJsonSchema[]) {\n super.set(\"anyOf\", anyOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n */\n oneOf(oneOf: AnyJsonSchema[]) {\n super.set(\"oneOf\", oneOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29\n */\n not(not: AnyJsonSchema) {\n super.set(\"not\", mapToJsonSchema(not));\n\n return this;\n }\n\n /**\n * Must be strictly greater than 0.\n * A numeric instance is valid only if division by this keyword's value results in an integer.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1\n */\n multipleOf(multipleOf: number): this {\n super.set(\"multipleOf\", multipleOf);\n\n return this;\n }\n\n /**\n * Representing an inclusive upper limit for a numeric instance.\n * This keyword validates only if the instance is less than or exactly equal to \"maximum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2\n */\n maximum(maximum: number): this {\n super.set(\"maximum\", maximum);\n\n return this;\n }\n\n /**\n * Representing an exclusive upper limit for a numeric instance.\n * This keyword validates only if the instance is strictly less than (not equal to) to \"exclusiveMaximum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3\n */\n exclusiveMaximum(exclusiveMaximum: number): this {\n super.set(\"exclusiveMaximum\", exclusiveMaximum);\n\n return this;\n }\n\n /**\n * Representing an inclusive lower limit for a numeric instance.\n * This keyword validates only if the instance is greater than or exactly equal to \"minimum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4\n */\n minimum(minimum: number): this {\n super.set(\"minimum\", minimum);\n\n return this;\n }\n\n /**\n * Representing an exclusive lower limit for a numeric instance.\n * This keyword validates only if the instance is strictly greater than (not equal to) to \"exclusiveMinimum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5\n */\n exclusiveMinimum(exclusiveMinimum: number): this {\n super.set(\"exclusiveMinimum\", exclusiveMinimum);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6\n */\n maxLength(maxLength: number): this {\n super.set(\"maxLength\", maxLength);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7\n */\n minLength(minLength: number): this {\n super.set(\"minLength\", minLength);\n\n return this;\n }\n\n /**\n * Should be a valid regular expression, according to the ECMA 262 regular expression dialect.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8\n */\n pattern(pattern: string | RegExp): this {\n super.set(\"pattern\", toJsonRegex(pattern));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8\n */\n format(format: JsonFormatTypes | ValueOf<JsonFormatTypes>): this {\n super.set(\"format\", format);\n\n return this;\n }\n\n /**\n * A single type, or a union of simple types\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25\n */\n type(type: any | JSONSchema6TypeName | JSONSchema6TypeName[]): this {\n switch (type) {\n case Map:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n if (!this.has(\"additionalProperties\")) {\n super.set(\"additionalProperties\", this.itemSchema({}));\n }\n break;\n\n case Array:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n\n if (!this.has(\"items\")) {\n super.set(\"items\", this.itemSchema({}));\n }\n break;\n\n case Set:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n this.uniqueItems(true);\n\n if (!this.has(\"items\")) {\n super.set(\"items\", this.itemSchema({}));\n }\n break;\n\n case \"integer\":\n super.set(\"type\", getJsonType(type));\n this.integer();\n break;\n\n case Object:\n case Date:\n case Boolean:\n case Number:\n case String:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n if (!this.has(\"properties\")) {\n super.set(\"properties\", {});\n }\n break;\n\n default:\n if (isClass(type) || isFunction(type)) {\n super.set(\"type\", undefined);\n this.#target = type;\n\n if (!this.has(\"properties\")) {\n super.set(\"properties\", {});\n }\n } else {\n const jsonType = getJsonType(type);\n if (jsonType === \"generic\") {\n this.#isGeneric = true;\n super.set(\"$ref\", type);\n } else {\n super.set(\"type\", jsonType);\n }\n }\n }\n\n return this;\n }\n\n any(...types: any[]) {\n const hasClasses = types.filter((type) => isClass(type));\n\n if (hasClasses.length >= 2) {\n this.oneOf(\n types.filter((value) => {\n if (value !== null) {\n this.nullable(true);\n return true;\n }\n return false;\n })\n );\n } else {\n // TODO when OS3 will the only minimal supported version, we'll can remove this code\n if (types.length) {\n types = uniq(types).map(getJsonType);\n\n if (types.includes(\"null\")) {\n this.nullable(true);\n types = types.filter((o) => o !== \"null\");\n }\n } else {\n types = [\"integer\", \"number\", \"string\", \"boolean\", \"array\", \"object\"];\n this.nullable(true);\n }\n\n this.type(types.length === 1 ? types[0] : types);\n }\n\n return this;\n }\n\n integer() {\n super.set(\"type\", \"integer\");\n super.set(\"multipleOf\", 1.0);\n\n return this;\n }\n\n /**\n * This attribute is a string that provides a short description of the instance property.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2\n */\n title(title: string): this {\n super.set(\"title\", title);\n\n return this;\n }\n\n readOnly(readOnly: boolean): this {\n super.set(\"readOnly\", readOnly);\n\n return this;\n }\n\n writeOnly(readOnly: boolean): this {\n super.set(\"writeOnly\", readOnly);\n\n return this;\n }\n\n customKey(key: string, value: any) {\n super.set(`#${key}`, value);\n\n return this;\n }\n\n toObject(options?: JsonSchemaOptions) {\n return this.toJSON(options);\n }\n\n toJSON(options?: JsonSchemaOptions) {\n let addDef = false;\n\n if (!options) {\n addDef = true;\n options = {schemas: {}};\n }\n\n const schema = execMapper(\"schema\", this, options);\n\n if (addDef && options.schemas && Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n return schema;\n }\n\n assign(obj: JsonSchema | Partial<JsonSchemaObject> = {}) {\n const entries = obj instanceof JsonSchema ? [...obj.entries()] : Object.entries(obj);\n entries.forEach(([key, value]) => {\n this.set(key, value);\n });\n\n if (obj instanceof JsonSchema) {\n this.$selfRequired = obj.$selfRequired;\n\n obj.$required.forEach((key) => {\n this.$required.add(key);\n });\n\n this.#ref = obj.#ref;\n this.#alias = new Map(this.#alias.entries());\n obj.#genericLabels && (this.#genericLabels = [...obj.#genericLabels]);\n this.#nestedGenerics = obj.#nestedGenerics.map((item) => [...item]);\n this.#target = obj.#target;\n this.#isGeneric = obj.#isGeneric;\n this.#isCollection = obj.#isCollection;\n this.#ref = obj.#ref;\n\n super.set(\"type\", obj.get(\"type\"));\n }\n\n return this;\n }\n\n set(key: string, value: any): this {\n if (key in this) {\n isFunction((this as any)[key]) && (this as any)[key](value);\n } else {\n super.set(key, value);\n }\n\n return this;\n }\n\n /**\n * Return the itemSchema computed type.\n * If the type is a function used for recursive model,\n * the function will be called to get the right type.\n */\n getComputedType(): any {\n return getComputedType(this.#target);\n }\n\n getComputedItemType(): any {\n return this.#itemSchema ? this.#itemSchema.getComputedType() : this.getComputedType();\n }\n\n /**\n * Return the Json type as string\n */\n getJsonType(): string | string[] {\n return this.get(\"type\") || getJsonType(this.getComputedType());\n }\n\n getTarget() {\n return this.#target;\n }\n\n /**\n * Get the symbolic name of the entity\n */\n getName() {\n return this.get(\"name\") || (this.#target ? nameOf(classOf(this.getComputedType())) : \"\");\n }\n\n clone() {\n return new JsonSchema(this);\n }\n}\n"]}
|
|
@@ -7,13 +7,12 @@ exports.alterIgnore = void 0;
|
|
|
7
7
|
* @param options
|
|
8
8
|
*/
|
|
9
9
|
function alterIgnore(schema, options) {
|
|
10
|
-
|
|
11
|
-
let result = (_a = schema === null || schema === void 0 ? void 0 : schema.$hooks) === null || _a === void 0 ? void 0 : _a.alter("ignore", false, [options]);
|
|
10
|
+
let result = schema?.$hooks?.alter("ignore", false, [options]);
|
|
12
11
|
if (result) {
|
|
13
12
|
return result;
|
|
14
13
|
}
|
|
15
14
|
if (options.groups !== false) {
|
|
16
|
-
return
|
|
15
|
+
return schema?.$hooks?.alter("groups", false, [options.groups]);
|
|
17
16
|
}
|
|
18
17
|
return result;
|
|
19
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alterIgnore.js","sourceRoot":"","sources":["../../../src/hooks/alterIgnore.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,SAAgB,WAAW,CAAC,MAAuB,EAAE,OAAY
|
|
1
|
+
{"version":3,"file":"alterIgnore.js","sourceRoot":"","sources":["../../../src/hooks/alterIgnore.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,SAAgB,WAAW,CAAC,MAAuB,EAAE,OAAY;IAC/D,IAAI,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAE/D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC;KACf;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE;QAC5B,OAAO,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;KACjE;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,kCAYC","sourcesContent":["import {Hooks} from \"@tsed/core\";\n\n/**\n * @ignore\n * @param schema\n * @param options\n */\nexport function alterIgnore(schema: {$hooks: Hooks}, options: any) {\n let result = schema?.$hooks?.alter(\"ignore\", false, [options]);\n\n if (result) {\n return result;\n }\n\n if (options.groups !== false) {\n return schema?.$hooks?.alter(\"groups\", false, [options.groups]);\n }\n\n return result;\n}\n"]}
|
|
@@ -5,9 +5,8 @@ exports.alterRequiredGroups = void 0;
|
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
7
7
|
function alterRequiredGroups(required, schema, options) {
|
|
8
|
-
var _a;
|
|
9
8
|
if (options.groups !== false) {
|
|
10
|
-
return
|
|
9
|
+
return schema?.$hooks?.alter("requiredGroups", required, [options.groups]);
|
|
11
10
|
}
|
|
12
11
|
return required;
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alterRequiredGroups.js","sourceRoot":"","sources":["../../../src/hooks/alterRequiredGroups.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,mBAAmB,CAAC,QAAkB,EAAE,MAAkB,EAAE,OAA0B
|
|
1
|
+
{"version":3,"file":"alterRequiredGroups.js","sourceRoot":"","sources":["../../../src/hooks/alterRequiredGroups.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,mBAAmB,CAAC,QAAkB,EAAE,MAAkB,EAAE,OAA0B;IACpG,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE;QAC5B,OAAO,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,gBAAgB,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;KAC5E;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAND,kDAMC","sourcesContent":["import type {JsonSchema} from \"../domain/JsonSchema\";\nimport type {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\n/**\n * @ignore\n */\nexport function alterRequiredGroups(required: string[], schema: JsonSchema, options: JsonSchemaOptions): string[] {\n if (options.groups !== false) {\n return schema?.$hooks?.alter(\"requiredGroups\", required, [options.groups]);\n }\n\n return required;\n}\n"]}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getJsonSchema = void 0;
|
|
4
|
-
const SpecTypes_1 = require("../domain/SpecTypes");
|
|
5
|
-
const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
|
|
6
|
-
const getJsonEntityStore_1 = require("./getJsonEntityStore");
|
|
7
4
|
require("../components/anyMapper");
|
|
8
5
|
require("../components/classMapper");
|
|
9
6
|
require("../components/genericsMapper");
|
|
@@ -15,6 +12,9 @@ require("../components/objectMapper");
|
|
|
15
12
|
require("../components/ofMapper");
|
|
16
13
|
require("../components/propertiesMapper");
|
|
17
14
|
require("../components/schemaMapper");
|
|
15
|
+
const SpecTypes_1 = require("../domain/SpecTypes");
|
|
16
|
+
const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
|
|
17
|
+
const getJsonEntityStore_1 = require("./getJsonEntityStore");
|
|
18
18
|
/**
|
|
19
19
|
* @ignore
|
|
20
20
|
*/
|
|
@@ -42,7 +42,6 @@ function get(entity, options) {
|
|
|
42
42
|
return cache.get(key);
|
|
43
43
|
}
|
|
44
44
|
function getJsonSchema(model, options = {}) {
|
|
45
|
-
var _a;
|
|
46
45
|
const entity = (0, getJsonEntityStore_1.getJsonEntityStore)(model);
|
|
47
46
|
options = {
|
|
48
47
|
endpoint: true,
|
|
@@ -56,7 +55,7 @@ function getJsonSchema(model, options = {}) {
|
|
|
56
55
|
...options,
|
|
57
56
|
genericTypes: entity.nestedGenerics[0],
|
|
58
57
|
nestedGenerics: entity.nestedGenerics,
|
|
59
|
-
groups:
|
|
58
|
+
groups: entity.parameter?.groups
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
61
|
return get(entity, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":";;;AACA,mCAAiC;AACjC,qCAAmC;AACnC,wCAAsC;AACtC,8CAA4C;AAC5C,oCAAkC;AAClC,uCAAqC;AACrC,mCAAiC;AACjC,sCAAoC;AACpC,kCAAgC;AAChC,0CAAwC;AACxC,sCAAoC;AAEpC,mDAA8C;AAE9C,uFAAmE;AACnE,6DAAwD;AAExD;;GAEG;AACH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;GAEG;AACH,SAAS,MAAM,CAAC,OAAY;IAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,GAAG,CAAC,MAAuB,EAAE,OAAY;IAChD,MAAM,KAAK,GAAqB,MAAM,CAAC,KAAK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sourcesContent":["import {Type} from \"@tsed/core\";\nimport \"../components/anyMapper\";\nimport \"../components/classMapper\";\nimport \"../components/genericsMapper\";\nimport \"../components/inheritedClassMapper\";\nimport \"../components/itemMapper\";\nimport \"../components/lazyRefMapper\";\nimport \"../components/mapMapper\";\nimport \"../components/objectMapper\";\nimport \"../components/ofMapper\";\nimport \"../components/propertiesMapper\";\nimport \"../components/schemaMapper\";\nimport type {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\n\n/**\n * @ignore\n */\nconst CACHE_KEY = \"$cache:schemes\";\n\n/**\n * @ignore\n */\nfunction getKey(options: any) {\n return JSON.stringify(options);\n}\n\n/**\n * @ignore\n */\nfunction get(entity: JsonEntityStore, options: any) {\n const cache: Map<string, any> = entity.store.get(CACHE_KEY) || new Map();\n const key = getKey(options);\n\n if (!cache.has(key)) {\n const schema = execMapper(\"schema\", entity.schema, options);\n\n if (Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n cache.set(key, schema);\n }\n\n entity.store.set(CACHE_KEY, cache);\n\n return cache.get(key);\n}\n\nexport function getJsonSchema(model: Type<any> | any, options: JsonSchemaOptions = {}) {\n const entity = getJsonEntityStore(model);\n\n options = {\n endpoint: true,\n groups: [],\n ...options,\n specType: options.specType || SpecTypes.JSON,\n schemas: {}\n };\n\n if (entity.decoratorType === \"parameter\") {\n options = {\n ...options,\n genericTypes: entity.nestedGenerics[0],\n nestedGenerics: entity.nestedGenerics,\n groups: entity.parameter?.groups\n };\n }\n\n return get(entity, options);\n}\n"]}
|
|
@@ -4,9 +4,9 @@ exports.getRequiredProperties = void 0;
|
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
5
|
const alterRequiredGroups_1 = require("../hooks/alterRequiredGroups");
|
|
6
6
|
function applyStringRule(obj, propSchema) {
|
|
7
|
-
if (!
|
|
8
|
-
if ([].concat(propSchema
|
|
9
|
-
const minLength = obj
|
|
7
|
+
if (!propSchema?.$allow.includes("")) {
|
|
8
|
+
if ([].concat(propSchema?.get("type")).includes("string")) {
|
|
9
|
+
const minLength = obj?.minLength;
|
|
10
10
|
// Disallow empty string
|
|
11
11
|
if (minLength === undefined) {
|
|
12
12
|
return {
|