@rxap/schematics-open-api 16.0.0-dev.13 → 16.0.0-dev.14
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 +6 -0
- package/README.md +1 -1
- package/package.json +14 -14
- package/src/index.js +29 -26
- package/src/index.js.map +1 -1
- package/src/lib/clear-operation.js +9 -5
- package/src/lib/clear-operation.js.map +1 -1
- package/src/lib/config.js +10 -7
- package/src/lib/config.js.map +1 -1
- package/src/lib/generate-components.js +9 -8
- package/src/lib/generate-components.js.map +1 -1
- package/src/lib/generate-index-exports.js +7 -3
- package/src/lib/generate-index-exports.js.map +1 -1
- package/src/lib/generate-operation.js +26 -24
- package/src/lib/generate-operation.js.map +1 -1
- package/src/lib/generate-parameters.js +18 -16
- package/src/lib/generate-parameters.js.map +1 -1
- package/src/lib/generate-request-body.js +14 -13
- package/src/lib/generate-request-body.js.map +1 -1
- package/src/lib/generate-response.js +14 -13
- package/src/lib/generate-response.js.map +1 -1
- package/src/lib/load-open-api-config.js +23 -16
- package/src/lib/load-open-api-config.js.map +1 -1
- package/src/lib/types.js +9 -3
- package/src/lib/types.js.map +1 -1
- package/src/lib/utilities/any-schema-object.js +5 -1
- package/src/lib/utilities/any-schema-object.js.map +1 -1
- package/src/lib/utilities/get-parameter-type.js +8 -4
- package/src/lib/utilities/get-parameter-type.js.map +1 -1
- package/src/lib/utilities/get-reqeust-body.js +10 -6
- package/src/lib/utilities/get-reqeust-body.js.map +1 -1
- package/src/lib/utilities/get-request-body-type.js +12 -8
- package/src/lib/utilities/get-request-body-type.js.map +1 -1
- package/src/lib/utilities/get-response-type.js +12 -8
- package/src/lib/utilities/get-response-type.js.map +1 -1
- package/src/lib/utilities/get-response.js +7 -3
- package/src/lib/utilities/get-response.js.map +1 -1
- package/src/lib/utilities/has-operation-paramters.js +5 -1
- package/src/lib/utilities/has-operation-paramters.js.map +1 -1
- package/src/lib/utilities/has-operation-request-body.js +5 -1
- package/src/lib/utilities/has-operation-request-body.js.map +1 -1
- package/src/lib/utilities/http-request.js +7 -3
- package/src/lib/utilities/http-request.js.map +1 -1
- package/src/lib/utilities/ignore-operation.js +7 -2
- package/src/lib/utilities/ignore-operation.js.map +1 -1
- package/src/lib/utilities/is-collection-response.js +11 -7
- package/src/lib/utilities/is-collection-response.js.map +1 -1
- package/src/lib/utilities/is-http-method.js +5 -1
- package/src/lib/utilities/is-http-method.js.map +1 -1
- package/src/lib/utilities/is-open-api-schema-from-path.js +7 -3
- package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -1
- package/src/lib/utilities/is-operation-object.js +5 -1
- package/src/lib/utilities/is-operation-object.js.map +1 -1
- package/src/lib/utilities/is-reference-object.js +5 -1
- package/src/lib/utilities/is-reference-object.js.map +1 -1
- package/src/lib/utilities/is-without-parameters.js +5 -1
- package/src/lib/utilities/is-without-parameters.js.map +1 -1
- package/src/schematics/generate/const.js +8 -5
- package/src/schematics/generate/const.js.map +1 -1
- package/src/schematics/generate/create-directive.js +14 -10
- package/src/schematics/generate/create-directive.js.map +1 -1
- package/src/schematics/generate/generate-data-source.js +17 -13
- package/src/schematics/generate/generate-data-source.js.map +1 -1
- package/src/schematics/generate/generate-openapi-provider.js +13 -9
- package/src/schematics/generate/generate-openapi-provider.js.map +1 -1
- package/src/schematics/generate/generate-operation-command.js +112 -105
- package/src/schematics/generate/generate-operation-command.js.map +1 -1
- package/src/schematics/generate/generate-remote-method.js +31 -27
- package/src/schematics/generate/generate-remote-method.js.map +1 -1
- package/src/schematics/generate/index.js +43 -38
- package/src/schematics/generate/index.js.map +1 -1
- package/src/schematics/generate/options.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [16.0.0-dev.14](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@16.0.0-dev.13...@rxap/schematics-open-api@16.0.0-dev.14) (2023-08-17)
|
|
7
|
+
|
|
8
|
+
### Reverts
|
|
9
|
+
|
|
10
|
+
- change from commonjs to es2022 ([747a381](https://gitlab.com/rxap/packages/commit/747a381a090f0a276cf363da61bb19ed0c9cb5b7))
|
|
11
|
+
|
|
6
12
|
# [16.0.0-dev.13](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@16.0.0-dev.12...@rxap/schematics-open-api@16.0.0-dev.13) (2023-08-16)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -17,5 +17,5 @@ yarn add @rxap/schematics-open-api
|
|
|
17
17
|
```
|
|
18
18
|
**Install peer dependencies:**
|
|
19
19
|
```bash
|
|
20
|
-
yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/json-schema-to-typescript@^16.0.0-dev.
|
|
20
|
+
yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/json-schema-to-typescript@^16.0.0-dev.6 @rxap/schematics-ts-morph@^16.0.0-dev.11 @rxap/schematics-utilities@^16.0.0-dev.8 @rxap/utilities@^16.0.0-dev.10 ts-morph@^18.0.0
|
|
21
21
|
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxap/schematics-open-api",
|
|
3
|
-
"version": "16.0.0-dev.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "16.0.0-dev.14",
|
|
4
|
+
"type": "commonjs",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@apidevtools/json-schema-ref-parser": "9.0.9",
|
|
7
7
|
"ignore": "^5.2.4",
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"@angular-devkit/core": "^16.1.4",
|
|
15
15
|
"@angular-devkit/schematics": "^16.1.4",
|
|
16
|
-
"@rxap/json-schema-to-typescript": "^16.0.0-dev.
|
|
17
|
-
"@rxap/schematics-ts-morph": "^16.0.0-dev.
|
|
18
|
-
"@rxap/schematics-utilities": "^16.0.0-dev.
|
|
19
|
-
"@rxap/utilities": "^16.0.0-dev.
|
|
16
|
+
"@rxap/json-schema-to-typescript": "^16.0.0-dev.6",
|
|
17
|
+
"@rxap/schematics-ts-morph": "^16.0.0-dev.11",
|
|
18
|
+
"@rxap/schematics-utilities": "^16.0.0-dev.8",
|
|
19
|
+
"@rxap/utilities": "^16.0.0-dev.10",
|
|
20
20
|
"ts-morph": "^18.0.0",
|
|
21
|
-
"@rxap/node-utilities": "1.1.0-dev.
|
|
22
|
-
"@rxap/workspace-ts-morph": "0.1.0-dev.
|
|
23
|
-
"@rxap/workspace-utilities": "0.1.0-dev.
|
|
21
|
+
"@rxap/node-utilities": "1.1.0-dev.3",
|
|
22
|
+
"@rxap/workspace-ts-morph": "0.1.0-dev.2",
|
|
23
|
+
"@rxap/workspace-utilities": "0.1.0-dev.5"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public",
|
|
@@ -52,23 +52,23 @@
|
|
|
52
52
|
"packageGroup": [
|
|
53
53
|
{
|
|
54
54
|
"package": "@rxap/json-schema-to-typescript",
|
|
55
|
-
"version": "16.0.0-dev.
|
|
55
|
+
"version": "16.0.0-dev.6"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"package": "@rxap/schematics-ts-morph",
|
|
59
|
-
"version": "16.0.0-dev.
|
|
59
|
+
"version": "16.0.0-dev.11"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"package": "@rxap/schematics-utilities",
|
|
63
|
-
"version": "16.0.0-dev.
|
|
63
|
+
"version": "16.0.0-dev.8"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"package": "@rxap/utilities",
|
|
67
|
-
"version": "16.0.0-dev.
|
|
67
|
+
"version": "16.0.0-dev.10"
|
|
68
68
|
}
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "bdda345932cb56c4034526de42761d15700fc56d",
|
|
72
72
|
"main": "./src/index.js",
|
|
73
73
|
"types": "./src/index.d.ts"
|
|
74
74
|
}
|
package/src/index.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/clear-operation"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/config"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/generate-components"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/generate-index-exports"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/generate-operation"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./lib/generate-parameters"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./lib/generate-request-body"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./lib/generate-response"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./lib/load-open-api-config"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./lib/types"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./lib/utilities/any-schema-object"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./lib/utilities/get-parameter-type"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./lib/utilities/get-reqeust-body"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./lib/utilities/get-request-body-type"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./lib/utilities/get-response-type"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./lib/utilities/get-response"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./lib/utilities/has-operation-paramters"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./lib/utilities/has-operation-request-body"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./lib/utilities/http-request"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./lib/utilities/ignore-operation"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./lib/utilities/is-collection-response"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./lib/utilities/is-http-method"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./lib/utilities/is-open-api-schema-from-path"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./lib/utilities/is-operation-object"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./lib/utilities/is-reference-object"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./lib/utilities/is-without-parameters"), exports);
|
|
27
30
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematic/open-api/src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematic/open-api/src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,uDAA6B;AAC7B,oEAA0C;AAC1C,uEAA6C;AAC7C,mEAAyC;AACzC,oEAA0C;AAC1C,sEAA4C;AAC5C,kEAAwC;AACxC,qEAA2C;AAC3C,sDAA4B;AAC5B,4EAAkD;AAClD,6EAAmD;AACnD,2EAAiD;AACjD,gFAAsD;AACtD,4EAAkD;AAClD,uEAA6C;AAC7C,kFAAwD;AACxD,qFAA2D;AAC3D,uEAA6C;AAC7C,2EAAiD;AACjD,iFAAuD;AACvD,yEAA+C;AAC/C,uFAA6D;AAC7D,8EAAoD;AACpD,8EAAoD;AACpD,gFAAsD"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClearOperation = void 0;
|
|
4
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function ClearOperation(pathList, basePath = '') {
|
|
4
7
|
return tree => {
|
|
5
8
|
console.debug(`clear operation for base path '${basePath}' with pathList '${pathList}'`);
|
|
6
9
|
for (const path of pathList) {
|
|
7
|
-
const fullPath = join(basePath, path);
|
|
8
|
-
DeleteDirectory(tree, tree.getDir(fullPath));
|
|
10
|
+
const fullPath = (0, path_1.join)(basePath, path);
|
|
11
|
+
(0, schematics_utilities_1.DeleteDirectory)(tree, tree.getDir(fullPath));
|
|
9
12
|
}
|
|
10
13
|
};
|
|
11
14
|
}
|
|
15
|
+
exports.ClearOperation = ClearOperation;
|
|
12
16
|
//# sourceMappingURL=clear-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-operation.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/clear-operation.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"clear-operation.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/clear-operation.ts"],"names":[],"mappings":";;;AACA,qEAA6D;AAC7D,+BAA4B;AAE5B,SAAgB,cAAc,CAC5B,QAAkB,EAClB,QAAQ,GAAG,EAAE;IAEb,OAAO,IAAI,CAAC,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,kCAAmC,QAAS,oBAAqB,QAAS,GAAG,CAAC,CAAC;QAC7F,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;YAC3B,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACtC,IAAA,sCAAe,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC9C;IACH,CAAC,CAAC;AACJ,CAAC;AAXD,wCAWC"}
|
package/src/lib/config.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REQUEST_BODY_BASE_PATH = exports.REQUEST_BODY_FILE_SUFFIX = exports.RESPONSE_FILE_SUFFIX = exports.RESPONSE_BASE_PATH = exports.PARAMETER_FILE_SUFFIX = exports.PARAMETER_BASE_PATH = exports.COMPONENTS_BASE_PATH = void 0;
|
|
4
|
+
exports.COMPONENTS_BASE_PATH = 'components';
|
|
5
|
+
exports.PARAMETER_BASE_PATH = 'parameters';
|
|
6
|
+
exports.PARAMETER_FILE_SUFFIX = 'parameter';
|
|
7
|
+
exports.RESPONSE_BASE_PATH = 'responses';
|
|
8
|
+
exports.RESPONSE_FILE_SUFFIX = 'response';
|
|
9
|
+
exports.REQUEST_BODY_FILE_SUFFIX = 'request-body';
|
|
10
|
+
exports.REQUEST_BODY_BASE_PATH = 'request-bodies';
|
|
8
11
|
//# sourceMappingURL=config.js.map
|
package/src/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,YAAY,CAAC;AAEpC,QAAA,mBAAmB,GAAG,YAAY,CAAC;AACnC,QAAA,qBAAqB,GAAG,WAAW,CAAC;AAEpC,QAAA,kBAAkB,GAAG,WAAW,CAAC;AACjC,QAAA,oBAAoB,GAAG,UAAU,CAAC;AAElC,QAAA,wBAAwB,GAAG,cAAc,CAAC;AAC1C,QAAA,sBAAsB,GAAG,gBAAgB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateComponents = void 0;
|
|
4
|
+
const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
|
|
5
|
+
const config_1 = require("./config");
|
|
3
6
|
function executeInterfaceBuild(components, project, schema, name) {
|
|
4
|
-
const generator = new TypescriptInterfaceGenerator({
|
|
5
|
-
|
|
6
|
-
components,
|
|
7
|
-
}, {
|
|
8
|
-
basePath: COMPONENTS_BASE_PATH,
|
|
7
|
+
const generator = new json_schema_to_typescript_1.TypescriptInterfaceGenerator(Object.assign(Object.assign({}, schema), { components }), {
|
|
8
|
+
basePath: config_1.COMPONENTS_BASE_PATH,
|
|
9
9
|
addImports: true,
|
|
10
10
|
}, project);
|
|
11
11
|
console.debug(`Generate component interface for: ${name}`);
|
|
@@ -16,11 +16,12 @@ function executeInterfaceBuild(components, project, schema, name) {
|
|
|
16
16
|
console.error(`Failed to generate response interface for: ${name}`, error.message);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
function GenerateComponents(components, project) {
|
|
20
20
|
if (components.schemas) {
|
|
21
21
|
for (const [name, schema] of Object.entries(components.schemas)) {
|
|
22
22
|
executeInterfaceBuild(components, project, schema, name);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
exports.GenerateComponents = GenerateComponents;
|
|
26
27
|
//# sourceMappingURL=generate-components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-components.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-components.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate-components.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-components.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAI/E,qCAAgD;AAEhD,SAAS,qBAAqB,CAC5B,UAAsC,EACtC,OAAgB,EAChB,MAAW,EACX,IAAY;IAGZ,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,MAAM,KACT,UAAU,KAEZ;QACE,QAAQ,EAAE,6BAAoB;QAC9B,UAAU,EAAE,IAAI;KACjB,EACD,OAAO,CACR,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,qCAAsC,IAAK,EAAE,CAAC,CAAC;IAE7D,IAAI;QAEF,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAE3B;IAAC,OAAO,KAAU,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,8CAA+C,IAAK,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;KACtF;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,UAAsC,EACtC,OAAgB;IAGhB,IAAI,UAAU,CAAC,OAAO,EAAE;QACtB,KAAK,MAAM,CAAE,IAAI,EAAE,MAAM,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YACjE,qBAAqB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;SAC1D;KACF;AAEH,CAAC;AAXD,gDAWC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateIndexExports = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
function GenerateIndexExports(project) {
|
|
3
6
|
const exports = [];
|
|
4
7
|
for (const sourceFile of project.getSourceFiles()) {
|
|
5
8
|
sourceFile.getDirectoryPath();
|
|
6
|
-
exports.push(`export * from '.${join('/lib', sourceFile.getDirectoryPath(), sourceFile.getBaseNameWithoutExtension())}';`);
|
|
9
|
+
exports.push(`export * from '.${(0, path_1.join)('/lib', sourceFile.getDirectoryPath(), sourceFile.getBaseNameWithoutExtension())}';`);
|
|
7
10
|
}
|
|
8
11
|
return exports.join('\n');
|
|
9
12
|
}
|
|
13
|
+
exports.GenerateIndexExports = GenerateIndexExports;
|
|
10
14
|
//# sourceMappingURL=generate-index-exports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-index-exports.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-index-exports.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"generate-index-exports.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-index-exports.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAE5B,SAAgB,oBAAoB,CAAC,OAAgB;IAEnD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE;QAEjD,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAE9B,OAAO,CAAC,IAAI,CAAC,mBAAoB,IAAA,WAAI,EACnC,MAAM,EACN,UAAU,CAAC,gBAAgB,EAAE,EAC7B,UAAU,CAAC,2BAA2B,EAAE,CACxC,IAAI,CAAC,CAAC;KAET;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE5B,CAAC;AAlBD,oDAkBC"}
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateOperation = void 0;
|
|
4
|
+
const generate_components_1 = require("./generate-components");
|
|
5
|
+
const generate_parameters_1 = require("./generate-parameters");
|
|
6
|
+
const generate_request_body_1 = require("./generate-request-body");
|
|
7
|
+
const generate_response_1 = require("./generate-response");
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
const ignore_operation_1 = require("./utilities/ignore-operation");
|
|
10
|
+
const is_http_method_1 = require("./utilities/is-http-method");
|
|
11
|
+
const is_operation_object_1 = require("./utilities/is-operation-object");
|
|
9
12
|
function executeGenerator(project, options, path, method, generatorFunction, components, operation) {
|
|
10
13
|
try {
|
|
11
|
-
const parameters = {
|
|
12
|
-
...operation,
|
|
13
|
-
components,
|
|
14
|
+
const parameters = Object.assign(Object.assign({}, operation), { components,
|
|
14
15
|
method,
|
|
15
16
|
path,
|
|
16
17
|
project,
|
|
17
|
-
options
|
|
18
|
-
};
|
|
18
|
+
options });
|
|
19
19
|
generatorFunction(parameters);
|
|
20
20
|
}
|
|
21
21
|
catch (e) {
|
|
22
|
-
console.error(`Failed to generate [${generatorFunction
|
|
22
|
+
console.error(`Failed to generate [${generatorFunction === null || generatorFunction === void 0 ? void 0 : generatorFunction.name}] for operation: ${operation.operationId}`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
function GenerateOperation(openapi, project, options, generatorFunctionList) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const components = (_b = (_a = openapi.components) !== null && _a !== void 0 ? _a : openapi.definitions) !== null && _b !== void 0 ? _b : {};
|
|
28
|
+
(0, generate_components_1.GenerateComponents)(components, project);
|
|
28
29
|
for (const [path, methods] of Object.entries(openapi.paths)) {
|
|
29
30
|
if (methods) {
|
|
30
|
-
for (const method of Object.keys(methods).filter(IsHttpMethod)) {
|
|
31
|
+
for (const method of Object.keys(methods).filter(is_http_method_1.IsHttpMethod)) {
|
|
31
32
|
const operation = methods[method];
|
|
32
|
-
if (IsOperationObject(operation)) {
|
|
33
|
-
if (IgnoreOperation(['hidden'])(operation)) {
|
|
33
|
+
if ((0, is_operation_object_1.IsOperationObject)(operation)) {
|
|
34
|
+
if ((0, ignore_operation_1.IgnoreOperation)(['hidden'])(operation)) {
|
|
34
35
|
console.log(`Ignore operation '${operation.operationId}'`);
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
|
-
if (HasOperationId(operation)) {
|
|
38
|
-
GenerateParameters(operation, project, components);
|
|
39
|
-
GenerateRequestBody(operation, project, components);
|
|
40
|
-
GenerateResponse(operation, project, components);
|
|
38
|
+
if ((0, types_1.HasOperationId)(operation)) {
|
|
39
|
+
(0, generate_parameters_1.GenerateParameters)(operation, project, components);
|
|
40
|
+
(0, generate_request_body_1.GenerateRequestBody)(operation, project, components);
|
|
41
|
+
(0, generate_response_1.GenerateResponse)(operation, project, components);
|
|
41
42
|
for (const generatorFunction of generatorFunctionList) {
|
|
42
43
|
executeGenerator(project, options, path, method, generatorFunction, components, operation);
|
|
43
44
|
}
|
|
@@ -51,4 +52,5 @@ export function GenerateOperation(openapi, project, options, generatorFunctionLi
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
}
|
|
55
|
+
exports.GenerateOperation = GenerateOperation;
|
|
54
56
|
//# sourceMappingURL=generate-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-operation.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-operation.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"generate-operation.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-operation.ts"],"names":[],"mappings":";;;AAEA,+DAA2D;AAC3D,+DAA2D;AAC3D,mEAA8D;AAC9D,2DAAuD;AACvD,mCAMiB;AACjB,mEAA+D;AAC/D,+DAA0D;AAC1D,yEAAoE;AAEpE,SAAS,gBAAgB,CACvB,OAAgB,EAChB,OAAgB,EAChB,IAAY,EACZ,MAAc,EACd,iBAA6C,EAC7C,UAAsC,EACtC,SAA0B;IAE1B,IAAI;QACF,MAAM,UAAU,mCACX,SAAS,KACZ,UAAU;YACV,MAAM;YACN,IAAI;YACJ,OAAO;YACP,OAAO,GACR,CAAC;QACF,iBAAiB,CAAC,UAAU,CAAC,CAAC;KAC/B;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,uBAAwB,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,IAAK,oBAAqB,SAAS,CAAC,WAAY,EAAE,CAAC,CAAC;KAC9G;AACH,CAAC;AAED,SAAgB,iBAAiB,CAC/B,OAA2B,EAC3B,OAAgB,EAChB,OAAgB,EAChB,qBAAmD;;IAEnD,MAAM,UAAU,GAA+B,MAAA,MAAC,OAAe,CAAC,UAAU,mCAAK,OAAe,CAAC,WAAW,mCAAI,EAAE,CAAC;IAEjH,IAAA,wCAAkB,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAExC,KAAK,MAAM,CAAE,IAAI,EAAE,OAAO,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAE7D,IAAI,OAAO,EAAE;YAEX,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,6BAAY,CAAC,EAAE;gBAE9D,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;gBAElC,IAAI,IAAA,uCAAiB,EAAC,SAAS,CAAC,EAAE;oBAEhC,IAAI,IAAA,kCAAe,EAAC,CAAE,QAAQ,CAAE,CAAC,CAAC,SAAS,CAAC,EAAE;wBAE5C,OAAO,CAAC,GAAG,CAAC,qBAAsB,SAAS,CAAC,WAAY,GAAG,CAAC,CAAC;qBAE9D;yBAAM;wBAEL,IAAI,IAAA,sBAAc,EAAC,SAAS,CAAC,EAAE;4BAE7B,IAAA,wCAAkB,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;4BACnD,IAAA,2CAAmB,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;4BACpD,IAAA,oCAAgB,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;4BAEjD,KAAK,MAAM,iBAAiB,IAAI,qBAAqB,EAAE;gCAErD,gBAAgB,CACd,OAAO,EACP,OAAO,EACP,IAAI,EACJ,MAAM,EACN,iBAAiB,EACjB,UAAU,EACV,SAAS,CACV,CAAC;6BAEH;yBAEF;6BAAM;4BACL,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;yBAC3D;qBAEF;iBAEF;aAEF;SAEF;KAEF;AAEH,CAAC;AA5DD,8CA4DC"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateParameters = void 0;
|
|
4
|
+
const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const is_reference_object_1 = require("./utilities/is-reference-object");
|
|
7
|
+
function GenerateParameters(operation, project, components) {
|
|
8
|
+
var _a;
|
|
5
9
|
if (operation.parameters && operation.parameters.length && operation.operationId) {
|
|
6
10
|
const operationId = operation.operationId;
|
|
7
11
|
const properties = {};
|
|
8
12
|
const required = [];
|
|
9
|
-
const parameters = operation.parameters.filter(param => !IsReferenceObject(param) && param.in !== 'header');
|
|
10
|
-
for (const parameter of operation.parameters.filter(param => IsReferenceObject(param))) {
|
|
11
|
-
if (IsReferenceObject(parameter)) {
|
|
13
|
+
const parameters = operation.parameters.filter(param => !(0, is_reference_object_1.IsReferenceObject)(param) && param.in !== 'header');
|
|
14
|
+
for (const parameter of operation.parameters.filter(param => (0, is_reference_object_1.IsReferenceObject)(param))) {
|
|
15
|
+
if ((0, is_reference_object_1.IsReferenceObject)(parameter)) {
|
|
12
16
|
const ref = parameter.$ref;
|
|
13
17
|
const segments = ref.split('/');
|
|
14
18
|
const hashTag = segments.shift();
|
|
@@ -31,14 +35,14 @@ export function GenerateParameters(operation, project, components) {
|
|
|
31
35
|
parameters.push(component[name]);
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
|
-
if (parameters.some(parameter => IsReferenceObject(parameter))) {
|
|
38
|
+
if (parameters.some(parameter => (0, is_reference_object_1.IsReferenceObject)(parameter))) {
|
|
35
39
|
throw new Error('Reference object are not supported in the parameter definition!');
|
|
36
40
|
}
|
|
37
41
|
for (const parameter of parameters) {
|
|
38
|
-
if (IsReferenceObject(parameter)) {
|
|
42
|
+
if ((0, is_reference_object_1.IsReferenceObject)(parameter)) {
|
|
39
43
|
throw new Error('FATAL: Reference object are not supported in the parameter definition!');
|
|
40
44
|
}
|
|
41
|
-
properties[parameter.name] = parameter.schema
|
|
45
|
+
properties[parameter.name] = (_a = parameter.schema) !== null && _a !== void 0 ? _a : { type: 'any' };
|
|
42
46
|
if (parameter.required) {
|
|
43
47
|
required.push(parameter.name);
|
|
44
48
|
}
|
|
@@ -48,12 +52,9 @@ export function GenerateParameters(operation, project, components) {
|
|
|
48
52
|
properties: properties,
|
|
49
53
|
required,
|
|
50
54
|
};
|
|
51
|
-
const generator = new TypescriptInterfaceGenerator({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, {
|
|
55
|
-
suffix: PARAMETER_FILE_SUFFIX,
|
|
56
|
-
basePath: PARAMETER_BASE_PATH,
|
|
55
|
+
const generator = new json_schema_to_typescript_1.TypescriptInterfaceGenerator(Object.assign(Object.assign({}, parametersSchema), { components }), {
|
|
56
|
+
suffix: config_1.PARAMETER_FILE_SUFFIX,
|
|
57
|
+
basePath: config_1.PARAMETER_BASE_PATH,
|
|
57
58
|
addImports: true,
|
|
58
59
|
}, project);
|
|
59
60
|
console.debug(`Generate parameter interface for: ${operationId}`);
|
|
@@ -65,4 +66,5 @@ export function GenerateParameters(operation, project, components) {
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
exports.GenerateParameters = GenerateParameters;
|
|
68
70
|
//# sourceMappingURL=generate-parameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-parameters.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-parameters.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate-parameters.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-parameters.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAG/E,qCAGkB;AAElB,yEAAoE;AAEpE,SAAgB,kBAAkB,CAChC,SAAoC,EACpC,OAAgB,EAChB,UAAsC;;IAGtC,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,IAAI,SAAS,CAAC,WAAW,EAAE;QAEhF,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,UAAU,GAAyF,EAAE,CAAC;QAC5G,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAA,uCAAiB,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;QAE5G,KAAK,MAAM,SAAS,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAA,uCAAiB,EAAC,KAAK,CAAC,CAAC,EAAE;YACtF,IAAI,IAAA,uCAAiB,EAAC,SAAS,CAAC,EAAE;gBAChC,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC;gBAC3B,MAAM,QAAQ,GAAa,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACjC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAC9B,IAAI,OAAO,KAAK,GAAG,EAAE;oBACnB,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,GAAG,CAAC,CAAC;iBAChD;gBACD,IAAI,iBAAiB,KAAK,YAAY,EAAE;oBACtC,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,GAAG,CAAC,CAAC;iBAChD;gBACD,IAAI,CAAC,KAAK,IAAI,CAAE,UAAkB,CAAC,KAAK,CAAC,EAAE;oBACzC,MAAM,IAAI,KAAK,CAAC,UAAW,KAAM,uDAAwD,GAAI,EAAE,CAAC,CAAC;iBAClG;gBACD,MAAM,SAAS,GAAI,UAAkB,CAAC,KAAK,CAAC,CAAC;gBAC7C,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;oBAC7B,MAAM,IAAI,KAAK,CAAC,mBAAoB,IAAK,eAAgB,KAAM,cAAe,GAAI,EAAE,CAAC,CAAC;iBACvF;gBACD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;aAClC;SACF;QAED,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,IAAA,uCAAiB,EAAC,SAAS,CAAC,CAAC,EAAE;YAC9D,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;SACpF;QAED,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAElC,IAAI,IAAA,uCAAiB,EAAC,SAAS,CAAC,EAAE;gBAChC,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;aAC3F;YAED,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAA,SAAS,CAAC,MAAM,mCAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YAEjE,IAAI,SAAS,CAAC,QAAQ,EAAE;gBACtB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;aAC/B;SAEF;QAED,MAAM,gBAAgB,GAA2B;YAC/C,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,UAAiB;YAC7B,QAAQ;SACT,CAAC;QAEF,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,gBAAgB,KACnB,UAAU,KAEZ;YACE,MAAM,EAAE,8BAAqB;YAC7B,QAAQ,EAAE,4BAAmB;YAC7B,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,qCAAsC,WAAY,EAAE,CAAC,CAAC;QAEpE,IAAI;YAEF,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SAElC;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,+CAAgD,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;SAC9F;KAEF;AAEH,CAAC;AAzFD,gDAyFC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateRequestBody = void 0;
|
|
4
|
+
const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const any_schema_object_1 = require("./utilities/any-schema-object");
|
|
7
|
+
const get_reqeust_body_1 = require("./utilities/get-reqeust-body");
|
|
8
|
+
function GenerateRequestBody(operation, project, components) {
|
|
9
|
+
const requestBodySchema = (0, get_reqeust_body_1.GetRequestBody)(operation);
|
|
10
|
+
if (requestBodySchema && !(0, any_schema_object_1.IsAnySchemaObject)(requestBodySchema) && operation.operationId) {
|
|
8
11
|
const operationId = operation.operationId;
|
|
9
|
-
const generator = new TypescriptInterfaceGenerator({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, {
|
|
13
|
-
suffix: REQUEST_BODY_FILE_SUFFIX,
|
|
14
|
-
basePath: REQUEST_BODY_BASE_PATH,
|
|
12
|
+
const generator = new json_schema_to_typescript_1.TypescriptInterfaceGenerator(Object.assign(Object.assign({}, requestBodySchema), { components }), {
|
|
13
|
+
suffix: config_1.REQUEST_BODY_FILE_SUFFIX,
|
|
14
|
+
basePath: config_1.REQUEST_BODY_BASE_PATH,
|
|
15
15
|
addImports: true,
|
|
16
16
|
}, project);
|
|
17
17
|
console.debug(`Generate request body interface for: ${operationId}`);
|
|
@@ -23,4 +23,5 @@ export function GenerateRequestBody(operation, project, components) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
exports.GenerateRequestBody = GenerateRequestBody;
|
|
26
27
|
//# sourceMappingURL=generate-request-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-request-body.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-request-body.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate-request-body.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-request-body.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAG/E,qCAGkB;AAClB,qEAAkE;AAClE,mEAA8D;AAE9D,SAAgB,mBAAmB,CACjC,SAAoC,EACpC,OAAgB,EAChB,UAAsC;IAGtC,MAAM,iBAAiB,GAAG,IAAA,iCAAc,EAAC,SAAS,CAAC,CAAC;IAEpD,IAAI,iBAAiB,IAAI,CAAC,IAAA,qCAAiB,EAAC,iBAAiB,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE;QACvF,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,iBAAiB,KACpB,UAAU,KAEZ;YACE,MAAM,EAAE,iCAAwB;YAChC,QAAQ,EAAE,+BAAsB;YAChC,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,wCAAyC,WAAY,EAAE,CAAC,CAAC;QAEvE,IAAI;YAEF,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SAElC;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,kDAAmD,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;SACjG;KAEF;AAEH,CAAC;AApCD,kDAoCC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateResponse = void 0;
|
|
4
|
+
const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const any_schema_object_1 = require("./utilities/any-schema-object");
|
|
7
|
+
const get_response_1 = require("./utilities/get-response");
|
|
8
|
+
function GenerateResponse(operation, project, components) {
|
|
9
|
+
const response = (0, get_response_1.GetResponse)(operation);
|
|
10
|
+
if (response && !(0, any_schema_object_1.IsAnySchemaObject)(response) && operation.operationId) {
|
|
8
11
|
const operationId = operation.operationId;
|
|
9
|
-
const generator = new TypescriptInterfaceGenerator({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, {
|
|
13
|
-
suffix: RESPONSE_FILE_SUFFIX,
|
|
14
|
-
basePath: RESPONSE_BASE_PATH,
|
|
12
|
+
const generator = new json_schema_to_typescript_1.TypescriptInterfaceGenerator(Object.assign(Object.assign({}, response), { components }), {
|
|
13
|
+
suffix: config_1.RESPONSE_FILE_SUFFIX,
|
|
14
|
+
basePath: config_1.RESPONSE_BASE_PATH,
|
|
15
15
|
addImports: true,
|
|
16
16
|
}, project);
|
|
17
17
|
console.debug(`Generate response interface for: ${operationId}`);
|
|
@@ -23,4 +23,5 @@ export function GenerateResponse(operation, project, components) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
exports.GenerateResponse = GenerateResponse;
|
|
26
27
|
//# sourceMappingURL=generate-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-response.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-response.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate-response.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/generate-response.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAG/E,qCAGkB;AAClB,qEAAkE;AAClE,2DAAuD;AAEvD,SAAgB,gBAAgB,CAC9B,SAAoC,EACpC,OAAgB,EAChB,UAAsC;IAGtC,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;IAExC,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE;QACrE,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,QAAQ,KACX,UAAU,KAEZ;YACE,MAAM,EAAE,6BAAoB;YAC5B,QAAQ,EAAE,2BAAkB;YAC5B,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,oCAAqC,WAAY,EAAE,CAAC,CAAC;QAEnE,IAAI;YAEF,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SAElC;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,8CAA+C,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;SAC7F;KAEF;AAEH,CAAC;AApCD,4CAoCC"}
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoadOpenApiConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const is_open_api_schema_from_path_1 = require("./utilities/is-open-api-schema-from-path");
|
|
6
|
+
const http_request_1 = require("./utilities/http-request");
|
|
7
|
+
function LoadOpenApiConfig(host, options) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
let openapi;
|
|
10
|
+
if ((0, is_open_api_schema_from_path_1.IsOpenApiSchemaFromPath)(options)) {
|
|
11
|
+
if (!host.exists(options.path)) {
|
|
12
|
+
throw new Error('Could not find openapi file.');
|
|
13
|
+
}
|
|
14
|
+
openapi = JSON.parse(host.read(options.path).toString('utf-8'));
|
|
8
15
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
return openapi;
|
|
16
|
+
else if (options.url) {
|
|
17
|
+
openapi = yield (0, http_request_1.HttpRequest)(options.url);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
throw new Error('Either the path or url must be defined');
|
|
21
|
+
}
|
|
22
|
+
return openapi;
|
|
23
|
+
});
|
|
18
24
|
}
|
|
25
|
+
exports.LoadOpenApiConfig = LoadOpenApiConfig;
|
|
19
26
|
//# sourceMappingURL=load-open-api-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-open-api-config.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/load-open-api-config.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"load-open-api-config.js","sourceRoot":"","sources":["../../../../../../packages/schematic/open-api/src/lib/load-open-api-config.ts"],"names":[],"mappings":";;;;AAAA,2FAAmF;AACnF,2DAAuD;AAKvD,SAAsB,iBAAiB,CAAC,IAAU,EAAE,OAAsB;;QACxE,IAAI,OAA2B,CAAC;QAChC,IAAI,IAAA,sDAAuB,EAAC,OAAO,CAAC,EAAE;YAEpC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAC9B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACjD;YAED,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SAElE;aAAM,IAAI,OAAO,CAAC,GAAG,EAAE;YAEtB,OAAO,GAAG,MAAM,IAAA,0BAAW,EAAqB,OAAO,CAAC,GAAG,CAAC,CAAC;SAE9D;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC3D;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAlBD,8CAkBC"}
|