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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +5 -5
  3. package/src/lib/create-directive.d.ts +31 -0
  4. package/src/lib/create-directive.js +39 -0
  5. package/src/lib/create-directive.js.map +1 -1
  6. package/src/lib/generate-components.d.ts +9 -0
  7. package/src/lib/generate-components.js +32 -0
  8. package/src/lib/generate-components.js.map +1 -1
  9. package/src/lib/generate-data-source.d.ts +21 -0
  10. package/src/lib/generate-data-source.js +21 -0
  11. package/src/lib/generate-data-source.js.map +1 -1
  12. package/src/lib/generate-directives.d.ts +23 -0
  13. package/src/lib/generate-directives.js +23 -0
  14. package/src/lib/generate-directives.js.map +1 -1
  15. package/src/lib/generate-index-exports.d.ts +15 -0
  16. package/src/lib/generate-index-exports.js +15 -0
  17. package/src/lib/generate-index-exports.js.map +1 -1
  18. package/src/lib/generate-interfaces.d.ts +17 -0
  19. package/src/lib/generate-interfaces.js +17 -0
  20. package/src/lib/generate-interfaces.js.map +1 -1
  21. package/src/lib/generate-operation-command.d.ts +29 -0
  22. package/src/lib/generate-operation-command.js +29 -0
  23. package/src/lib/generate-operation-command.js.map +1 -1
  24. package/src/lib/generate-operation.d.ts +20 -0
  25. package/src/lib/generate-operation.js +41 -0
  26. package/src/lib/generate-operation.js.map +1 -1
  27. package/src/lib/generate-parameters.d.ts +27 -0
  28. package/src/lib/generate-parameters.js +27 -0
  29. package/src/lib/generate-parameters.js.map +1 -1
  30. package/src/lib/generate-remote-method.d.ts +25 -0
  31. package/src/lib/generate-remote-method.js +25 -0
  32. package/src/lib/generate-remote-method.js.map +1 -1
  33. package/src/lib/generate-request-body.d.ts +16 -0
  34. package/src/lib/generate-request-body.js +16 -0
  35. package/src/lib/generate-request-body.js.map +1 -1
  36. package/src/lib/generate-response.d.ts +23 -0
  37. package/src/lib/generate-response.js +23 -0
  38. package/src/lib/generate-response.js.map +1 -1
  39. package/src/lib/load-open-api-config.d.ts +17 -0
  40. package/src/lib/load-open-api-config.js +17 -0
  41. package/src/lib/load-open-api-config.js.map +1 -1
  42. package/src/lib/resolve-ref.d.ts +10 -0
  43. package/src/lib/resolve-ref.js +10 -0
  44. package/src/lib/resolve-ref.js.map +1 -1
  45. package/src/lib/types.d.ts +40 -0
  46. package/src/lib/types.js +40 -0
  47. package/src/lib/types.js.map +1 -1
  48. package/src/lib/utilities/any-schema-object.d.ts +9 -0
  49. package/src/lib/utilities/any-schema-object.js +9 -0
  50. package/src/lib/utilities/any-schema-object.js.map +1 -1
  51. package/src/lib/utilities/create-component-type-alias-source-file.d.ts +19 -0
  52. package/src/lib/utilities/create-component-type-alias-source-file.js +19 -0
  53. package/src/lib/utilities/create-component-type-alias-source-file.js.map +1 -1
  54. package/src/lib/utilities/get-parameter-type.d.ts +10 -0
  55. package/src/lib/utilities/get-parameter-type.js +10 -0
  56. package/src/lib/utilities/get-parameter-type.js.map +1 -1
  57. package/src/lib/utilities/get-reqeust-body.d.ts +12 -0
  58. package/src/lib/utilities/get-reqeust-body.js +12 -0
  59. package/src/lib/utilities/get-reqeust-body.js.map +1 -1
  60. package/src/lib/utilities/get-request-body-type.d.ts +19 -0
  61. package/src/lib/utilities/get-request-body-type.js +19 -0
  62. package/src/lib/utilities/get-request-body-type.js.map +1 -1
  63. package/src/lib/utilities/get-response-type.d.ts +15 -0
  64. package/src/lib/utilities/get-response-type.js +15 -0
  65. package/src/lib/utilities/get-response-type.js.map +1 -1
  66. package/src/lib/utilities/get-response.d.ts +13 -0
  67. package/src/lib/utilities/get-response.js +13 -0
  68. package/src/lib/utilities/get-response.js.map +1 -1
  69. package/src/lib/utilities/get-type-parameters.d.ts +14 -0
  70. package/src/lib/utilities/get-type-parameters.js +14 -0
  71. package/src/lib/utilities/get-type-parameters.js.map +1 -1
  72. package/src/lib/utilities/has-operation-paramters.d.ts +10 -0
  73. package/src/lib/utilities/has-operation-paramters.js +10 -0
  74. package/src/lib/utilities/has-operation-paramters.js.map +1 -1
  75. package/src/lib/utilities/has-operation-request-body.d.ts +10 -0
  76. package/src/lib/utilities/has-operation-request-body.js +10 -0
  77. package/src/lib/utilities/has-operation-request-body.js.map +1 -1
  78. package/src/lib/utilities/http-request.d.ts +30 -0
  79. package/src/lib/utilities/http-request.js +30 -0
  80. package/src/lib/utilities/http-request.js.map +1 -1
  81. package/src/lib/utilities/ignore-operation.d.ts +11 -0
  82. package/src/lib/utilities/ignore-operation.js +11 -0
  83. package/src/lib/utilities/ignore-operation.js.map +1 -1
  84. package/src/lib/utilities/is-collection-response.d.ts +13 -0
  85. package/src/lib/utilities/is-collection-response.js +13 -0
  86. package/src/lib/utilities/is-collection-response.js.map +1 -1
  87. package/src/lib/utilities/is-http-method.d.ts +14 -0
  88. package/src/lib/utilities/is-http-method.js +14 -0
  89. package/src/lib/utilities/is-http-method.js.map +1 -1
  90. package/src/lib/utilities/is-open-api-schema-from-path.d.ts +11 -0
  91. package/src/lib/utilities/is-open-api-schema-from-path.js +11 -0
  92. package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -1
  93. package/src/lib/utilities/is-operation-object.d.ts +16 -0
  94. package/src/lib/utilities/is-operation-object.js +16 -0
  95. package/src/lib/utilities/is-operation-object.js.map +1 -1
  96. package/src/lib/utilities/is-reference-object.d.ts +22 -0
  97. package/src/lib/utilities/is-reference-object.js +22 -0
  98. package/src/lib/utilities/is-reference-object.js.map +1 -1
  99. package/src/lib/utilities/is-without-parameters.d.ts +10 -0
  100. package/src/lib/utilities/is-without-parameters.js +10 -0
  101. package/src/lib/utilities/is-without-parameters.js.map +1 -1
  102. package/src/lib/utilities/ref-schema-object.d.ts +26 -0
  103. package/src/lib/utilities/ref-schema-object.js +26 -0
  104. package/src/lib/utilities/ref-schema-object.js.map +1 -1
