@tsed/schema 7.34.1 → 7.35.0-beta.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 (167) hide show
  1. package/.barrelsby.json +5 -0
  2. package/jest.config.js +1 -1
  3. package/lib/browser/schema.umd.min.js +1 -1
  4. package/lib/browser/schema.umd.min.js.map +1 -1
  5. package/lib/cjs/components/anyMapper.js +3 -2
  6. package/lib/cjs/components/anyMapper.js.map +1 -1
  7. package/lib/cjs/components/index.js +27 -0
  8. package/lib/cjs/components/index.js.map +1 -0
  9. package/lib/cjs/components/lazyRefMapper.js +7 -7
  10. package/lib/cjs/components/lazyRefMapper.js.map +1 -1
  11. package/lib/cjs/components/mapMapper.js +1 -1
  12. package/lib/cjs/components/mapMapper.js.map +1 -1
  13. package/lib/cjs/components/operationInFilesMapper.js +28 -0
  14. package/lib/cjs/components/operationInFilesMapper.js.map +1 -0
  15. package/lib/cjs/components/operationInParameterMapper.js +39 -0
  16. package/lib/cjs/components/operationInParameterMapper.js.map +1 -0
  17. package/lib/cjs/components/operationInParametersMapper.js +10 -0
  18. package/lib/cjs/components/operationInParametersMapper.js.map +1 -0
  19. package/lib/cjs/components/operationInQueryMapper.js +39 -0
  20. package/lib/cjs/components/operationInQueryMapper.js.map +1 -0
  21. package/lib/cjs/components/operationMapper.js +49 -0
  22. package/lib/cjs/components/operationMapper.js.map +1 -0
  23. package/lib/cjs/components/operationMediaMapper.js +11 -0
  24. package/lib/cjs/components/operationMediaMapper.js.map +1 -0
  25. package/lib/cjs/components/operationRequestBodyMapper.js +57 -0
  26. package/lib/cjs/components/operationRequestBodyMapper.js.map +1 -0
  27. package/lib/cjs/components/operationResponseMapper.js +24 -0
  28. package/lib/cjs/components/operationResponseMapper.js.map +1 -0
  29. package/lib/cjs/components/pathsMapper.js +90 -0
  30. package/lib/cjs/components/pathsMapper.js.map +1 -0
  31. package/lib/cjs/components/schemaMapper.js +35 -5
  32. package/lib/cjs/components/schemaMapper.js.map +1 -1
  33. package/lib/cjs/decorators/common/ignore.js +1 -0
  34. package/lib/cjs/decorators/common/ignore.js.map +1 -1
  35. package/lib/cjs/decorators/common/property.js +1 -1
  36. package/lib/cjs/decorators/common/property.js.map +1 -1
  37. package/lib/cjs/domain/JsonClassStore.js.map +1 -1
  38. package/lib/cjs/domain/JsonEntityStore.js +3 -1
  39. package/lib/cjs/domain/JsonEntityStore.js.map +1 -1
  40. package/lib/cjs/domain/JsonLazyRef.js +0 -4
  41. package/lib/cjs/domain/JsonLazyRef.js.map +1 -1
  42. package/lib/cjs/domain/JsonMap.js +2 -1
  43. package/lib/cjs/domain/JsonMap.js.map +1 -1
  44. package/lib/cjs/domain/JsonMedia.js +20 -0
  45. package/lib/cjs/domain/JsonMedia.js.map +1 -0
  46. package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
  47. package/lib/cjs/domain/JsonOperation.js +1 -83
  48. package/lib/cjs/domain/JsonOperation.js.map +1 -1
  49. package/lib/cjs/domain/JsonOperationPathsMap.js +1 -0
  50. package/lib/cjs/domain/JsonOperationPathsMap.js.map +1 -1
  51. package/lib/cjs/domain/JsonParameter.js +3 -72
  52. package/lib/cjs/domain/JsonParameter.js.map +1 -1
  53. package/lib/cjs/domain/JsonParameterStore.js.map +1 -1
  54. package/lib/cjs/domain/JsonPropertyStore.js.map +1 -1
  55. package/lib/cjs/domain/JsonRequestBody.js +1 -0
  56. package/lib/cjs/domain/JsonRequestBody.js.map +1 -1
  57. package/lib/cjs/domain/JsonResponse.js +5 -38
  58. package/lib/cjs/domain/JsonResponse.js.map +1 -1
  59. package/lib/cjs/domain/JsonSchema.js +2 -10
  60. package/lib/cjs/domain/JsonSchema.js.map +1 -1
  61. package/lib/cjs/index.js +10 -1
  62. package/lib/cjs/index.js.map +1 -1
  63. package/lib/cjs/registries/JsonSchemaMapperContainer.js +5 -1
  64. package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -1
  65. package/lib/cjs/utils/getJsonSchema.js +1 -11
  66. package/lib/cjs/utils/getJsonSchema.js.map +1 -1
  67. package/lib/cjs/utils/getSpec.js +24 -37
  68. package/lib/cjs/utils/getSpec.js.map +1 -1
  69. package/lib/esm/components/anyMapper.js +4 -3
  70. package/lib/esm/components/anyMapper.js.map +1 -1
  71. package/lib/esm/components/index.js +24 -0
  72. package/lib/esm/components/index.js.map +1 -0
  73. package/lib/esm/components/lazyRefMapper.js +8 -8
  74. package/lib/esm/components/lazyRefMapper.js.map +1 -1
  75. package/lib/esm/components/mapMapper.js +1 -1
  76. package/lib/esm/components/mapMapper.js.map +1 -1
  77. package/lib/esm/components/operationInFilesMapper.js +24 -0
  78. package/lib/esm/components/operationInFilesMapper.js.map +1 -0
  79. package/lib/esm/components/operationInParameterMapper.js +35 -0
  80. package/lib/esm/components/operationInParameterMapper.js.map +1 -0
  81. package/lib/esm/components/operationInParametersMapper.js +6 -0
  82. package/lib/esm/components/operationInParametersMapper.js.map +1 -0
  83. package/lib/esm/components/operationInQueryMapper.js +35 -0
  84. package/lib/esm/components/operationInQueryMapper.js.map +1 -0
  85. package/lib/esm/components/operationMapper.js +45 -0
  86. package/lib/esm/components/operationMapper.js.map +1 -0
  87. package/lib/esm/components/operationMediaMapper.js +7 -0
  88. package/lib/esm/components/operationMediaMapper.js.map +1 -0
  89. package/lib/esm/components/operationRequestBodyMapper.js +53 -0
  90. package/lib/esm/components/operationRequestBodyMapper.js.map +1 -0
  91. package/lib/esm/components/operationResponseMapper.js +20 -0
  92. package/lib/esm/components/operationResponseMapper.js.map +1 -0
  93. package/lib/esm/components/pathsMapper.js +86 -0
  94. package/lib/esm/components/pathsMapper.js.map +1 -0
  95. package/lib/esm/components/schemaMapper.js +35 -5
  96. package/lib/esm/components/schemaMapper.js.map +1 -1
  97. package/lib/esm/decorators/common/ignore.js +1 -0
  98. package/lib/esm/decorators/common/ignore.js.map +1 -1
  99. package/lib/esm/decorators/common/property.js +2 -2
  100. package/lib/esm/decorators/common/property.js.map +1 -1
  101. package/lib/esm/domain/JsonClassStore.js.map +1 -1
  102. package/lib/esm/domain/JsonEntityStore.js +4 -2
  103. package/lib/esm/domain/JsonEntityStore.js.map +1 -1
  104. package/lib/esm/domain/JsonLazyRef.js +0 -4
  105. package/lib/esm/domain/JsonLazyRef.js.map +1 -1
  106. package/lib/esm/domain/JsonMap.js +2 -1
  107. package/lib/esm/domain/JsonMap.js.map +1 -1
  108. package/lib/esm/domain/JsonMedia.js +16 -0
  109. package/lib/esm/domain/JsonMedia.js.map +1 -0
  110. package/lib/esm/domain/JsonMethodStore.js.map +1 -1
  111. package/lib/esm/domain/JsonOperation.js +1 -83
  112. package/lib/esm/domain/JsonOperation.js.map +1 -1
  113. package/lib/esm/domain/JsonOperationPathsMap.js +1 -0
  114. package/lib/esm/domain/JsonOperationPathsMap.js.map +1 -1
  115. package/lib/esm/domain/JsonParameter.js +4 -73
  116. package/lib/esm/domain/JsonParameter.js.map +1 -1
  117. package/lib/esm/domain/JsonParameterStore.js.map +1 -1
  118. package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
  119. package/lib/esm/domain/JsonRequestBody.js +1 -0
  120. package/lib/esm/domain/JsonRequestBody.js.map +1 -1
  121. package/lib/esm/domain/JsonResponse.js +2 -34
  122. package/lib/esm/domain/JsonResponse.js.map +1 -1
  123. package/lib/esm/domain/JsonSchema.js +2 -10
  124. package/lib/esm/domain/JsonSchema.js.map +1 -1
  125. package/lib/esm/index.js +10 -1
  126. package/lib/esm/index.js.map +1 -1
  127. package/lib/esm/registries/JsonSchemaMapperContainer.js +3 -0
  128. package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -1
  129. package/lib/esm/utils/getJsonSchema.js +1 -11
  130. package/lib/esm/utils/getJsonSchema.js.map +1 -1
  131. package/lib/esm/utils/getSpec.js +24 -37
  132. package/lib/esm/utils/getSpec.js.map +1 -1
  133. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  134. package/lib/tsconfig.tsbuildinfo +1 -1
  135. package/lib/types/components/index.d.ts +23 -0
  136. package/lib/types/components/lazyRefMapper.d.ts +1 -1
  137. package/lib/types/components/mapMapper.d.ts +1 -1
  138. package/lib/types/components/operationInFilesMapper.d.ts +2 -0
  139. package/lib/types/components/operationInParameterMapper.d.ts +10 -0
  140. package/lib/types/components/operationInParametersMapper.d.ts +3 -0
  141. package/lib/types/components/operationInQueryMapper.d.ts +2 -0
  142. package/lib/types/components/operationMapper.d.ts +3 -0
  143. package/lib/types/components/operationMediaMapper.d.ts +3 -0
  144. package/lib/types/components/operationRequestBodyMapper.d.ts +3 -0
  145. package/lib/types/components/operationResponseMapper.d.ts +3 -0
  146. package/lib/types/components/pathsMapper.d.ts +2 -0
  147. package/lib/types/components/schemaMapper.d.ts +1 -1
  148. package/lib/types/decorators/common/ignore.d.ts +1 -0
  149. package/lib/types/domain/JsonLazyRef.d.ts +0 -2
  150. package/lib/types/domain/JsonMap.d.ts +1 -0
  151. package/lib/types/domain/JsonMedia.d.ts +11 -0
  152. package/lib/types/domain/JsonOperation.d.ts +1 -2
  153. package/lib/types/domain/JsonOperationPathsMap.d.ts +1 -0
  154. package/lib/types/domain/JsonParameter.d.ts +1 -3
  155. package/lib/types/domain/JsonRequestBody.d.ts +1 -0
  156. package/lib/types/domain/JsonResponse.d.ts +2 -10
  157. package/lib/types/domain/JsonSchema.d.ts +1 -0
  158. package/lib/types/index.d.ts +10 -1
  159. package/lib/types/registries/JsonSchemaMapperContainer.d.ts +1 -0
  160. package/lib/types/utils/getJsonSchema.d.ts +1 -11
  161. package/lib/types/utils/withErrorMsg.d.ts +1 -1
  162. package/package.json +13 -10
  163. package/lib/cjs/utils/mergeOperation.js +0 -44
  164. package/lib/cjs/utils/mergeOperation.js.map +0 -1
  165. package/lib/esm/utils/mergeOperation.js +0 -40
  166. package/lib/esm/utils/mergeOperation.js.map +0 -1
  167. package/lib/types/utils/mergeOperation.d.ts +0 -17
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @file Automatically generated by barrelsby.
3
+ */
4
+ export * from "./anyMapper";
5
+ export * from "./classMapper";
6
+ export * from "./genericsMapper";
7
+ export * from "./inheritedClassMapper";
8
+ export * from "./itemMapper";
9
+ export * from "./lazyRefMapper";
10
+ export * from "./mapMapper";
11
+ export * from "./objectMapper";
12
+ export * from "./ofMapper";
13
+ export * from "./operationInFilesMapper";
14
+ export * from "./operationInParameterMapper";
15
+ export * from "./operationInParametersMapper";
16
+ export * from "./operationInQueryMapper";
17
+ export * from "./operationMapper";
18
+ export * from "./operationMediaMapper";
19
+ export * from "./operationRequestBodyMapper";
20
+ export * from "./operationResponseMapper";
21
+ export * from "./pathsMapper";
22
+ export * from "./propertiesMapper";
23
+ export * from "./schemaMapper";
@@ -1,3 +1,3 @@
1
1
  import { JsonLazyRef } from "../domain/JsonLazyRef";
