@tsed/schema 7.34.1 → 7.34.3

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 (154) hide show
  1. package/.barrelsby.json +5 -0
  2. package/jest.config.js +3 -3
  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/domain/JsonClassStore.js.map +1 -1
  34. package/lib/cjs/domain/JsonLazyRef.js +0 -4
  35. package/lib/cjs/domain/JsonLazyRef.js.map +1 -1
  36. package/lib/cjs/domain/JsonMap.js +2 -1
  37. package/lib/cjs/domain/JsonMap.js.map +1 -1
  38. package/lib/cjs/domain/JsonMedia.js +20 -0
  39. package/lib/cjs/domain/JsonMedia.js.map +1 -0
  40. package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
  41. package/lib/cjs/domain/JsonOperation.js +1 -83
  42. package/lib/cjs/domain/JsonOperation.js.map +1 -1
  43. package/lib/cjs/domain/JsonOperationPathsMap.js +1 -0
  44. package/lib/cjs/domain/JsonOperationPathsMap.js.map +1 -1
  45. package/lib/cjs/domain/JsonParameter.js +3 -72
  46. package/lib/cjs/domain/JsonParameter.js.map +1 -1
  47. package/lib/cjs/domain/JsonParameterStore.js.map +1 -1
  48. package/lib/cjs/domain/JsonPropertyStore.js.map +1 -1
  49. package/lib/cjs/domain/JsonRequestBody.js +1 -0
  50. package/lib/cjs/domain/JsonRequestBody.js.map +1 -1
  51. package/lib/cjs/domain/JsonResponse.js +5 -38
  52. package/lib/cjs/domain/JsonResponse.js.map +1 -1
  53. package/lib/cjs/domain/JsonSchema.js +2 -10
  54. package/lib/cjs/domain/JsonSchema.js.map +1 -1
  55. package/lib/cjs/index.js +10 -1
  56. package/lib/cjs/index.js.map +1 -1
  57. package/lib/cjs/registries/JsonSchemaMapperContainer.js +5 -1
  58. package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -1
  59. package/lib/cjs/utils/getJsonSchema.js +1 -11
  60. package/lib/cjs/utils/getJsonSchema.js.map +1 -1
  61. package/lib/cjs/utils/getSpec.js +24 -37
  62. package/lib/cjs/utils/getSpec.js.map +1 -1
  63. package/lib/esm/components/anyMapper.js +4 -3
  64. package/lib/esm/components/anyMapper.js.map +1 -1
  65. package/lib/esm/components/index.js +24 -0
  66. package/lib/esm/components/index.js.map +1 -0
  67. package/lib/esm/components/lazyRefMapper.js +8 -8
  68. package/lib/esm/components/lazyRefMapper.js.map +1 -1
  69. package/lib/esm/components/mapMapper.js +1 -1
  70. package/lib/esm/components/mapMapper.js.map +1 -1
  71. package/lib/esm/components/operationInFilesMapper.js +24 -0
  72. package/lib/esm/components/operationInFilesMapper.js.map +1 -0
  73. package/lib/esm/components/operationInParameterMapper.js +35 -0
  74. package/lib/esm/components/operationInParameterMapper.js.map +1 -0
  75. package/lib/esm/components/operationInParametersMapper.js +6 -0
  76. package/lib/esm/components/operationInParametersMapper.js.map +1 -0
  77. package/lib/esm/components/operationInQueryMapper.js +35 -0
  78. package/lib/esm/components/operationInQueryMapper.js.map +1 -0
  79. package/lib/esm/components/operationMapper.js +45 -0
  80. package/lib/esm/components/operationMapper.js.map +1 -0
  81. package/lib/esm/components/operationMediaMapper.js +7 -0
  82. package/lib/esm/components/operationMediaMapper.js.map +1 -0
  83. package/lib/esm/components/operationRequestBodyMapper.js +53 -0
  84. package/lib/esm/components/operationRequestBodyMapper.js.map +1 -0
  85. package/lib/esm/components/operationResponseMapper.js +20 -0
  86. package/lib/esm/components/operationResponseMapper.js.map +1 -0
  87. package/lib/esm/components/pathsMapper.js +86 -0
  88. package/lib/esm/components/pathsMapper.js.map +1 -0
  89. package/lib/esm/components/schemaMapper.js +35 -5
  90. package/lib/esm/components/schemaMapper.js.map +1 -1
  91. package/lib/esm/domain/JsonClassStore.js.map +1 -1
  92. package/lib/esm/domain/JsonLazyRef.js +0 -4
  93. package/lib/esm/domain/JsonLazyRef.js.map +1 -1
  94. package/lib/esm/domain/JsonMap.js +2 -1
  95. package/lib/esm/domain/JsonMap.js.map +1 -1
  96. package/lib/esm/domain/JsonMedia.js +16 -0
  97. package/lib/esm/domain/JsonMedia.js.map +1 -0
  98. package/lib/esm/domain/JsonMethodStore.js.map +1 -1
  99. package/lib/esm/domain/JsonOperation.js +1 -83
  100. package/lib/esm/domain/JsonOperation.js.map +1 -1
  101. package/lib/esm/domain/JsonOperationPathsMap.js +1 -0
  102. package/lib/esm/domain/JsonOperationPathsMap.js.map +1 -1
  103. package/lib/esm/domain/JsonParameter.js +4 -73
  104. package/lib/esm/domain/JsonParameter.js.map +1 -1
  105. package/lib/esm/domain/JsonParameterStore.js.map +1 -1
  106. package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
  107. package/lib/esm/domain/JsonRequestBody.js +1 -0
  108. package/lib/esm/domain/JsonRequestBody.js.map +1 -1
  109. package/lib/esm/domain/JsonResponse.js +2 -34
  110. package/lib/esm/domain/JsonResponse.js.map +1 -1
  111. package/lib/esm/domain/JsonSchema.js +2 -10
  112. package/lib/esm/domain/JsonSchema.js.map +1 -1
  113. package/lib/esm/index.js +10 -1
  114. package/lib/esm/index.js.map +1 -1
  115. package/lib/esm/registries/JsonSchemaMapperContainer.js +3 -0
  116. package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -1
  117. package/lib/esm/utils/getJsonSchema.js +1 -11
  118. package/lib/esm/utils/getJsonSchema.js.map +1 -1
  119. package/lib/esm/utils/getSpec.js +24 -37
  120. package/lib/esm/utils/getSpec.js.map +1 -1
  121. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  122. package/lib/tsconfig.tsbuildinfo +1 -1
  123. package/lib/types/components/index.d.ts +23 -0
  124. package/lib/types/components/lazyRefMapper.d.ts +1 -1
  125. package/lib/types/components/mapMapper.d.ts +1 -1
  126. package/lib/types/components/operationInFilesMapper.d.ts +2 -0
  127. package/lib/types/components/operationInParameterMapper.d.ts +10 -0
  128. package/lib/types/components/operationInParametersMapper.d.ts +3 -0
  129. package/lib/types/components/operationInQueryMapper.d.ts +2 -0
  130. package/lib/types/components/operationMapper.d.ts +3 -0
  131. package/lib/types/components/operationMediaMapper.d.ts +3 -0
  132. package/lib/types/components/operationRequestBodyMapper.d.ts +3 -0
  133. package/lib/types/components/operationResponseMapper.d.ts +3 -0
  134. package/lib/types/components/pathsMapper.d.ts +2 -0
  135. package/lib/types/components/schemaMapper.d.ts +1 -1
  136. package/lib/types/domain/JsonLazyRef.d.ts +0 -2
  137. package/lib/types/domain/JsonMap.d.ts +1 -0
  138. package/lib/types/domain/JsonMedia.d.ts +11 -0
  139. package/lib/types/domain/JsonOperation.d.ts +1 -2
  140. package/lib/types/domain/JsonOperationPathsMap.d.ts +1 -0
  141. package/lib/types/domain/JsonParameter.d.ts +1 -3
  142. package/lib/types/domain/JsonRequestBody.d.ts +1 -0
  143. package/lib/types/domain/JsonResponse.d.ts +2 -10
  144. package/lib/types/domain/JsonSchema.d.ts +1 -0
  145. package/lib/types/index.d.ts +10 -1
  146. package/lib/types/registries/JsonSchemaMapperContainer.d.ts +1 -0
  147. package/lib/types/utils/getJsonSchema.d.ts +1 -11
  148. package/lib/types/utils/withErrorMsg.d.ts +1 -1
  149. package/package.json +9 -9
  150. package/lib/cjs/utils/mergeOperation.js +0 -44
  151. package/lib/cjs/utils/mergeOperation.js.map +0 -1
  152. package/lib/esm/utils/mergeOperation.js +0 -40
  153. package/lib/esm/utils/mergeOperation.js.map +0 -1
  154. package/lib/types/utils/mergeOperation.d.ts +0 -17