@@ -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"}
@@ -1 +1,31 @@
1
+ /**
2
+ * Performs an HTTP GET request to retrieve JSON data from the specified URL.
3
+ *
4
+ * This function supports both HTTP and HTTPS protocols based on the URL provided.
5
+ * It returns a promise that resolves with the JSON parsed data if the request is successful
6
+ * and the response contains valid JSON content. If the request fails or the response is not
7
+ * valid JSON, the promise is rejected with an error message.
8
+ *
9
+ * @param {string} url - The URL from which to fetch data. Must be a valid HTTP or HTTPS URL.
10
+ * @returns {Promise<T>} A promise that resolves with the parsed JSON data as type T, or rejects with an error message.
11
+ *
12
+ * @template T - The type of the JSON data expected to be returned by the server.
13
+ *
14
+ * ### Example
15
+ *
16
+ * interface User {
17
+ * id: number;
18
+ * name: string;
19
+ * }
20
+ *
21
+ * const userPromise: Promise<User> = HttpRequest<User>('https://api.example.com/users/1');
22
+ * userPromise.then(user => console.log(user.name)).catch(error => console.error(error));
23
+ * ```
24
+ *
25
+ * ### Error Handling
26
+ * - If the status code of the response is not 200, the promise is rejected with "Request Failed. Status Code: [statusCode]".
27
+ * - If the content type of the response is not `application/json`, the promise is rejected with "Invalid content-type. Expected application/json but received [contentType]".
28
+ * - If there is an error in parsing the JSON data, the promise is rejected with the parsing error message.
29
+ * - Network errors or other request issues result in a promise rejection with the respective error message.
30
+ */
1
31
  export declare function HttpRequest<T>(url: string): Promise<T>;
@@ -3,6 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HttpRequest = void 0;
4
4
  const http = require("http");
5
5
  const https = require("https");
