@tsed/schema 8.1.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/schema.umd.min.js +1 -1
- package/lib/browser/schema.umd.min.js.map +1 -1
- package/lib/esm/components/default/anyMapper.js +2 -2
- package/lib/esm/components/default/anyMapper.js.map +1 -1
- package/lib/esm/components/default/inheritedClassMapper.js +16 -2
- package/lib/esm/components/default/inheritedClassMapper.js.map +1 -1
- package/lib/esm/decorators/common/labelledAs.js +35 -0
- package/lib/esm/decorators/common/labelledAs.js.map +1 -0
- package/lib/esm/decorators/generics/genericOf.js +1 -1
- package/lib/esm/decorators/generics/genericOf.js.map +1 -1
- package/lib/esm/decorators/operations/returns.js +1 -1
- package/lib/esm/decorators/operations/returns.js.map +1 -1
- package/lib/esm/fn/allOf.js +12 -0
- package/lib/esm/fn/allOf.js.map +1 -0
- package/lib/esm/fn/any.js +10 -0
- package/lib/esm/fn/any.js.map +1 -0
- package/lib/esm/fn/anyOf.js +12 -0
- package/lib/esm/fn/anyOf.js.map +1 -0
- package/lib/esm/fn/boolean.js +10 -0
- package/lib/esm/fn/boolean.js.map +1 -0
- package/lib/esm/fn/collection.js +50 -0
- package/lib/esm/fn/collection.js.map +1 -0
- package/lib/esm/fn/date.js +27 -0
- package/lib/esm/fn/date.js.map +1 -0
- package/lib/esm/fn/email.js +18 -0
- package/lib/esm/fn/email.js.map +1 -0
- package/lib/esm/fn/enums.js +8 -0
- package/lib/esm/fn/enums.js.map +1 -0
- package/lib/esm/fn/from.js +28 -0
- package/lib/esm/fn/from.js.map +1 -0
- package/lib/esm/fn/integer.js +13 -0
- package/lib/esm/fn/integer.js.map +1 -0
- package/lib/esm/fn/lazyRef.js +17 -0
- package/lib/esm/fn/lazyRef.js.map +1 -0
- package/lib/esm/fn/number.js +10 -0
- package/lib/esm/fn/number.js.map +1 -0
- package/lib/esm/fn/object.js +22 -0
- package/lib/esm/fn/object.js.map +1 -0
- package/lib/esm/fn/oneOf.js +13 -0
- package/lib/esm/fn/oneOf.js.map +1 -0
- package/lib/esm/fn/string.js +10 -0
- package/lib/esm/fn/string.js.map +1 -0
- package/lib/esm/fn/uri.js +13 -0
- package/lib/esm/fn/uri.js.map +1 -0
- package/lib/esm/fn/url.js +11 -0
- package/lib/esm/fn/url.js.map +1 -0
- package/lib/esm/index.js +18 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/registries/JsonSchemaMapperContainer.js +1 -1
- package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -1
- package/lib/esm/utils/ref.js.map +1 -1
- package/lib/types/decorators/common/labelledAs.d.ts +24 -0
- package/lib/types/fn/allOf.d.ts +9 -0
- package/lib/types/fn/any.d.ts +7 -0
- package/lib/types/fn/anyOf.d.ts +9 -0
- package/lib/types/fn/boolean.d.ts +7 -0
- package/lib/types/fn/collection.d.ts +43 -0
- package/lib/types/fn/date.d.ts +19 -0
- package/lib/types/fn/email.d.ts +14 -0
- package/lib/types/fn/enums.d.ts +1 -0
- package/lib/types/fn/from.d.ts +14 -0
- package/lib/types/fn/integer.d.ts +10 -0
- package/lib/types/fn/lazyRef.d.ts +5 -0
- package/lib/types/fn/number.d.ts +6 -0
- package/lib/types/fn/object.d.ts +21 -0
- package/lib/types/fn/oneOf.d.ts +10 -0
- package/lib/types/fn/string.d.ts +7 -0
- package/lib/types/fn/uri.d.ts +9 -0
- package/lib/types/fn/url.d.ts +7 -0
- package/lib/types/index.d.ts +18 -1
- package/lib/types/registries/JsonSchemaMapperContainer.d.ts +1 -1
- package/package.json +10 -10
- package/src/components/default/anyMapper.ts +2 -2
- package/src/components/default/inheritedClassMapper.ts +19 -2
- package/src/decorators/collections/collectionOf.spec.ts +2 -1
- package/src/decorators/common/allOf.spec.ts +2 -1
- package/src/decorators/common/anyOf.spec.ts +2 -1
- package/src/decorators/common/enum.spec.ts +1 -1
- package/src/decorators/common/labelledAs.spec.ts +85 -0
- package/src/decorators/common/labelledAs.ts +34 -0
- package/src/decorators/common/oneOf.spec.ts +2 -1
- package/src/decorators/generics/genericOf.ts +1 -1
- package/src/decorators/operations/returns.ts +1 -1
- package/src/fn/allOf.ts +13 -0
- package/src/fn/any.ts +11 -0
- package/src/fn/anyOf.ts +13 -0
- package/src/fn/boolean.ts +11 -0
- package/src/fn/collection.ts +53 -0
- package/src/fn/date.ts +30 -0
- package/src/fn/email.ts +19 -0
- package/src/fn/enums.ts +9 -0
- package/src/{utils → fn}/from.spec.ts +14 -83
- package/src/fn/from.ts +33 -0
- package/src/fn/integer.ts +13 -0
- package/src/fn/layzRef.spec.ts +70 -0
- package/src/fn/lazyRef.ts +19 -0
- package/src/fn/number.ts +10 -0
- package/src/fn/object.ts +23 -0
- package/src/fn/oneOf.ts +14 -0
- package/src/fn/string.ts +11 -0
- package/src/fn/uri.ts +14 -0
- package/src/fn/url.ts +12 -0
- package/src/index.ts +18 -1
- package/src/registries/JsonSchemaMapperContainer.ts +1 -1
- package/src/utils/ref.ts +0 -1
- package/lib/esm/utils/from.js +0 -256
- package/lib/esm/utils/from.js.map +0 -1
- package/lib/types/utils/from.d.ts +0 -190
- package/src/utils/from.ts +0 -281
package/lib/esm/utils/from.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { isClass } from "@tsed/core";
|
|
2
|
-
import { JsonEntityStore } from "../domain/JsonEntityStore.js";
|
|
3
|
-
import { JsonFormatTypes } from "../domain/JsonFormatTypes.js";
|
|
4
|
-
import { JsonLazyRef } from "../domain/JsonLazyRef.js";
|
|
5
|
-
import { JsonSchema } from "../domain/JsonSchema.js";
|
|
6
|
-
import { enumsRegistry } from "../registries/enumRegistries.js";
|
|
7
|
-
import { getJsonEntityStore } from "./getJsonEntityStore.js";
|
|
8
|
-
/**
|
|
9
|
-
* Create a new model from the given type.
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* from(String)
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
16
|
-
*
|
|
17
|
-
* @schemaFunctional
|
|
18
|
-
*/
|
|
19
|
-
export function from(type = Object) {
|
|
20
|
-
if (isClass(type)) {
|
|
21
|
-
const { schema } = getJsonEntityStore(type);
|
|
22
|
-
schema.properties = function properties(obj) {
|
|
23
|
-
Object.entries(obj).forEach(([propertyKey, propSchema]) => {
|
|
24
|
-
getJsonEntityStore(type.prototype, propertyKey).schema.assign(propSchema);
|
|
25
|
-
});
|
|
26
|
-
return this;
|
|
27
|
-
};
|
|
28
|
-
return schema;
|
|
29
|
-
}
|
|
30
|
-
return JsonSchema.from({ type });
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Declare a new number model.
|
|
34
|
-
*
|
|
35
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
36
|
-
*
|
|
37
|
-
* @schemaFunctional
|
|
38
|
-
*/
|
|
39
|
-
export function number() {
|
|
40
|
-
return from(Number);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Declare a new integer model.
|
|
44
|
-
*
|
|
45
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
46
|
-
*
|
|
47
|
-
* @schemaFunctional
|
|
48
|
-
*/
|
|
49
|
-
export function integer() {
|
|
50
|
-
return from(Number).integer();
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Declare a new string model.
|
|
54
|
-
*
|
|
55
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
56
|
-
*
|
|
57
|
-
* @schemaFunctional
|
|
58
|
-
*/
|
|
59
|
-
export function string() {
|
|
60
|
-
return from(String);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Declare a new boolean model.
|
|
64
|
-
*
|
|
65
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
66
|
-
*
|
|
67
|
-
* @schemaFunctional
|
|
68
|
-
*/
|
|
69
|
-
export function boolean() {
|
|
70
|
-
return from(Boolean);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Declare a new string model with `format: date`.
|
|
74
|
-
*
|
|
75
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
76
|
-
*
|
|
77
|
-
* @schemaFunctional
|
|
78
|
-
*/
|
|
79
|
-
export function date() {
|
|
80
|
-
return from(Date).format(JsonFormatTypes.DATE);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Declare a new string model with `format: datetime`.
|
|
84
|
-
*
|
|
85
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
86
|
-
*
|
|
87
|
-
* @schemaFunctional
|
|
88
|
-
*/
|
|
89
|
-
export function datetime() {
|
|
90
|
-
return from(Date).format(JsonFormatTypes.DATE_TIME);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Declare a new string model with `format: time`.
|
|
94
|
-
*
|
|
95
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
96
|
-
*
|
|
97
|
-
* @schemaFunctional
|
|
98
|
-
*/
|
|
99
|
-
export function time() {
|
|
100
|
-
return from(Date).format(JsonFormatTypes.TIME);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Declare a new string model with `format: email`.
|
|
104
|
-
*
|
|
105
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
106
|
-
*
|
|
107
|
-
* @schemaFunctional
|
|
108
|
-
*/
|
|
109
|
-
export function email() {
|
|
110
|
-
return from(String).format(JsonFormatTypes.EMAIL);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Declare a new string model with `format: uri`.
|
|
114
|
-
*
|
|
115
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
116
|
-
*
|
|
117
|
-
* @schemaFunctional
|
|
118
|
-
*/
|
|
119
|
-
export function uri() {
|
|
120
|
-
return from(String).format(JsonFormatTypes.URI);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Declare a new string model with `format: url`.
|
|
124
|
-
*
|
|
125
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
126
|
-
*
|
|
127
|
-
* @schemaFunctional
|
|
128
|
-
*/
|
|
129
|
-
export function url() {
|
|
130
|
-
return from(String).format(JsonFormatTypes.URL);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Declare a new object model with `additionalProperties: true`.
|
|
134
|
-
*
|
|
135
|
-
* ```json
|
|
136
|
-
* {
|
|
137
|
-
* "type": "array"
|
|
138
|
-
* }
|
|
139
|
-
* ```
|
|
140
|
-
*
|
|
141
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
142
|
-
*
|
|
143
|
-
* @schemaFunctional
|
|
144
|
-
*/
|
|
145
|
-
export function array() {
|
|
146
|
-
return from(Array);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Declare a new object model with `additionalProperties: true`.
|
|
150
|
-
*
|
|
151
|
-
* ```json
|
|
152
|
-
* {
|
|
153
|
-
* "type": "object",
|
|
154
|
-
* "additionalProperties": true
|
|
155
|
-
* }
|
|
156
|
-
* ```
|
|
157
|
-
*
|
|
158
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
159
|
-
*
|
|
160
|
-
* @schemaFunctional
|
|
161
|
-
*/
|
|
162
|
-
export function map() {
|
|
163
|
-
return from(Map).unknown(true);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Declare a new array model with `uniqueItems: true`.
|
|
167
|
-
*
|
|
168
|
-
* ```json
|
|
169
|
-
* {
|
|
170
|
-
* "type": "array",
|
|
171
|
-
* "uniqueItems": true
|
|
172
|
-
* }
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
175
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
176
|
-
*
|
|
177
|
-
* @schemaFunctional
|
|
178
|
-
*/
|
|
179
|
-
export function set() {
|
|
180
|
-
return from(Array).uniqueItems(true);
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Declare a new object model.
|
|
184
|
-
*
|
|
185
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
186
|
-
*
|
|
187
|
-
* @schemaFunctional
|
|
188
|
-
*/
|
|
189
|
-
export function object(properties = {}) {
|
|
190
|
-
return from(Object).properties(properties);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)
|
|
194
|
-
*
|
|
195
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
196
|
-
*
|
|
197
|
-
* @schemaFunctional
|
|
198
|
-
*/
|
|
199
|
-
export function any(...types) {
|
|
200
|
-
return from().any(...types);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
204
|
-
*
|
|
205
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
206
|
-
*
|
|
207
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
208
|
-
* @schemaFunctional
|
|
209
|
-
*/
|
|
210
|
-
export function anyOf(...anyOf) {
|
|
211
|
-
return from().anyOf(anyOf);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
215
|
-
*
|
|
216
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
217
|
-
*
|
|
218
|
-
* @schemaFunctional
|
|
219
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
220
|
-
*/
|
|
221
|
-
export function oneOf(...oneOf) {
|
|
222
|
-
return from().oneOf(oneOf);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
226
|
-
*
|
|
227
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
228
|
-
*
|
|
229
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
230
|
-
* @schemaFunctional
|
|
231
|
-
*/
|
|
232
|
-
export function allOf(...allOf) {
|
|
233
|
-
return from().allOf(allOf);
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.
|
|
237
|
-
*
|
|
238
|
-
* @schemaFunctional
|
|
239
|
-
*/
|
|
240
|
-
export function lazyRef(cb) {
|
|
241
|
-
try {
|
|
242
|
-
// solve issue with a self referenced model
|
|
243
|
-
if (cb()) {
|
|
244
|
-
// type is already accessible
|
|
245
|
-
return JsonEntityStore.from(cb()).schema;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
catch (er) { }
|
|
249
|
-
return new JsonLazyRef(cb);
|
|
250
|
-
}
|
|
251
|
-
export function enums(e) {
|
|
252
|
-
const schema = string().enum(e);
|
|
253
|
-
enumsRegistry.set(e, schema);
|
|
254
|
-
return schema;
|
|
255
|
-
}
|
|
256
|
-
//# sourceMappingURL=from.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/utils/from.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAO,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,IAAI,CAAC,OAAkB,MAAM;IAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,MAAM,EAAC,MAAM,EAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,CA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H,MAAM,UAAU,KAAK,CAAC,GAAG,KAAY;IACnC,OAAO,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,GAAG,KAAY;IACnC,OAAO,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,EAAmB;IACzC,IAAI,CAAC;QACH,2CAA2C;QAC3C,IAAI,EAAE,EAAE,EAAE,CAAC;YACT,6BAA6B;YAC7B,OAAO,eAAe,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,MAAa,CAAC;QAClD,CAAC;IACH,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC,CAAA,CAAC;IAEf,OAAO,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC;AACD,MAAM,UAAU,KAAK,CAAC,CAAsB;IAC1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAE7B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { JsonSchema } from "../domain/JsonSchema.js";
|
|
3
|
-
/**
|
|
4
|
-
* Create a new model from the given type.
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* from(String)
|
|
8
|
-
* ```
|
|
9
|
-
*
|
|
10
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
11
|
-
*
|
|
12
|
-
* @schemaFunctional
|
|
13
|
-
*/
|
|
14
|
-
export declare function from(type?: Type<any>): JsonSchema;
|
|
15
|
-
/**
|
|
16
|
-
* Declare a new number model.
|
|
17
|
-
*
|
|
18
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
19
|
-
*
|
|
20
|
-
* @schemaFunctional
|
|
21
|
-
*/
|
|
22
|
-
export declare function number(): JsonSchema;
|
|
23
|
-
/**
|
|
24
|
-
* Declare a new integer model.
|
|
25
|
-
*
|
|
26
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
27
|
-
*
|
|
28
|
-
* @schemaFunctional
|
|
29
|
-
*/
|
|
30
|
-
export declare function integer(): JsonSchema;
|
|
31
|
-
/**
|
|
32
|
-
* Declare a new string model.
|
|
33
|
-
*
|
|
34
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
35
|
-
*
|
|
36
|
-
* @schemaFunctional
|
|
37
|
-
*/
|
|
38
|
-
export declare function string(): JsonSchema;
|
|
39
|
-
/**
|
|
40
|
-
* Declare a new boolean model.
|
|
41
|
-
*
|
|
42
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
43
|
-
*
|
|
44
|
-
* @schemaFunctional
|
|
45
|
-
*/
|
|
46
|
-
export declare function boolean(): JsonSchema;
|
|
47
|
-
/**
|
|
48
|
-
* Declare a new string model with `format: date`.
|
|
49
|
-
*
|
|
50
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
51
|
-
*
|
|
52
|
-
* @schemaFunctional
|
|
53
|
-
*/
|
|
54
|
-
export declare function date(): JsonSchema;
|
|
55
|
-
/**
|
|
56
|
-
* Declare a new string model with `format: datetime`.
|
|
57
|
-
*
|
|
58
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
59
|
-
*
|
|
60
|
-
* @schemaFunctional
|
|
61
|
-
*/
|
|
62
|
-
export declare function datetime(): JsonSchema;
|
|
63
|
-
/**
|
|
64
|
-
* Declare a new string model with `format: time`.
|
|
65
|
-
*
|
|
66
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
67
|
-
*
|
|
68
|
-
* @schemaFunctional
|
|
69
|
-
*/
|
|
70
|
-
export declare function time(): JsonSchema;
|
|
71
|
-
/**
|
|
72
|
-
* Declare a new string model with `format: email`.
|
|
73
|
-
*
|
|
74
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
75
|
-
*
|
|
76
|
-
* @schemaFunctional
|
|
77
|
-
*/
|
|
78
|
-
export declare function email(): JsonSchema;
|
|
79
|
-
/**
|
|
80
|
-
* Declare a new string model with `format: uri`.
|
|
81
|
-
*
|
|
82
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
83
|
-
*
|
|
84
|
-
* @schemaFunctional
|
|
85
|
-
*/
|
|
86
|
-
export declare function uri(): JsonSchema;
|
|
87
|
-
/**
|
|
88
|
-
* Declare a new string model with `format: url`.
|
|
89
|
-
*
|
|
90
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
91
|
-
*
|
|
92
|
-
* @schemaFunctional
|
|
93
|
-
*/
|
|
94
|
-
export declare function url(): JsonSchema;
|
|
95
|
-
/**
|
|
96
|
-
* Declare a new object model with `additionalProperties: true`.
|
|
97
|
-
*
|
|
98
|
-
* ```json
|
|
99
|
-
* {
|
|
100
|
-
* "type": "array"
|
|
101
|
-
* }
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
105
|
-
*
|
|
106
|
-
* @schemaFunctional
|
|
107
|
-
*/
|
|
108
|
-
export declare function array(): JsonSchema;
|
|
109
|
-
/**
|
|
110
|
-
* Declare a new object model with `additionalProperties: true`.
|
|
111
|
-
*
|
|
112
|
-
* ```json
|
|
113
|
-
* {
|
|
114
|
-
* "type": "object",
|
|
115
|
-
* "additionalProperties": true
|
|
116
|
-
* }
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
120
|
-
*
|
|
121
|
-
* @schemaFunctional
|
|
122
|
-
*/
|
|
123
|
-
export declare function map(): JsonSchema;
|
|
124
|
-
/**
|
|
125
|
-
* Declare a new array model with `uniqueItems: true`.
|
|
126
|
-
*
|
|
127
|
-
* ```json
|
|
128
|
-
* {
|
|
129
|
-
* "type": "array",
|
|
130
|
-
* "uniqueItems": true
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
135
|
-
*
|
|
136
|
-
* @schemaFunctional
|
|
137
|
-
*/
|
|
138
|
-
export declare function set(): JsonSchema;
|
|
139
|
-
/**
|
|
140
|
-
* Declare a new object model.
|
|
141
|
-
*
|
|
142
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
143
|
-
*
|
|
144
|
-
* @schemaFunctional
|
|
145
|
-
*/
|
|
146
|
-
export declare function object(properties?: {
|
|
147
|
-
[key: string]: JsonSchema;
|
|
148
|
-
}): JsonSchema;
|
|
149
|
-
/**
|
|
150
|
-
* Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)
|
|
151
|
-
*
|
|
152
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
153
|
-
*
|
|
154
|
-
* @schemaFunctional
|
|
155
|
-
*/
|
|
156
|
-
export declare function any(...types: any[]): JsonSchema;
|
|
157
|
-
/**
|
|
158
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
159
|
-
*
|
|
160
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
161
|
-
*
|
|
162
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
163
|
-
* @schemaFunctional
|
|
164
|
-
*/
|
|
165
|
-
export declare function anyOf(...anyOf: any[]): JsonSchema;
|
|
166
|
-
/**
|
|
167
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
168
|
-
*
|
|
169
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
170
|
-
*
|
|
171
|
-
* @schemaFunctional
|
|
172
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
173
|
-
*/
|
|
174
|
-
export declare function oneOf(...oneOf: any[]): JsonSchema;
|
|
175
|
-
/**
|
|
176
|
-
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
177
|
-
*
|
|
178
|
-
* * See @@JsonSchema@@ to discover available methods.
|
|
179
|
-
*
|
|
180
|
-
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
181
|
-
* @schemaFunctional
|
|
182
|
-
*/
|
|
183
|
-
export declare function allOf(...allOf: any[]): JsonSchema;
|
|
184
|
-
/**
|
|
185
|
-
* Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.
|
|
186
|
-
*
|
|
187
|
-
* @schemaFunctional
|
|
188
|
-
*/
|
|
189
|
-
export declare function lazyRef(cb: () => Type<any>): any;
|
|
190
|
-
export declare function enums(e: Record<string, any>): JsonSchema;
|