@tsed/schema 7.84.1 → 7.85.1

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.
Files changed (148) hide show
  1. package/lib/browser/schema.umd.min.js +1 -1
  2. package/lib/browser/schema.umd.min.js.map +1 -1
  3. package/lib/cjs/components/default/anyMapper.js +1 -1
  4. package/lib/cjs/components/default/anyMapper.js.map +1 -1
  5. package/lib/cjs/components/default/inheritedClassMapper.js +16 -2
  6. package/lib/cjs/components/default/inheritedClassMapper.js.map +1 -1
  7. package/lib/cjs/decorators/common/labelledAs.js +39 -0
  8. package/lib/cjs/decorators/common/labelledAs.js.map +1 -0
  9. package/lib/cjs/decorators/generics/genericOf.js +2 -2
  10. package/lib/cjs/decorators/generics/genericOf.js.map +1 -1
  11. package/lib/cjs/decorators/operations/returns.js +2 -2
  12. package/lib/cjs/decorators/operations/returns.js.map +1 -1
  13. package/lib/cjs/fn/allOf.js +16 -0
  14. package/lib/cjs/fn/allOf.js.map +1 -0
  15. package/lib/cjs/fn/any.js +14 -0
  16. package/lib/cjs/fn/any.js.map +1 -0
  17. package/lib/cjs/fn/anyOf.js +16 -0
  18. package/lib/cjs/fn/anyOf.js.map +1 -0
  19. package/lib/cjs/fn/boolean.js +14 -0
  20. package/lib/cjs/fn/boolean.js.map +1 -0
  21. package/lib/cjs/fn/collection.js +56 -0
  22. package/lib/cjs/fn/collection.js.map +1 -0
  23. package/lib/cjs/fn/date.js +33 -0
  24. package/lib/cjs/fn/date.js.map +1 -0
  25. package/lib/cjs/fn/email.js +22 -0
  26. package/lib/cjs/fn/email.js.map +1 -0
  27. package/lib/cjs/fn/enums.js +12 -0
  28. package/lib/cjs/fn/enums.js.map +1 -0
  29. package/lib/cjs/fn/from.js +32 -0
  30. package/lib/cjs/fn/from.js.map +1 -0
  31. package/lib/cjs/fn/integer.js +17 -0
  32. package/lib/cjs/fn/integer.js.map +1 -0
  33. package/lib/cjs/fn/lazyRef.js +21 -0
  34. package/lib/cjs/fn/lazyRef.js.map +1 -0
  35. package/lib/cjs/fn/number.js +14 -0
  36. package/lib/cjs/fn/number.js.map +1 -0
  37. package/lib/cjs/fn/object.js +26 -0
  38. package/lib/cjs/fn/object.js.map +1 -0
  39. package/lib/cjs/fn/oneOf.js +17 -0
  40. package/lib/cjs/fn/oneOf.js.map +1 -0
  41. package/lib/cjs/fn/string.js +14 -0
  42. package/lib/cjs/fn/string.js.map +1 -0
  43. package/lib/cjs/fn/uri.js +17 -0
  44. package/lib/cjs/fn/uri.js.map +1 -0
  45. package/lib/cjs/fn/url.js +15 -0
  46. package/lib/cjs/fn/url.js.map +1 -0
  47. package/lib/cjs/index.js +18 -1
  48. package/lib/cjs/index.js.map +1 -1
  49. package/lib/cjs/registries/JsonSchemaMapperContainer.js +3 -3
  50. package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -1
  51. package/lib/cjs/utils/ref.js.map +1 -1
  52. package/lib/esm/components/default/anyMapper.js +2 -2
  53. package/lib/esm/components/default/anyMapper.js.map +1 -1
  54. package/lib/esm/components/default/inheritedClassMapper.js +16 -2
  55. package/lib/esm/components/default/inheritedClassMapper.js.map +1 -1
  56. package/lib/esm/decorators/common/labelledAs.js +35 -0
  57. package/lib/esm/decorators/common/labelledAs.js.map +1 -0
  58. package/lib/esm/decorators/generics/genericOf.js +1 -1
  59. package/lib/esm/decorators/generics/genericOf.js.map +1 -1
  60. package/lib/esm/decorators/operations/returns.js +1 -1
  61. package/lib/esm/decorators/operations/returns.js.map +1 -1
  62. package/lib/esm/fn/allOf.js +12 -0
  63. package/lib/esm/fn/allOf.js.map +1 -0
  64. package/lib/esm/fn/any.js +10 -0
  65. package/lib/esm/fn/any.js.map +1 -0
  66. package/lib/esm/fn/anyOf.js +12 -0
  67. package/lib/esm/fn/anyOf.js.map +1 -0
  68. package/lib/esm/fn/boolean.js +10 -0
  69. package/lib/esm/fn/boolean.js.map +1 -0
  70. package/lib/esm/fn/collection.js +50 -0
  71. package/lib/esm/fn/collection.js.map +1 -0
  72. package/lib/esm/fn/date.js +27 -0
  73. package/lib/esm/fn/date.js.map +1 -0
  74. package/lib/esm/fn/email.js +18 -0
  75. package/lib/esm/fn/email.js.map +1 -0
  76. package/lib/esm/fn/enums.js +8 -0
  77. package/lib/esm/fn/enums.js.map +1 -0
  78. package/lib/esm/fn/from.js +28 -0
  79. package/lib/esm/fn/from.js.map +1 -0
  80. package/lib/esm/fn/integer.js +13 -0
  81. package/lib/esm/fn/integer.js.map +1 -0
  82. package/lib/esm/fn/lazyRef.js +17 -0
  83. package/lib/esm/fn/lazyRef.js.map +1 -0
  84. package/lib/esm/fn/number.js +10 -0
  85. package/lib/esm/fn/number.js.map +1 -0
  86. package/lib/esm/fn/object.js +22 -0
  87. package/lib/esm/fn/object.js.map +1 -0
  88. package/lib/esm/fn/oneOf.js +13 -0
  89. package/lib/esm/fn/oneOf.js.map +1 -0
  90. package/lib/esm/fn/string.js +10 -0
  91. package/lib/esm/fn/string.js.map +1 -0
  92. package/lib/esm/fn/uri.js +13 -0
  93. package/lib/esm/fn/uri.js.map +1 -0
  94. package/lib/esm/fn/url.js +11 -0
  95. package/lib/esm/fn/url.js.map +1 -0
  96. package/lib/esm/index.js +18 -1
  97. package/lib/esm/index.js.map +1 -1
  98. package/lib/esm/registries/JsonSchemaMapperContainer.js +1 -1
  99. package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -1
  100. package/lib/esm/utils/ref.js.map +1 -1
  101. package/lib/types/decorators/common/labelledAs.d.ts +24 -0
  102. package/lib/types/fn/allOf.d.ts +9 -0
  103. package/lib/types/fn/any.d.ts +7 -0
  104. package/lib/types/fn/anyOf.d.ts +9 -0
  105. package/lib/types/fn/boolean.d.ts +7 -0
  106. package/lib/types/fn/collection.d.ts +43 -0
  107. package/lib/types/fn/date.d.ts +19 -0
  108. package/lib/types/fn/email.d.ts +14 -0
  109. package/lib/types/fn/enums.d.ts +1 -0
  110. package/lib/types/fn/from.d.ts +14 -0
  111. package/lib/types/fn/integer.d.ts +10 -0
  112. package/lib/types/fn/lazyRef.d.ts +5 -0
  113. package/lib/types/fn/number.d.ts +6 -0
  114. package/lib/types/fn/object.d.ts +21 -0
  115. package/lib/types/fn/oneOf.d.ts +10 -0
  116. package/lib/types/fn/string.d.ts +7 -0
  117. package/lib/types/fn/uri.d.ts +9 -0
  118. package/lib/types/fn/url.d.ts +7 -0
  119. package/lib/types/index.d.ts +18 -1
  120. package/lib/types/registries/JsonSchemaMapperContainer.d.ts +1 -1
  121. package/lib/types-esm/decorators/common/labelledAs.d.ts +24 -0
  122. package/lib/types-esm/fn/allOf.d.ts +9 -0
  123. package/lib/types-esm/fn/any.d.ts +7 -0
  124. package/lib/types-esm/fn/anyOf.d.ts +9 -0
  125. package/lib/types-esm/fn/boolean.d.ts +7 -0
  126. package/lib/types-esm/fn/collection.d.ts +43 -0
  127. package/lib/types-esm/fn/date.d.ts +19 -0
  128. package/lib/types-esm/fn/email.d.ts +14 -0
  129. package/lib/types-esm/fn/enums.d.ts +1 -0
  130. package/lib/types-esm/fn/from.d.ts +14 -0
  131. package/lib/types-esm/fn/integer.d.ts +10 -0
  132. package/lib/types-esm/fn/lazyRef.d.ts +5 -0
  133. package/lib/types-esm/fn/number.d.ts +6 -0
  134. package/lib/types-esm/fn/object.d.ts +21 -0
  135. package/lib/types-esm/fn/oneOf.d.ts +10 -0
  136. package/lib/types-esm/fn/string.d.ts +7 -0
  137. package/lib/types-esm/fn/uri.d.ts +9 -0
  138. package/lib/types-esm/fn/url.d.ts +7 -0
  139. package/lib/types-esm/index.d.ts +18 -1
  140. package/lib/types-esm/registries/JsonSchemaMapperContainer.d.ts +1 -1
  141. package/package.json +8 -8
  142. package/readme.md +6 -6
  143. package/lib/cjs/utils/from.js +0 -280
  144. package/lib/cjs/utils/from.js.map +0 -1
  145. package/lib/esm/utils/from.js +0 -256
  146. package/lib/esm/utils/from.js.map +0 -1
  147. package/lib/types/utils/from.d.ts +0 -190
  148. package/lib/types-esm/utils/from.d.ts +0 -190
