@rxap/workspace-open-api 19.0.3-dev.0 → 19.0.3-dev.2

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 (107) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +7 -5
  3. package/src/generators/init/generator.d.ts +4 -0
  4. package/src/generators/init/generator.js +106 -0
  5. package/src/generators/init/generator.js.map +1 -0
  6. package/src/lib/create-directive.d.ts +31 -0
  7. package/src/lib/create-directive.js +39 -0
  8. package/src/lib/create-directive.js.map +1 -1
  9. package/src/lib/generate-components.d.ts +9 -0
  10. package/src/lib/generate-components.js +32 -0
  11. package/src/lib/generate-components.js.map +1 -1
  12. package/src/lib/generate-data-source.d.ts +21 -0
  13. package/src/lib/generate-data-source.js +21 -0
  14. package/src/lib/generate-data-source.js.map +1 -1
  15. package/src/lib/generate-directives.d.ts +23 -0
  16. package/src/lib/generate-directives.js +23 -0
  17. package/src/lib/generate-directives.js.map +1 -1
  18. package/src/lib/generate-index-exports.d.ts +15 -0
  19. package/src/lib/generate-index-exports.js +15 -0
  20. package/src/lib/generate-index-exports.js.map +1 -1
  21. package/src/lib/generate-interfaces.d.ts +17 -0
  22. package/src/lib/generate-interfaces.js +17 -0
  23. package/src/lib/generate-interfaces.js.map +1 -1
  24. package/src/lib/generate-operation-command.d.ts +29 -0
  25. package/src/lib/generate-operation-command.js +29 -0
  26. package/src/lib/generate-operation-command.js.map +1 -1
  27. package/src/lib/generate-operation.d.ts +20 -0
  28. package/src/lib/generate-operation.js +41 -0
  29. package/src/lib/generate-operation.js.map +1 -1
  30. package/src/lib/generate-parameters.d.ts +27 -0
  31. package/src/lib/generate-parameters.js +27 -0
  32. package/src/lib/generate-parameters.js.map +1 -1
  33. package/src/lib/generate-remote-method.d.ts +25 -0
  34. package/src/lib/generate-remote-method.js +25 -0
  35. package/src/lib/generate-remote-method.js.map +1 -1
  36. package/src/lib/generate-request-body.d.ts +16 -0
  37. package/src/lib/generate-request-body.js +16 -0
  38. package/src/lib/generate-request-body.js.map +1 -1
  39. package/src/lib/generate-response.d.ts +23 -0
  40. package/src/lib/generate-response.js +23 -0
  41. package/src/lib/generate-response.js.map +1 -1
  42. package/src/lib/load-open-api-config.d.ts +17 -0
  43. package/src/lib/load-open-api-config.js +17 -0
  44. package/src/lib/load-open-api-config.js.map +1 -1
  45. package/src/lib/resolve-ref.d.ts +10 -0
  46. package/src/lib/resolve-ref.js +10 -0
  47. package/src/lib/resolve-ref.js.map +1 -1
  48. package/src/lib/types.d.ts +40 -0
  49. package/src/lib/types.js +40 -0
  50. package/src/lib/types.js.map +1 -1
  51. package/src/lib/utilities/any-schema-object.d.ts +9 -0
  52. package/src/lib/utilities/any-schema-object.js +9 -0
  53. package/src/lib/utilities/any-schema-object.js.map +1 -1
  54. package/src/lib/utilities/create-component-type-alias-source-file.d.ts +19 -0
  55. package/src/lib/utilities/create-component-type-alias-source-file.js +19 -0
  56. package/src/lib/utilities/create-component-type-alias-source-file.js.map +1 -1
  57. package/src/lib/utilities/get-parameter-type.d.ts +10 -0
  58. package/src/lib/utilities/get-parameter-type.js +10 -0
  59. package/src/lib/utilities/get-parameter-type.js.map +1 -1
  60. package/src/lib/utilities/get-reqeust-body.d.ts +12 -0
  61. package/src/lib/utilities/get-reqeust-body.js +12 -0
  62. package/src/lib/utilities/get-reqeust-body.js.map +1 -1
  63. package/src/lib/utilities/get-request-body-type.d.ts +19 -0
  64. package/src/lib/utilities/get-request-body-type.js +19 -0
  65. package/src/lib/utilities/get-request-body-type.js.map +1 -1
  66. package/src/lib/utilities/get-response-type.d.ts +15 -0
  67. package/src/lib/utilities/get-response-type.js +15 -0
  68. package/src/lib/utilities/get-response-type.js.map +1 -1
  69. package/src/lib/utilities/get-response.d.ts +13 -0
  70. package/src/lib/utilities/get-response.js +13 -0
  71. package/src/lib/utilities/get-response.js.map +1 -1
  72. package/src/lib/utilities/get-type-parameters.d.ts +14 -0
  73. package/src/lib/utilities/get-type-parameters.js +14 -0
  74. package/src/lib/utilities/get-type-parameters.js.map +1 -1
  75. package/src/lib/utilities/has-operation-paramters.d.ts +10 -0
  76. package/src/lib/utilities/has-operation-paramters.js +10 -0
  77. package/src/lib/utilities/has-operation-paramters.js.map +1 -1
  78. package/src/lib/utilities/has-operation-request-body.d.ts +10 -0
  79. package/src/lib/utilities/has-operation-request-body.js +10 -0
  80. package/src/lib/utilities/has-operation-request-body.js.map +1 -1
  81. package/src/lib/utilities/http-request.d.ts +30 -0
  82. package/src/lib/utilities/http-request.js +30 -0
  83. package/src/lib/utilities/http-request.js.map +1 -1
  84. package/src/lib/utilities/ignore-operation.d.ts +11 -0
  85. package/src/lib/utilities/ignore-operation.js +11 -0
  86. package/src/lib/utilities/ignore-operation.js.map +1 -1
  87. package/src/lib/utilities/is-collection-response.d.ts +13 -0
  88. package/src/lib/utilities/is-collection-response.js +13 -0
  89. package/src/lib/utilities/is-collection-response.js.map +1 -1
  90. package/src/lib/utilities/is-http-method.d.ts +14 -0
  91. package/src/lib/utilities/is-http-method.js +14 -0
  92. package/src/lib/utilities/is-http-method.js.map +1 -1
  93. package/src/lib/utilities/is-open-api-schema-from-path.d.ts +11 -0
  94. package/src/lib/utilities/is-open-api-schema-from-path.js +11 -0
  95. package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -1
  96. package/src/lib/utilities/is-operation-object.d.ts +16 -0
  97. package/src/lib/utilities/is-operation-object.js +16 -0
  98. package/src/lib/utilities/is-operation-object.js.map +1 -1
  99. package/src/lib/utilities/is-reference-object.d.ts +22 -0
  100. package/src/lib/utilities/is-reference-object.js +22 -0
  101. package/src/lib/utilities/is-reference-object.js.map +1 -1
  102. package/src/lib/utilities/is-without-parameters.d.ts +10 -0
  103. package/src/lib/utilities/is-without-parameters.js +10 -0
  104. package/src/lib/utilities/is-without-parameters.js.map +1 -1
  105. package/src/lib/utilities/ref-schema-object.d.ts +26 -0
  106. package/src/lib/utilities/ref-schema-object.js +26 -0
  107. package/src/lib/utilities/ref-schema-object.js.map +1 -1
