@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.
Files changed (203) 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/discriminatorMappingMapper.js +26 -0
  6. package/lib/cjs/components/default/discriminatorMappingMapper.js.map +1 -0
  7. package/lib/cjs/components/default/{inlineEnumsMapper.js → enumsMapper.js} +5 -5
  8. package/lib/cjs/components/default/enumsMapper.js.map +1 -0
  9. package/lib/cjs/components/default/inheritedClassMapper.js +16 -2
  10. package/lib/cjs/components/default/inheritedClassMapper.js.map +1 -1
  11. package/lib/cjs/components/default/requiredMapper.js +1 -4
  12. package/lib/cjs/components/default/requiredMapper.js.map +1 -1
  13. package/lib/cjs/components/default/schemaMapper.js +7 -10
  14. package/lib/cjs/components/default/schemaMapper.js.map +1 -1
  15. package/lib/cjs/components/index.js +4 -1
  16. package/lib/cjs/components/index.js.map +1 -1
  17. package/lib/cjs/components/open-spec/discriminatorMappingMapper.js +9 -0
  18. package/lib/cjs/components/open-spec/discriminatorMappingMapper.js.map +1 -0
  19. package/lib/cjs/components/open-spec/enumsMapper.js +19 -0
  20. package/lib/cjs/components/open-spec/enumsMapper.js.map +1 -0
  21. package/lib/cjs/decorators/common/labelledAs.js +39 -0
  22. package/lib/cjs/decorators/common/labelledAs.js.map +1 -0
  23. package/lib/cjs/decorators/generics/genericOf.js +2 -2
  24. package/lib/cjs/decorators/generics/genericOf.js.map +1 -1
  25. package/lib/cjs/decorators/operations/returns.js +2 -2
  26. package/lib/cjs/decorators/operations/returns.js.map +1 -1
  27. package/lib/cjs/domain/JsonSchema.js +9 -1
  28. package/lib/cjs/domain/JsonSchema.js.map +1 -1
  29. package/lib/cjs/fn/allOf.js +16 -0
  30. package/lib/cjs/fn/allOf.js.map +1 -0
  31. package/lib/cjs/fn/any.js +14 -0
  32. package/lib/cjs/fn/any.js.map +1 -0
  33. package/lib/cjs/fn/anyOf.js +16 -0
  34. package/lib/cjs/fn/anyOf.js.map +1 -0
  35. package/lib/cjs/fn/boolean.js +14 -0
  36. package/lib/cjs/fn/boolean.js.map +1 -0
  37. package/lib/cjs/fn/collection.js +56 -0
  38. package/lib/cjs/fn/collection.js.map +1 -0
  39. package/lib/cjs/fn/date.js +33 -0
  40. package/lib/cjs/fn/date.js.map +1 -0
  41. package/lib/cjs/fn/email.js +22 -0
  42. package/lib/cjs/fn/email.js.map +1 -0
  43. package/lib/cjs/fn/enums.js +12 -0
  44. package/lib/cjs/fn/enums.js.map +1 -0
  45. package/lib/cjs/fn/from.js +32 -0
  46. package/lib/cjs/fn/from.js.map +1 -0
  47. package/lib/cjs/fn/integer.js +17 -0
  48. package/lib/cjs/fn/integer.js.map +1 -0
  49. package/lib/cjs/fn/lazyRef.js +21 -0
  50. package/lib/cjs/fn/lazyRef.js.map +1 -0
  51. package/lib/cjs/fn/number.js +14 -0
  52. package/lib/cjs/fn/number.js.map +1 -0
  53. package/lib/cjs/fn/object.js +26 -0
  54. package/lib/cjs/fn/object.js.map +1 -0
  55. package/lib/cjs/fn/oneOf.js +17 -0
  56. package/lib/cjs/fn/oneOf.js.map +1 -0
  57. package/lib/cjs/fn/string.js +14 -0
  58. package/lib/cjs/fn/string.js.map +1 -0
  59. package/lib/cjs/fn/uri.js +17 -0
  60. package/lib/cjs/fn/uri.js.map +1 -0
  61. package/lib/cjs/fn/url.js +15 -0
  62. package/lib/cjs/fn/url.js.map +1 -0
  63. package/lib/cjs/index.js +22 -2
  64. package/lib/cjs/index.js.map +1 -1
  65. package/lib/cjs/registries/JsonSchemaMapperContainer.js +3 -3
  66. package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -1
  67. package/lib/cjs/utils/ref.js +3 -1
  68. package/lib/cjs/utils/ref.js.map +1 -1
  69. package/lib/cjs/utils/transformToOS2.js +5 -4
  70. package/lib/cjs/utils/transformToOS2.js.map +1 -1
  71. package/lib/esm/components/default/anyMapper.js +2 -2
  72. package/lib/esm/components/default/anyMapper.js.map +1 -1
  73. package/lib/esm/components/default/discriminatorMappingMapper.js +22 -0
  74. package/lib/esm/components/default/discriminatorMappingMapper.js.map +1 -0
  75. package/lib/esm/components/default/{inlineEnumsMapper.js → enumsMapper.js} +3 -3
  76. package/lib/esm/components/default/enumsMapper.js.map +1 -0
  77. package/lib/esm/components/default/inheritedClassMapper.js +16 -2
  78. package/lib/esm/components/default/inheritedClassMapper.js.map +1 -1
  79. package/lib/esm/components/default/requiredMapper.js +1 -4
  80. package/lib/esm/components/default/requiredMapper.js.map +1 -1
  81. package/lib/esm/components/default/schemaMapper.js +7 -10
  82. package/lib/esm/components/default/schemaMapper.js.map +1 -1
  83. package/lib/esm/components/index.js +4 -1
  84. package/lib/esm/components/index.js.map +1 -1
  85. package/lib/esm/components/open-spec/discriminatorMappingMapper.js +7 -0
  86. package/lib/esm/components/open-spec/discriminatorMappingMapper.js.map +1 -0
  87. package/lib/esm/components/open-spec/enumsMapper.js +15 -0
  88. package/lib/esm/components/open-spec/enumsMapper.js.map +1 -0
  89. package/lib/esm/decorators/common/labelledAs.js +35 -0
  90. package/lib/esm/decorators/common/labelledAs.js.map +1 -0
  91. package/lib/esm/decorators/generics/genericOf.js +1 -1
  92. package/lib/esm/decorators/generics/genericOf.js.map +1 -1
  93. package/lib/esm/decorators/operations/returns.js +1 -1
  94. package/lib/esm/decorators/operations/returns.js.map +1 -1
  95. package/lib/esm/domain/JsonSchema.js +9 -1
  96. package/lib/esm/domain/JsonSchema.js.map +1 -1
  97. package/lib/esm/fn/allOf.js +12 -0
  98. package/lib/esm/fn/allOf.js.map +1 -0
  99. package/lib/esm/fn/any.js +10 -0
  100. package/lib/esm/fn/any.js.map +1 -0
  101. package/lib/esm/fn/anyOf.js +12 -0
  102. package/lib/esm/fn/anyOf.js.map +1 -0
  103. package/lib/esm/fn/boolean.js +10 -0
  104. package/lib/esm/fn/boolean.js.map +1 -0
  105. package/lib/esm/fn/collection.js +50 -0
  106. package/lib/esm/fn/collection.js.map +1 -0
  107. package/lib/esm/fn/date.js +27 -0
  108. package/lib/esm/fn/date.js.map +1 -0
  109. package/lib/esm/fn/email.js +18 -0
  110. package/lib/esm/fn/email.js.map +1 -0
  111. package/lib/esm/fn/enums.js +8 -0
  112. package/lib/esm/fn/enums.js.map +1 -0
  113. package/lib/esm/fn/from.js +28 -0
  114. package/lib/esm/fn/from.js.map +1 -0
  115. package/lib/esm/fn/integer.js +13 -0
  116. package/lib/esm/fn/integer.js.map +1 -0
  117. package/lib/esm/fn/lazyRef.js +17 -0
  118. package/lib/esm/fn/lazyRef.js.map +1 -0
  119. package/lib/esm/fn/number.js +10 -0
  120. package/lib/esm/fn/number.js.map +1 -0
  121. package/lib/esm/fn/object.js +22 -0
  122. package/lib/esm/fn/object.js.map +1 -0
  123. package/lib/esm/fn/oneOf.js +13 -0
  124. package/lib/esm/fn/oneOf.js.map +1 -0
  125. package/lib/esm/fn/string.js +10 -0
  126. package/lib/esm/fn/string.js.map +1 -0
  127. package/lib/esm/fn/uri.js +13 -0
  128. package/lib/esm/fn/uri.js.map +1 -0
  129. package/lib/esm/fn/url.js +11 -0
  130. package/lib/esm/fn/url.js.map +1 -0
  131. package/lib/esm/index.js +22 -2
  132. package/lib/esm/index.js.map +1 -1
  133. package/lib/esm/registries/JsonSchemaMapperContainer.js +1 -1
  134. package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -1
  135. package/lib/esm/utils/ref.js +3 -1
  136. package/lib/esm/utils/ref.js.map +1 -1
  137. package/lib/esm/utils/transformToOS2.js +5 -4
  138. package/lib/esm/utils/transformToOS2.js.map +1 -1
  139. package/lib/types/components/default/discriminatorMappingMapper.d.ts +9 -0
  140. package/lib/types/components/default/enumsMapper.d.ts +3 -0
  141. package/lib/types/components/index.d.ts +4 -1
  142. package/lib/types/components/open-spec/discriminatorMappingMapper.d.ts +1 -0
  143. package/lib/types/components/open-spec/enumsMapper.d.ts +3 -0
  144. package/lib/types/decorators/common/labelledAs.d.ts +24 -0
  145. package/lib/types/fn/allOf.d.ts +9 -0
  146. package/lib/types/fn/any.d.ts +7 -0
  147. package/lib/types/fn/anyOf.d.ts +9 -0
  148. package/lib/types/fn/boolean.d.ts +7 -0
  149. package/lib/types/fn/collection.d.ts +43 -0
  150. package/lib/types/fn/date.d.ts +19 -0
  151. package/lib/types/fn/email.d.ts +14 -0
  152. package/lib/types/fn/enums.d.ts +1 -0
  153. package/lib/types/fn/from.d.ts +14 -0
  154. package/lib/types/fn/integer.d.ts +10 -0
  155. package/lib/types/fn/lazyRef.d.ts +5 -0
  156. package/lib/types/fn/number.d.ts +6 -0
  157. package/lib/types/fn/object.d.ts +21 -0
  158. package/lib/types/fn/oneOf.d.ts +10 -0
  159. package/lib/types/fn/string.d.ts +7 -0
  160. package/lib/types/fn/uri.d.ts +9 -0
  161. package/lib/types/fn/url.d.ts +7 -0
  162. package/lib/types/index.d.ts +22 -2
  163. package/lib/types/interfaces/JsonSchemaOptions.d.ts +3 -0
  164. package/lib/types/registries/JsonSchemaMapperContainer.d.ts +1 -1
  165. package/lib/types/utils/ref.d.ts +1 -1
  166. package/lib/types/utils/transformToOS2.d.ts +2 -2
  167. package/lib/types-esm/components/default/discriminatorMappingMapper.d.ts +9 -0
  168. package/lib/types-esm/components/default/{inlineEnumsMapper.d.ts → enumsMapper.d.ts} +1 -1
  169. package/lib/types-esm/components/index.d.ts +4 -1
  170. package/lib/types-esm/components/open-spec/discriminatorMappingMapper.d.ts +1 -0
  171. package/lib/{types/components/default/inlineEnumsMapper.d.ts → types-esm/components/open-spec/enumsMapper.d.ts} +1 -1
  172. package/lib/types-esm/decorators/common/labelledAs.d.ts +24 -0
  173. package/lib/types-esm/fn/allOf.d.ts +9 -0
  174. package/lib/types-esm/fn/any.d.ts +7 -0
  175. package/lib/types-esm/fn/anyOf.d.ts +9 -0
  176. package/lib/types-esm/fn/boolean.d.ts +7 -0
  177. package/lib/types-esm/fn/collection.d.ts +43 -0
  178. package/lib/types-esm/fn/date.d.ts +19 -0
  179. package/lib/types-esm/fn/email.d.ts +14 -0
  180. package/lib/types-esm/fn/enums.d.ts +1 -0
  181. package/lib/types-esm/fn/from.d.ts +14 -0
  182. package/lib/types-esm/fn/integer.d.ts +10 -0
  183. package/lib/types-esm/fn/lazyRef.d.ts +5 -0
  184. package/lib/types-esm/fn/number.d.ts +6 -0
  185. package/lib/types-esm/fn/object.d.ts +21 -0
  186. package/lib/types-esm/fn/oneOf.d.ts +10 -0
  187. package/lib/types-esm/fn/string.d.ts +7 -0
  188. package/lib/types-esm/fn/uri.d.ts +9 -0
  189. package/lib/types-esm/fn/url.d.ts +7 -0
  190. package/lib/types-esm/index.d.ts +22 -2
  191. package/lib/types-esm/interfaces/JsonSchemaOptions.d.ts +3 -0
  192. package/lib/types-esm/registries/JsonSchemaMapperContainer.d.ts +1 -1
  193. package/lib/types-esm/utils/ref.d.ts +1 -1
  194. package/lib/types-esm/utils/transformToOS2.d.ts +2 -2
  195. package/package.json +8 -8
  196. package/lib/cjs/components/default/inlineEnumsMapper.js.map +0 -1
  197. package/lib/cjs/utils/from.js +0 -280
  198. package/lib/cjs/utils/from.js.map +0 -1
  199. package/lib/esm/components/default/inlineEnumsMapper.js.map +0 -1
  200. package/lib/esm/utils/from.js +0 -256
  201. package/lib/esm/utils/from.js.map +0 -1
  202. package/lib/types/utils/from.d.ts +0 -190
  203. 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,5 @@