@@ -0,0 +1,10 @@
1
+ import type { AnyJsonSchema, JsonSchema } from "../domain/JsonSchema.js";
2
+ /**
3
+ * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
4
+ *
5
+ * * See @@JsonSchema@@ to discover available methods.
6
+ *
7
+ * @schemaFunctional
8
+ * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
9
+ */
10
+ export declare function oneOf(...oneOf: AnyJsonSchema[]): JsonSchema;
@@ -0,0 +1,7 @@
1
+ import type { JsonSchema } from "../domain/JsonSchema.js";
2
+ /**
3
+ * Declare a new string model.
4
+ *
5
+ * See @@JsonSchema@@ to discover available methods.
6
+ */
7
+ export declare function string(): JsonSchema;
@@ -0,0 +1,9 @@
1
+ import type { JsonSchema } from "../domain/JsonSchema.js";
2
+ /**
3
+ * Declare a new string model with `format: uri`.
4
+ *
5
+ * * See @@JsonSchema@@ to discover available methods.
6
+ *
7
+ * @schemaFunctional
8
+ */
9
+ export declare function uri(): JsonSchema;
@@ -0,0 +1,7 @@
1
+ import type { JsonSchema } from "../domain/JsonSchema.js";
2
+ /**
3
+ * Declare a new string model with `format: url`.
4
+ *
5
+ * See @@JsonSchema@@ to discover available methods.
6
+ */
7
+ export declare function url(): JsonSchema;
@@ -71,6 +71,7 @@ export * from "./decorators/common/hidden.js";
71
71
  export * from "./decorators/common/ignore.js";