@@ -14,8 +14,48 @@ export interface OperationObjectWithMetadata extends OpenAPIV3.OperationObject {
14
14
  path: string;
15
15
  method: string;
16
16
  }
17
+ /**
18
+ * Generates a sanitized OperationObject with metadata from a given parameter object, filtering out non-essential properties.
19
+ * This function is particularly useful for creating lightweight API operation objects that are stripped of human-readable properties
20
+ * which are not necessary for programmatic processing.
21
+ *
22
+ * @param {GenerateParameter} parameter - The source parameter object containing properties like method, path, operationId, parameters, responses, and requestBody.
23
+ * @returns {OperationObjectWithMetadata} A new object containing only essential API operation data, excluding human-readable properties such as descriptions or examples.
24
+ *
25
+ * The function performs the following operations:
26
+ * 1. Filters and copies properties from the input parameter that are listed in a predefined whitelist.
27
+ * 2. Further filters the `responses` property to include only successful responses (HTTP status codes 200-299).
28
+ * 3. Recursively removes properties listed in a blacklist (e.g., 'description', 'example', 'summary') from the object to ensure the output is suitable for programmatic use.
29
+ *
30
+ * Note: This function assumes that the input parameter object's structure aligns with typical API operation specifications.
31
+ */
17
32
  export declare function GenerateParameterToOperationObjectWithMetadata(parameter: GenerateParameter): OperationObjectWithMetadata;
33
+ /**
34
+ * Checks if the provided OpenAPI operation object contains a non-empty `operationId`.
35
+ *
36
+ * The `operationId` is a unique string used to identify the operation. The presence of an `operationId` is essential for various tools and libraries that parse and utilize OpenAPI specifications, enabling unique operation referencing and handling.
37
+ *
38
+ * @param operation - The OpenAPI operation object to check.
39
+ * @returns `true` if `operationId` is present and not empty, otherwise `false`.
40
+ *
41
+ * @example
42
+ *
43
+ * const operation = { operationId: "getUserById" };
44
+ * console.log(HasOperationId(operation)); // Output: true
45
+ * ```
46
+ */
18
47
  export declare function HasOperationId(operation: OpenAPIV3.OperationObject): operation is OperationObject;
48
+ /**
49
+ * Asserts that the given OpenAPI operation object contains a valid operation ID.
50
+ *
51
+ * This function is a type guard that ensures the provided operation object adheres to the expected structure
52
+ * with a defined operation ID. If the operation object does not have an operation ID, it throws an error.
53
+ * This is particularly useful for enforcing that all operations in an OpenAPI specification include an
54
+ * operation ID, which is crucial for certain API tools and libraries that rely on this identifier.
55
+ *
56
+ * @param operation - The OpenAPI operation object to be validated.
57
+ * @throws {Error} Throws an error if the operation object does not have an operation ID.
58
+ */
19
59
  export declare function AssertWithOperationId(operation: OpenAPIV3.OperationObject): asserts operation is OperationObject;
20
60
  export type GeneratorFunction<Options extends OpenApiSchemaBase = OpenApiSchemaBase> = (parameters: GenerateParameter<Options>) => void;