@@ -17,8 +17,9 @@ function anyMapper(input, options = {}) {
17
17
  const enumSchema = input.get("enum");
18
18
  return (0, ref_1.toRef)(enumSchema, enumSchema.toJSON(options), options);
19
19
  }
20
- if ("toJSON" in input) {
21
- const schema = input.toJSON((0, generics_1.mapGenericsOptions)(options));
20
+ if (input.kind) {
21
+ const kind = (0, JsonSchemaMapperContainer_1.oneOfMapper)(input.kind, "map");
22
+ const schema = (0, JsonSchemaMapperContainer_1.execMapper)(kind, input, (0, generics_1.mapGenericsOptions)(options));
22
23
  return input.canRef ? (0, ref_1.toRef)(input, schema, options) : schema;
23
24
  }
24
25
  return (0, JsonSchemaMapperContainer_1.execMapper)("object", input, options);
@@ -1 +1 @@
1
- {"version":3,"file":"anyMapper.js","sourceRoot":"","sources":["../../../src/components/anyMapper.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;A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E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;QAC/C,OAAO,KAAK,CAAC;KACd;IAED,IAAI,KAAK,YAAY,yBAAW,EAAE;QAChC,OAAO,IAAA,sCAAU,EAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;KAC9C;IAED,IAAI,KAAK,YAAY,uBAAU,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,uBAAU,EAAE;QAC1E,MAAM,UAAU,GAAe,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEjD,OAAO,IAAA,WAAK,EAAC,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;KAC/D;IAED,IAAI,KAAK,CAAC,IAAI,EAAE;QACd,MAAM,IAAI,GAAG,IAAA,uCAAW,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAA,sCAAU,EAAC,IAAI,EAAE,KAAK,EAAE,IAAA,6BAAkB,EAAC,OAAO,CAAC,CAAC,CAAC;QAEpE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,WAAK,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KAC9D;IAED,OAAO,IAAA,sCAAU,EAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAvBD,8BAuBC;AAED,IAAA,oDAAwB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * @file Automatically generated by barrelsby.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const tslib_1 = require("tslib");
7
+ tslib_1.__exportStar(require("./anyMapper"), exports);
8
+ tslib_1.__exportStar(require("./classMapper"), exports);
9
+ tslib_1.__exportStar(require("./genericsMapper"), exports);
10
+ tslib_1.__exportStar(require("./inheritedClassMapper"), exports);
11
+ tslib_1.__exportStar(require("./itemMapper"), exports);
12
+ tslib_1.__exportStar(require("./lazyRefMapper"), exports);
13
+ tslib_1.__exportStar(require("./mapMapper"), exports);
14
+ tslib_1.__exportStar(require("./objectMapper"), exports);
15
+ tslib_1.__exportStar(require("./ofMapper"), exports);
16
+ tslib_1.__exportStar(require("./operationInFilesMapper"), exports);
17
+ tslib_1.__exportStar(require("./operationInParameterMapper"), exports);
18
+ tslib_1.__exportStar(require("./operationInParametersMapper"), exports);
19
+ tslib_1.__exportStar(require("./operationInQueryMapper"), exports);
20
+ tslib_1.__exportStar(require("./operationMapper"), exports);
21
+ tslib_1.__exportStar(require("./operationMediaMapper"), exports);
22
+ tslib_1.__exportStar(require("./operationRequestBodyMapper"), exports);
23
+ tslib_1.__exportStar(require("./operationResponseMapper"), exports);
24
+ tslib_1.__exportStar(require("./pathsMapper"), exports);
25
+ tslib_1.__exportStar(require("./propertiesMapper"), exports);
26
+ tslib_1.__exportStar(require("./schemaMapper"), exports);
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sDAA4B;AAC5B,wDAA8B;AAC9B,2DAAiC;AACjC,iEAAuC;AACvC,uDAA6B;AAC7B,0DAAgC;AAChC,sDAA4B;AAC5B,yDAA+B;AAC/B,qDAA2B;AAC3B,mEAAyC;AACzC,uEAA6C;AAC7C,wEAA8C;AAC9C,mEAAyC;AACzC,4DAAkC;AAClC,iEAAuC;AACvC,uEAA6C;AAC7C,oEAA0C;AAC1C,wDAA8B;AAC9B,6DAAmC;AACnC,yDAA+B"}
@@ -4,14 +4,14 @@ exports.lazyRefMapper = void 0;
4
4
  const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
5
5
  const generics_1 = require("../utils/generics");
6
6
  const ref_1 = require("../utils/ref");
7
- function lazyRefMapper(input, options) {
8
- const name = input.name;
9
- if (options.$refs?.find((t) => t === input.target)) {
10
- return (0, ref_1.createRef)(name, input.schema, options);
7
+ function lazyRefMapper(jsonLazyRef, options) {
8
+ const name = jsonLazyRef.name;
9
+ if (options.$refs?.find((t) => t === jsonLazyRef.target)) {
10
+ return (0, ref_1.createRef)(name, jsonLazyRef.schema, options);
11
11
  }
12
- options.$refs = [...(options.$refs || []), input.target];
13
- const schema = input.toJSON((0, generics_1.mapGenericsOptions)(options));
14
- return (0, ref_1.toRef)(input.schema, schema, options);
12
+ options.$refs = [...(options.$refs || []), jsonLazyRef.target];
13
+ const schema = jsonLazyRef.getType() && (0, JsonSchemaMapperContainer_1.execMapper)("schema", jsonLazyRef.schema, (0, generics_1.mapGenericsOptions)(options));
14
+ return (0, ref_1.toRef)(jsonLazyRef.schema, schema, options);
15
15
  }
16
16
  exports.lazyRefMapper = lazyRefMapper;
17
17
  (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("lazyRef", lazyRefMapper);
@@ -1 +1 @@
1
- {"version":3,"file":"lazyRefMapper.js","sourceRoot":"","sources":["../../../src/components/lazyRefMapper.ts"],"names":[],"mappings":";;;AAEA,uFAAiF;AACjF,gDAAqD;AACrD,sCAA8C;AAE9C,SAAgB,aAAa,CAAC,KAAkB,EAAE,OAA0B;IAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAExB,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,EAAE;QACvD,OAAO,IAAA,eAAS,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/C;IAED,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAA,6BAAkB,EAAC,OAAO,CAAC,CAAC,CAAC;IAEzD,OAAO,IAAA,WAAK,EAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAZD,sCAYC;AAED,IAAA,oDAAwB,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"lazyRefMapper.js","sourceRoot":"","sources":["../../../src/components/lazyRefMapper.ts"],"names":[],"mappings":";;;AAEA,uFAA6F;AAC7F,gDAAqD;AACrD,sCAA8C;AAE9C,SAAgB,aAAa,CAAC,WAAwB,EAAE,OAA0B;IAChF,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAE9B,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,KAAK,WAAW,CAAC,MAAM,CAAC,EAAE;QAC7D,OAAO,IAAA,eAAS,EAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrD;IAED,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAE/D,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,IAAA,sCAAU,EAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,IAAA,6BAAkB,EAAC,OAAO,CAAC,CAAC,CAAC;IAE9G,OAAO,IAAA,WAAK,EAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAZD,sCAYC;AAED,IAAA,oDAAwB,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC"}
@@ -10,7 +10,7 @@ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperConta
10
10
  * @param options
11
11
  * @ignore
12
12
  */
13
- function mapMapper(input, { ignore = [], ...options }) {
13
+ function mapMapper(input, { ignore = [], ...options } = {}) {
14
14
  options = (0, generics_1.mapGenericsOptions)(options);
15
15
  return Array.from(input.entries()).reduce((obj, [key, value]) => {
16
16
  if (ignore.includes(key)) {
@@ -1 +1 @@
1
- {"version":3,"file":"mapMapper.js","sourceRoot":"","sources":["../../../src/components/mapMapper.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AAErD,uFAA6F;AAE7F;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,KAAuB,EAAE,EAAC,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,EAAoB;IAC7F,OAAO,GAAG,IAAA,6BAAkB,EAAC,OAAO,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,OAAO,GAAG,CAAC;SACZ;QAED,GAAG,CAAC,GAAG,CAAC,GAAG,IAAA,sCAAU,EAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAXD,8BAWC;AAED,IAAA,oDAAwB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"mapMapper.js","sourceRoot":"","sources":["../../../src/components/mapMapper.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AAErD,uFAA6F;AAE7F;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,KAAuB,EAAE,EAAC,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,KAAuB,EAAE;IAClG,OAAO,GAAG,IAAA,6BAAkB,EAAC,OAAO,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,OAAO,GAAG,CAAC;SACZ;QAED,GAAG,CAAC,GAAG,CAAC,GAAG,IAAA,sCAAU,EAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAXD,8BAWC;AAED,IAAA,oDAAwB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationInFilesMapper = void 0;
4
+ const core_1 = require("@tsed/core");
5
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
6
+ function operationInFilesMapper(parameter, { jsonSchema }) {
7
+ const schema = {
8
+ type: "string",
9
+ format: "binary",
10
+ oneOf: undefined
11
+ };
12
+ if (jsonSchema.type === "array") {
13
+ jsonSchema.items = (0, core_1.cleanObject)({
14
+ ...jsonSchema.items,
15
+ ...schema
16
+ });
17
+ parameter.schema = jsonSchema;
18
+ return parameter;
19
+ }
20
+ parameter.schema = (0, core_1.cleanObject)({
21
+ ...jsonSchema,
22
+ ...schema
23
+ });
24
+ return parameter;
25
+ }
26
+ exports.operationInFilesMapper = operationInFilesMapper;
27
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationInFiles", operationInFilesMapper);
28
+ //# sourceMappingURL=operationInFilesMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationInFilesMapper.js","sourceRoot":"","sources":["../../../src/components/operationInFilesMapper.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,uFAAiF;AAGjF,SAAgB,sBAAsB,CAAC,SAAc,EAAE,EAAC,UAAU,EAAuB;IACvF,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,SAAS;KACjB,CAAC;IAEF,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE;QAC/B,UAAU,CAAC,KAAK,GAAG,IAAA,kBAAW,EAAC;YAC7B,GAAI,UAAU,CAAC,KAAgB;YAC/B,GAAG,MAAM;SACV,CAAC,CAAC;QAEH,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC;QAE9B,OAAO,SAAS,CAAC;KAClB;IAED,SAAS,CAAC,MAAM,GAAG,IAAA,kBAAW,EAAC;QAC7B,GAAG,UAAU;QACb,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC;AAxBD,wDAwBC;AAED,IAAA,oDAAwB,EAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationInParameterMapper = void 0;
4
+ const change_case_1 = require("change-case");
5
+ const JsonParameterTypes_1 = require("../domain/JsonParameterTypes");
6
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
7
+ const generics_1 = require("../utils/generics");
8
+ function mapOptions(parameter, options = {}) {
9
+ return {
10
+ ...options,
11
+ groups: parameter.groups,
12
+ groupsName: parameter.groupsName
13
+ };
14
+ }
15
+ function operationInParameterMapper(jsonParameter, opts) {
16
+ const options = mapOptions(jsonParameter, opts);
17
+ const schemas = { ...(options.schemas || {}) };
18
+ const { type, schema, ...parameter } = (0, JsonSchemaMapperContainer_1.execMapper)("map", jsonParameter, options);
19
+ const jsonSchema = (0, JsonSchemaMapperContainer_1.execMapper)("item", jsonParameter.$schema, {
20
+ ...options,
21
+ ...(0, generics_1.popGenerics)(jsonParameter)
22
+ });
23
+ parameter.required = parameter.required || jsonParameter.get("in") === JsonParameterTypes_1.JsonParameterTypes.PATH;
24
+ const paramOpts = {
25
+ ...options,
26
+ jsonSchema,
27
+ jsonParameter,
28
+ oldSchemas: schemas
29
+ };
30
+ const mapperName = (0, change_case_1.camelCase)(`operationIn ${jsonParameter.get("in")}`);
31
+ if ((0, JsonSchemaMapperContainer_1.hasMapper)(mapperName)) {
32
+ return (0, JsonSchemaMapperContainer_1.execMapper)(mapperName, parameter, paramOpts);
33
+ }
34
+ parameter.schema = jsonSchema;
35
+ return parameter;
36
+ }
37
+ exports.operationInParameterMapper = operationInParameterMapper;
38
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationInParameter", operationInParameterMapper);
39
+ //# sourceMappingURL=operationInParameterMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationInParameterMapper.js","sourceRoot":"","sources":["../../../src/components/operationInParameterMapper.ts"],"names":[],"mappings":";;;AACA,6CAAsC;AAGtC,qEAAgE;AAEhE,uFAAwG;AACxG,gDAA8C;AAQ9C,SAAS,UAAU,CAAC,SAAwB,EAAE,UAA6B,EAAE;IAC3E,OAAO;QACL,GAAG,OAAO;QACV,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,UAAU,EAAE,SAAS,CAAC,UAAU;KACjC,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAAC,aAA4B,EAAE,IAAwB;IAC/F,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,EAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,EAAC,CAAC;IAE7C,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,EAAC,GAAG,IAAA,sCAAU,EAAC,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAE/E,MAAM,UAAU,GAAG,IAAA,sCAAU,EAAC,MAAM,EAAE,aAAa,CAAC,OAAO,EAAE;QAC3D,GAAG,OAAO;QACV,GAAG,IAAA,sBAAW,EAAC,aAAa,CAAC;KAC9B,CAAC,CAAC;IAEH,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,uCAAkB,CAAC,IAAI,CAAC;IAE/F,MAAM,SAAS,GAAG;QAChB,GAAG,OAAO;QACV,UAAU;QACV,aAAa;QACb,UAAU,EAAE,OAAO;KACpB,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,uBAAS,EAAC,eAAe,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEvE,IAAI,IAAA,qCAAS,EAAC,UAAU,CAAC,EAAE;QACzB,OAAO,IAAA,sCAAU,EAAC,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;KACrD;IAED,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC;IAE9B,OAAO,SAAS,CAAC;AACnB,CAAC;AA7BD,gEA6BC;AAED,IAAA,oDAAwB,EAAC,sBAAsB,EAAE,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationInParametersMapper = void 0;
4
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
5
+ function operationInParametersMapper(parameters, options) {
6
+ return parameters.flatMap((parameter) => (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameter", parameter, options)).filter(Boolean);
7
+ }
8
+ exports.operationInParametersMapper = operationInParametersMapper;
9
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationInParameters", operationInParametersMapper);
10
+ //# sourceMappingURL=operationInParametersMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationInParametersMapper.js","sourceRoot":"","sources":["../../../src/components/operationInParametersMapper.ts"],"names":[],"mappings":";;;AAEA,uFAA6F;AAE7F,SAAgB,2BAA2B,CAAC,UAA2B,EAAE,OAA0B;IACjG,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAA,sCAAU,EAAC,sBAAsB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACnH,CAAC;AAFD,kEAEC;AAED,IAAA,oDAAwB,EAAC,uBAAuB,EAAE,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationInQueryMapper = void 0;
4
+ const core_1 = require("@tsed/core");
5
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
6
+ const ref_1 = require("../utils/ref");
7
+ function inlineReference(parameter, { jsonParameter, ...options }) {
8
+ const name = (0, ref_1.createRefName)(jsonParameter.$schema.getName(), options);
9
+ const schema = options.schemas?.[name];
10
+ if (schema && !options.oldSchemas?.[name]) {
11
+ delete options.schemas[jsonParameter.$schema.getName()];
12
+ }
13
+ return Object.entries(schema?.properties || {}).reduce((params, [key, { description, ...prop }]) => {
14
+ return [
15
+ ...params,
16
+ (0, core_1.cleanObject)({
17
+ ...parameter,
18
+ name: key,
19
+ required: (schema?.required || []).includes(key),
20
+ description,
21
+ schema: prop,
22
+ style: prop.$ref ? "deepObject" : undefined
23
+ })
24
+ ];
25
+ }, []);
26
+ }
27
+ function operationInQueryMapper(parameter, { jsonSchema, jsonParameters, ...options }) {
28
+ if (jsonSchema.$ref) {
29
+ if (!parameter.name) {
30
+ return inlineReference(parameter, options);
31
+ }
32
+ parameter.style = "deepObject";
33
+ }
34
+ parameter.schema = jsonSchema;
35
+ return parameter;
36
+ }
37
+ exports.operationInQueryMapper = operationInQueryMapper;
38
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationInQuery", operationInQueryMapper);
39
+ //# sourceMappingURL=operationInQueryMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationInQueryMapper.js","sourceR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CAAC,IAAI,EAAE;YACnB,OAAO,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;SAC5C;QAED,SAAS,CAAC,KAAK,GAAG,YAAY,CAAC;KAChC;IAED,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC;IAE9B,OAAO,SAAS,CAAC;AACnB,CAAC;AAZD,wDAYC;AAED,IAAA,oDAAwB,EAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationMapper = void 0;
4
+ const httpStatusMessages_1 = require("../constants/httpStatusMessages");
5
+ const JsonParameterTypes_1 = require("../domain/JsonParameterTypes");
6
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
7
+ function extractParameters(jsonOperation, options) {
8
+ return jsonOperation
9
+ .get("parameters")
10
+ .filter((parameter) => (0, JsonParameterTypes_1.isParameterType)(parameter.get("in")))
11
+ .reduce((inputs, parameter) => {
12
+ const [parameters, bodyParameters] = inputs;
13
+ if ([JsonParameterTypes_1.JsonParameterTypes.BODY, JsonParameterTypes_1.JsonParameterTypes.FILES].includes(parameter.get("in"))) {
14
+ return [parameters, [...bodyParameters, parameter]];
15
+ }
16
+ return [[...parameters, parameter], bodyParameters];
17
+ }, [[], []]);
18
+ }
19
+ function operationMapper(jsonOperation, { tags = [], defaultTags = [], ...options } = {}) {
20
+ const { consumes, produces, ...operation } = (0, JsonSchemaMapperContainer_1.execMapper)("map", jsonOperation, { ...options, ignore: ["parameters"] });
21
+ if (operation.security) {
22
+ operation.security = [].concat(operation.security);
23
+ }
24
+ if (jsonOperation.get("responses").size === 0) {
25
+ operation.responses = {
26
+ "200": {
27
+ description: (0, httpStatusMessages_1.getStatusMessage)(200)
28
+ }
29
+ };
30
+ }
31
+ const parametersOptions = {
32
+ ...options,
33
+ consumes: jsonOperation.get("consumes")?.length ? jsonOperation.get("consumes") : ["application/json"]
34
+ };
35
+ const [parameters, bodyParameters] = extractParameters(jsonOperation, parametersOptions);
36
+ operation.parameters = (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameters", parameters, options);
37
+ if (bodyParameters.length) {
38
+ operation.requestBody = (0, JsonSchemaMapperContainer_1.execMapper)("operationRequestBody", bodyParameters, parametersOptions);
39
+ }
40
+ const operationTags = operation.tags?.length ? operation.tags : defaultTags;
41
+ if (operationTags.length) {
42
+ operation.tags = operationTags.map(({ name }) => name);
43
+ }
44
+ tags.push(...operationTags);
45
+ return operation;
46
+ }
47
+ exports.operationMapper = operationMapper;
48
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operation", operationMapper);
49
+ //# sourceMappingURL=operationMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationMapper.js","sourceRoot":"","sources":["../../../src/components/operationMapper.ts"],"names":[],"mappings":";;;AAAA,wEAAiE;AAGjE,qEAAiF;AAEjF,uFAA6F;AAE7F,SAAS,iBAAiB,CAAC,aAA4B,EAAE,OAA0B;IACjF,OAAO,aAAa;SACjB,GAAG,CAAC,YAAY,CAAC;SACjB,MAAM,CAAC,CAAC,SAAwB,EAAE,EAAE,CAAC,IAAA,oCAAe,EAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;SAC1E,MAAM,CACL,CAAC,MAAgC,EAAE,SAAwB,EAAE,EAAE;QAC7D,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,MAAM,CAAC;QAE5C,IAAI,CAAC,uCAAkB,CAAC,IAAI,EAAE,uCAAkB,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE;YACrF,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;SACrD;QAED,OAAO,CAAC,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,EAAE,cAAc,CAAC,CAAC;IACtD,CAA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F;IAED,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAE5E,IAAI,aAAa,CAAC,MAAM,EAAE;QACxB,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAM,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;KAC3D;IAED,IAAI,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;IAE5B,OAAO,SAAS,CAAC;AACnB,CAAC;AArCD,0CAqCC;AAED,IAAA,oDAAwB,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationMediaMapper = void 0;
4
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
5
+ function operationMediaMapper(jsonMedia, options) {
6
+ let groups = [...(jsonMedia.groups || [])];
7
+ return (0, JsonSchemaMapperContainer_1.execMapper)("map", jsonMedia, { ...options, groups, groupsName: jsonMedia.groupsName });
8
+ }
9
+ exports.operationMediaMapper = operationMediaMapper;
10
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationMedia", operationMediaMapper);
11
+ //# sourceMappingURL=operationMediaMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationMediaMapper.js","sourceRoot":"","sources":["../../../src/components/operationMediaMapper.ts"],"names":[],"mappings":";;;AAEA,uFAA6F;AAE7F,SAAgB,oBAAoB,CAAC,SAAoB,EAAE,OAA0B;IACnF,IAAI,MAAM,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAE3C,OAAO,IAAA,sCAAU,EAAC,KAAK,EAAE,SAAS,EAAE,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,UAAU,EAAC,CAAC,CAAC;AAC9F,CAAC;AAJD,oDAIC;AAED,IAAA,oDAAwB,EAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationRequestBodyMapper = void 0;
4
+ const JsonRequestBody_1 = require("../domain/JsonRequestBody");
5
+ const JsonSchema_1 = require("../domain/JsonSchema");
6
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
7
+ function buildSchemaFromBodyParameters(parameters, options) {
8
+ let schema = new JsonSchema_1.JsonSchema();
9
+ const props = {};
10
+ const refs = [];
11
+ let propsLength = 0;
12
+ parameters.forEach((parameter) => {
13
+ const name = parameter.getName();
14
+ [...parameter.entries()]
15
+ .filter(([key]) => !["in", "name"].includes(key))
16
+ .forEach(([key, value]) => {
17
+ if (props[key] === undefined) {
18
+ props[key] = value;
19
+ }
20
+ });
21
+ const jsonParameter = (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameter", parameter, options);
22
+ if (name) {
23
+ schema.addProperty(name, jsonParameter.schema || {
24
+ type: jsonParameter.type
25
+ });
26
+ if (parameter.get("required")) {
27
+ schema.addRequired(name);
28
+ }
29
+ propsLength++;
30
+ }
31
+ else {
32
+ refs.push(jsonParameter);
33
+ }
34
+ });
35
+ if (!propsLength) {
36
+ if (refs.length === 1) {
37
+ return refs[0];
38
+ }
39
+ }
40
+ schema.type("object");
41
+ return {
42
+ schema: schema.toJSON(options),
43
+ required: false,
44
+ ...props
45
+ };
46
+ }
47
+ function operationRequestBodyMapper(bodyParameters, { consumes, ...options }) {
48
+ const { schema, examples, in: _, ...props } = buildSchemaFromBodyParameters(bodyParameters, options);
49
+ const requestBody = new JsonRequestBody_1.JsonRequestBody(props);
50
+ consumes.forEach((consume) => {
51
+ requestBody.addContent(consume, schema, examples);
52
+ });
53
+ return (0, JsonSchemaMapperContainer_1.execMapper)("map", requestBody, options);
54
+ }
55
+ exports.operationRequestBodyMapper = operationRequestBodyMapper;
56
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationRequestBody", operationRequestBodyMapper);
57
+ //# sourceMappingURL=operationRequestBodyMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationRequestBodyMapper.js","sourceRoot":"","sources":["../../../src/components/operationRequestBodyMapper.ts"],"names":[],"mappings":";;;AAGA,+DAA0D;AAC1D,qDAAgD;AAEhD,uFAA6F;AAE7F,SAAS,6BAA6B,CAAC,UAA2B,EAAE,OAA0B;IAC5F,IAAI,MAAM,GAAG,IAAI,uBAAU,EAAE,CAAC;IAC9B,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;QAEjC,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;aACrB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;aAChD,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACxB,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;gBAC5B,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;QAEL,MAAM,aAAa,GAAG,IAAA,sCAAU,EAAC,sBAAsB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7E,IAAI,IAAI,EAAE;YACR,MAAM,CAAC,WAAW,CAChB,IAAI,EACJ,aAAa,CAAC,MAAM,IAAI;gBACtB,IAAI,EAAE,aAAa,CAAC,IAAI;aACzB,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const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
5
+ function operationResponseMapper(jsonResponse, options = {}) {
6
+ const response = (0, JsonSchemaMapperContainer_1.execMapper)("map", jsonResponse, options);
7
+ if (jsonResponse.status === 204) {
8
+ delete response.content;
9
+ }
10
+ if (response.headers) {
11
+ Object.entries(response.headers).forEach(([key, { type, ...props }]) => {
12
+ response.headers[key] = {
13
+ ...props,
14
+ schema: {
15
+ type
16
+ }
17
+ };
18
+ });
19
+ }
20
+ return response;
21
+ }
22
+ exports.operationResponseMapper = operationResponseMapper;
23
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationResponse", operationResponseMapper);
24
+ //# sourceMappingURL=operationResponseMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationResponseMapper.js","sourceRoot":"","sources":["../../../src/components/operationResponseMapper.ts"],"names":[],"mappings":";;;AAEA,uFAA6F;AAE7F,SAAgB,uBAAuB,CAAC,YAA0B,EAAE,UAA6B,EAAE;IACjG,MAAM,QAAQ,GAAG,IAAA,sCAAU,EAAC,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAE1D,IAAI,YAAY,CAAC,MAAM,KAAK,GAAG,EAAE;QAC/B,OAAO,QAAQ,CAAC,OAAO,CAAC;KACzB;IAED,IAAI,QAAQ,CAAC,OAAO,EAAE;QACpB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,CAAgB,EAAE,EAAE;YAClF,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG;gBACtB,GAAG,KAAK;gBACR,MAAM,EAAE;oBACN,IAAI;iBACL;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAnBD,0DAmBC;AAED,IAAA,oDAAwB,EAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pathsMapper = void 0;
4
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
5
+ const buildPath_1 = require("../utils/buildPath");
6
+ const concatParameters_1 = require("../utils/concatParameters");
7
+ const getJsonEntityStore_1 = require("../utils/getJsonEntityStore");
8
+ const getJsonPathParameters_1 = require("../utils/getJsonPathParameters");
9
+ const getOperationsStores_1 = require("../utils/getOperationsStores");
10
+ function operationId(path, { store, operationIdFormatter }) {
11
+ return operationIdFormatter(store.parent.schema.get("name") || store.parent.targetName, store.propertyName, path);
12
+ }
13
+ function pushToPath(paths, { path, method, operation }) {
14
+ return {
15
+ ...paths,
16
+ [path]: {
17
+ ...paths[path],
18
+ [method.toLowerCase()]: operation
19
+ }
20
+ };
21
+ }
22
+ function removeHiddenOperation(operationStore) {
23
+ return !operationStore.store.get("hidden");
24
+ }
25
+ function mapOperationPaths({ operationStore, operation }) {
26
+ return [...operationStore.operation.operationPaths.values()]
27
+ .map((operationPath) => {
28
+ return {
29
+ ...operationPath,
30
+ operationStore,
31
+ operation
32
+ };
33
+ })
34
+ .filter(({ method }) => method);
35
+ }
36
+ function mapOperationInPathParameters(options) {
37
+ return ({ path, method, operation, operationStore }) => {
38
+ return (0, getJsonPathParameters_1.getJsonPathParameters)(options.ctrlRootPath, path).map(({ path, parameters }) => {
39
+ path = path ? path : "/";
40
+ parameters = (0, concatParameters_1.concatParameters)(parameters.map(({ type, ...param }) => {
41
+ return {
42
+ ...param,
43
+ schema: {
44
+ type
45
+ }
46
+ };
47
+ }), operation);
48
+ return {
49
+ operation: {
50
+ ...operation,
51
+ parameters,
52
+ operationId: operation.operationId ||
53
+ operationId(path, {
54
+ ...options,
55
+ store: operationStore
56
+ })
57
+ },
58
+ method,
59
+ path
60
+ };
61
+ });
62
+ };
63
+ }
64
+ function mapOperation(options) {
65
+ return (operationStore) => {
66
+ const operation = (0, JsonSchemaMapperContainer_1.execMapper)("operation", operationStore.operation, options);
67
+ return {
68
+ operation,
69
+ operationStore
70
+ };
71
+ };
72
+ }
73
+ function pathsMapper(model, { paths, rootPath, ...options }) {
74
+ const store = (0, getJsonEntityStore_1.getJsonEntityStore)(model);
75
+ const ctrlPath = store.path;
76
+ const ctrlRootPath = (0, buildPath_1.buildPath)(rootPath + ctrlPath);
77
+ options = {
78
+ ...options,
79
+ ctrlRootPath
80
+ };
81
+ return [...(0, getOperationsStores_1.getOperationsStores)(model).values()]
82
+ .filter(removeHiddenOperation)
83
+ .map(mapOperation(options))
84
+ .flatMap(mapOperationPaths)
85
+ .flatMap(mapOperationInPathParameters(options))
86
+ .reduce(pushToPath, paths);
87
+ }
88
+ exports.pathsMapper = pathsMapper;
89
+ (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("paths", pathsMapper);
90
+ //# sourceMappingURL=pathsMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathsMapper.js","sourceRoot":"","sources":["../../../src/components/pathsMapper.ts"],"names":[],"mappings":";;;AAGA,uFAA6F;AAC7F,kDAA6C;AAC7C,gEAA2D;AAC3D,oEAA+D;AAC/D,0EAAqE;AACrE,sEAAiE;AAEjE,SAAS,WAAW,CAAC,IAAY,EAAE,EAAC,KAAK,EAAE,oBAAoB,EAAoB;IACjF,OAAO,oBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AACrH,CAAC;AAED,SAAS,UAAU,CACjB,KAAe,EACf,EACE,IAAI,EACJ,MAAM,EACN,SAAS,EAKV;IAED,OAAO;QACL,GAAG,KAAK;QACR,CAAC,IAAI,CAAC,EAAE;YACN,GAAI,KAAa,CAAC,IAAI,CAAC;YACvB,CAAC,MAAM,CAAC,WAAW,E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BACV,KAAK,EAAE,cAAc;yBACtB,CAAC;iBACL;gBACD,MAAM;gBACN,IAAI;aACL,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,OAA0B;IAC9C,OAAO,CAAC,cAA+B,EAAE,EAAE;QACzC,MAAM,SAAS,GAAG,IAAA,sCAAU,EAAC,WAAW,EAAE,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7E,OAAO;YACL,SAAS;YACT,cAAc;SACf,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,WAAW,CAAC,KAAU,EAAE,EAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAoB;IACtF,MAAM,KAAK,GAAG,IAAA,uCAAkB,EAAC,KAAK,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC;IAC5B,MAAM,YAAY,GAAG,IAAA,qBAAS,EAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;IAEpD,OAAO,GAAG;QACR,GAAG,OAAO;QACV,YAAY;KACb,CAAC;IAEF,OAAO,CAAC,GAAG,IAAA,yCAAmB,EAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;SAC5C,MAAM,CAAC,qBAAqB,CAAC;SAC7B,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SAC1B,OAAO,CAAC,iBAAiB,CAAC;SAC1B,OAAO,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;SAC9C,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC/B,CAAC;AAhBD,kCAgBC;AAED,IAAA,oDAAwB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC"}
@@ -40,14 +40,26 @@ function shouldSkipKey(key, { specType = SpecTypes_1.SpecTypes.JSON, customKeys
40
40
  function isExample(key, value, options) {
41
41
  return key === "examples" && (0, core_1.isObject)(value) && SpecTypes_1.SpecTypes.OPENAPI === options.specType;
42
42
  }
43
- function schemaMapper(schema, options) {
43
+ function mapOptions(options) {
44
+ let addDef = false;
45
+ if (!options) {
46
+ addDef = true;
47
+ options = { schemas: {}, inlineEnums: true };
48
+ }
44
49
  const { useAlias = true, schemas = {} } = options;
45
50
  options = {
46
51
  ...options,
47
52
  useAlias,
48
53
  schemas
49
54
  };
50
- let obj = [...schema.keys()]
55
+ return {
56
+ addDef,
57
+ options
58
+ };
59
+ }
60
+ function mapKeys(schema, options) {
61
+ const { useAlias } = options;
62
+ return [...schema.keys()]
51
63
  .filter((key) => !shouldSkipKey(key, options))
52
64
  .reduce((item, key) => {
53
65
  let value = schema.get(key);
@@ -76,22 +88,40 @@ function schemaMapper(schema, options) {
76
88
  [key]: value
77
89
  };
78
90
  }, {});
91
+ }
92
+ function serializeSchema(schema, options) {
93
+ let obj = mapKeys(schema, options);
79
94
  if (schema.isClass) {
80
- obj = (0, JsonSchemaMapperContainer_1.execMapper)("inheritedClass", obj, { ...options, root: false, schemas, target: schema.getComputedType() });
95
+ obj = (0, JsonSchemaMapperContainer_1.execMapper)("inheritedClass", obj, {
96
+ ...options,
97
+ root: false,
98
+ target: schema.getComputedType()
99
+ });
81
100
  }
82
- obj = (0, JsonSchemaMapperContainer_1.execMapper)("generics", obj, { ...options, root: false, schemas });
101
+ obj = (0, JsonSchemaMapperContainer_1.execMapper)("generics", obj, {
102
+ ...options,
103
+ root: false
104
+ });
83
105
  if (schema.has(options.specType)) {
84
106
  obj = {
85
107
  ...obj,
86
108
  ...schema.get(options.specType).toJSON(options)
87
109
  };
88
110
  }
89
- obj = (0, getRequiredProperties_1.getRequiredProperties)(obj, schema, { ...options, useAlias });
111
+ obj = (0, getRequiredProperties_1.getRequiredProperties)(obj, schema, options);
90
112
  obj = (0, mapNullableType_1.mapNullableType)(obj, schema, options);
91
113
  obj = (0, alterOneOf_1.alterOneOf)(obj, schema, options);
92
114
  obj = (0, inlineEnums_1.inlineEnums)(obj, schema, options);
93
115
  return obj;
94
116
  }
117
+ function schemaMapper(schema, opts) {
118
+ const { options, addDef } = mapOptions(opts);
119
+ const obj = serializeSchema(schema, options);
120
+ if (addDef && options.schemas && Object.keys(options.schemas).length) {
121
+ obj.definitions = options.schemas;
122
+ }
123
+ return obj;
124
+ }
95
125
  exports.schemaMapper = schemaMapper;
96
126
  (0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("schema", schemaMapper);
97
127
  //# sourceMappingURL=schemaMapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaMapper.js","sourceRoot":"","sources":["../../../src/components/schemaMapper.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AACpC,yDAA4D;AAE5D,mDAA8C;AAE9C,uFAAwG;AACxG,0EAAqE;AACrE,oDAA+C;AAC/C,sDAAiD;AACjD,8DAAyD;AAEzD;;GAEG;AACH,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAE,qBAAS,CAAC,OAAO,EAAE,qBAAS,CAAC,OAAO,EAAE,qBAAS,CAAC,IAAI,CAAC,CAAC;AACzH;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,CAAC;AAEnC;;GAEG;AACH,SAAS,iBAAiB,CAAC,GAAW,EAAE,KAAU;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,sBAAsB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACvI,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,GAAW,EAAE,KAAU,EAAE,QAAiB;IAChE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACvG,CAAC;AAED;;GAEG;AACH,SA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;GAC7B,cAAc,CAyB1B;AAzBY,wCAAc"}
1
+ {"version":3,"file":"JsonClassStore.js","sourceRoot":"","sources":["../../../src/domain/JsonClassStore.ts"],"names":[],"mappings":";;;;AAAA,qCAA0C;AAG1C,uDAA0E;AAC1E,6CAAwC;AACxC,kFAA6E;AAG7E,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,iCAAe;IACjD;;OAEG;IACM,QAAQ,GAA8D,IAAI,GAAG,EAAE,CAAC;IAEzF,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,IAAI,CAAC,IAAY;QACnB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAES,KAAK;QACb,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC;QAElC,IAAI,CAAC,OAAO,GAAG,uBAAU,CAAC,IAAI,CAAC;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAzBY,cAAc;IAD1B,IAAA,yCAAmB,EAAC,qBAAc,CAAC,KAAK,CAAC;GAC7B,cAAc,CAyB1B;AAzBY,wCAAc"}
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsonLazyRef = void 0;
4
4
  const core_1 = require("@tsed/core");
5
- const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
6
5
  const getJsonEntityStore_1 = require("../utils/getJsonEntityStore");
7
6
  class JsonLazyRef {
8
7
  getType;
@@ -19,9 +18,6 @@ class JsonLazyRef {
19
18
  get name() {
20
19
  return (0, core_1.nameOf)(this.getType());
21
20
  }
22
- toJSON(options) {
23
- return this.getType() && (0, JsonSchemaMapperContainer_1.execMapper)("schema", this.schema, options);
24
- }
25
21
  }
26
22
  exports.JsonLazyRef = JsonLazyRef;
27
23
  //# sourceMappingURL=JsonLazyRef.js.map