72
72
  export * from "./decorators/common/integer.js";
73
73
  export * from "./decorators/common/jsonEntityFn.js";
74
+ export * from "./decorators/common/labelledAs.js";
74
75
  export * from "./decorators/common/maximum.js";
75
76
  export * from "./decorators/common/maxLength.js";
76
77
  export * from "./decorators/common/minimum.js";
@@ -138,6 +139,23 @@ export * from "./domain/JsonRequestBody.js";
138
139
  export * from "./domain/JsonResponse.js";
139
140
  export * from "./domain/JsonSchema.js";
140
141
  export * from "./domain/SpecTypes.js";
142
+ export * from "./fn/allOf.js";
143
+ export * from "./fn/any.js";
144
+ export * from "./fn/anyOf.js";
145
+ export * from "./fn/boolean.js";
146
+ export * from "./fn/collection.js";
147
+ export * from "./fn/date.js";
148
+ export * from "./fn/email.js";
149
+ export * from "./fn/enums.js";
150
+ export * from "./fn/from.js";
151
+ export * from "./fn/integer.js";
152
+ export * from "./fn/lazyRef.js";
153
+ export * from "./fn/number.js";
154
+ export * from "./fn/object.js";
155
+ export * from "./fn/oneOf.js";
156
+ export * from "./fn/string.js";
157
+ export * from "./fn/uri.js";
158
+ export * from "./fn/url.js";
141
159
  export * from "./hooks/alterIgnore.js";
142
160
  export * from "./hooks/alterOneOf.js";
143
161
  export * from "./hooks/alterRequiredGroups.js";
@@ -151,7 +169,6 @@ export * from "./utils/buildPath.js";
151
169
  export * from "./utils/concatParameters.js";
152
170
  export * from "./utils/concatPath.js";
153
171
  export * from "./utils/defineStatusModel.js";
