@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.
- package/CHANGELOG.md +8 -0
- package/package.json +7 -5
- package/src/generators/init/generator.d.ts +4 -0
- package/src/generators/init/generator.js +106 -0
- package/src/generators/init/generator.js.map +1 -0
- package/src/lib/create-directive.d.ts +31 -0
- package/src/lib/create-directive.js +39 -0
- package/src/lib/create-directive.js.map +1 -1
- package/src/lib/generate-components.d.ts +9 -0
- package/src/lib/generate-components.js +32 -0
- package/src/lib/generate-components.js.map +1 -1
- package/src/lib/generate-data-source.d.ts +21 -0
- package/src/lib/generate-data-source.js +21 -0
- package/src/lib/generate-data-source.js.map +1 -1
- package/src/lib/generate-directives.d.ts +23 -0
- package/src/lib/generate-directives.js +23 -0
- package/src/lib/generate-directives.js.map +1 -1
- package/src/lib/generate-index-exports.d.ts +15 -0
- package/src/lib/generate-index-exports.js +15 -0
- package/src/lib/generate-index-exports.js.map +1 -1
- package/src/lib/generate-interfaces.d.ts +17 -0
- package/src/lib/generate-interfaces.js +17 -0
- package/src/lib/generate-interfaces.js.map +1 -1
- package/src/lib/generate-operation-command.d.ts +29 -0
- package/src/lib/generate-operation-command.js +29 -0
- package/src/lib/generate-operation-command.js.map +1 -1
- package/src/lib/generate-operation.d.ts +20 -0
- package/src/lib/generate-operation.js +41 -0
- package/src/lib/generate-operation.js.map +1 -1
- package/src/lib/generate-parameters.d.ts +27 -0
- package/src/lib/generate-parameters.js +27 -0
- package/src/lib/generate-parameters.js.map +1 -1
- package/src/lib/generate-remote-method.d.ts +25 -0
- package/src/lib/generate-remote-method.js +25 -0
- package/src/lib/generate-remote-method.js.map +1 -1
- package/src/lib/generate-request-body.d.ts +16 -0
- package/src/lib/generate-request-body.js +16 -0
- package/src/lib/generate-request-body.js.map +1 -1
- package/src/lib/generate-response.d.ts +23 -0
- package/src/lib/generate-response.js +23 -0
- package/src/lib/generate-response.js.map +1 -1
- package/src/lib/load-open-api-config.d.ts +17 -0
- package/src/lib/load-open-api-config.js +17 -0
- package/src/lib/load-open-api-config.js.map +1 -1
- package/src/lib/resolve-ref.d.ts +10 -0
- package/src/lib/resolve-ref.js +10 -0
- package/src/lib/resolve-ref.js.map +1 -1
- package/src/lib/types.d.ts +40 -0
- package/src/lib/types.js +40 -0
- package/src/lib/types.js.map +1 -1
- package/src/lib/utilities/any-schema-object.d.ts +9 -0
- package/src/lib/utilities/any-schema-object.js +9 -0
- package/src/lib/utilities/any-schema-object.js.map +1 -1
- package/src/lib/utilities/create-component-type-alias-source-file.d.ts +19 -0
- package/src/lib/utilities/create-component-type-alias-source-file.js +19 -0
- package/src/lib/utilities/create-component-type-alias-source-file.js.map +1 -1
- package/src/lib/utilities/get-parameter-type.d.ts +10 -0
- package/src/lib/utilities/get-parameter-type.js +10 -0
- package/src/lib/utilities/get-parameter-type.js.map +1 -1
- package/src/lib/utilities/get-reqeust-body.d.ts +12 -0
- package/src/lib/utilities/get-reqeust-body.js +12 -0
- package/src/lib/utilities/get-reqeust-body.js.map +1 -1
- package/src/lib/utilities/get-request-body-type.d.ts +19 -0
- package/src/lib/utilities/get-request-body-type.js +19 -0
- package/src/lib/utilities/get-request-body-type.js.map +1 -1
- package/src/lib/utilities/get-response-type.d.ts +15 -0
- package/src/lib/utilities/get-response-type.js +15 -0
- package/src/lib/utilities/get-response-type.js.map +1 -1
- package/src/lib/utilities/get-response.d.ts +13 -0
- package/src/lib/utilities/get-response.js +13 -0
- package/src/lib/utilities/get-response.js.map +1 -1
- package/src/lib/utilities/get-type-parameters.d.ts +14 -0
- package/src/lib/utilities/get-type-parameters.js +14 -0
- package/src/lib/utilities/get-type-parameters.js.map +1 -1
- package/src/lib/utilities/has-operation-paramters.d.ts +10 -0
- package/src/lib/utilities/has-operation-paramters.js +10 -0
- package/src/lib/utilities/has-operation-paramters.js.map +1 -1
- package/src/lib/utilities/has-operation-request-body.d.ts +10 -0
- package/src/lib/utilities/has-operation-request-body.js +10 -0
- package/src/lib/utilities/has-operation-request-body.js.map +1 -1
- package/src/lib/utilities/http-request.d.ts +30 -0
- package/src/lib/utilities/http-request.js +30 -0
- package/src/lib/utilities/http-request.js.map +1 -1
- package/src/lib/utilities/ignore-operation.d.ts +11 -0
- package/src/lib/utilities/ignore-operation.js +11 -0
- package/src/lib/utilities/ignore-operation.js.map +1 -1
- package/src/lib/utilities/is-collection-response.d.ts +13 -0
- package/src/lib/utilities/is-collection-response.js +13 -0
- package/src/lib/utilities/is-collection-response.js.map +1 -1
- package/src/lib/utilities/is-http-method.d.ts +14 -0
- package/src/lib/utilities/is-http-method.js +14 -0
- package/src/lib/utilities/is-http-method.js.map +1 -1
- package/src/lib/utilities/is-open-api-schema-from-path.d.ts +11 -0
- package/src/lib/utilities/is-open-api-schema-from-path.js +11 -0
- package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -1
- package/src/lib/utilities/is-operation-object.d.ts +16 -0
- package/src/lib/utilities/is-operation-object.js +16 -0
- package/src/lib/utilities/is-operation-object.js.map +1 -1
- package/src/lib/utilities/is-reference-object.d.ts +22 -0
- package/src/lib/utilities/is-reference-object.js +22 -0
- package/src/lib/utilities/is-reference-object.js.map +1 -1
- package/src/lib/utilities/is-without-parameters.d.ts +10 -0
- package/src/lib/utilities/is-without-parameters.js +10 -0
- package/src/lib/utilities/is-without-parameters.js.map +1 -1
- package/src/lib/utilities/ref-schema-object.d.ts +26 -0
- package/src/lib/utilities/ref-schema-object.js +26 -0
- package/src/lib/utilities/ref-schema-object.js.map +1 -1
|
@@ -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"}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided method string is a valid HTTP method.
|
|
3
|
+
*
|
|
4
|
+
* This function determines if the given string corresponds to one of the common HTTP methods
|
|
5
|
+
* used in web development. It specifically checks for 'get', 'put', 'post', 'delete', or 'patch'.
|
|
6
|
+
*
|
|
7
|
+
* @param method - The method string to check.
|
|
8
|
+
* @returns True if the method is one of the specified HTTP methods, false otherwise.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* IsHttpMethod('get'); // returns true
|
|
12
|
+
* IsHttpMethod('post'); // returns true
|
|
13
|
+
* IsHttpMethod('connect'); // returns false
|
|
14
|
+
*/
|
|
1
15
|
export declare function IsHttpMethod(method: string): method is 'get' | 'put' | 'post' | 'delete' | 'patch';
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IsHttpMethod = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the provided method string is a valid HTTP method.
|
|
6
|
+
*
|
|
7
|
+
* This function determines if the given string corresponds to one of the common HTTP methods
|
|
8
|
+
* used in web development. It specifically checks for 'get', 'put', 'post', 'delete', or 'patch'.
|
|
9
|
+
*
|
|
10
|
+
* @param method - The method string to check.
|
|
11
|
+
* @returns True if the method is one of the specified HTTP methods, false otherwise.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* IsHttpMethod('get'); // returns true
|
|
15
|
+
* IsHttpMethod('post'); // returns true
|
|
16
|
+
* IsHttpMethod('connect'); // returns false
|
|
17
|
+
*/
|
|
4
18
|
function IsHttpMethod(method) {
|
|
5
19
|
return ['get', 'put', 'post', 'delete', 'patch'].includes(method);
|
|
6
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-http-method.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-http-method.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,CAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAFD,oCAEC"}
|
|
1
|
+
{"version":3,"file":"is-http-method.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-http-method.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,CAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAFD,oCAEC"}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import { OpenApiSchema, OpenApiSchemaFromPath } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Determines if the provided `options` object conforms to the `OpenApiSchemaFromPath` interface.
|
|
4
|
+
*
|
|
5
|
+
* This function checks if the `options` object:
|
|
6
|
+
* 1. Exists and is not null.
|
|
7
|
+
* 2. Contains an index signature, ensuring it can hold properties dynamically.
|
|
8
|
+
* 3. Includes a 'path' property, which is essential for identifying it as an instance of `OpenApiSchemaFromPath`.
|
|
9
|
+
*
|
|
10
|
+
* @param options - The object to be tested against the `OpenApiSchemaFromPath` interface.
|
|
11
|
+
* @returns `true` if `options` matches the `OpenApiSchemaFromPath` interface, otherwise `false`.
|
|
12
|
+
*/
|
|
2
13
|
export declare function IsOpenApiSchemaFromPath(options: OpenApiSchema): options is OpenApiSchemaFromPath;
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IsOpenApiSchemaFromPath = void 0;
|
|
4
4
|
const utilities_1 = require("@rxap/utilities");
|
|
5
|
+
/**
|
|
6
|
+
* Determines if the provided `options` object conforms to the `OpenApiSchemaFromPath` interface.
|
|
7
|
+
*
|
|
8
|
+
* This function checks if the `options` object:
|
|
9
|
+
* 1. Exists and is not null.
|
|
10
|
+
* 2. Contains an index signature, ensuring it can hold properties dynamically.
|
|
11
|
+
* 3. Includes a 'path' property, which is essential for identifying it as an instance of `OpenApiSchemaFromPath`.
|
|
12
|
+
*
|
|
13
|
+
* @param options - The object to be tested against the `OpenApiSchemaFromPath` interface.
|
|
14
|
+
* @returns `true` if `options` matches the `OpenApiSchemaFromPath` interface, otherwise `false`.
|
|
15
|
+
*/
|
|
5
16
|
function IsOpenApiSchemaFromPath(options) {
|
|
6
17
|
return !!options && (0, utilities_1.hasIndexSignature)(options) && !!options['path'];
|
|
7
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-open-api-schema-from-path.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-open-api-schema-from-path.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AAMpD,SAAgB,uBAAuB,CAAC,OAAsB;IAC5D,OAAO,CAAC,CAAC,OAAO,IAAI,IAAA,6BAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAFD,0DAEC"}
|
|
1
|
+
{"version":3,"file":"is-open-api-schema-from-path.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-open-api-schema-from-path.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AAMpD;;;;;;;;;;GAUG;AACH,SAAgB,uBAAuB,CAAC,OAAsB;IAC5D,OAAO,CAAC,CAAC,OAAO,IAAI,IAAA,6BAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAFD,0DAEC"}
|
|
@@ -1,2 +1,18 @@
|
|
|
1
1
|
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a given object is a valid OpenAPIV3 OperationObject based on the presence of an `operationId` property.
|
|
4
|
+
*
|
|
5
|
+
* An OpenAPI OperationObject typically represents a single API operation on a path and must have an `operationId` which is a unique string used to identify the operation.
|
|
6
|
+
*
|
|
7
|
+
* @param obj - The object to be checked.
|
|
8
|
+
* @returns `true` if the object has a property `operationId` indicating it's likely an OpenAPIV3 OperationObject, otherwise `false`.
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* const apiOperation = {
|
|
12
|
+
* operationId: 'getUser',
|
|
13
|
+
* summary: 'Gets a user by ID'
|
|
14
|
+
* };
|
|
15
|
+
* console.log(IsOperationObject(apiOperation)); // Output: true
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
2
18
|
export declare function IsOperationObject(obj: any): obj is OpenAPIV3.OperationObject;
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IsOperationObject = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a given object is a valid OpenAPIV3 OperationObject based on the presence of an `operationId` property.
|
|
6
|
+
*
|
|
7
|
+
* An OpenAPI OperationObject typically represents a single API operation on a path and must have an `operationId` which is a unique string used to identify the operation.
|
|
8
|
+
*
|
|
9
|
+
* @param obj - The object to be checked.
|
|
10
|
+
* @returns `true` if the object has a property `operationId` indicating it's likely an OpenAPIV3 OperationObject, otherwise `false`.
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* const apiOperation = {
|
|
14
|
+
* operationId: 'getUser',
|
|
15
|
+
* summary: 'Gets a user by ID'
|
|
16
|
+
* };
|
|
17
|
+
* console.log(IsOperationObject(apiOperation)); // Output: true
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
4
20
|
function IsOperationObject(obj) {
|
|
5
21
|
return !!obj && !!obj['operationId'];
|
|
6
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-operation-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-operation-object.ts"],"names":[],"mappings":";;;AAEA,SAAgB,iBAAiB,CAAC,GAAQ;IACxC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAFD,8CAEC"}
|
|
1
|
+
{"version":3,"file":"is-operation-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-operation-object.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,iBAAiB,CAAC,GAAQ;IACxC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAFD,8CAEC"}
|
|
@@ -1,2 +1,24 @@
|
|
|
1
1
|
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the provided object is a ReferenceObject as defined in the OpenAPI V3 specification.
|
|
4
|
+
*
|
|
5
|
+
* A ReferenceObject in the OpenAPI specification is an object that contains a `$ref` property.
|
|
6
|
+
* This function determines if the given object has a `$ref` property, which would indicate that
|
|
7
|
+
* it conforms to the ReferenceObject structure.
|
|
8
|
+
*
|
|
9
|
+
* @param {any} obj - The object to check. This parameter is optional.
|
|
10
|
+
* @returns {boolean} - Returns `true` if the object is a ReferenceObject, otherwise returns `false`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // returns true
|
|
14
|
+
* IsReferenceObject({ '$ref': '#/components/schemas/Example' });
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // returns false
|
|
18
|
+
* IsReferenceObject({ 'name': 'Example' });
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // returns false
|
|
22
|
+
* IsReferenceObject();
|
|
23
|
+
*/
|
|
2
24
|
export declare function IsReferenceObject(obj?: any): obj is OpenAPIV3.ReferenceObject;
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IsReferenceObject = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the provided object is a ReferenceObject as defined in the OpenAPI V3 specification.
|
|
6
|
+
*
|
|
7
|
+
* A ReferenceObject in the OpenAPI specification is an object that contains a `$ref` property.
|
|
8
|
+
* This function determines if the given object has a `$ref` property, which would indicate that
|
|
9
|
+
* it conforms to the ReferenceObject structure.
|
|
10
|
+
*
|
|
11
|
+
* @param {any} obj - The object to check. This parameter is optional.
|
|
12
|
+
* @returns {boolean} - Returns `true` if the object is a ReferenceObject, otherwise returns `false`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // returns true
|
|
16
|
+
* IsReferenceObject({ '$ref': '#/components/schemas/Example' });
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // returns false
|
|
20
|
+
* IsReferenceObject({ 'name': 'Example' });
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // returns false
|
|
24
|
+
* IsReferenceObject();
|
|
25
|
+
*/
|
|
4
26
|
function IsReferenceObject(obj) {
|
|
5
27
|
return !!obj && !!obj['$ref'];
|
|
6
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-reference-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-reference-object.ts"],"names":[],"mappings":";;;AAEA,SAAgB,iBAAiB,CAAC,GAAS;IACzC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAFD,8CAEC"}
|
|
1
|
+
{"version":3,"file":"is-reference-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-reference-object.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,iBAAiB,CAAC,GAAS;IACzC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAFD,8CAEC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import { OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
export type OperationObjectWithoutParameters = Omit<OpenAPIV3.OperationObject, 'parameters'>;
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the provided OpenAPI operation object does not contain any parameters.
|
|
5
|
+
*
|
|
6
|
+
* This function is a type guard that determines whether the `operation` object passed to it
|
|
7
|
+
* conforms to the `OperationObjectWithoutParameters` type, which is a subtype of the standard
|
|
8
|
+
* OpenAPI operation object that specifically has no parameters.
|
|
9
|
+
*
|
|
10
|
+
* @param operation - The OpenAPI operation object to check.
|
|
11
|
+
* @returns `true` if the operation object has no parameters or an empty parameters array, otherwise `false`.
|
|
12
|
+
*/
|
|
3
13
|
export declare function IsWithoutParameters(operation: OpenAPIV3.OperationObject): operation is OperationObjectWithoutParameters;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IsWithoutParameters = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the provided OpenAPI operation object does not contain any parameters.
|
|
6
|
+
*
|
|
7
|
+
* This function is a type guard that determines whether the `operation` object passed to it
|
|
8
|
+
* conforms to the `OperationObjectWithoutParameters` type, which is a subtype of the standard
|
|
9
|
+
* OpenAPI operation object that specifically has no parameters.
|
|
10
|
+
*
|
|
11
|
+
* @param operation - The OpenAPI operation object to check.
|
|
12
|
+
* @returns `true` if the operation object has no parameters or an empty parameters array, otherwise `false`.
|
|
13
|
+
*/
|
|
4
14
|
function IsWithoutParameters(operation) {
|
|
5
15
|
return !operation.parameters || !operation.parameters.length;
|
|
6
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-without-parameters.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-without-parameters.ts"],"names":[],"mappings":";;;AAIA,SAAgB,mBAAmB,CAAC,SAAoC;IACtE,OAAO,CAAC,SAAS,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;AAC/D,CAAC;AAFD,kDAEC"}
|
|
1
|
+
{"version":3,"file":"is-without-parameters.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-without-parameters.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;;GASG;AACH,SAAgB,mBAAmB,CAAC,SAAoC;IACtE,OAAO,CAAC,SAAS,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;AAC/D,CAAC;AAFD,kDAEC"}
|
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
export interface RefSchemaObject {
|
|
2
2
|
$ref: string;
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the given object is a reference schema object.
|
|
6
|
+
*
|
|
7
|
+
* A reference schema object is typically used in JSON schema and OpenAPI specifications
|
|
8
|
+
* to reuse definitions. This function determines if the provided object contains a `$ref` property,
|
|
9
|
+
* which is a common indicator of a reference schema object.
|
|
10
|
+
*
|
|
11
|
+
* @param obj - The object to check.
|
|
12
|
+
* @returns True if `obj` contains a `$ref` property, indicating it is a reference schema object; otherwise, false.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* const schema = { $ref: '#/definitions/example' };
|
|
17
|
+
* console.log(IsRefSchemaObject(schema)); // Output: true
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
4
20
|
export declare function IsRefSchemaObject(obj: any): obj is RefSchemaObject;
|
|
5
21
|
export interface ArrayRefSchemaObject {
|
|
6
22
|
type: 'array';
|
|
7
23
|
items: RefSchemaObject;
|
|
8
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Checks if a given object conforms to the `ArrayRefSchemaObject` type.
|
|
27
|
+
*
|
|
28
|
+
* This function determines if the provided object is an `ArrayRefSchemaObject` by checking specific properties:
|
|
29
|
+
* - The object must exist and have a `type` property equal to 'array'.
|
|
30
|
+
* - The `items` property of the object must satisfy the `IsRefSchemaObject` check.
|
|
31
|
+
*
|
|
32
|
+
* @param obj - The object to be checked.
|
|
33
|
+
* @returns True if the object matches the `ArrayRefSchemaObject` type criteria, false otherwise.
|
|
34
|
+
*/
|
|
9
35
|
export declare function IsArrayRefSchemaObject(obj: any): obj is ArrayRefSchemaObject;
|
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IsArrayRefSchemaObject = exports.IsRefSchemaObject = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the given object is a reference schema object.
|
|
6
|
+
*
|
|
7
|
+
* A reference schema object is typically used in JSON schema and OpenAPI specifications
|
|
8
|
+
* to reuse definitions. This function determines if the provided object contains a `$ref` property,
|
|
9
|
+
* which is a common indicator of a reference schema object.
|
|
10
|
+
*
|
|
11
|
+
* @param obj - The object to check.
|
|
12
|
+
* @returns True if `obj` contains a `$ref` property, indicating it is a reference schema object; otherwise, false.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* const schema = { $ref: '#/definitions/example' };
|
|
17
|
+
* console.log(IsRefSchemaObject(schema)); // Output: true
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
4
20
|
function IsRefSchemaObject(obj) {
|
|
5
21
|
return obj && obj['$ref'];
|
|
6
22
|
}
|
|
7
23
|
exports.IsRefSchemaObject = IsRefSchemaObject;
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a given object conforms to the `ArrayRefSchemaObject` type.
|
|
26
|
+
*
|
|
27
|
+
* This function determines if the provided object is an `ArrayRefSchemaObject` by checking specific properties:
|
|
28
|
+
* - The object must exist and have a `type` property equal to 'array'.
|
|
29
|
+
* - The `items` property of the object must satisfy the `IsRefSchemaObject` check.
|
|
30
|
+
*
|
|
31
|
+
* @param obj - The object to be checked.
|
|
32
|
+
* @returns True if the object matches the `ArrayRefSchemaObject` type criteria, false otherwise.
|
|
33
|
+
*/
|
|
8
34
|
function IsArrayRefSchemaObject(obj) {
|
|
9
35
|
return obj && obj.type === 'array' && IsRefSchemaObject(obj.items);
|
|
10
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref-schema-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/ref-schema-object.ts"],"names":[],"mappings":";;;AAIA,SAAgB,iBAAiB,CAAC,GAAQ;IACxC,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAFD,8CAEC;AAOD,SAAgB,sBAAsB,CAAC,GAAQ;IAC7C,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC;AAFD,wDAEC"}
|
|
1
|
+
{"version":3,"file":"ref-schema-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/ref-schema-object.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,iBAAiB,CAAC,GAAQ;IACxC,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAFD,8CAEC;AAOD;;;;;;;;;GASG;AACH,SAAgB,sBAAsB,CAAC,GAAQ;IAC7C,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC;AAFD,wDAEC"}
|