1
+ import type { Type } from "@tsed/core";
2
+ /**
3
+ * Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.
4
+ */
5
+ export declare function lazyRef(cb: () => Type<any>): any;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Declare a new number model.
3
+ *
4
+ * * See @@JsonSchema@@ to discover available methods.
5
+ */
6
+ export declare function number(): import("../index.js").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;
@@ -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;
@@ -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";
@@ -25,6 +25,9 @@ export interface JsonSchemaOptions {
25
25
  * Generate custom keys when SpecType is JSON.
26
26
  */
27
27
  customKeys?: boolean;
28
+ /**
29
+ * Inline enums when enum instead of using $ref.
30
+ */
28
31
  inlineEnums?: boolean;
29
32
  [key: string]: any;
30
33
  }
@@ -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;
@@ -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: any, options: JsonSchemaOptions): any;
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 inlineEnumsMapper(obj: any, schema: JsonSchema, options: JsonSchemaOptions): any;
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";
@@ -1,3 +1,3 @@
1
1
  import { JsonSchema } from "../../domain/JsonSchema.js";
2
2
  import { JsonSchemaOptions } from "../../interfaces/JsonSchemaOptions.js";
3
- export declare function inlineEnumsMapper(obj: any, schema: JsonSchema, options: JsonSchemaOptions): any;
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,7 @@
1
+ import type { JsonSchema } from "../domain/JsonSchema.js";
2
+ /**
3
+ * Declare a new boolean model.
4
+ *
5
+ * * See @@JsonSchema@@ to discover available methods.
6
+ */
7
+ export declare function boolean(): 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,5 @@
1
+ import type { Type } from "@tsed/core";
2
+ /**
3
+ * Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.
4
+ */
5
+ export declare function lazyRef(cb: () => Type<any>): any;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Declare a new number model.
3
+ *
4
+ * * See @@JsonSchema@@ to discover available methods.
5
+ */
6
+ export declare function number(): import("../index.js").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;
@@ -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;
@@ -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";