6
+ /**
7
+ * Performs an HTTP GET request to retrieve JSON data from the specified URL.
8
+ *
9
+ * This function supports both HTTP and HTTPS protocols based on the URL provided.
10
+ * It returns a promise that resolves with the JSON parsed data if the request is successful
11
+ * and the response contains valid JSON content. If the request fails or the response is not
12
+ * valid JSON, the promise is rejected with an error message.
13
+ *
14
+ * @param {string} url - The URL from which to fetch data. Must be a valid HTTP or HTTPS URL.
15
+ * @returns {Promise<T>} A promise that resolves with the parsed JSON data as type T, or rejects with an error message.
16
+ *
17
+ * @template T - The type of the JSON data expected to be returned by the server.
18
+ *
19
+ * ### Example
20
+ *
21
+ * interface User {
22
+ * id: number;
23
+ * name: string;
24
+ * }
25
+ *
26
+ * const userPromise: Promise<User> = HttpRequest<User>('https://api.example.com/users/1');
27
+ * userPromise.then(user => console.log(user.name)).catch(error => console.error(error));
28
+ * ```
29
+ *
30
+ * ### Error Handling
31
+ * - If the status code of the response is not 200, the promise is rejected with "Request Failed. Status Code: [statusCode]".
32
+ * - If the content type of the response is not `application/json`, the promise is rejected with "Invalid content-type. Expected application/json but received [contentType]".
33
+ * - If there is an error in parsing the JSON data, the promise is rejected with the parsing error message.
34
+ * - Network errors or other request issues result in a promise rejection with the respective error message.
35
+ */
6
36
  function HttpRequest(url) {
7
37
  function callback(resolve, reject) {
8
38
  return function (res) {
@@ -1 +1 @@
1
- {"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/http-request.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+BAA+B;AAE/B,SAAgB,WAAW,CAAI,GAAW;IAExC,SAAS,QAAQ,CAAC,OAA6B,EAAE,MAA4B;QAE3E,OAAO,UAAU,GAAyB;YAExC,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;YAC3B,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YAEhD,IAAI,KAAK,CAAC;YACV,wDAAwD;YACxD,oCAAoC;YACpC,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gBACvB,KAAK,GAAG,IAAI,KAAK,CAAC,mBAAmB;oBACnC,gBAAiB,UAAW,EAAE,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,WAAW,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,KAAK,GAAG,IAAI,KAAK,CAAC,yBAAyB;oBACzC,0CAA2C,WAAY,EAAE,CAAC,CAAC;YAC/D,CAAC;YACD,IAAI,KAAK,EAAE,CAAC;gBACV,0CAA0C;gBAC1C,GAAG,CAAC,MAAM,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC7B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACxB,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,OAAO,IAAI,KAAK,CAAC;YACnB,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACjB,IAAI,CAAC;oBACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC/B,CAAC;gBAAC,OAAO,CAAM,EAAE,CAAC;oBAChB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBACzB,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC,CAAC;QAEL,CAAC,CAAC;IAEJ,CAAC;IAED,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC;AAEH,CAAC;AAvDD,kCAuDC"}
1
+ {"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/http-request.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+BAA+B;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,WAAW,CAAI,GAAW;IAExC,SAAS,QAAQ,CAAC,OAA6B,EAAE,MAA4B;QAE3E,OAAO,UAAU,GAAyB;YAExC,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;YAC3B,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YAEhD,IAAI,KAAK,CAAC;YACV,wDAAwD;YACxD,oCAAoC;YACpC,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gBACvB,KAAK,GAAG,IAAI,KAAK,CAAC,mBAAmB;oBACnC,gBAAiB,UAAW,EAAE,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,WAAW,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,KAAK,GAAG,IAAI,KAAK,CAAC,yBAAyB;oBACzC,0CAA2C,WAAY,EAAE,CAAC,CAAC;YAC/D,CAAC;YACD,IAAI,KAAK,EAAE,CAAC;gBACV,0CAA0C;gBAC1C,GAAG,CAAC,MAAM,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC7B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACxB,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,OAAO,IAAI,KAAK,CAAC;YACnB,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACjB,IAAI,CAAC;oBACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC/B,CAAC;gBAAC,OAAO,CAAM,EAAE,CAAC;oBAChB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBACzB,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC,CAAC;QAEL,CAAC,CAAC;IAEJ,CAAC;IAED,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC;AAEH,CAAC;AAvDD,kCAuDC"}
@@ -1,2 +1,13 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
+ /**
3
+ * Creates a predicate function that checks if an OpenAPI operation should be ignored based on its tags.
4
+ *
5
+ * The returned function evaluates whether any of the operation's tags match the specified tags to ignore.
6
+ * If a match is found, the operation is considered for ignoring (i.e., the function returns `true`).
7
+ * If no tags are specified in the input, or the operation has no tags, the function will return `false`.
8
+ *
9
+ * @param {string[]} tags - An array of strings representing the tags to check against the operation's tags.
10
+ * @returns {(operation: OpenAPIV3.OperationObject) => boolean} A function that takes an OpenAPI operation object
11
+ * and returns `true` if any of the operation's tags match the tags to ignore, otherwise `false`.
12
+ */
2
13
  export declare function IgnoreOperation(tags?: string[]): (operation: OpenAPIV3.OperationObject) => boolean;
@@ -1,6 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IgnoreOperation = void 0;
4
+ /**
5
+ * Creates a predicate function that checks if an OpenAPI operation should be ignored based on its tags.
6
+ *
7
+ * The returned function evaluates whether any of the operation's tags match the specified tags to ignore.
8
+ * If a match is found, the operation is considered for ignoring (i.e., the function returns `true`).
9
+ * If no tags are specified in the input, or the operation has no tags, the function will return `false`.
10
+ *
11
+ * @param {string[]} tags - An array of strings representing the tags to check against the operation's tags.
12
+ * @returns {(operation: OpenAPIV3.OperationObject) => boolean} A function that takes an OpenAPI operation object
13
+ * and returns `true` if any of the operation's tags match the tags to ignore, otherwise `false`.
14
+ */
4
15
  function IgnoreOperation(tags = []) {
5
16
  return operation => {
6
17
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"ignore-operation.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/ignore-operation.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,OAAiB,EAAE;IACjD,OAAO,SAAS,CAAC,EAAE;;QAEjB,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,MAAM,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,OAAO,KAAK,CAAC;IAEf,CAAC,CAAC;AACJ,CAAC;AAVD,0CAUC"}
1
+ {"version":3,"file":"ignore-operation.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/ignore-operation.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,OAAiB,EAAE;IACjD,OAAO,SAAS,CAAC,EAAE;;QAEjB,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,MAAM,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,OAAO,KAAK,CAAC;IAEf,CAAC,CAAC;AACJ,CAAC;AAVD,0CAUC"}
@@ -1,2 +1,15 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
+ /**
3
+ * Determines if the given OpenAPI operation object represents a collection response.
4
+ *
5
+ * This function checks if the operation's response schema explicitly defines an array type,
6
+ * indicating that the response is a collection of items rather than a single item. It first
7
+ * retrieves the response schema from the operation object, then verifies that the schema
8
+ * is neither a wildcard schema object nor a reference to another schema. If these conditions
9
+ * are met and the response type is an array, the function returns true, indicating a collection
10
+ * response.
11
+ *
12
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object to evaluate.
13
+ * @returns {boolean} True if the operation's response is a collection (array type), false otherwise.
14
+ */
2
15
  export declare function IsCollectionResponse(operation: OpenAPIV3.OperationObject): boolean;
@@ -4,6 +4,19 @@ exports.IsCollectionResponse = void 0;
4
4
  const any_schema_object_1 = require("./any-schema-object");
5
5
  const get_response_1 = require("./get-response");
6
6
  const is_reference_object_1 = require("./is-reference-object");
7
+ /**
8
+ * Determines if the given OpenAPI operation object represents a collection response.
9
+ *
10
+ * This function checks if the operation's response schema explicitly defines an array type,
11
+ * indicating that the response is a collection of items rather than a single item. It first
12
+ * retrieves the response schema from the operation object, then verifies that the schema
13
+ * is neither a wildcard schema object nor a reference to another schema. If these conditions
14
+ * are met and the response type is an array, the function returns true, indicating a collection
15
+ * response.
16
+ *
17
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object to evaluate.
18
+ * @returns {boolean} True if the operation's response is a collection (array type), false otherwise.
19
+ */
7
20
  function IsCollectionResponse(operation) {
8
21
  const response = (0, get_response_1.GetResponse)(operation);
9
22
  if (response && !(0, any_schema_object_1.IsAnySchemaObject)(response)) {
@@ -1 +1 @@
1
- {"version":3,"file":"is-collection-response.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-collection-response.ts"],"names":[],"mappings":";;;AACA,2DAAwD;AACxD,iDAA6C;AAC7C,+DAA0D;AAE1D,SAAgB,oBAAoB,CAAC,SAAoC;IAEvE,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;IAExC,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,OAAO,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAXD,oDAWC"}
1
+ {"version":3,"file":"is-collection-response.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-collection-response.ts"],"names":[],"mappings":";;;AACA,2DAAwD;AACxD,iDAA6C;AAC7C,+DAA0D;AAE1D;;;;;;;;;;;;GAYG;AACH,SAAgB,oBAAoB,CAAC,SAAoC;IAEvE,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;IAExC,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,OAAO,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAXD,oDAWC"}