154
- export * from "./utils/from.js";
155
172
  export * from "./utils/generateSpec.js";
156
173
  export * from "./utils/generics.js";
157
174
  export * from "./utils/getComputedType.js";
@@ -18,4 +18,4 @@ export declare function getJsonSchemaMapper(type: string, options: any): JsonSch
18
18
  */
19
19
  export declare function execMapper(type: string, args: any[], options: any, parent?: any): any;
20
20
  export declare function hasMapper(type: string): boolean;
21
- export declare function oneOfMapper(types: string[], options: any): string;
21
+ export declare function execOneOfMapper(types: string[], options: any): string;
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.84.1",
5
+ "version": "7.85.1",
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.84.1",
40
+ "@tsed/openspec": "7.85.1",
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.84.1",
51
- "@tsed/core": "7.84.1",
52
- "@tsed/openspec": "7.84.1",
53
- "@tsed/typescript": "7.84.1",
50
+ "@tsed/barrels": "7.85.1",
51
+ "@tsed/core": "7.85.1",
52
+ "@tsed/openspec": "7.85.1",
53
+ "@tsed/typescript": "7.85.1",
54
54
  "@types/fs-extra": "11.0.4",
55
55
  "@types/json-schema": "7.0.15",
56
56
  "@types/picomatch": "2.3.3",
@@ -61,8 +61,8 @@
61
61
  "vitest": "2.0.4"
62
62
  },
63
63
  "peerDependencies": {
64
- "@tsed/core": "7.84.1",
65
- "@tsed/openspec": "7.84.1"
64
+ "@tsed/core": "7.85.1",
65
+ "@tsed/openspec": "7.85.1"
66
66
  },