21
61
  export interface OpenApiSchemaBase {
package/src/lib/types.js CHANGED
@@ -1,6 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AssertWithOperationId = exports.HasOperationId = exports.GenerateParameterToOperationObjectWithMetadata = void 0;
4
+ /**
5
+ * Generates a sanitized OperationObject with metadata from a given parameter object, filtering out non-essential properties.
6
+ * This function is particularly useful for creating lightweight API operation objects that are stripped of human-readable properties
7
+ * which are not necessary for programmatic processing.
8
+ *
9
+ * @param {GenerateParameter} parameter - The source parameter object containing properties like method, path, operationId, parameters, responses, and requestBody.
10
+ * @returns {OperationObjectWithMetadata} A new object containing only essential API operation data, excluding human-readable properties such as descriptions or examples.
11
+ *
12
+ * The function performs the following operations:
13
+ * 1. Filters and copies properties from the input parameter that are listed in a predefined whitelist.
14
+ * 2. Further filters the `responses` property to include only successful responses (HTTP status codes 200-299).
15
+ * 3. Recursively removes properties listed in a blacklist (e.g., 'description', 'example', 'summary') from the object to ensure the output is suitable for programmatic use.
16
+ *
17
+ * Note: This function assumes that the input parameter object's structure aligns with typical API operation specifications.
18
+ */
4
19
  function GenerateParameterToOperationObjectWithMetadata(parameter) {
5
20
  const whitelist = ['method', 'path', 'operationId', 'parameters', 'responses', 'requestBody'];
6
21
  const copy = {};
@@ -34,10 +49,35 @@ function GenerateParameterToOperationObjectWithMetadata(parameter) {
34
49
  return removeHumanProperties(copy);
35
50
  }
36
51
  exports.GenerateParameterToOperationObjectWithMetadata = GenerateParameterToOperationObjectWithMetadata;
52
+ /**
53
+ * Checks if the provided OpenAPI operation object contains a non-empty `operationId`.
54
+ *
55
+ * The `operationId` is a unique string used to identify the operation. The presence of an `operationId` is essential for various tools and libraries that parse and utilize OpenAPI specifications, enabling unique operation referencing and handling.
56
+ *
57
+ * @param operation - The OpenAPI operation object to check.
58
+ * @returns `true` if `operationId` is present and not empty, otherwise `false`.
59
+ *
60
+ * @example
61
+ *
62
+ * const operation = { operationId: "getUserById" };
63
+ * console.log(HasOperationId(operation)); // Output: true
64
+ * ```
65
+ */
37
66
  function HasOperationId(operation) {
38
67
  return !!operation.operationId;
39
68
  }
40
69
  exports.HasOperationId = HasOperationId;
70
+ /**
71
+ * Asserts that the given OpenAPI operation object contains a valid operation ID.
72
+ *
73
+ * This function is a type guard that ensures the provided operation object adheres to the expected structure
74
+ * with a defined operation ID. If the operation object does not have an operation ID, it throws an error.
75
+ * This is particularly useful for enforcing that all operations in an OpenAPI specification include an
76
+ * operation ID, which is crucial for certain API tools and libraries that rely on this identifier.
77
+ *
78
+ * @param operation - The OpenAPI operation object to be validated.
79
+ * @throws {Error} Throws an error if the operation object does not have an operation ID.
80
+ */
41
81
  function AssertWithOperationId(operation) {
42
82
  if (!HasOperationId(operation)) {
43
83
  throw new Error('Ensure all operation have a operation id.');
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/types.ts"],"names":[],"mappings":";;;AAkBA,SAAgB,8CAA8C,CAAC,SAA4B;IACzF,MAAM,SAAS,GAAG,CAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,CAAE,CAAC;IAChG,MAAM,IAAI,GAAQ,EAAE,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,IAAI,CAAC,GAAG,CAAC,GAAI,SAAiB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,KAAK,MAAM,MAAM,IACf,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;YACnG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,SAAS,qBAAqB,CAAC,GAAQ;QACrC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,CAAC;QACb,CAAC;QACD,MAAM,KAAK,GAAQ,EAAE,CAAC;QACtB,MAAM,SAAS,GAAG,CAAE,aAAa,EAAE,SAAS,EAAE,SAAS,CAAE,CAAC;QAC1D,KAAK,MAAM,CAAE,GAAG,EAAE,KAAK,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7B,KAAK,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAjCD,wGAiCC;AAED,SAAgB,cAAc,CAAC,SAAoC;IACjE,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC;AACjC,CAAC;AAFD,wCAEC;AAED,SAAgB,qBAAqB,CAAC,SAAoC;IACxE,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAJD,sDAIC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/types.ts"],"names":[],"mappings":";;;AAkBA;;;;;;;;;;;;;;GAcG;AACH,SAAgB,8CAA8C,CAAC,SAA4B;IACzF,MAAM,SAAS,GAAG,CAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,CAAE,CAAC;IAChG,MAAM,IAAI,GAAQ,EAAE,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,IAAI,CAAC,GAAG,CAAC,GAAI,SAAiB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,KAAK,MAAM,MAAM,IACf,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;YACnG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,SAAS,qBAAqB,CAAC,GAAQ;QACrC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,CAAC;QACb,CAAC;QACD,MAAM,KAAK,GAAQ,EAAE,CAAC;QACtB,MAAM,SAAS,GAAG,CAAE,aAAa,EAAE,SAAS,EAAE,SAAS,CAAE,CAAC;QAC1D,KAAK,MAAM,CAAE,GAAG,EAAE,KAAK,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7B,KAAK,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAjCD,wGAiCC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,cAAc,CAAC,SAAoC;IACjE,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC;AACjC,CAAC;AAFD,wCAEC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,qBAAqB,CAAC,SAAoC;IACxE,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAJD,sDAIC"}
@@ -1,4 +1,13 @@
1
1
  export interface AnySchemaObject {
2
2
  type: 'any';
3
3
  }
4
+ /**
5
+ * Checks if the provided object conforms to the `AnySchemaObject` interface.
6
+ *
7
+ * This function determines if the given object is an instance of `AnySchemaObject` by checking
8
+ * if the object is not null, has a 'type' property, and if the 'type' property is exactly equal to 'any'.
9
+ *
10
+ * @param obj - The object to be checked.
11
+ * @returns True if the object matches the `AnySchemaObject` interface, false otherwise.
12
+ */
4
13
  export declare function IsAnySchemaObject(obj: any): obj is AnySchemaObject;
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IsAnySchemaObject = void 0;
4
+ /**
5
+ * Checks if the provided object conforms to the `AnySchemaObject` interface.
6
+ *
7
+ * This function determines if the given object is an instance of `AnySchemaObject` by checking
8
+ * if the object is not null, has a 'type' property, and if the 'type' property is exactly equal to 'any'.
9
+ *
10
+ * @param obj - The object to be checked.
11
+ * @returns True if the object matches the `AnySchemaObject` interface, false otherwise.
12
+ */
4
13
  function IsAnySchemaObject(obj) {
5
14
  return obj && obj['type'] && obj.type === 'any';
6
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"any-schema-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/any-schema-object.ts"],"names":[],"mappings":";;;AAIA,SAAgB,iBAAiB,CAAC,GAAQ;IACxC,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC;AAClD,CAAC;AAFD,8CAEC"}
1
+ {"version":3,"file":"any-schema-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/any-schema-object.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAAC,GAAQ;IACxC,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC;AAClD,CAAC;AAFD,8CAEC"}
@@ -1,4 +1,23 @@
1
1
  import { ArrayRefSchemaObject } from '@rxap/workspace-open-api';
2
2
  import { Project } from 'ts-morph';
3
3
  import { RefSchemaObject } from './ref-schema-object';
4
+ /**
5
+ * Creates a TypeScript source file in a specified project with a type alias derived from a given schema object.
6
+ * This function is particularly useful for generating type definitions based on OpenAPI schema components.
7
+ *
8
+ * @param {Project} project - The project within which the source file will be created.
9
+ * @param {string} operationId - A unique identifier for the operation, used to name the generated file and type alias.
10
+ * @param {RefSchemaObject | ArrayRefSchemaObject} schema - The schema object that defines the structure of the type.
11
+ * This can be a direct reference to a schema (`RefSchemaObject`) or a reference to an array of schemas (`ArrayRefSchemaObject`).
12
+ * @param {string} basePath - The base directory path where the new source file will be created.
13
+ * @param {string} fileSuffix - A suffix to append to the operationId for the filename and type alias, aiding in the creation of distinct, descriptive names.
14
+ *
15
+ * The function performs the following operations:
16
+ * 1. Constructs the filename from the operationId and fileSuffix, then creates a new TypeScript file in the specified project.
17
+ * 2. Determines the reference path from the schema object, extracting the component name to be used in type alias and import declarations.
18
+ * 3. Adds a type alias to the source file that corresponds to the schema reference, appending '[]' to the type if the schema is an array type.
19
+ * 4. Adds necessary import declarations for the type based on the extracted component name.
20
+ *
21
+ * Note: This function relies on utility functions like `dasherize`, `classify`, and path manipulation functions (`join`, `relative`) to format names and paths.
22
+ */
4
23
  export declare function CreateComponentTypeAliasSourceFile(project: Project, operationId: string, schema: RefSchemaObject | ArrayRefSchemaObject, basePath: string, fileSuffix: string): void;
@@ -4,6 +4,25 @@ exports.CreateComponentTypeAliasSourceFile = void 0;
4
4
  const utilities_1 = require("@rxap/utilities");
5
5
  const workspace_open_api_1 = require("@rxap/workspace-open-api");
6
6
  const path_1 = require("path");
7
+ /**
8
+ * Creates a TypeScript source file in a specified project with a type alias derived from a given schema object.
9
+ * This function is particularly useful for generating type definitions based on OpenAPI schema components.
10
+ *
11
+ * @param {Project} project - The project within which the source file will be created.
12
+ * @param {string} operationId - A unique identifier for the operation, used to name the generated file and type alias.
13
+ * @param {RefSchemaObject | ArrayRefSchemaObject} schema - The schema object that defines the structure of the type.
14
+ * This can be a direct reference to a schema (`RefSchemaObject`) or a reference to an array of schemas (`ArrayRefSchemaObject`).
15
+ * @param {string} basePath - The base directory path where the new source file will be created.
16
+ * @param {string} fileSuffix - A suffix to append to the operationId for the filename and type alias, aiding in the creation of distinct, descriptive names.
17
+ *
18
+ * The function performs the following operations:
19
+ * 1. Constructs the filename from the operationId and fileSuffix, then creates a new TypeScript file in the specified project.
20
+ * 2. Determines the reference path from the schema object, extracting the component name to be used in type alias and import declarations.
21
+ * 3. Adds a type alias to the source file that corresponds to the schema reference, appending '[]' to the type if the schema is an array type.
22
+ * 4. Adds necessary import declarations for the type based on the extracted component name.
23
+ *
24
+ * Note: This function relies on utility functions like `dasherize`, `classify`, and path manipulation functions (`join`, `relative`) to format names and paths.
25
+ */
7
26
  function CreateComponentTypeAliasSourceFile(project, operationId, schema, basePath, fileSuffix) {
8
27
  const sourceFile = project.createSourceFile((0, path_1.join)(basePath, `${(0, utilities_1.dasherize)(operationId)}.${fileSuffix}.ts`));
9
28
  const ref = (0, workspace_open_api_1.IsRefSchemaObject)(schema) ? schema.$ref : schema.items.$ref;
@@ -1 +1 @@
1
- {"version":3,"file":"create-component-type-alias-source-file.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/create-component-type-alias-source-file.ts"],"names":[],"mappings":";;;AAAA,+CAGyB;AACzB,iEAKkC;AAClC,+BAGc;AAId,SAAgB,kCAAkC,CAChD,OAAgB,EAChB,WAAmB,EACnB,MAA8C,EAC9C,QAAgB,EAChB,UAAkB;IAElB,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAA,WAAI,EAAC,QAAQ,EAAE,GAAI,IAAA,qBAAS,EAAC,WAAW,CAAE,IAAK,UAAW,KAAK,CAAC,CAAC,CAAC;IAC9G,MAAM,GAAG,GAAG,IAAA,sCAAiB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;IACxE,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IAC/D,IAAI,IAAI,GAAG,IAAA,oBAAQ,EAAC,aAAa,CAAC,CAAC;IACnC,IAAI,IAAA,2CAAsB,EAAC,MAAM,CAAC,EAAE,CAAC;QACnC,IAAI,IAAI,IAAI,CAAC;IACf,CAAC;IACD,UAAU,CAAC,YAAY,CAAC;QACtB,IAAI,EAAE,IAAA,oBAAQ,EAAC,WAAW,CAAC,GAAG,IAAA,oBAAQ,EAAC,UAAU,CAAC;QAClD,UAAU,EAAE,IAAI;QAChB,IAAI;KACL,CAAC,CAAC;IACH,UAAU,CAAC,qBAAqB,CAAC,CAAC;YAChC,YAAY,EAAE,CAAC,IAAA,oBAAQ,EAAC,aAAa,CAAC,CAAC;YACvC,eAAe,EAAE,GAAG,IAAA,eAAQ,EAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,yCAAoB,IAAK,IAAA,qBAAS,EAAC,aAAa,CAAE,EAAE;SACnG,CAAC,CAAC,CAAC;AACN,CAAC;AAvBD,gFAuBC"}
1
+ {"version":3,"file":"create-component-type-alias-source-file.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/create-component-type-alias-source-file.ts"],"names":[],"mappings":";;;AAAA,+CAGyB;AACzB,iEAKkC;AAClC,+BAGc;AAId;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,kCAAkC,CAChD,OAAgB,EAChB,WAAmB,EACnB,MAA8C,EAC9C,QAAgB,EAChB,UAAkB;IAElB,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAA,WAAI,EAAC,QAAQ,EAAE,GAAI,IAAA,qBAAS,EAAC,WAAW,CAAE,IAAK,UAAW,KAAK,CAAC,CAAC,CAAC;IAC9G,MAAM,GAAG,GAAG,IAAA,sCAAiB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;IACxE,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IAC/D,IAAI,IAAI,GAAG,IAAA,oBAAQ,EAAC,aAAa,CAAC,CAAC;IACnC,IAAI,IAAA,2CAAsB,EAAC,MAAM,CAAC,EAAE,CAAC;QACnC,IAAI,IAAI,IAAI,CAAC;IACf,CAAC;IACD,UAAU,CAAC,YAAY,CAAC;QACtB,IAAI,EAAE,IAAA,oBAAQ,EAAC,WAAW,CAAC,GAAG,IAAA,oBAAQ,EAAC,UAAU,CAAC;QAClD,UAAU,EAAE,IAAI;QAChB,IAAI;KACL,CAAC,CAAC;IACH,UAAU,CAAC,qBAAqB,CAAC,CAAC;YAChC,YAAY,EAAE,CAAC,IAAA,oBAAQ,EAAC,aAAa,CAAC,CAAC;YACvC,eAAe,EAAE,GAAG,IAAA,eAAQ,EAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,yCAAoB,IAAK,IAAA,qBAAS,EAAC,aAAa,CAAE,EAAE;SACnG,CAAC,CAAC,CAAC;AACN,CAAC;AAvBD,gFAuBC"}
@@ -1,2 +1,12 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
+ /**
3
+ * Generates a string representing the type of parameter for a given OpenAPI operation.
4
+ *
5
+ * This function examines the provided `operation` object to determine if it contains parameters and an operation ID.
6
+ * If both are present, it constructs a parameter type string using the operation ID and a predefined suffix.
7
+ * If either is absent, it defaults to returning 'void'.
8
+ *
9
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object to analyze.
10
+ * @returns {string} A string representing the parameter type. Returns 'void' if the necessary conditions are not met.
11
+ */
2
12
  export declare function GetParameterType(operation: OpenAPIV3.OperationObject): string;
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetParameterType = void 0;
4
4
  const utilities_1 = require("@rxap/utilities");
5
5
  const config_1 = require("../config");
6
+ /**
7
+ * Generates a string representing the type of parameter for a given OpenAPI operation.
8
+ *
9
+ * This function examines the provided `operation` object to determine if it contains parameters and an operation ID.
10
+ * If both are present, it constructs a parameter type string using the operation ID and a predefined suffix.
11
+ * If either is absent, it defaults to returning 'void'.
12
+ *
13
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object to analyze.
14
+ * @returns {string} A string representing the parameter type. Returns 'void' if the necessary conditions are not met.
15
+ */
6
16
  function GetParameterType(operation) {
7
17
  let parameterType = 'void';
8
18
  if (operation.parameters && operation.parameters.length && operation.operationId) {
@@ -1 +1 @@
1
- {"version":3,"file":"get-parameter-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-parameter-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,sCAAkD;AAElD,SAAgB,gBAAgB,CAAC,SAAoC;IAEnE,IAAI,aAAa,GAAG,MAAM,CAAC;IAE3B,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QACjF,aAAa,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,8BAAqB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,OAAO,aAAa,CAAC;AAEvB,CAAC;AAVD,4CAUC"}
1
+ {"version":3,"file":"get-parameter-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-parameter-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,sCAAkD;AAElD;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAAC,SAAoC;IAEnE,IAAI,aAAa,GAAG,MAAM,CAAC;IAE3B,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QACjF,aAAa,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,8BAAqB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,OAAO,aAAa,CAAC;AAEvB,CAAC;AAVD,4CAUC"}
@@ -1,3 +1,15 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { AnySchemaObject } from './any-schema-object';
3
+ /**
4
+ * Extracts the schema object from the request body of an OpenAPI operation.
5
+ *
6
+ * This function analyzes the `requestBody` of a given OpenAPI operation object to retrieve the schema definition
7
+ * for the 'application/json' media type. It ensures that the requestBody is not a reference object, as reference
8
+ * objects are not supported by this function. If the requestBody or the 'application/json' media type does not
9
+ * contain a schema, the function returns null.
10
+ *
11
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object containing the requestBody from which the schema is to be extracted.
12
+ * @returns {OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | AnySchemaObject | null} The schema object associated with the 'application/json' media type if available, otherwise null.
13
+ * @throws {Error} Throws an error if the requestBody itself is a reference object.
14
+ */
3
15
  export declare function GetRequestBody(operation: OpenAPIV3.OperationObject): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | AnySchemaObject | null;
@@ -3,6 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetRequestBody = void 0;
4
4
  const utilities_1 = require("@rxap/utilities");
5
5
  const is_reference_object_1 = require("./is-reference-object");
6
+ /**
7
+ * Extracts the schema object from the request body of an OpenAPI operation.
8
+ *
9
+ * This function analyzes the `requestBody` of a given OpenAPI operation object to retrieve the schema definition
10
+ * for the 'application/json' media type. It ensures that the requestBody is not a reference object, as reference
11
+ * objects are not supported by this function. If the requestBody or the 'application/json' media type does not
12
+ * contain a schema, the function returns null.
13
+ *
14
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object containing the requestBody from which the schema is to be extracted.
15
+ * @returns {OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | AnySchemaObject | null} The schema object associated with the 'application/json' media type if available, otherwise null.
16
+ * @throws {Error} Throws an error if the requestBody itself is a reference object.
17
+ */
6
18
  function GetRequestBody(operation) {
7
19
  if (operation.requestBody) {
8
20
  if ((0, is_reference_object_1.IsReferenceObject)(operation.requestBody)) {
@@ -1 +1 @@
1
- {"version":3,"file":"get-reqeust-body.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-reqeust-body.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,+DAA0D;AAE1D,SAAgB,cAAc,CAAC,SAAoC;IAEjE,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1B,IAAI,IAAA,uCAAiB,EAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,aAAa,GAA0D,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC;QAE3G,IAAI,IAAA,oBAAQ,EAAC,aAAa,CAAC,EAAE,CAAC;YAE5B,IAAI,IAAA,uCAAiB,EAAC,aAAa,CAAC,EAAE,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;YAC/E,CAAC;iBAAM,CAAC;gBACN,IAAI,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;oBACtC,MAAM,MAAM,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC;oBAC3D,IAAI,MAAM,EAAE,CAAC;wBACX,OAAO,MAAM,CAAC;oBAChB,CAAC;gBACH,CAAC;YACH,CAAC;QAEH,CAAC;IAEH,CAAC;IAED,OAAO,IAAI,CAAC;AAEd,CAAC;AA7BD,wCA6BC"}
1
+ {"version":3,"file":"get-reqeust-body.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-reqeust-body.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,+DAA0D;AAE1D;;;;;;;;;;;GAWG;AACH,SAAgB,cAAc,CAAC,SAAoC;IAEjE,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1B,IAAI,IAAA,uCAAiB,EAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,aAAa,GAA0D,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC;QAE3G,IAAI,IAAA,oBAAQ,EAAC,aAAa,CAAC,EAAE,CAAC;YAE5B,IAAI,IAAA,uCAAiB,EAAC,aAAa,CAAC,EAAE,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;YAC/E,CAAC;iBAAM,CAAC;gBACN,IAAI,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;oBACtC,MAAM,MAAM,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC;oBAC3D,IAAI,MAAM,EAAE,CAAC;wBACX,OAAO,MAAM,CAAC;oBAChB,CAAC;gBACH,CAAC;YACH,CAAC;QAEH,CAAC;IAEH,CAAC;IAED,OAAO,IAAI,CAAC;AAEd,CAAC;AA7BD,wCA6BC"}
@@ -1,4 +1,23 @@
1
1
  import { GenerateParameter } from '../types';
2
+ /**
3
+ * Generates a description of the request body type for a given API operation.
4
+ *
5
+ * This function examines the specified operation to determine the type of its request body.
6
+ * It returns an object containing the type as a string and an optional name for the type.
7
+ * If the operation does not specify a request body, or if the body cannot be determined,
8
+ * the type defaults to 'void'. If the body is of a generic or undefined type, it is classified
9
+ * under a generated name using the operation ID and a suffix. If the body schema is too generic
10
+ * (i.e., matches any schema), the type is set to 'any'.
11
+ *
12
+ * @param {GenerateParameter<any>} operation - The operation object to analyze, which should include
13
+ * an operationId and potentially other metadata necessary
14
+ * for determining the request body schema.
15
+ * @returns {{ type: string, name: string | null }} An object containing:
16
+ * - `type`: A string representing the determined type of the request body. Possible values
17
+ * are 'void', a specific classified type name, or 'any'.
18
+ * - `name`: An optional string representing a name for the request body type, which is
19
+ * null if no specific name is applicable.
20
+ */
2
21
  export declare function GetRequestBodyType(operation: GenerateParameter<any>): {
3
22
  type: string;
4
23
  name: string | null;
@@ -6,6 +6,25 @@ const config_1 = require("../config");
6
6
  const any_schema_object_1 = require("./any-schema-object");
7
7
  const get_reqeust_body_1 = require("./get-reqeust-body");
8
8
  const is_reference_object_1 = require("./is-reference-object");
9
+ /**
10
+ * Generates a description of the request body type for a given API operation.
11
+ *
12
+ * This function examines the specified operation to determine the type of its request body.
13
+ * It returns an object containing the type as a string and an optional name for the type.
14
+ * If the operation does not specify a request body, or if the body cannot be determined,
15
+ * the type defaults to 'void'. If the body is of a generic or undefined type, it is classified
16
+ * under a generated name using the operation ID and a suffix. If the body schema is too generic
17
+ * (i.e., matches any schema), the type is set to 'any'.
18
+ *
19
+ * @param {GenerateParameter<any>} operation - The operation object to analyze, which should include
20
+ * an operationId and potentially other metadata necessary
21
+ * for determining the request body schema.
22
+ * @returns {{ type: string, name: string | null }} An object containing:
23
+ * - `type`: A string representing the determined type of the request body. Possible values
24
+ * are 'void', a specific classified type name, or 'any'.
25
+ * - `name`: An optional string representing a name for the request body type, which is
26
+ * null if no specific name is applicable.
27
+ */
9
28
  function GetRequestBodyType(operation) {
10
29
  let requestBodyType = 'void';
11
30
  let name = null;
@@ -1 +1 @@
1
- {"version":3,"file":"get-request-body-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-request-body-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,sCAAqD;AAErD,2DAAwD;AACxD,yDAAoD;AACpD,+DAA0D;AAE1D,SAAgB,kBAAkB,CAAC,SAAiC;IAElE,IAAI,eAAe,GAAG,MAAM,CAAC;IAC7B,IAAI,IAAI,GAAkB,IAAI,CAAC;IAE/B,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1B,MAAM,WAAW,GAAG,IAAA,iCAAc,EAAC,SAAS,CAAC,CAAC;QAE9C,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;YACzB,eAAe,GAAG,MAAM,CAAC;QAC3B,CAAC;aAAM,IAAI,CAAC,IAAA,qCAAiB,EAAC,WAAW,CAAC,EAAE,CAAC;YAC3C,IAAI,GAAG,eAAe,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,iCAAwB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACjG,IAAI,CAAC,IAAA,uCAAiB,EAAC,WAAW,CAAC,EAAE,CAAC;gBACpC,IAAI,WAAW,CAAC,oBAAoB,KAAK,IAAI,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;oBAChF,eAAe,IAAI,gBAAgB,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,eAAe,GAAG,KAAK,CAAC;QAC1B,CAAC;IAEH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI;KACL,CAAC;AAEJ,CAAC;AA7BD,gDA6BC"}
1
+ {"version":3,"file":"get-request-body-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-request-body-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,sCAAqD;AAErD,2DAAwD;AACxD,yDAAoD;AACpD,+DAA0D;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,kBAAkB,CAAC,SAAiC;IAElE,IAAI,eAAe,GAAG,MAAM,CAAC;IAC7B,IAAI,IAAI,GAAkB,IAAI,CAAC;IAE/B,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1B,MAAM,WAAW,GAAG,IAAA,iCAAc,EAAC,SAAS,CAAC,CAAC;QAE9C,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;YACzB,eAAe,GAAG,MAAM,CAAC;QAC3B,CAAC;aAAM,IAAI,CAAC,IAAA,qCAAiB,EAAC,WAAW,CAAC,EAAE,CAAC;YAC3C,IAAI,GAAG,eAAe,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,iCAAwB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACjG,IAAI,CAAC,IAAA,uCAAiB,EAAC,WAAW,CAAC,EAAE,CAAC;gBACpC,IAAI,WAAW,CAAC,oBAAoB,KAAK,IAAI,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;oBAChF,eAAe,IAAI,gBAAgB,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,eAAe,GAAG,KAAK,CAAC;QAC1B,CAAC;IAEH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI;KACL,CAAC;AAEJ,CAAC;AA7BD,gDA6BC"}
@@ -1,4 +1,19 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
+ /**
3
+ * Determines the response type and name for a given OpenAPI operation.
4
+ *
5
+ * This function analyzes an OpenAPI operation object to ascertain the appropriate TypeScript type
6
+ * and name for the response. It defaults to a type of 'void' if no specific response structure is defined
7
+ * or if the response type is 'any'. If a valid response structure is found and it is not of type 'any',
8
+ * the function generates a TypeScript type name based on the operation ID and a predefined suffix.
9
+ * Additionally, if the response object is not a direct reference and either has additional properties
10
+ * or an undefined type, a generic type parameter 'TResponse' is appended to the response type.
11
+ *
12
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object to analyze.
13
+ * @returns {{ type: string, name: string | null }} An object containing the 'type' as a string
14
+ * indicating the TypeScript type of the response, and 'name', which is either a string
15
+ * representing the generated type name or null if no specific type name is generated.
16
+ */
2
17
  export declare function GetResponseType(operation: OpenAPIV3.OperationObject): {
3
18
  type: string;
4
19
  name: string | null;
@@ -6,6 +6,21 @@ const config_1 = require("../config");
6
6
  const any_schema_object_1 = require("./any-schema-object");
7
7
  const get_response_1 = require("./get-response");
8
8
  const is_reference_object_1 = require("./is-reference-object");
9
+ /**
10
+ * Determines the response type and name for a given OpenAPI operation.
11
+ *
12
+ * This function analyzes an OpenAPI operation object to ascertain the appropriate TypeScript type
13
+ * and name for the response. It defaults to a type of 'void' if no specific response structure is defined
14
+ * or if the response type is 'any'. If a valid response structure is found and it is not of type 'any',
15
+ * the function generates a TypeScript type name based on the operation ID and a predefined suffix.
16
+ * Additionally, if the response object is not a direct reference and either has additional properties
17
+ * or an undefined type, a generic type parameter 'TResponse' is appended to the response type.
18
+ *
19
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object to analyze.
20
+ * @returns {{ type: string, name: string | null }} An object containing the 'type' as a string
21
+ * indicating the TypeScript type of the response, and 'name', which is either a string
22
+ * representing the generated type name or null if no specific type name is generated.
23
+ */
9
24
  function GetResponseType(operation) {
10
25
  let responseType = 'void';
11
26
  let name = null;
@@ -1 +1 @@
1
- {"version":3,"file":"get-response-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-response-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,sCAAiD;AACjD,2DAAwD;AACxD,iDAA6C;AAC7C,+DAA0D;AAE1D,SAAgB,eAAe,CAAC,SAAoC;IAElE,IAAI,YAAY,GAAG,MAAM,CAAC;IAC1B,IAAI,IAAI,GAAkB,IAAI,CAAC;IAE/B,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;QAExC,8DAA8D;QAC9D,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC7C,IAAI,GAAG,YAAY,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,6BAAoB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1F,IAAI,CAAC,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;gBACjC,IAAI,QAAQ,CAAC,oBAAoB,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;oBAC1E,YAAY,IAAI,aAAa,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,MAAM,CAAC;QACxB,CAAC;IAEH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,IAAI;KACL,CAAC;AAEJ,CAAC;AA5BD,0CA4BC"}
1
+ {"version":3,"file":"get-response-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-response-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,sCAAiD;AACjD,2DAAwD;AACxD,iDAA6C;AAC7C,+DAA0D;AAE1D;;;;;;;;;;;;;;GAcG;AACH,SAAgB,eAAe,CAAC,SAAoC;IAElE,IAAI,YAAY,GAAG,MAAM,CAAC;IAC1B,IAAI,IAAI,GAAkB,IAAI,CAAC;IAE/B,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;QAExC,8DAA8D;QAC9D,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC7C,IAAI,GAAG,YAAY,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,6BAAoB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1F,IAAI,CAAC,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;gBACjC,IAAI,QAAQ,CAAC,oBAAoB,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;oBAC1E,YAAY,IAAI,aAAa,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,MAAM,CAAC;QACxB,CAAC;IAEH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,IAAI;KACL,CAAC;AAEJ,CAAC;AA5BD,0CA4BC"}
@@ -1,3 +1,16 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { AnySchemaObject } from './any-schema-object';
3
+ /**
4
+ * Extracts the JSON schema from a specified operation's responses in an OpenAPI 3.0 specification.
5
+ *
6
+ * This function navigates through the responses of an OpenAPI operation object to find and return the JSON schema
7
+ * associated with the response content type 'application/json'. It prioritizes the default response, followed by
8
+ * HTTP 200 and 201 status codes. If a response is found, the function checks if it is a reference object or an actual
9
+ * response object. For reference objects, a warning is logged indicating that reference objects are not supported.
10
+ * If an actual response object with a 'application/json' content type is found, the associated schema is returned.
11
+ *
12
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object containing the responses to be analyzed.
13
+ * @returns {OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | AnySchemaObject | null} The JSON schema associated with
14
+ * the operation's response if available, otherwise null. Note that reference objects are recognized but not supported.
15
+ */
3
16
  export declare function GetResponse(operation: OpenAPIV3.OperationObject): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | AnySchemaObject | null;
@@ -2,6 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetResponse = void 0;
4
4
  const is_reference_object_1 = require("./is-reference-object");
5
+ /**
6
+ * Extracts the JSON schema from a specified operation's responses in an OpenAPI 3.0 specification.
7
+ *
8
+ * This function navigates through the responses of an OpenAPI operation object to find and return the JSON schema
9
+ * associated with the response content type 'application/json'. It prioritizes the default response, followed by
10
+ * HTTP 200 and 201 status codes. If a response is found, the function checks if it is a reference object or an actual
11
+ * response object. For reference objects, a warning is logged indicating that reference objects are not supported.
12
+ * If an actual response object with a 'application/json' content type is found, the associated schema is returned.
13
+ *
14
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object containing the responses to be analyzed.
15
+ * @returns {OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | AnySchemaObject | null} The JSON schema associated with
16
+ * the operation's response if available, otherwise null. Note that reference objects are recognized but not supported.
17
+ */
5
18
  function GetResponse(operation) {
6
19
  if (operation.responses) {
7
20
  let response = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"get-response.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-response.ts"],"names":[],"mappings":";;;AAEA,+DAA0D;AAE1D,SAAgB,WAAW,CAAC,SAAoC;IAE9D,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;QAExB,IAAI,QAAQ,GAAqE,SAAS,CAAC;QAE3F,IAAI,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;aAAM,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YAEb,IAAI,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;gBAChC,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;YAC7E,CAAC;iBAAM,CAAC;gBACN,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;oBAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC;oBAC3D,IAAI,MAAM,EAAE,CAAC;wBACX,OAAO,MAAM,CAAC;oBAChB,CAAC;gBACH,CAAC;YACH,CAAC;QAEH,CAAC;IAEH,CAAC;IAED,OAAO,IAAI,CAAC;AAEd,CAAC;AAjCD,kCAiCC"}
1
+ {"version":3,"file":"get-response.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-response.ts"],"names":[],"mappings":";;;AAEA,+DAA0D;AAE1D;;;;;;;;;;;;GAYG;AACH,SAAgB,WAAW,CAAC,SAAoC;IAE9D,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;QAExB,IAAI,QAAQ,GAAqE,SAAS,CAAC;QAE3F,IAAI,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;aAAM,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YAEb,IAAI,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;gBAChC,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;YAC7E,CAAC;iBAAM,CAAC;gBACN,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;oBAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC;oBAC3D,IAAI,MAAM,EAAE,CAAC;wBACX,OAAO,MAAM,CAAC;oBAChB,CAAC;gBACH,CAAC;YACH,CAAC;QAEH,CAAC;IAEH,CAAC;IAED,OAAO,IAAI,CAAC;AAEd,CAAC;AAjCD,kCAiCC"}
@@ -1,3 +1,17 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { OptionalKind, TypeParameterDeclarationStructure } from 'ts-morph';
3
+ /**
4
+ * Extracts type parameters for the response and request body of a given OpenAPI operation object.
5
+ * This function analyzes the operation's response and request body to determine if type parameters
6
+ * should be defined based on the presence of additional properties or undefined types.
7
+ *
8
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object to analyze.
9
+ * @returns {Array<OptionalKind<TypeParameterDeclarationStructure>>} An array of type parameter declarations.
10
+ * Each type parameter is represented with a name and a default type. If the operation's response or request body
11
+ * has additional properties set to true or an undefined type, type parameters 'TResponse' and 'TRequestBody'
12
+ * are added with a default type of 'unknown'.
13
+ *
14
+ * Note: The function assumes that the operation object is well-formed and contains the necessary properties
15
+ * to perform checks on the response and request body. It returns an empty array if no type parameters are needed.
16
+ */
3
17
  export declare function GetTypeParameters(operation: OpenAPIV3.OperationObject): Array<OptionalKind<TypeParameterDeclarationStructure>>;
@@ -5,6 +5,20 @@ const any_schema_object_1 = require("./any-schema-object");
5
5
  const get_reqeust_body_1 = require("./get-reqeust-body");
6
6
  const get_response_1 = require("./get-response");
7
7
  const is_reference_object_1 = require("./is-reference-object");
8
+ /**
9
+ * Extracts type parameters for the response and request body of a given OpenAPI operation object.
10
+ * This function analyzes the operation's response and request body to determine if type parameters
11
+ * should be defined based on the presence of additional properties or undefined types.
12
+ *
13
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object to analyze.
14
+ * @returns {Array<OptionalKind<TypeParameterDeclarationStructure>>} An array of type parameter declarations.
15
+ * Each type parameter is represented with a name and a default type. If the operation's response or request body
16
+ * has additional properties set to true or an undefined type, type parameters 'TResponse' and 'TRequestBody'
17
+ * are added with a default type of 'unknown'.
18
+ *
19
+ * Note: The function assumes that the operation object is well-formed and contains the necessary properties
20
+ * to perform checks on the response and request body. It returns an empty array if no type parameters are needed.
21
+ */
8
22
  function GetTypeParameters(operation) {
9
23
  const typeParameters = [];
10
24
  if (operation.operationId) {
@@ -1 +1 @@
1
- {"version":3,"file":"get-type-parameters.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-type-parameters.ts"],"names":[],"mappings":";;;AAKA,2DAAwD;AACxD,yDAAoD;AACpD,iDAA6C;AAC7C,+DAA0D;AAE1D,SAAgB,iBAAiB,CAAC,SAAoC;IAEpE,MAAM,cAAc,GAA2D,EAAE,CAAC;IAElF,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;QACxC,MAAM,WAAW,GAAG,IAAA,iCAAc,EAAC,SAAS,CAAC,CAAC;QAE9C,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,IAAI,CAAC,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC7E,IAAI,QAAQ,CAAC,oBAAoB,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC1E,cAAc,CAAC,IAAI,CAAC;oBAClB,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,SAAS;iBACnB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,IAAI,WAAW,IAAI,CAAC,IAAA,qCAAiB,EAAC,WAAW,CAAC,IAAI,CAAC,IAAA,uCAAiB,EAAC,WAAW,CAAC,EAAE,CAAC;YACtF,IAAI,WAAW,CAAC,oBAAoB,KAAK,IAAI,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAChF,cAAc,CAAC,IAAI,CAAC;oBAClB,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,SAAS;iBACnB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IAEH,CAAC;IAED,OAAO,cAAc,CAAC;AAExB,CAAC;AA/BD,8CA+BC"}
1
+ {"version":3,"file":"get-type-parameters.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-type-parameters.ts"],"names":[],"mappings":";;;AAKA,2DAAwD;AACxD,yDAAoD;AACpD,iDAA6C;AAC7C,+DAA0D;AAE1D;;;;;;;;;;;;;GAaG;AACH,SAAgB,iBAAiB,CAAC,SAAoC;IAEpE,MAAM,cAAc,GAA2D,EAAE,CAAC;IAElF,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;QACxC,MAAM,WAAW,GAAG,IAAA,iCAAc,EAAC,SAAS,CAAC,CAAC;QAE9C,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,IAAI,CAAC,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC7E,IAAI,QAAQ,CAAC,oBAAoB,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC1E,cAAc,CAAC,IAAI,CAAC;oBAClB,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,SAAS;iBACnB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,IAAI,WAAW,IAAI,CAAC,IAAA,qCAAiB,EAAC,WAAW,CAAC,IAAI,CAAC,IAAA,uCAAiB,EAAC,WAAW,CAAC,EAAE,CAAC;YACtF,IAAI,WAAW,CAAC,oBAAoB,KAAK,IAAI,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAChF,cAAc,CAAC,IAAI,CAAC;oBAClB,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,SAAS;iBACnB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IAEH,CAAC;IAED,OAAO,cAAc,CAAC;AAExB,CAAC;AA/BD,8CA+BC"}
@@ -1,3 +1,13 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  export type OperationObjectWithParameters = Omit<OpenAPIV3.OperationObject, 'parameters'> & Required<Pick<OpenAPIV3.OperationObject, 'parameters'>>;
3
+ /**
4
+ * Checks if the provided OpenAPI operation object has any parameters defined.
5
+ *
6
+ * This function is a type guard that determines whether the `operation` object
7
+ * conforms to the `OperationObjectWithParameters` type, which is an extension
8
+ * of the standard `OpenAPIV3.OperationObject` with a non-empty `parameters` array.
9
+ *
10
+ * @param operation - The OpenAPI operation object to check.
11
+ * @returns `true` if the `operation` object has a non-empty array of parameters, `false` otherwise.
12
+ */
3
13
  export declare function HasOperationParameters(operation: OpenAPIV3.OperationObject): operation is OperationObjectWithParameters;
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HasOperationParameters = void 0;
4
+ /**
5
+ * Checks if the provided OpenAPI operation object has any parameters defined.
6
+ *
7
+ * This function is a type guard that determines whether the `operation` object
8
+ * conforms to the `OperationObjectWithParameters` type, which is an extension
9
+ * of the standard `OpenAPIV3.OperationObject` with a non-empty `parameters` array.
10
+ *
11
+ * @param operation - The OpenAPI operation object to check.
12
+ * @returns `true` if the `operation` object has a non-empty array of parameters, `false` otherwise.
13
+ */
4
14
  function HasOperationParameters(operation) {
5
15
  return Array.isArray(operation.parameters) && operation.parameters.length !== 0;
6
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"has-operation-paramters.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/has-operation-paramters.ts"],"names":[],"mappings":";;;AAMA,SAAgB,sBAAsB,CAAC,SAAoC;IACzE,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;AAClF,CAAC;AAFD,wDAEC"}
1
+ {"version":3,"file":"has-operation-paramters.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/has-operation-paramters.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;GASG;AACH,SAAgB,sBAAsB,CAAC,SAAoC;IACzE,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;AAClF,CAAC;AAFD,wDAEC"}
@@ -1,3 +1,13 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  export type OperationObjectWithRequestBody = Omit<OpenAPIV3.OperationObject, 'requestBody'> & Required<Pick<OpenAPIV3.OperationObject, 'requestBody'>>;
3
+ /**
4
+ * Checks if the provided OpenAPI operation object includes a request body.
5
+ *
6
+ * This function is a type guard that determines whether the `operation` object
7
+ * conforms to the `OperationObjectWithRequestBody` interface, which is an extension
8
+ * of the standard OpenAPIV3 `OperationObject` that includes a `requestBody`.
9
+ *
10
+ * @param operation - The OpenAPI operation object to check.
11
+ * @returns `true` if the `operation` includes a `requestBody`, otherwise `false`.
12
+ */
3
13
  export declare function HasOperationRequestBody(operation: OpenAPIV3.OperationObject): operation is OperationObjectWithRequestBody;
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HasOperationRequestBody = void 0;
4
+ /**
5
+ * Checks if the provided OpenAPI operation object includes a request body.
6
+ *
7
+ * This function is a type guard that determines whether the `operation` object
8
+ * conforms to the `OperationObjectWithRequestBody` interface, which is an extension
9
+ * of the standard OpenAPIV3 `OperationObject` that includes a `requestBody`.
10
+ *
11
+ * @param operation - The OpenAPI operation object to check.
12
+ * @returns `true` if the `operation` includes a `requestBody`, otherwise `false`.
13
+ */
4
14
  function HasOperationRequestBody(operation) {
5
15
  return !!operation.requestBody;
6
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"has-operation-request-body.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/has-operation-request-body.ts"],"names":[],"mappings":";;;AAMA,SAAgB,uBAAuB,CAAC,SAAoC;IAC1E,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC;AACjC,CAAC;AAFD,0DAEC"}
1
+ {"version":3,"file":"has-operation-request-body.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/has-operation-request-body.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;GASG;AACH,SAAgB,uBAAuB,CAAC,SAAoC;IAC1E,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC;AACjC,CAAC;AAFD,0DAEC"}