2
2
  import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
- export declare function lazyRefMapper(input: JsonLazyRef, options: JsonSchemaOptions): any;
3
+ export declare function lazyRefMapper(jsonLazyRef: JsonLazyRef, options: JsonSchemaOptions): any;
@@ -6,4 +6,4 @@ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
6
6
  * @param options
7
7
  * @ignore
8
8
  */
9
- export declare function mapMapper(input: Map<string, any>, { ignore, ...options }: JsonSchemaOptions): any;
9
+ export declare function mapMapper(input: Map<string, any>, { ignore, ...options }?: JsonSchemaOptions): any;
@@ -0,0 +1,2 @@
1
+ import type { JsonParameterOptions } from "./operationInParameterMapper";
2
+ export declare function operationInFilesMapper(parameter: any, { jsonSchema }: JsonParameterOptions): any;
@@ -0,0 +1,10 @@
1
+ import { OS3Schema } from "@tsed/openspec";
2
+ import type { JSONSchema6 } from "json-schema";
3
+ import { JsonParameter } from "../domain/JsonParameter";
4
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
5
+ export type JsonParameterOptions = JsonSchemaOptions & {
6
+ jsonParameter: JsonParameter;
7
+ jsonSchema: JSONSchema6;
8
+ oldSchemas: Record<string, OS3Schema>;
9
+ };
10
+ export declare function operationInParameterMapper(jsonParameter: JsonParameter, opts?: JsonSchemaOptions): any;
@@ -0,0 +1,3 @@
1
+ import { JsonParameter } from "../domain/JsonParameter";
2
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
+ export declare function operationInParametersMapper(parameters: JsonParameter[], options: JsonSchemaOptions): any[];
@@ -0,0 +1,2 @@
1
+ import type { JsonParameterOptions } from "./operationInParameterMapper";
2
+ export declare function operationInQueryMapper(parameter: any, { jsonSchema, jsonParameters, ...options }: JsonParameterOptions): any;
@@ -0,0 +1,3 @@
1
+ import { JsonOperation } from "../domain/JsonOperation";
2
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
+ export declare function operationMapper(jsonOperation: JsonOperation, { tags, defaultTags, ...options }?: JsonSchemaOptions): any;
@@ -0,0 +1,3 @@
1
+ import { JsonMedia } from "../domain/JsonMedia";
2
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
+ export declare function operationMediaMapper(jsonMedia: JsonMedia, options: JsonSchemaOptions): any;
@@ -0,0 +1,3 @@
1
+ import { JsonParameter } from "../domain/JsonParameter";
2
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
+ export declare function operationRequestBodyMapper(bodyParameters: JsonParameter[], { consumes, ...options }: JsonSchemaOptions): any;
@@ -0,0 +1,3 @@
1
+ import { JsonResponse } from "../domain/JsonResponse";
2
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
+ export declare function operationResponseMapper(jsonResponse: JsonResponse, options?: JsonSchemaOptions): any;
@@ -0,0 +1,2 @@
1
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
2
+ export declare function pathsMapper(model: any, { paths, rootPath, ...options }: JsonSchemaOptions): any;
@@ -1,3 +1,3 @@
1
1
  import { JsonSchema } from "../domain/JsonSchema";