67
67
  "peerDependenciesMeta": {
68
68
  "@tsed/core": {
package/readme.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p style="text-align: center" align="center">
2
- <a href="https://tsed.io" target="_blank"><img src="https://tsed.io/tsed-og.png" width="200" alt="Ts.ED logo"/></a>
2
+ <a href="https://tsed.dev" target="_blank"><img src="https://tsed.dev/tsed-og.png" width="200" alt="Ts.ED logo"/></a>
3
3
  </p>
4
4
 
5
5
  <div align="center">
@@ -16,9 +16,9 @@
16
16
  </div>
17
17
 
18
18
  <div align="center">
19
- <a href="https://tsed.io/">Website</a>
19
+ <a href="https://tsed.dev/">Website</a>
20
20
  <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
21
- <a href="https://tsed.io/getting-started/">Getting started</a>
21
+ <a href="https://tsed.dev/getting-started/">Getting started</a>
22
22
  <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
23
23
  <a href="https://api.tsed.io/rest/slack/tsedio/tsed">Slack</a>
24
24
  <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
@@ -27,13 +27,13 @@
27
27
 
28
28
  <hr />
29
29
 
30
- A package of Ts.ED framework. See website: https://tsed.io/
30
+ A package of Ts.ED framework. See website: https://tsed.dev/
31
31
 
32
32
  Package to declare JsonSchema and OpenAPI.
33
33
 
34
34
  ## Documentation
35
35
 
36
- Documentation is available on [https://tsed.io](https://tsed.io/docs/model.html)
36
+ Documentation is available on [https://tsed.dev](https://tsed.dev/docs/model.html)
37
37
 
38
38
  ## Installation
39
39
 
@@ -45,7 +45,7 @@ npm install --save @tsed/schema
45
45
 
46
46
  ## Contributors
47
47
 
48
- Please read [contributing guidelines here](https://tsed.io/contributing.html)
48
+ Please read [contributing guidelines here](https://tsed.dev/contributing.html)
49
49
 
50
50
  <a href="https://github.com/tsedio/tsed/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
51
51
 
@@ -1,280 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enums = exports.lazyRef = exports.allOf = exports.oneOf = exports.anyOf = exports.any = exports.object = exports.set = exports.map = exports.array = exports.url = exports.uri = exports.email = exports.time = exports.datetime = exports.date = exports.boolean = exports.string = exports.integer = exports.number = exports.from = void 0;
4
- const core_1 = require("@tsed/core");
5
- const JsonEntityStore_js_1 = require("../domain/JsonEntityStore.js");
6
- const JsonFormatTypes_js_1 = require("../domain/JsonFormatTypes.js");
7
- const JsonLazyRef_js_1 = require("../domain/JsonLazyRef.js");
8
- const JsonSchema_js_1 = require("../domain/JsonSchema.js");
9
- const enumRegistries_js_1 = require("../registries/enumRegistries.js");
10
- const getJsonEntityStore_js_1 = require("./getJsonEntityStore.js");
11
- /**
12
- * Create a new model from the given type.
13
- *
14
- * ```typescript
15
- * from(String)
16
- * ```
17
- *
18
- * * See @@JsonSchema@@ to discover available methods.
19
- *
20
- * @schemaFunctional
21
- */
22
- function from(type = Object) {
23
- if ((0, core_1.isClass)(type)) {
24
- const { schema } = (0, getJsonEntityStore_js_1.getJsonEntityStore)(type);
25
- schema.properties = function properties(obj) {
26
- Object.entries(obj).forEach(([propertyKey, propSchema]) => {
27
- (0, getJsonEntityStore_js_1.getJsonEntityStore)(type.prototype, propertyKey).schema.assign(propSchema);
28
- });
29
- return this;
30
- };
31
- return schema;
32
- }
33
- return JsonSchema_js_1.JsonSchema.from({ type });
34
- }
35
- exports.from = from;
36
- /**
37
- * Declare a new number model.
38
- *
39
- * * See @@JsonSchema@@ to discover available methods.
40
- *
41
- * @schemaFunctional
42
- */
43
- function number() {
44
- return from(Number);
45
- }
46
- exports.number = number;
47
- /**
48
- * Declare a new integer model.
49
- *
50
- * * See @@JsonSchema@@ to discover available methods.
51
- *
52
- * @schemaFunctional
53
- */
54
- function integer() {
55
- return from(Number).integer();
56
- }
57
- exports.integer = integer;
58
- /**
59
- * Declare a new string model.
60
- *
61
- * * See @@JsonSchema@@ to discover available methods.
62
- *
63
- * @schemaFunctional
64
- */
65
- function string() {
66
- return from(String);
67
- }
68
- exports.string = string;
69
- /**
70
- * Declare a new boolean model.
71
- *
72
- * * See @@JsonSchema@@ to discover available methods.
73
- *
74
- * @schemaFunctional
75
- */
76
- function boolean() {
77
- return from(Boolean);
78
- }
79
- exports.boolean = boolean;
80
- /**
81
- * Declare a new string model with `format: date`.
82
- *
83
- * * See @@JsonSchema@@ to discover available methods.
84
- *
85
- * @schemaFunctional
86
- */
87
- function date() {
88
- return from(Date).format(JsonFormatTypes_js_1.JsonFormatTypes.DATE);
89
- }
90
- exports.date = date;
91
- /**
92
- * Declare a new string model with `format: datetime`.
93
- *
94
- * * See @@JsonSchema@@ to discover available methods.
95
- *
96
- * @schemaFunctional
97
- */
98
- function datetime() {
99
- return from(Date).format(JsonFormatTypes_js_1.JsonFormatTypes.DATE_TIME);
100
- }
101
- exports.datetime = datetime;
102
- /**
103
- * Declare a new string model with `format: time`.
104
- *
105
- * * See @@JsonSchema@@ to discover available methods.
106
- *
107
- * @schemaFunctional
108
- */
109
- function time() {
110
- return from(Date).format(JsonFormatTypes_js_1.JsonFormatTypes.TIME);
111
- }
112
- exports.time = time;
113
- /**
114
- * Declare a new string model with `format: email`.
115
- *
116
- * * See @@JsonSchema@@ to discover available methods.
117
- *
118
- * @schemaFunctional
119
- */
120
- function email() {
121
- return from(String).format(JsonFormatTypes_js_1.JsonFormatTypes.EMAIL);
122
- }
123
- exports.email = email;
124
- /**
125
- * Declare a new string model with `format: uri`.
126
- *
127
- * * See @@JsonSchema@@ to discover available methods.
128
- *
129
- * @schemaFunctional
130
- */
131
- function uri() {
132
- return from(String).format(JsonFormatTypes_js_1.JsonFormatTypes.URI);
133
- }
134
- exports.uri = uri;
135
- /**
136
- * Declare a new string model with `format: url`.
137
- *
138
- * * See @@JsonSchema@@ to discover available methods.
139
- *
140
- * @schemaFunctional
141
- */
142
- function url() {
143
- return from(String).format(JsonFormatTypes_js_1.JsonFormatTypes.URL);
144
- }
145
- exports.url = url;
146
- /**
147
- * Declare a new object model with `additionalProperties: true`.
148
- *
149
- * ```json
150
- * {
151
- * "type": "array"
152
- * }
153
- * ```
154
- *
155
- * * See @@JsonSchema@@ to discover available methods.
156
- *
157
- * @schemaFunctional
158
- */
159
- function array() {
160
- return from(Array);
161
- }
162
- exports.array = array;
163
- /**
164
- * Declare a new object model with `additionalProperties: true`.
165
- *
166
- * ```json
167
- * {
168
- * "type": "object",
169
- * "additionalProperties": true
170
- * }
171
- * ```
172
- *
173
- * * See @@JsonSchema@@ to discover available methods.
174
- *
175
- * @schemaFunctional
176
- */
177
- function map() {
178
- return from(Map).unknown(true);
179
- }
180
- exports.map = map;
181
- /**
182
- * Declare a new array model with `uniqueItems: true`.
183
- *
184
- * ```json
185
- * {
186
- * "type": "array",
187
- * "uniqueItems": true
188
- * }
189
- * ```
190
- *
191
- * * See @@JsonSchema@@ to discover available methods.
192
- *
193
- * @schemaFunctional
194
- */
195
- function set() {
196
- return from(Array).uniqueItems(true);
197
- }
198
- exports.set = set;
199
- /**
200
- * Declare a new object model.
201
- *
202
- * * See @@JsonSchema@@ to discover available methods.
203
- *
204
- * @schemaFunctional
205
- */
206
- function object(properties = {}) {
207
- return from(Object).properties(properties);
208
- }
209
- exports.object = object;
210
- /**
211
- * Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)
212
- *
213
- * * See @@JsonSchema@@ to discover available methods.
214
- *
215
- * @schemaFunctional
216
- */
217
- function any(...types) {
218
- return from().any(...types);
219
- }
220
- exports.any = any;
221
- /**
222
- * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
223
- *
224
- * * See @@JsonSchema@@ to discover available methods.
225
- *
226
- * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
227
- * @schemaFunctional
228
- */
229
- function anyOf(...anyOf) {
230
- return from().anyOf(anyOf);
231
- }
232
- exports.anyOf = anyOf;
233
- /**
234
- * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
235
- *
236
- * * See @@JsonSchema@@ to discover available methods.
237
- *
238
- * @schemaFunctional
239
- * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
240
- */
241
- function oneOf(...oneOf) {
242
- return from().oneOf(oneOf);
243
- }
244
- exports.oneOf = oneOf;
245
- /**
246
- * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
247
- *
248
- * * See @@JsonSchema@@ to discover available methods.
249
- *
250
- * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
251
- * @schemaFunctional
252
- */
253
- function allOf(...allOf) {
254
- return from().allOf(allOf);
255
- }
256
- exports.allOf = allOf;
257
- /**
258
- * Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.
259
- *
260
- * @schemaFunctional
261
- */
262
- function lazyRef(cb) {
263
- try {
264
- // solve issue with a self referenced model
265
- if (cb()) {
266
- // type is already accessible
267
- return JsonEntityStore_js_1.JsonEntityStore.from(cb()).schema;
268
- }
269
- }
270
- catch (er) { }
271
- return new JsonLazyRef_js_1.JsonLazyRef(cb);
272
- }
273
- exports.lazyRef = lazyRef;
274
- function enums(e) {
275
- const schema = string().enum(e);
276
- enumRegistries_js_1.enumsRegistry.set(e, schema);
277
- return schema;
278
- }
279
- exports.enums = enums;
280
- //# sourceMappingURL=from.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/utils/from.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AACzC,qEAA6D;AAC7D,qEAA6D;AAC7D,6DAAqD;AACrD,2DAAmD;AACnD,uEAA8D;AAC9D,mEAA2D;AAE3D;;;;;;;;;;GAUG;AACH,SAAgB,IAAI,CAAC,OAAkB,MAAM;IAC3C,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QACjB,MAAM,EAAC,MAAM,EAAC,GAAG,IAAA,0CAAkB,EAAC,IAAI,CAAC,CAAC;QAE1C,MAAM,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,GAAgC;YACtE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,EAAE;gBACxD,IAAA,0CAAkB,EAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAEF,OAAO,MAAM,CAAC;KACf;IAED,OAAO,0BAAU,CAAC,IAAI,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;AACjC,CAAC;AAhBD,oBAgBC;AAED;;;;;;GAMG;AACH,SAAgB,MAAM;IACpB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAFD,wBAEC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO;IACrB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;AAChC,CAAC;AAFD,0BAEC;AAED;;;;;;GAMG;AACH,SAAgB,MAAM;IACpB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAFD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