@tsed/schema 7.84.0 → 7.85.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/cjs/components/default/anyMapper.js +1 -1
- package/lib/cjs/components/default/anyMapper.js.map +1 -1
- package/lib/cjs/components/default/discriminatorMappingMapper.js +26 -0
- package/lib/cjs/components/default/discriminatorMappingMapper.js.map +1 -0
- package/lib/cjs/components/default/{inlineEnumsMapper.js → enumsMapper.js} +5 -5
- package/lib/cjs/components/default/enumsMapper.js.map +1 -0
- package/lib/cjs/components/default/inheritedClassMapper.js +16 -2
- package/lib/cjs/components/default/inheritedClassMapper.js.map +1 -1
- package/lib/cjs/components/default/requiredMapper.js +1 -4
- package/lib/cjs/components/default/requiredMapper.js.map +1 -1
- package/lib/cjs/components/default/schemaMapper.js +7 -10
- package/lib/cjs/components/default/schemaMapper.js.map +1 -1
- package/lib/cjs/components/index.js +4 -1
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/open-spec/discriminatorMappingMapper.js +9 -0
- package/lib/cjs/components/open-spec/discriminatorMappingMapper.js.map +1 -0
- package/lib/cjs/components/open-spec/enumsMapper.js +19 -0
- package/lib/cjs/components/open-spec/enumsMapper.js.map +1 -0
- package/lib/cjs/decorators/common/labelledAs.js +39 -0
- package/lib/cjs/decorators/common/labelledAs.js.map +1 -0
- package/lib/cjs/decorators/generics/genericOf.js +2 -2
- package/lib/cjs/decorators/generics/genericOf.js.map +1 -1
- package/lib/cjs/decorators/operations/returns.js +2 -2
- package/lib/cjs/decorators/operations/returns.js.map +1 -1
- package/lib/cjs/domain/JsonSchema.js +9 -1
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/fn/allOf.js +16 -0
- package/lib/cjs/fn/allOf.js.map +1 -0
- package/lib/cjs/fn/any.js +14 -0
- package/lib/cjs/fn/any.js.map +1 -0
- package/lib/cjs/fn/anyOf.js +16 -0
- package/lib/cjs/fn/anyOf.js.map +1 -0
- package/lib/cjs/fn/boolean.js +14 -0
- package/lib/cjs/fn/boolean.js.map +1 -0
- package/lib/cjs/fn/collection.js +56 -0
- package/lib/cjs/fn/collection.js.map +1 -0
- package/lib/cjs/fn/date.js +33 -0
- package/lib/cjs/fn/date.js.map +1 -0
- package/lib/cjs/fn/email.js +22 -0
- package/lib/cjs/fn/email.js.map +1 -0
- package/lib/cjs/fn/enums.js +12 -0
- package/lib/cjs/fn/enums.js.map +1 -0
- package/lib/cjs/fn/from.js +32 -0
- package/lib/cjs/fn/from.js.map +1 -0
- package/lib/cjs/fn/integer.js +17 -0
- package/lib/cjs/fn/integer.js.map +1 -0
- package/lib/cjs/fn/lazyRef.js +21 -0
- package/lib/cjs/fn/lazyRef.js.map +1 -0
- package/lib/cjs/fn/number.js +14 -0
- package/lib/cjs/fn/number.js.map +1 -0
- package/lib/cjs/fn/object.js +26 -0
- package/lib/cjs/fn/object.js.map +1 -0
- package/lib/cjs/fn/oneOf.js +17 -0
- package/lib/cjs/fn/oneOf.js.map +1 -0
- package/lib/cjs/fn/string.js +14 -0
- package/lib/cjs/fn/string.js.map +1 -0
- package/lib/cjs/fn/uri.js +17 -0
- package/lib/cjs/fn/uri.js.map +1 -0
- package/lib/cjs/fn/url.js +15 -0
- package/lib/cjs/fn/url.js.map +1 -0
- package/lib/cjs/index.js +22 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/registries/JsonSchemaMapperContainer.js +3 -3
- package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -1
- package/lib/cjs/utils/ref.js +3 -1
- package/lib/cjs/utils/ref.js.map +1 -1
- package/lib/cjs/utils/transformToOS2.js +5 -4
- package/lib/cjs/utils/transformToOS2.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/discriminatorMappingMapper.js +22 -0
- package/lib/esm/components/default/discriminatorMappingMapper.js.map +1 -0
- package/lib/esm/components/default/{inlineEnumsMapper.js → enumsMapper.js} +3 -3
- package/lib/esm/components/default/enumsMapper.js.map +1 -0
- package/lib/esm/components/default/inheritedClassMapper.js +16 -2
- package/lib/esm/components/default/inheritedClassMapper.js.map +1 -1
- package/lib/esm/components/default/requiredMapper.js +1 -4
- package/lib/esm/components/default/requiredMapper.js.map +1 -1
- package/lib/esm/components/default/schemaMapper.js +7 -10
- package/lib/esm/components/default/schemaMapper.js.map +1 -1
- package/lib/esm/components/index.js +4 -1
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/open-spec/discriminatorMappingMapper.js +7 -0
- package/lib/esm/components/open-spec/discriminatorMappingMapper.js.map +1 -0
- package/lib/esm/components/open-spec/enumsMapper.js +15 -0
- package/lib/esm/components/open-spec/enumsMapper.js.map +1 -0
- 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/domain/JsonSchema.js +9 -1
- package/lib/esm/domain/JsonSchema.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 +22 -2
- 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 +3 -1
- package/lib/esm/utils/ref.js.map +1 -1
- package/lib/esm/utils/transformToOS2.js +5 -4
- package/lib/esm/utils/transformToOS2.js.map +1 -1
- package/lib/types/components/default/discriminatorMappingMapper.d.ts +9 -0
- package/lib/types/components/default/enumsMapper.d.ts +3 -0
- package/lib/types/components/index.d.ts +4 -1
- package/lib/types/components/open-spec/discriminatorMappingMapper.d.ts +1 -0
- package/lib/types/components/open-spec/enumsMapper.d.ts +3 -0
- 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 +22 -2
- package/lib/types/interfaces/JsonSchemaOptions.d.ts +3 -0
- package/lib/types/registries/JsonSchemaMapperContainer.d.ts +1 -1
- package/lib/types/utils/ref.d.ts +1 -1
- package/lib/types/utils/transformToOS2.d.ts +2 -2
- package/lib/types-esm/components/default/discriminatorMappingMapper.d.ts +9 -0
- package/lib/types-esm/components/default/{inlineEnumsMapper.d.ts → enumsMapper.d.ts} +1 -1
- package/lib/types-esm/components/index.d.ts +4 -1
- package/lib/types-esm/components/open-spec/discriminatorMappingMapper.d.ts +1 -0
- package/lib/{types/components/default/inlineEnumsMapper.d.ts → types-esm/components/open-spec/enumsMapper.d.ts} +1 -1
- package/lib/types-esm/decorators/common/labelledAs.d.ts +24 -0
- package/lib/types-esm/fn/allOf.d.ts +9 -0
- package/lib/types-esm/fn/any.d.ts +7 -0
- package/lib/types-esm/fn/anyOf.d.ts +9 -0
- package/lib/types-esm/fn/boolean.d.ts +7 -0
- package/lib/types-esm/fn/collection.d.ts +43 -0
- package/lib/types-esm/fn/date.d.ts +19 -0
- package/lib/types-esm/fn/email.d.ts +14 -0
- package/lib/types-esm/fn/enums.d.ts +1 -0
- package/lib/types-esm/fn/from.d.ts +14 -0
- package/lib/types-esm/fn/integer.d.ts +10 -0
- package/lib/types-esm/fn/lazyRef.d.ts +5 -0
- package/lib/types-esm/fn/number.d.ts +6 -0
- package/lib/types-esm/fn/object.d.ts +21 -0
- package/lib/types-esm/fn/oneOf.d.ts +10 -0
- package/lib/types-esm/fn/string.d.ts +7 -0
- package/lib/types-esm/fn/uri.d.ts +9 -0
- package/lib/types-esm/fn/url.d.ts +7 -0
- package/lib/types-esm/index.d.ts +22 -2
- package/lib/types-esm/interfaces/JsonSchemaOptions.d.ts +3 -0
- package/lib/types-esm/registries/JsonSchemaMapperContainer.d.ts +1 -1
- package/lib/types-esm/utils/ref.d.ts +1 -1
- package/lib/types-esm/utils/transformToOS2.d.ts +2 -2
- package/package.json +8 -8
- package/lib/cjs/components/default/inlineEnumsMapper.js.map +0 -1
- package/lib/cjs/utils/from.js +0 -280
- package/lib/cjs/utils/from.js.map +0 -1
- package/lib/esm/components/default/inlineEnumsMapper.js.map +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/lib/types-esm/utils/from.d.ts +0 -190
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new object model with `additionalProperties: true`.
|
|
4
|
+
*
|
|
5
|
+
* ```json
|
|
6
|
+
* {
|
|
7
|
+
* "type": "array"
|
|
8
|
+
* }
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
12
|
+
*
|
|
13
|
+
* @schemaFunctional
|
|
14
|
+
*/
|
|
15
|
+
export declare function array(): JsonSchema;
|
|
16
|
+
/**
|
|
17
|
+
* Declare a new object model with `additionalProperties: true`.
|
|
18
|
+
*
|
|
19
|
+
* ```json
|
|
20
|
+
* {
|
|
21
|
+
* "type": "object",
|
|
22
|
+
* "additionalProperties": true
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
27
|
+
*
|
|
28
|
+
* @schemaFunctional
|
|
29
|
+
*/
|
|
30
|
+
export declare function map(): JsonSchema;
|
|
31
|
+
/**
|
|
32
|
+
* Declare a new array model with `uniqueItems: true`.
|
|
33
|
+
*
|
|
34
|
+
* ```json
|
|
35
|
+
* {
|
|
36
|
+
* "type": "array",
|
|
37
|
+
* "uniqueItems": true
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
42
|
+
*/
|
|
43
|
+
export declare function set(): JsonSchema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new string model with `format: date`.
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*/
|
|
7
|
+
export declare function date(): JsonSchema;
|
|
8
|
+
/**
|
|
9
|
+
* Declare a new string model with `format: datetime`.
|
|
10
|
+
*
|
|
11
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
12
|
+
*/
|
|
13
|
+
export declare function datetime(): JsonSchema;
|
|
14
|
+
/**
|
|
15
|
+
* Declare a new string model with `format: time`.
|
|
16
|
+
*
|
|
17
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
18
|
+
*/
|
|
19
|
+
export declare function time(): JsonSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new string model with `format: email`.
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*
|
|
7
|
+
* ### Example
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const schema = email();
|
|
11
|
+
* // Results in: { type: "string", format: "email" }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function email(): JsonSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function enums(e: Record<string, any>): import("../index.js").JsonSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new integer model.
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*
|
|
7
|
+
* @returns {JsonSchema} A schema configured for integer values
|
|
8
|
+
* @function
|
|
9
|
+
*/
|
|
10
|
+
export declare function integer(): JsonSchema;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new object model.
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*
|
|
7
|
+
* ### Example
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const userSchema = object({
|
|
11
|
+
* name: string(),
|
|
12
|
+
* age: number()
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param properties - An object containing property definitions where each value is a JsonSchema
|
|
17
|
+
* @returns {JsonSchema} A new object model with the specified properties
|
|
18
|
+
*/
|
|
19
|
+
export declare function object(properties?: {
|
|
20
|
+
[key: string]: JsonSchema;
|
|
21
|
+
}): JsonSchema;
|
|
@@ -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;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -8,9 +8,10 @@ export * from "./components/async-api/payloadMapper.js";
|
|
|
8
8
|
export * from "./components/async-api/responseMapper.js";
|
|
9
9
|
export * from "./components/default/anyMapper.js";
|
|
10
10
|
export * from "./components/default/classMapper.js";
|
|
11
|
+
export * from "./components/default/discriminatorMappingMapper.js";
|
|
12
|
+
export * from "./components/default/enumsMapper.js";
|
|
11
13
|
export * from "./components/default/genericsMapper.js";
|
|
12
14
|
export * from "./components/default/inheritedClassMapper.js";
|
|
13
|
-
export * from "./components/default/inlineEnumsMapper.js";
|
|
14
15
|
export * from "./components/default/itemMapper.js";
|
|
15
16
|
export * from "./components/default/lazyRefMapper.js";
|
|
16
17
|
export * from "./components/default/mapMapper.js";
|
|
@@ -21,6 +22,8 @@ export * from "./components/default/propertiesMapper.js";
|
|
|
21
22
|
export * from "./components/default/requiredMapper.js";
|
|
22
23
|
export * from "./components/default/schemaMapper.js";
|
|
23
24
|
export * from "./components/index.js";
|
|
25
|
+
export * from "./components/open-spec/discriminatorMappingMapper.js";
|
|
26
|
+
export * from "./components/open-spec/enumsMapper.js";
|
|
24
27
|
export * from "./components/open-spec/generate.js";
|
|
25
28
|
export * from "./components/open-spec/nullableMapper.js";
|
|
26
29
|
export * from "./components/open-spec/operationInFilesMapper.js";
|
|
@@ -68,6 +71,7 @@ export * from "./decorators/common/hidden.js";
|
|
|
68
71
|
export * from "./decorators/common/ignore.js";
|
|
69
72
|
export * from "./decorators/common/integer.js";
|
|
70
73
|
export * from "./decorators/common/jsonEntityFn.js";
|
|
74
|
+
export * from "./decorators/common/labelledAs.js";
|
|
71
75
|
export * from "./decorators/common/maximum.js";
|
|
72
76
|
export * from "./decorators/common/maxLength.js";
|
|
73
77
|
export * from "./decorators/common/minimum.js";
|
|
@@ -135,6 +139,23 @@ export * from "./domain/JsonRequestBody.js";
|
|
|
135
139
|
export * from "./domain/JsonResponse.js";
|
|
136
140
|
export * from "./domain/JsonSchema.js";
|
|
137
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";
|
|
138
159
|
export * from "./hooks/alterIgnore.js";
|
|
139
160
|
export * from "./hooks/alterOneOf.js";
|
|
140
161
|
export * from "./hooks/alterRequiredGroups.js";
|
|
@@ -148,7 +169,6 @@ export * from "./utils/buildPath.js";
|
|
|
148
169
|
export * from "./utils/concatParameters.js";
|
|
149
170
|
export * from "./utils/concatPath.js";
|
|
150
171
|
export * from "./utils/defineStatusModel.js";
|
|
151
|
-
export * from "./utils/from.js";
|
|
152
172
|
export * from "./utils/generateSpec.js";
|
|
153
173
|
export * from "./utils/generics.js";
|
|
154
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
|
|
21
|
+
export declare function execOneOfMapper(types: string[], options: any): string;
|
package/lib/types/utils/ref.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export declare function createRef(name: string, schema: JsonSchema, options: Jso
|
|
|
11
11
|
/**
|
|
12
12
|
* @ignore
|
|
13
13
|
*/
|
|
14
|
-
export declare function toRef(value: JsonSchema, schema:
|
|
14
|
+
export declare function toRef(value: JsonSchema, schema: unknown | undefined, options: JsonSchemaOptions): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OpenSpec2, OpenSpec3, OS3Operation } from "@tsed/openspec";
|
|
2
|
-
export declare function transformSecurity(securitySchemes: any):
|
|
1
|
+
import { OpenSpec2, OpenSpec3, type OS2Security, OS3Operation } from "@tsed/openspec";
|
|
2
|
+
export declare function transformSecurity(securitySchemes: any): Record<string, OS2Security>;
|
|
3
3
|
export declare function transformInformation(server: any): {
|
|
4
4
|
host: string | undefined;
|
|
5
5
|
basePath: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JsonSchema } from "../../domain/JsonSchema.js";
|
|
2
|
+
import type { JsonSchemaOptions } from "../../interfaces/JsonSchemaOptions.js";
|
|
3
|
+
interface SchemaWithDiscriminator {
|
|
4
|
+
discriminator?: {
|
|
5
|
+
mapping?: Record<string, JsonSchema | string>;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare function discriminatorMappingMapper(obj: SchemaWithDiscriminator, _: JsonSchema, options: JsonSchemaOptions): SchemaWithDiscriminator;
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JsonSchema } from "../../domain/JsonSchema.js";
|
|
2
2
|
import { JsonSchemaOptions } from "../../interfaces/JsonSchemaOptions.js";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function enumsMapper(obj: any, schema: JsonSchema, options: JsonSchemaOptions): any;
|
|
@@ -8,9 +8,10 @@ export * from "./async-api/payloadMapper.js";
|
|
|
8
8
|
export * from "./async-api/responseMapper.js";
|
|
9
9
|
export * from "./default/anyMapper.js";
|
|
10
10
|
export * from "./default/classMapper.js";
|
|
11
|
+
export * from "./default/discriminatorMappingMapper.js";
|
|
12
|
+
export * from "./default/enumsMapper.js";
|
|
11
13
|
export * from "./default/genericsMapper.js";
|
|
12
14
|
export * from "./default/inheritedClassMapper.js";
|
|
13
|
-
export * from "./default/inlineEnumsMapper.js";
|
|
14
15
|
export * from "./default/itemMapper.js";
|
|
15
16
|
export * from "./default/lazyRefMapper.js";
|
|
16
17
|
export * from "./default/mapMapper.js";
|
|
@@ -20,6 +21,8 @@ export * from "./default/ofMapper.js";
|
|
|
20
21
|
export * from "./default/propertiesMapper.js";
|
|
21
22
|
export * from "./default/requiredMapper.js";
|
|
22
23
|
export * from "./default/schemaMapper.js";
|
|
24
|
+
export * from "./open-spec/discriminatorMappingMapper.js";
|
|
25
|
+
export * from "./open-spec/enumsMapper.js";
|
|
23
26
|
export * from "./open-spec/generate.js";
|
|
24
27
|
export * from "./open-spec/nullableMapper.js";
|
|
25
28
|
export * from "./open-spec/operationInFilesMapper.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JsonSchema } from "../../domain/JsonSchema.js";
|
|
2
2
|
import { JsonSchemaOptions } from "../../interfaces/JsonSchemaOptions.js";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function wrapEnumsMapper(obj: any, schema: JsonSchema, options: JsonSchemaOptions): any;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use label to create ref on the current decorated property.
|
|
3
|
+
*
|
|
4
|
+
* ### Example
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* class Model {
|
|
8
|
+
* // For single property
|
|
9
|
+
* @LabelledAs("UserSchema")
|
|
10
|
+
* name: string;
|
|
11
|
+
*
|
|
12
|
+
* // For collection
|
|
13
|
+
* @LabelledAs("UserCollectionSchema", "collection")
|
|
14
|
+
* users: User[];
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param label The name of the label
|
|
19
|
+
* @param includeCollection Add the label to the collection. By default, the label is added to the item of the collection it the property is a collection.
|
|
20
|
+
* @returns PropertyDecorator
|
|
21
|
+
*
|
|
22
|
+
* @decorator
|
|
23
|
+
*/
|
|
24
|
+
export declare function LabelledAs(label: string, includeCollection?: false | "collection"): PropertyDecorator;
|
|
@@ -0,0 +1,9 @@
|
|
|
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.26
|
|
4
|
+
*
|
|
5
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*
|
|
7
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
8
|
+
*/
|
|
9
|
+
export declare function allOf(...allOf: AnyJsonSchema[]): JsonSchema;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AnyJsonSchema, JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*/
|
|
7
|
+
export declare function any(...types: AnyJsonSchema[]): JsonSchema;
|
|
@@ -0,0 +1,9 @@
|
|
|
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.27
|
|
4
|
+
*
|
|
5
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*
|
|
7
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
8
|
+
*/
|
|
9
|
+
export declare function anyOf(...anyOf: AnyJsonSchema[]): JsonSchema;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new object model with `additionalProperties: true`.
|
|
4
|
+
*
|
|
5
|
+
* ```json
|
|
6
|
+
* {
|
|
7
|
+
* "type": "array"
|
|
8
|
+
* }
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
12
|
+
*
|
|
13
|
+
* @schemaFunctional
|
|
14
|
+
*/
|
|
15
|
+
export declare function array(): JsonSchema;
|
|
16
|
+
/**
|
|
17
|
+
* Declare a new object model with `additionalProperties: true`.
|
|
18
|
+
*
|
|
19
|
+
* ```json
|
|
20
|
+
* {
|
|
21
|
+
* "type": "object",
|
|
22
|
+
* "additionalProperties": true
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
27
|
+
*
|
|
28
|
+
* @schemaFunctional
|
|
29
|
+
*/
|
|
30
|
+
export declare function map(): JsonSchema;
|
|
31
|
+
/**
|
|
32
|
+
* Declare a new array model with `uniqueItems: true`.
|
|
33
|
+
*
|
|
34
|
+
* ```json
|
|
35
|
+
* {
|
|
36
|
+
* "type": "array",
|
|
37
|
+
* "uniqueItems": true
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
42
|
+
*/
|
|
43
|
+
export declare function set(): JsonSchema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new string model with `format: date`.
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*/
|
|
7
|
+
export declare function date(): JsonSchema;
|
|
8
|
+
/**
|
|
9
|
+
* Declare a new string model with `format: datetime`.
|
|
10
|
+
*
|
|
11
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
12
|
+
*/
|
|
13
|
+
export declare function datetime(): JsonSchema;
|
|
14
|
+
/**
|
|
15
|
+
* Declare a new string model with `format: time`.
|
|
16
|
+
*
|
|
17
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
18
|
+
*/
|
|
19
|
+
export declare function time(): JsonSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new string model with `format: email`.
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*
|
|
7
|
+
* ### Example
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const schema = email();
|
|
11
|
+
* // Results in: { type: "string", format: "email" }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function email(): JsonSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function enums(e: Record<string, any>): import("../index.js").JsonSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new integer model.
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*
|
|
7
|
+
* @returns {JsonSchema} A schema configured for integer values
|
|
8
|
+
* @function
|
|
9
|
+
*/
|
|
10
|
+
export declare function integer(): JsonSchema;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JsonSchema } from "../domain/JsonSchema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a new object model.
|
|
4
|
+
*
|
|
5
|
+
* See @@JsonSchema@@ to discover available methods.
|
|
6
|
+
*
|
|
7
|
+
* ### Example
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const userSchema = object({
|
|
11
|
+
* name: string(),
|
|
12
|
+
* age: number()
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param properties - An object containing property definitions where each value is a JsonSchema
|
|
17
|
+
* @returns {JsonSchema} A new object model with the specified properties
|
|
18
|
+
*/
|
|
19
|
+
export declare function object(properties?: {
|
|
20
|
+
[key: string]: JsonSchema;
|
|
21
|
+
}): JsonSchema;
|
|
@@ -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;
|
package/lib/types-esm/index.d.ts
CHANGED
|
@@ -8,9 +8,10 @@ export * from "./components/async-api/payloadMapper.js";
|
|
|
8
8
|
export * from "./components/async-api/responseMapper.js";
|
|
9
9
|
export * from "./components/default/anyMapper.js";
|
|
10
10
|
export * from "./components/default/classMapper.js";
|
|
11
|
+
export * from "./components/default/discriminatorMappingMapper.js";
|
|
12
|
+
export * from "./components/default/enumsMapper.js";
|
|
11
13
|
export * from "./components/default/genericsMapper.js";
|
|
12
14
|
export * from "./components/default/inheritedClassMapper.js";
|
|
13
|
-
export * from "./components/default/inlineEnumsMapper.js";
|
|
14
15
|
export * from "./components/default/itemMapper.js";
|
|
15
16
|
export * from "./components/default/lazyRefMapper.js";
|
|
16
17
|
export * from "./components/default/mapMapper.js";
|
|
@@ -21,6 +22,8 @@ export * from "./components/default/propertiesMapper.js";
|
|
|
21
22
|
export * from "./components/default/requiredMapper.js";
|
|
22
23
|
export * from "./components/default/schemaMapper.js";
|
|
23
24
|
export * from "./components/index.js";
|
|
25
|
+
export * from "./components/open-spec/discriminatorMappingMapper.js";
|
|
26
|
+
export * from "./components/open-spec/enumsMapper.js";
|
|
24
27
|
export * from "./components/open-spec/generate.js";
|
|
25
28
|
export * from "./components/open-spec/nullableMapper.js";
|
|
26
29
|
export * from "./components/open-spec/operationInFilesMapper.js";
|
|
@@ -68,6 +71,7 @@ export * from "./decorators/common/hidden.js";
|
|
|
68
71
|
export * from "./decorators/common/ignore.js";
|
|
69
72
|
export * from "./decorators/common/integer.js";
|
|
70
73
|
export * from "./decorators/common/jsonEntityFn.js";
|
|
74
|
+
export * from "./decorators/common/labelledAs.js";
|
|
71
75
|
export * from "./decorators/common/maximum.js";
|
|
72
76
|
export * from "./decorators/common/maxLength.js";
|
|
73
77
|
export * from "./decorators/common/minimum.js";
|
|
@@ -135,6 +139,23 @@ export * from "./domain/JsonRequestBody.js";
|
|
|
135
139
|
export * from "./domain/JsonResponse.js";
|
|
136
140
|
export * from "./domain/JsonSchema.js";
|
|
137
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";
|
|
138
159
|
export * from "./hooks/alterIgnore.js";
|
|
139
160
|
export * from "./hooks/alterOneOf.js";
|
|
140
161
|
export * from "./hooks/alterRequiredGroups.js";
|
|
@@ -148,7 +169,6 @@ export * from "./utils/buildPath.js";
|
|
|
148
169
|
export * from "./utils/concatParameters.js";
|
|
149
170
|
export * from "./utils/concatPath.js";
|
|
150
171
|
export * from "./utils/defineStatusModel.js";
|
|
151
|
-
export * from "./utils/from.js";
|
|
152
172
|
export * from "./utils/generateSpec.js";
|
|
153
173
|
export * from "./utils/generics.js";
|
|
154
174
|
export * from "./utils/getComputedType.js";
|