2
2
  import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
- export declare function schemaMapper(schema: JsonSchema, options: JsonSchemaOptions): any;
3
+ export declare function schemaMapper(schema: JsonSchema, opts: JsonSchemaOptions): any;
@@ -54,5 +54,6 @@ import { IgnoreCallback } from "../../interfaces/IgnoreCallback";
54
54
  * @validation
55
55
  * @swagger
56
56
  * @schema
57
+ * @deprecated Since v7. Use @Groups decorator instead of.
57
58
  */
58
59
  export declare function Ignore(cb?: boolean | IgnoreCallback): (...args: any[]) => any;
@@ -1,5 +1,4 @@
1
1
  import { Type } from "@tsed/core";
2
- import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
2
  export declare class JsonLazyRef {
4
3
  readonly getType: () => Type<any>;
5
4
  readonly isLazyRef = true;
@@ -7,5 +6,4 @@ export declare class JsonLazyRef {
7
6
  get target(): Type<any>;
8
7
  get schema(): import("./JsonSchema").JsonSchema;
9
8
  get name(): string;
10
- toJSON(options?: JsonSchemaOptions): any;
11
9
  }
@@ -1,6 +1,7 @@
1
1
  import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
2
2
  export declare class JsonMap<T> extends Map<string, any> {
3
3
  [key: string]: any;
4
+ kind: string;
4
5
  constructor(obj?: Partial<T>);
5
6
  assign(obj?: Partial<T> & any): this;
6
7
  toJSON(options?: JsonSchemaOptions): any;
@@ -0,0 +1,11 @@
1
+ import { OS3MediaType } from "@tsed/openspec";
2
+ import { JsonMap } from "./JsonMap";
3
+ import { JsonSchema } from "./JsonSchema";
4
+ export declare class JsonMedia extends JsonMap<OS3MediaType<JsonSchema>> {
5
+ kind: string;
6
+ groups: string[];
7
+ groupsName: string;
8
+ allowedGroups?: Set<string>;
9
+ schema(schema: JsonSchema): this;
10
+ examples(examples: any): this;
11
+ }
@@ -1,6 +1,5 @@
1
1
  import { OpenSpecSecurity, OpenSpecTag, OS3Operation } from "@tsed/openspec";
2
2
  import { JsonHeader } from "../interfaces/JsonOpenSpec";
3
- import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
4
3
  import { JsonMap } from "./JsonMap";
5
4
  import { JsonParameter } from "./JsonParameter";
6
5
  import { JsonResponse } from "./JsonResponse";
@@ -16,6 +15,7 @@ export interface JsonOperationOptions extends OS3Operation<JsonSchema, JsonParam
16
15
  }
17
16
  export declare class JsonOperation extends JsonMap<JsonOperationOptions> {
18
17
  #private;
18
+ kind: string;
19
19
  readonly operationPaths: Map<string, JsonMethodPath>;
20
20
  constructor(obj?: Partial<JsonOperationOptions>);
21
21
  get response(): JsonResponse | undefined;
@@ -47,5 +47,4 @@ export declare class JsonOperation extends JsonMap<JsonOperationOptions> {
47
47
  produces(produces: string[]): this;
48
48
  addProduce(produce: string): void;
49
49
  addOperationPath(method: string, path: string | RegExp, options?: any): this;
50
- toJSON(options?: JsonSchemaOptions): any;
51
50
  }
@@ -1,5 +1,6 @@
1
1
  import { JsonMethodPath } from "./JsonOperation";
2
2
  export declare class JsonOperationPathsMap extends Map<string, JsonMethodPath> {
3
+ kind: string;
3
4
  setOperationPath(operationPath: JsonMethodPath): void;
4
5
  protected getKey: (method: string, path: any) => string;
5
6
  }
@@ -5,6 +5,7 @@ import { NestedGenerics } from "../utils/generics";
5
5
  import { JsonMap } from "./JsonMap";
6
6
  import { JsonSchema } from "./JsonSchema";
7
7
  export declare class JsonParameter extends JsonMap<OS3Parameter<JsonSchema>> implements NestedGenerics {
8
+ kind: string;
8
9
  nestedGenerics: Type<any>[][];
9
10
  groups: string[];
10
11
  groupsName: string;
@@ -18,7 +19,4 @@ export declare class JsonParameter extends JsonMap<OS3Parameter<JsonSchema>> imp
18
19
  required(required: boolean): this;
19
20
  schema(schema: JsonSchema): this;
20
21
  toJSON(options?: JsonSchemaOptions): any;
21
- private build;
22
- private getFileSchema;
23
- private refToParameters;
24
22
  }
@@ -3,6 +3,7 @@ import { JsonMap } from "./JsonMap";
3
3
  import { JsonSchema } from "./JsonSchema";
4
4
  export type JsonRequestBodyOptions = OS3RequestBody<JsonSchema>;
5
5
  export declare class JsonRequestBody extends JsonMap<JsonRequestBodyOptions> {
6
+ kind: string;
6
7
  constructor(obj?: Partial<JsonRequestBodyOptions>);
7
8
  description(description: string): this;
8
9
  content(content: OpenSpecHash<OS3MediaType<JsonSchema>>): this;
@@ -1,18 +1,11 @@
1
1
  import { OS3MediaType, OS3Response } from "@tsed/openspec";
2
2
  import { JsonHeader } from "../interfaces/JsonOpenSpec";
3
- import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
4
3
  import { JsonMap } from "./JsonMap";
4
+ import { JsonMedia } from "./JsonMedia";
5
5
  import { JsonSchema } from "./JsonSchema";
6
6
  export type JsonResponseOptions = OS3Response<JsonSchema, string | JsonHeader>;
7
- export declare class JsonMedia extends JsonMap<OS3MediaType<JsonSchema>> {
8
- groups: string[];
9
- groupsName: string;
10
- allowedGroups?: Set<string>;
11
- schema(schema: JsonSchema): this;
12
- examples(examples: any): this;
13
- toJSON(options?: JsonSchemaOptions): any;
14
- }
15
7
  export declare class JsonResponse extends JsonMap<JsonResponseOptions> {
8
+ kind: string;
16
9
  status: number;
17
10
  constructor(obj?: Partial<JsonResponseOptions>);
18
11
  description(description: string): this;
@@ -21,5 +14,4 @@ export declare class JsonResponse extends JsonMap<JsonResponseOptions> {
21
14
  getContent(): JsonMap<JsonMedia>;
22
15
  getMedia(mediaType: string, create?: boolean): JsonMedia;
23
16
  addMedia(mediaType: string): this;
24
- toJSON(options?: JsonSchemaOptions): any;
25
17
  }
@@ -16,6 +16,7 @@ export interface JsonSchemaObject extends JSONSchema6, Record<string, any> {
16
16
  export type AnyJsonSchema = Partial<JsonSchemaObject> | JsonSchema | JsonLazyRef | any;
17
17
  export declare class JsonSchema extends Map<string, any> implements NestedGenerics {
18
18
  #private;
19
+ kind: string;
19
20
  readonly isJsonSchema = true;
20
21
  readonly $hooks: Hooks;
21
22
  readonly $required: Set<string>;
@@ -10,6 +10,15 @@ export * from "./components/lazyRefMapper";
10
10
  export * from "./components/mapMapper";
11
11
  export * from "./components/objectMapper";
12
12
  export * from "./components/ofMapper";
13
+ export * from "./components/operationInFilesMapper";
14
+ export * from "./components/operationInParameterMapper";
15
+ export * from "./components/operationInParametersMapper";
16
+ export * from "./components/operationInQueryMapper";
17
+ export * from "./components/operationMapper";
18
+ export * from "./components/operationMediaMapper";
19
+ export * from "./components/operationRequestBodyMapper";
20
+ export * from "./components/operationResponseMapper";
21
+ export * from "./components/pathsMapper";
13
22
  export * from "./components/propertiesMapper";
14
23
  export * from "./components/schemaMapper";
15
24
  export * from "./constants/httpMethods";
@@ -98,6 +107,7 @@ export * from "./domain/JsonEntityStore";
98
107
  export * from "./domain/JsonFormatTypes";
99
108
  export * from "./domain/JsonLazyRef";
100
109
  export * from "./domain/JsonMap";
110
+ export * from "./domain/JsonMedia";
101
111
  export * from "./domain/JsonMethodStore";
102
112
  export * from "./domain/JsonOperation";
103
113
  export * from "./domain/JsonOperationPathsMap";
@@ -148,7 +158,6 @@ export * from "./utils/mapOpenSpec3";
148
158
  export * from "./utils/mapOpenSpecInfo";
149
159
  export * from "./utils/mapRouteOptions";
150
160
  export * from "./utils/matchGroups";
151
- export * from "./utils/mergeOperation";
152
161
  export * from "./utils/mergeSpec";
153
162
  export * from "./utils/operationIdFormatter";
154
163
  export * from "./utils/ref";
@@ -17,3 +17,4 @@ export declare function getJsonSchemaMapper(type: string): JsonSchemaMapper;
17
17
  */
18
18
  export declare function execMapper(type: string, schema: any, options: any, parent?: any): any;
19
19
  export declare function hasMapper(type: string): boolean;
20
+ export declare function oneOfMapper(...types: string[]): string;
@@ -1,14 +1,4 @@
1
1
  import { Type } from "@tsed/core";
2
- import "../components/anyMapper";
3
- import "../components/classMapper";
4
- import "../components/genericsMapper";
5
- import "../components/inheritedClassMapper";
6
- import "../components/itemMapper";
7
- import "../components/lazyRefMapper";
8
- import "../components/mapMapper";
9
- import "../components/objectMapper";
10
- import "../components/ofMapper";
11
- import "../components/propertiesMapper";
12
- import "../components/schemaMapper";
2
+ import "../components";
13
3
  import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
14
4
  export declare function getJsonSchema(model: Type<any> | any, options?: JsonSchemaOptions): any;
@@ -1,5 +1,5 @@
1
1
  export interface ErrorChainedMethods<T> {
2
- <T>(target: Object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<T> | number): any;
2
+ <T>(target: Object, propertyKey: string | symbol | undefined, descriptor?: TypedPropertyDescriptor<T> | number): any;
3
3
  Error(msg: string): this;
4
4
  }
5
5
  export type ErrorChainedDecorator<Decorator extends (...args: any[]) => any> = (...args: Parameters<Decorator>) => ErrorChainedMethods<Decorator>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/schema",
3
- "version": "7.34.1",
3
+ "version": "7.35.0-beta.1",
4
4
  "description": "JsonSchema module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -19,7 +19,7 @@
19
19
  "clean": "rm -rf lib",
20
20
  "build": "yarn clean && yarn barrels && yarn build:ts && yarn run build:browser",
21
21
  "build:browser": "webpack",
22
- "barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
22
+ "barrels": "yarn barrelsby --config .barrelsby.json",
23
23
  "test": "cross-env NODE_ENV=test yarn jest --max-workers=2 && jest-coverage-thresholds-bumper",
24
24
  "build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json",
25
25
  "lint": "eslint '**/*.{ts,js}'",
@@ -36,7 +36,7 @@
36
36
  "tsed"
37
37
  ],
38
38
  "dependencies": {
39
- "@tsed/openspec": "7.34.1",
39
+ "@tsed/openspec": "7.35.0-beta.1",
40
40
  "change-case": "^4.1.2",
41
41
  "fs-extra": "^10.0.1",
42
42
  "json-schema": "0.4.0",
@@ -46,10 +46,10 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@apidevtools/swagger-parser": "10.0.3",
49
- "@tsed/core": "7.34.1",
50
- "@tsed/eslint": "7.34.1",
51
- "@tsed/openspec": "7.34.1",
52
- "@tsed/typescript": "7.34.1",
49
+ "@tsed/core": "7.35.0-beta.1",
50
+ "@tsed/eslint": "7.35.0-beta.1",
51
+ "@tsed/openspec": "7.35.0-beta.1",
52
+ "@tsed/typescript": "7.35.0-beta.1",
53
53
  "@types/fs-extra": "9.0.13",
54
54
  "@types/json-schema": "7.0.11",
55
55
  "@types/picomatch": "2.3.0",
@@ -58,8 +58,8 @@
58
58
  "picomatch-browser": "https://github.com/silverwind/picomatch#ee6ebcc5570a8846d81610c11ebb92a9e199b145"
59
59
  },
60
60
  "peerDependencies": {
61
- "@tsed/core": "^7.34.1",
62
- "@tsed/openspec": "^7.34.1"
61
+ "@tsed/core": "^7.35.0-beta.1",
62
+ "@tsed/openspec": "^7.35.0-beta.1"
63
63
  },
64
64
  "peerDependenciesMeta": {
65
65
  "@tsed/openspec": {
@@ -75,5 +75,8 @@
75
75
  },
76
76
  "homepage": "https://github.com/tsedio/tsed/tree/production/packages/specs/schema",
77
77
  "author": "Romain Lenzotti",
78
- "license": "MIT"
78
+ "license": "MIT",
79
+ "publishConfig": {
80
+ "tag": "beta"
81
+ }
79
82
  }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeOperation = void 0;
4
- const SpecTypes_1 = require("../domain/SpecTypes");
5
- const concatParameters_1 = require("./concatParameters");
6
- const getJsonPathParameters_1 = require("./getJsonPathParameters");
7
- /**
8
- * @ignore
9
- */
10
- function mergeOperation(obj, operation, { rootPath, specType, operationId, defaultTags, tags, path, method }) {
11
- const pathParameters = (0, getJsonPathParameters_1.getJsonPathParameters)(rootPath, path).map(({ path, parameters }) => {
12
- path = path ? path : "/";
13
- // FIXME not on the right place
14
- if (specType === SpecTypes_1.SpecTypes.OPENAPI) {
15
- parameters = parameters.map(({ type, ...param }) => {
16
- return {
17
- ...param,
18
- schema: {
19
- type
20
- }
21
- };
22
- });
23
- }
24
- return { path, parameters };
25
- });
26
- return pathParameters.reduce((obj, { path, parameters }) => {
27
- parameters = (0, concatParameters_1.concatParameters)(parameters, operation);
28
- path = path ? path : "/";
29
- const operationTags = operation.tags?.length ? operation.tags : [defaultTags];
30
- obj.paths[path] = {
31
- ...obj.paths[path],
32
- [method.toLowerCase()]: {
33
- operationId: operation.operationId || operationId(path),
34
- ...operation,
35
- tags: operationTags.map(({ name }) => name),
36
- parameters
37
- }
38
- };
39
- tags.push(...operationTags);
40
- return obj;
41
- }, obj);
42
- }
43
- exports.mergeOperation = mergeOperation;
44
- //# sourceMappingURL=mergeOperation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeOperation.js","sourceRoot":"","sources":["../../../src/utils/mergeOperation.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,yDAAoD;AACpD,mEAA8D;AAe9D;;GAEG;AACH,SAAgB,cAAc,CAC5B,GAAQ,EACR,SAAc,EACd,EAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAwB;IAEzF,MAAM,cAAc,GAAG,IAAA,6CAAqB,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAE,UAAU,EAAC,EAAE,EAAE;QACtF,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QAEzB,+BAA+B;QAC/B,IAAI,QAAQ,KAAK,qBAAS,CAAC,OAAO,EAAE;YAClC,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,EAAE,EAAE;gBAC/C,OAAO;oBACL,GAAG,KAAK;oBACR,MAAM,EAAE;wBACN,IAAI;qBACL;iBACF,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,UAAU,EAAC,EAAE,EAAE;QACvD,UAAU,GAAG,IAAA,mCAAgB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QACrD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QAEzB,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAE9E,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG;YAChB,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAClB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE;gBACtB,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC;gBACvD,GAAG,SAAS;gBACZ,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAM,EAAE,EAAE,CAAC,IAAI,CAAC;gBAC9C,UAAU;aACX;SACF,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QAE5B,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,GAAG,CAAC,CAAC;AACV,CAAC;AA3CD,wCA2CC"}
@@ -1,40 +0,0 @@
1
- import { SpecTypes } from "../domain/SpecTypes.js";
2
- import { concatParameters } from "./concatParameters.js";
3
- import { getJsonPathParameters } from "./getJsonPathParameters.js";
4
- /**
5
- * @ignore
6
- */
7
- export function mergeOperation(obj, operation, { rootPath, specType, operationId, defaultTags, tags, path, method }) {
8
- const pathParameters = getJsonPathParameters(rootPath, path).map(({ path, parameters }) => {
9
- path = path ? path : "/";
10
- // FIXME not on the right place
11
- if (specType === SpecTypes.OPENAPI) {
12
- parameters = parameters.map(({ type, ...param }) => {
13
- return {
14
- ...param,
15
- schema: {
16
- type
17
- }
18
- };
19
- });
20
- }
21
- return { path, parameters };
22
- });
23
- return pathParameters.reduce((obj, { path, parameters }) => {
24
- parameters = concatParameters(parameters, operation);
25
- path = path ? path : "/";
26
- const operationTags = operation.tags?.length ? operation.tags : [defaultTags];
27
- obj.paths[path] = {
28
- ...obj.paths[path],
29
- [method.toLowerCase()]: {
30
- operationId: operation.operationId || operationId(path),
31
- ...operation,
32
- tags: operationTags.map(({ name }) => name),
33
- parameters
34
- }
35
- };
36
- tags.push(...operationTags);
37
- return obj;
38
- }, obj);
39
- }
40
- //# sourceMappingURL=mergeOperation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeOperation.js","sourceRoot":"","sources":["../../../src/utils/mergeOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAe9D;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,GAAQ,EACR,SAAc,EACd,EAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAwB;IAEzF,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAE,UAAU,EAAC,EAAE,EAAE;QACtF,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QAEzB,+BAA+B;QAC/B,IAAI,QAAQ,KAAK,SAAS,CAAC,OAAO,EAAE;YAClC,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,EAAE,EAAE;gBAC/C,OAAO;oBACL,GAAG,KAAK;oBACR,MAAM,EAAE;wBACN,IAAI;qBACL;iBACF,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,UAAU,EAAC,EAAE,EAAE;QACvD,UAAU,GAAG,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QACrD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QAEzB,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAE9E,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG;YAChB,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAClB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE;gBACtB,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC;gBACvD,GAAG,SAAS;gBACZ,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAM,EAAE,EAAE,CAAC,IAAI,CAAC;gBAC9C,UAAU;aACX;SACF,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QAE5B,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,GAAG,CAAC,CAAC;AACV,CAAC"}
@@ -1,17 +0,0 @@
1
- import { SpecTypes } from "../domain/SpecTypes";
2
- /**
3
- * @ignore
4
- */
5
- export interface MergeOperationOptions {
6
- rootPath: string;
7
- specType: SpecTypes;
8
- operationId: (path: string) => string | undefined;
9
- defaultTags: string[];
10
- tags: string[];
11
- path: string;
12
- method: string;
13
- }
14
- /**
15
- * @ignore
16
- */
17
- export declare function mergeOperation(obj: any, operation: any, { rootPath, specType, operationId, defaultTags, tags, path, method }: MergeOperationOptions): any;