@rxap/schematics-open-api 13.0.0-next.2 → 13.0.0-next.5
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 +33 -0
- package/README.md +1 -1
- package/package.json +10 -3
- package/src/index.js +26 -29
- package/src/index.js.map +1 -1
- package/src/lib/clear-operation.js +3 -7
- package/src/lib/clear-operation.js.map +1 -1
- package/src/lib/config.js +7 -10
- package/src/lib/config.js.map +1 -1
- package/src/lib/generate-components.js +6 -10
- package/src/lib/generate-components.js.map +1 -1
- package/src/lib/generate-index-exports.js +3 -7
- package/src/lib/generate-index-exports.js.map +1 -1
- package/src/lib/generate-operation.js +20 -24
- package/src/lib/generate-operation.js.map +1 -1
- package/src/lib/generate-parameters.js +35 -14
- package/src/lib/generate-parameters.js.map +1 -1
- package/src/lib/generate-request-body.js +10 -14
- package/src/lib/generate-request-body.js.map +1 -1
- package/src/lib/generate-response.js +10 -14
- package/src/lib/generate-response.js.map +1 -1
- package/src/lib/load-open-api-config.js +7 -11
- package/src/lib/load-open-api-config.js.map +1 -1
- package/src/lib/types.js +3 -9
- package/src/lib/types.js.map +1 -1
- package/src/lib/utilities/any-schema-object.js +1 -5
- package/src/lib/utilities/any-schema-object.js.map +1 -1
- package/src/lib/utilities/get-parameter-type.js +4 -8
- package/src/lib/utilities/get-parameter-type.js.map +1 -1
- package/src/lib/utilities/get-reqeust-body.js +6 -10
- package/src/lib/utilities/get-reqeust-body.js.map +1 -1
- package/src/lib/utilities/get-request-body-type.js +8 -12
- package/src/lib/utilities/get-request-body-type.js.map +1 -1
- package/src/lib/utilities/get-response-type.js +8 -12
- package/src/lib/utilities/get-response-type.js.map +1 -1
- package/src/lib/utilities/get-response.js +3 -7
- package/src/lib/utilities/get-response.js.map +1 -1
- package/src/lib/utilities/has-operation-paramters.js +1 -5
- package/src/lib/utilities/has-operation-paramters.js.map +1 -1
- package/src/lib/utilities/has-operation-request-body.js +1 -5
- package/src/lib/utilities/has-operation-request-body.js.map +1 -1
- package/src/lib/utilities/http-request.js +3 -7
- package/src/lib/utilities/http-request.js.map +1 -1
- package/src/lib/utilities/ignore-operation.js +1 -5
- package/src/lib/utilities/ignore-operation.js.map +1 -1
- package/src/lib/utilities/is-collection-response.js +7 -11
- package/src/lib/utilities/is-collection-response.js.map +1 -1
- package/src/lib/utilities/is-http-method.js +1 -5
- package/src/lib/utilities/is-http-method.js.map +1 -1
- package/src/lib/utilities/is-open-api-schema-from-path.js +1 -5
- package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -1
- package/src/lib/utilities/is-operation-object.js +1 -5
- package/src/lib/utilities/is-operation-object.js.map +1 -1
- package/src/lib/utilities/is-reference-object.js +1 -5
- package/src/lib/utilities/is-reference-object.js.map +1 -1
- package/src/lib/utilities/is-without-parameters.js +1 -5
- package/src/lib/utilities/is-without-parameters.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
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
|
+
# [13.0.0-next.5](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@13.0.0-next.4...@rxap/schematics-open-api@13.0.0-next.5) (2022-08-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* support node16 module resolution ([f8975a1](https://gitlab.com/rxap/packages/commit/f8975a160b07276e72db3f6745c207ac4b4632f4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [13.0.0-next.4](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@13.0.0-next.3...@rxap/schematics-open-api@13.0.0-next.4) (2022-05-23)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* update typescript generator package ([3bd311c](https://gitlab.com/rxap/packages/commit/3bd311ca5697bdbed598cdf8c9ec44f297fd2215))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [13.0.0-next.3](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@13.0.0-next.2...@rxap/schematics-open-api@13.0.0-next.3) (2022-05-09)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* convert ref into object for parameters ([81f8f9e](https://gitlab.com/rxap/packages/commit/81f8f9e02b8feffe24ca43ee0684740bd59e0f88))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
6
39
|
# [13.0.0-next.2](https://gitlab.com/rxap/packages/compare/@rxap/schematics-open-api@13.0.0-next.1...@rxap/schematics-open-api@13.0.0-next.2) (2022-05-09)
|
|
7
40
|
|
|
8
41
|
**Note:** Version bump only for package @rxap/schematics-open-api
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxap/schematics-open-api",
|
|
3
|
-
"version": "13.0.0-next.
|
|
3
|
+
"version": "13.0.0-next.5",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"tslib": "^2.3.1"
|
|
5
|
+
"tslib": "^2.3.1",
|
|
6
|
+
"semver": "^7.3.5"
|
|
6
7
|
},
|
|
7
8
|
"schematics": "./schematics/collection.json",
|
|
8
9
|
"ng-update": {
|
|
9
10
|
"migrations": "./migration.json",
|
|
10
11
|
"packageGroup": [
|
|
12
|
+
"@rxap/json-schema-to-typescript",
|
|
11
13
|
"@rxap/schematics-open-api",
|
|
12
14
|
"@rxap/schematics-utilities"
|
|
13
15
|
]
|
|
@@ -35,6 +37,11 @@
|
|
|
35
37
|
"url": "https://gitlab.com/rxap/plugins/-/issues",
|
|
36
38
|
"email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
|
|
37
39
|
},
|
|
38
|
-
"peerDependencies": {
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@rxap/json-schema-to-typescript": "^13.0.0-next.1",
|
|
42
|
+
"@rxap/schematics-utilities": "^13.0.0-next.2",
|
|
43
|
+
"openapi-types": "^10.0.0",
|
|
44
|
+
"ts-morph": "^13.0.3"
|
|
45
|
+
},
|
|
39
46
|
"typings": "./src/index.d.ts"
|
|
40
47
|
}
|
package/src/index.js
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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);
|
|
1
|
+
export * from './lib/clear-operation';
|
|
2
|
+
export * from './lib/config';
|
|
3
|
+
export * from './lib/generate-components';
|
|
4
|
+
export * from './lib/generate-operation';
|
|
5
|
+
export * from './lib/generate-parameters';
|
|
6
|
+
export * from './lib/generate-request-body';
|
|
7
|
+
export * from './lib/generate-index-exports';
|
|
8
|
+
export * from './lib/generate-response';
|
|
9
|
+
export * from './lib/load-open-api-config';
|
|
10
|
+
export * from './lib/types';
|
|
14
11
|
// region utilities
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
export * from './lib/utilities/any-schema-object';
|
|
13
|
+
export * from './lib/utilities/get-parameter-type';
|
|
14
|
+
export * from './lib/utilities/get-reqeust-body';
|
|
15
|
+
export * from './lib/utilities/get-request-body-type';
|
|
16
|
+
export * from './lib/utilities/get-response';
|
|
17
|
+
export * from './lib/utilities/get-response-type';
|
|
18
|
+
export * from './lib/utilities/has-operation-paramters';
|
|
19
|
+
export * from './lib/utilities/has-operation-request-body';
|
|
20
|
+
export * from './lib/utilities/http-request';
|
|
21
|
+
export * from './lib/utilities/ignore-operation';
|
|
22
|
+
export * from './lib/utilities/is-collection-response';
|
|
23
|
+
export * from './lib/utilities/is-http-method';
|
|
24
|
+
export * from './lib/utilities/is-open-api-schema-from-path';
|
|
25
|
+
export * from './lib/utilities/is-reference-object';
|
|
26
|
+
export * from './lib/utilities/is-without-parameters';
|
|
27
|
+
export * from './lib/utilities/is-operation-object';
|
|
31
28
|
// endregion
|
|
32
29
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/open-api/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/open-api/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAE5B,mBAAmB;AAEnB,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AAEpD,YAAY"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ClearOperation = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
function ClearOperation(pathList, basePath = '') {
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
export function ClearOperation(pathList, basePath = '') {
|
|
6
3
|
return tree => {
|
|
7
4
|
console.debug(`clear operation for base path '${basePath}' with pathList '${pathList}'`);
|
|
8
5
|
for (const path of pathList) {
|
|
9
|
-
const fullPath =
|
|
6
|
+
const fullPath = join(basePath, path);
|
|
10
7
|
if (tree.exists(fullPath)) {
|
|
11
8
|
tree.delete(fullPath);
|
|
12
9
|
}
|
|
@@ -16,5 +13,4 @@ function ClearOperation(pathList, basePath = '') {
|
|
|
16
13
|
}
|
|
17
14
|
};
|
|
18
15
|
}
|
|
19
|
-
exports.ClearOperation = ClearOperation;
|
|
20
16
|
//# sourceMappingURL=clear-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-operation.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/clear-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clear-operation.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/clear-operation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,UAAU,cAAc,CAC5B,QAAkB,EAClB,WAAmB,EAAE;IAErB,OAAO,IAAI,CAAC,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,kCAAkC,QAAQ,oBAAoB,QAAQ,GAAG,CAAC,CAAC;QACzF,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACtC,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;gBACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;aACvB;iBAAM;gBACL,OAAO,CAAC,KAAK,CAAC,SAAS,QAAQ,oBAAoB,CAAC,CAAC;aACtD;SACF;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/src/lib/config.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.RESPONSE_FILE_SUFFIX = 'response';
|
|
9
|
-
exports.REQUEST_BODY_FILE_SUFFIX = 'request-body';
|
|
10
|
-
exports.REQUEST_BODY_BASE_PATH = 'request-bodies';
|
|
1
|
+
export const COMPONENTS_BASE_PATH = 'components';
|
|
2
|
+
export const PARAMETER_BASE_PATH = 'parameters';
|
|
3
|
+
export const PARAMETER_FILE_SUFFIX = 'parameter';
|
|
4
|
+
export const RESPONSE_BASE_PATH = 'responses';
|
|
5
|
+
export const RESPONSE_FILE_SUFFIX = 'response';
|
|
6
|
+
export const REQUEST_BODY_FILE_SUFFIX = 'request-body';
|
|
7
|
+
export const REQUEST_BODY_BASE_PATH = 'request-bodies';
|
|
11
8
|
//# sourceMappingURL=config.js.map
|
package/src/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,mBAAmB,GAAK,YAAY,CAAC;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAAK,WAAW,CAAC;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAK,gBAAgB,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const config_1 = require("./config");
|
|
7
|
-
function GenerateComponents(components, project) {
|
|
8
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { TypescriptInterfaceGenerator } from '@rxap/json-schema-to-typescript';
|
|
3
|
+
import { COMPONENTS_BASE_PATH } from './config';
|
|
4
|
+
export function GenerateComponents(components, project) {
|
|
5
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9
6
|
if (components.schemas) {
|
|
10
7
|
for (const [name, schema] of Object.entries(components.schemas)) {
|
|
11
|
-
const generator = new
|
|
8
|
+
const generator = new TypescriptInterfaceGenerator(Object.assign(Object.assign({}, schema), { components }), { basePath: COMPONENTS_BASE_PATH }, project);
|
|
12
9
|
console.debug(`Generate component interface for: ${name}`);
|
|
13
10
|
try {
|
|
14
11
|
yield generator.build(name);
|
|
@@ -20,5 +17,4 @@ function GenerateComponents(components, project) {
|
|
|
20
17
|
}
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
|
-
exports.GenerateComponents = GenerateComponents;
|
|
24
20
|
//# sourceMappingURL=generate-components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-components.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-components.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-components.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,UAAgB,kBAAkB,CACtC,UAAsC,EACtC,OAAgB;;QAGhB,IAAI,UAAU,CAAC,OAAO,EAAE;YACtB,KAAK,MAAM,CAAE,IAAI,EAAE,MAAM,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;gBAEjE,MAAM,SAAS,GAAG,IAAI,4BAA4B,iCAC3C,MAAM,KAAE,UAAU,KACvB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAClC,OAAO,CACR,CAAC;gBAEF,OAAO,CAAC,KAAK,CAAC,qCAAqC,IAAI,EAAE,CAAC,CAAC;gBAE3D,IAAI;oBAEF,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBAE7B;gBAAC,OAAO,KAAK,EAAE;oBACd,OAAO,CAAC,KAAK,CAAC,8CAA8C,IAAI,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;iBACpF;aAEF;SACF;IAEH,CAAC;CAAA"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GenerateIndexExports = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
function GenerateIndexExports(project) {
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
export function GenerateIndexExports(project) {
|
|
6
3
|
const exports = [];
|
|
7
4
|
for (let sourceFile of project.getSourceFiles()) {
|
|
8
5
|
sourceFile.getDirectoryPath();
|
|
9
|
-
exports.push(`export * from '.${
|
|
6
|
+
exports.push(`export * from '.${join('/lib', sourceFile.getDirectoryPath(), sourceFile.getBaseNameWithoutExtension())}';`);
|
|
10
7
|
}
|
|
11
8
|
return exports.join('\n');
|
|
12
9
|
}
|
|
13
|
-
exports.GenerateIndexExports = GenerateIndexExports;
|
|
14
10
|
//# sourceMappingURL=generate-index-exports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-index-exports.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-index-exports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-index-exports.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-index-exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IAEnD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,IAAI,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE;QAE/C,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAE9B,OAAO,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,gBAAgB,EAAE,EAAE,UAAU,CAAC,2BAA2B,EAAE,CAAC,IAAI,CAAC,CAAC;KAE5H;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE5B,CAAC"}
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const generate_response_1 = require("./generate-response");
|
|
12
|
-
const generate_components_1 = require("./generate-components");
|
|
13
|
-
function GenerateOperation(openapi, project, options, generatorFunctionList) {
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { IsHttpMethod } from './utilities/is-http-method';
|
|
3
|
+
import { IgnoreOperation } from './utilities/ignore-operation';
|
|
4
|
+
import { IsOperationObject } from './utilities/is-operation-object';
|
|
5
|
+
import { HasOperationId } from './types';
|
|
6
|
+
import { GenerateParameters } from './generate-parameters';
|
|
7
|
+
import { GenerateRequestBody } from './generate-request-body';
|
|
8
|
+
import { GenerateResponse } from './generate-response';
|
|
9
|
+
import { GenerateComponents } from './generate-components';
|
|
10
|
+
export function GenerateOperation(openapi, project, options, generatorFunctionList) {
|
|
14
11
|
var _a, _b;
|
|
15
|
-
return
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
13
|
const components = (_b = (_a = openapi.components) !== null && _a !== void 0 ? _a : openapi.definitions) !== null && _b !== void 0 ? _b : {};
|
|
17
|
-
yield
|
|
14
|
+
yield GenerateComponents(components, project);
|
|
18
15
|
for (const [path, methods] of Object.entries(openapi.paths)) {
|
|
19
16
|
if (methods) {
|
|
20
|
-
for (const method of Object.keys(methods).filter(
|
|
17
|
+
for (const method of Object.keys(methods).filter(IsHttpMethod)) {
|
|
21
18
|
const operation = methods[method];
|
|
22
|
-
if (
|
|
23
|
-
if (
|
|
19
|
+
if (IsOperationObject(operation)) {
|
|
20
|
+
if (IgnoreOperation(['hidden'])(operation)) {
|
|
24
21
|
console.log(`Ignore operation '${operation.operationId}'`);
|
|
25
22
|
}
|
|
26
23
|
else {
|
|
27
|
-
if (
|
|
28
|
-
yield
|
|
29
|
-
yield
|
|
30
|
-
yield
|
|
24
|
+
if (HasOperationId(operation)) {
|
|
25
|
+
yield GenerateParameters(operation, project, components);
|
|
26
|
+
yield GenerateRequestBody(operation, project, components);
|
|
27
|
+
yield GenerateResponse(operation, project, components);
|
|
31
28
|
for (const generatorFunction of generatorFunctionList) {
|
|
32
29
|
try {
|
|
33
30
|
const parameters = Object.assign(Object.assign({}, operation), { components,
|
|
@@ -38,7 +35,7 @@ function GenerateOperation(openapi, project, options, generatorFunctionList) {
|
|
|
38
35
|
yield generatorFunction(parameters);
|
|
39
36
|
}
|
|
40
37
|
catch (e) {
|
|
41
|
-
console.error(`Failed to generate [${generatorFunction}] for operation: ${operation.operationId}`);
|
|
38
|
+
console.error(`Failed to generate [${generatorFunction === null || generatorFunction === void 0 ? void 0 : generatorFunction.name}] for operation: ${operation.operationId}`);
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
}
|
|
@@ -52,5 +49,4 @@ function GenerateOperation(openapi, project, options, generatorFunctionList) {
|
|
|
52
49
|
}
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
|
-
exports.GenerateOperation = GenerateOperation;
|
|
56
52
|
//# sourceMappingURL=generate-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-operation.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-operation.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-operation.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EACL,cAAc,EAIf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,UAAgB,iBAAiB,CACrC,OAA2B,EAC3B,OAAgB,EAChB,OAAgB,EAChB,qBAAmD;;;QAEnD,MAAM,UAAU,GAA+B,MAAA,MAAC,OAAe,CAAC,UAAU,mCAAK,OAAe,CAAC,WAAW,mCAAI,EAAE,CAAC;QAEjH,MAAM,kBAAkB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAE9C,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAE3D,IAAI,OAAO,EAAE;gBAEX,KAAK,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("./config");
|
|
7
|
-
const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
|
|
8
|
-
function GenerateParameters(operation, project, components) {
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { IsReferenceObject } from './utilities/is-reference-object';
|
|
3
|
+
import { PARAMETER_BASE_PATH, PARAMETER_FILE_SUFFIX } from './config';
|
|
4
|
+
import { TypescriptInterfaceGenerator } from '@rxap/json-schema-to-typescript';
|
|
5
|
+
export function GenerateParameters(operation, project, components) {
|
|
9
6
|
var _a;
|
|
10
|
-
return
|
|
7
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11
8
|
if (operation.parameters && operation.parameters.length && operation.operationId) {
|
|
12
9
|
const operationId = operation.operationId;
|
|
13
10
|
const properties = {};
|
|
14
11
|
const required = [];
|
|
15
|
-
|
|
12
|
+
const parameters = operation.parameters.filter(param => !IsReferenceObject(param) && param.in !== 'header');
|
|
13
|
+
for (const parameter of operation.parameters.filter(param => IsReferenceObject(param))) {
|
|
14
|
+
if (IsReferenceObject(parameter)) {
|
|
15
|
+
const ref = parameter.$ref;
|
|
16
|
+
const segments = ref.split('/');
|
|
17
|
+
const hashTag = segments.shift();
|
|
18
|
+
const componentsSegment = segments.shift();
|
|
19
|
+
const group = segments.shift();
|
|
20
|
+
const name = segments.shift();
|
|
21
|
+
if (hashTag !== '#') {
|
|
22
|
+
throw new Error('Could not parse ref: ' + ref);
|
|
23
|
+
}
|
|
24
|
+
if (componentsSegment !== 'components') {
|
|
25
|
+
throw new Error('Could not parse ref: ' + ref);
|
|
26
|
+
}
|
|
27
|
+
if (!group || !components[group]) {
|
|
28
|
+
throw new Error(`Group '${group}' does not exist in the components object with ref: ${ref}`);
|
|
29
|
+
}
|
|
30
|
+
const component = components[group];
|
|
31
|
+
if (!name || !component[name]) {
|
|
32
|
+
throw new Error(`Could not find '${name}' in group '${group} with ref: ${ref}`);
|
|
33
|
+
}
|
|
34
|
+
parameters.push(component[name]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (parameters.some(parameter => IsReferenceObject(parameter))) {
|
|
16
38
|
throw new Error('Reference object are not supported in the parameter definition!');
|
|
17
39
|
}
|
|
18
|
-
for (const parameter of
|
|
19
|
-
if (
|
|
40
|
+
for (const parameter of parameters) {
|
|
41
|
+
if (IsReferenceObject(parameter)) {
|
|
20
42
|
throw new Error('FATAL: Reference object are not supported in the parameter definition!');
|
|
21
43
|
}
|
|
22
44
|
properties[parameter.name] = (_a = parameter.schema) !== null && _a !== void 0 ? _a : { type: 'any' };
|
|
@@ -29,7 +51,7 @@ function GenerateParameters(operation, project, components) {
|
|
|
29
51
|
properties: properties,
|
|
30
52
|
required
|
|
31
53
|
};
|
|
32
|
-
const generator = new
|
|
54
|
+
const generator = new TypescriptInterfaceGenerator(Object.assign(Object.assign({}, parametersSchema), { components }), { suffix: PARAMETER_FILE_SUFFIX, basePath: PARAMETER_BASE_PATH }, project);
|
|
33
55
|
console.debug(`Generate parameter interface for: ${operationId}`);
|
|
34
56
|
try {
|
|
35
57
|
yield generator.build(operationId);
|
|
@@ -40,5 +62,4 @@ function GenerateParameters(operation, project, components) {
|
|
|
40
62
|
}
|
|
41
63
|
});
|
|
42
64
|
}
|
|
43
|
-
exports.GenerateParameters = GenerateParameters;
|
|
44
65
|
//# sourceMappingURL=generate-parameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-parameters.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-parameters.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-parameters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAI/E,MAA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C,KAAK,CAAC,qCAAqC,WAAW,EAAE,CAAC,CAAC;YAElE,IAAI;gBAEF,MAAM,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;aAEpC;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,+CAA+C,WAAW,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aAC5F;SAEF;;CAEF"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const requestBodySchema = get_reqeust_body_1.GetRequestBody(operation);
|
|
12
|
-
if (!any_schema_object_1.IsAnySchemaObject(requestBodySchema) && operation.operationId) {
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { TypescriptInterfaceGenerator } from '@rxap/json-schema-to-typescript';
|
|
3
|
+
import { IsAnySchemaObject } from './utilities/any-schema-object';
|
|
4
|
+
import { REQUEST_BODY_BASE_PATH, REQUEST_BODY_FILE_SUFFIX } from './config';
|
|
5
|
+
import { GetRequestBody } from './utilities/get-reqeust-body';
|
|
6
|
+
export function GenerateRequestBody(operation, project, components) {
|
|
7
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const requestBodySchema = GetRequestBody(operation);
|
|
9
|
+
if (!IsAnySchemaObject(requestBodySchema) && operation.operationId) {
|
|
13
10
|
const operationId = operation.operationId;
|
|
14
|
-
const generator = new
|
|
11
|
+
const generator = new TypescriptInterfaceGenerator(Object.assign(Object.assign({}, requestBodySchema), { components }), { suffix: REQUEST_BODY_FILE_SUFFIX, basePath: REQUEST_BODY_BASE_PATH }, project);
|
|
15
12
|
console.debug(`Generate request body interface for: ${operationId}`);
|
|
16
13
|
try {
|
|
17
14
|
yield generator.build(operationId);
|
|
@@ -22,5 +19,4 @@ function GenerateRequestBody(operation, project, components) {
|
|
|
22
19
|
}
|
|
23
20
|
});
|
|
24
21
|
}
|
|
25
|
-
exports.GenerateRequestBody = GenerateRequestBody;
|
|
26
22
|
//# sourceMappingURL=generate-request-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-request-body.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-request-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-request-body.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-request-body.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,UAAgB,mBAAmB,CACvC,SAAoC,EACpC,OAAgB,EAChB,UAAsC;;QAGtC,MAAM,iBAAiB,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;QAEpD,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE;YAClE,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;YAE1C,MAAM,SAAS,GAAG,IAAI,4BAA4B,iCAC3C,iBAAiB,KAAE,UAAU,KAClC,EAAE,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,EACtE,OAAO,CACR,CAAC;YAEF,OAAO,CAAC,KAAK,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;YAErE,IAAI;gBAEF,MAAM,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;aAEpC;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,kDAAkD,WAAW,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aAC/F;SAEF;IAEH,CAAC;CAAA"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const response = get_response_1.GetResponse(operation);
|
|
12
|
-
if (!any_schema_object_1.IsAnySchemaObject(response) && operation.operationId) {
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { TypescriptInterfaceGenerator } from '@rxap/json-schema-to-typescript';
|
|
3
|
+
import { RESPONSE_BASE_PATH, RESPONSE_FILE_SUFFIX } from './config';
|
|
4
|
+
import { IsAnySchemaObject } from './utilities/any-schema-object';
|
|
5
|
+
import { GetResponse } from './utilities/get-response';
|
|
6
|
+
export function GenerateResponse(operation, project, components) {
|
|
7
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const response = GetResponse(operation);
|
|
9
|
+
if (!IsAnySchemaObject(response) && operation.operationId) {
|
|
13
10
|
const operationId = operation.operationId;
|
|
14
|
-
const generator = new
|
|
11
|
+
const generator = new TypescriptInterfaceGenerator(Object.assign(Object.assign({}, response), { components }), { suffix: RESPONSE_FILE_SUFFIX, basePath: RESPONSE_BASE_PATH }, project);
|
|
15
12
|
console.debug(`Generate response interface for: ${operationId}`);
|
|
16
13
|
try {
|
|
17
14
|
yield generator.build(operationId);
|
|
@@ -22,5 +19,4 @@ function GenerateResponse(operation, project, components) {
|
|
|
22
19
|
}
|
|
23
20
|
});
|
|
24
21
|
}
|
|
25
|
-
exports.GenerateResponse = GenerateResponse;
|
|
26
22
|
//# sourceMappingURL=generate-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-response.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-response.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/generate-response.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,UAAgB,gBAAgB,CACpC,SAAoC,EACpC,OAAgB,EAChB,UAAsC;;QAGtC,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;QAExC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE;YACzD,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;YAE1C,MAAM,SAAS,GAAG,IAAI,4BAA4B,iCAC3C,QAAQ,KAAE,UAAU,KACzB,EAAE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAC9D,OAAO,CACR,CAAC;YAEF,OAAO,CAAC,KAAK,CAAC,oCAAoC,WAAW,EAAE,CAAC,CAAC;YAEjE,IAAI;gBAEF,MAAM,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;aAEpC;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,8CAA8C,WAAW,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aAC3F;SAEF;IAEH,CAAC;CAAA"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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* () {
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { IsOpenApiSchemaFromPath } from './utilities/is-open-api-schema-from-path';
|
|
3
|
+
import { HttpRequest } from './utilities/http-request';
|
|
4
|
+
export function LoadOpenApiConfig(host, options) {
|
|
5
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9
6
|
let openapi;
|
|
10
|
-
if (
|
|
7
|
+
if (IsOpenApiSchemaFromPath(options)) {
|
|
11
8
|
if (!host.exists(options.path)) {
|
|
12
9
|
throw new Error('Could not find openapi file.');
|
|
13
10
|
}
|
|
14
11
|
openapi = JSON.parse(host.read(options.path).toString('utf-8'));
|
|
15
12
|
}
|
|
16
13
|
else if (options.url) {
|
|
17
|
-
openapi = yield
|
|
14
|
+
openapi = yield HttpRequest(options.url);
|
|
18
15
|
}
|
|
19
16
|
else {
|
|
20
17
|
throw new Error('Either the path or url must be defined');
|
|
@@ -22,5 +19,4 @@ function LoadOpenApiConfig(host, options) {
|
|
|
22
19
|
return openapi;
|
|
23
20
|
});
|
|
24
21
|
}
|
|
25
|
-
exports.LoadOpenApiConfig = LoadOpenApiConfig;
|
|
26
22
|
//# sourceMappingURL=load-open-api-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-open-api-config.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/load-open-api-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load-open-api-config.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/load-open-api-config.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAKvD,MAAM,UAAgB,iBAAiB,CAAC,IAAU,EAAE,OAAsB;;QACxE,IAAI,OAA2B,CAAC;QAChC,IAAI,uBAAuB,CAAC,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,WAAW,CAAqB,OAAO,CAAC,GAAG,CAAC,CAAC;SAE9D;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC3D;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA"}
|
package/src/lib/types.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AssertWithOperationId = exports.HasOperationId = exports.GenerateParameterToOperationObjectWithMetadata = void 0;
|
|
4
|
-
function GenerateParameterToOperationObjectWithMetadata(parameter) {
|
|
1
|
+
export function GenerateParameterToOperationObjectWithMetadata(parameter) {
|
|
5
2
|
const blacklist = ['project', 'options', 'components'];
|
|
6
3
|
const copy = {};
|
|
7
4
|
for (const key of Object.keys(parameter).filter(k => !blacklist.includes(k))) {
|
|
@@ -9,15 +6,12 @@ function GenerateParameterToOperationObjectWithMetadata(parameter) {
|
|
|
9
6
|
}
|
|
10
7
|
return copy;
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
function HasOperationId(operation) {
|
|
9
|
+
export function HasOperationId(operation) {
|
|
14
10
|
return !!operation.operationId;
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
function AssertWithOperationId(operation) {
|
|
12
|
+
export function AssertWithOperationId(operation) {
|
|
18
13
|
if (!HasOperationId(operation)) {
|
|
19
14
|
throw new Error('Ensure all operation have a operation id.');
|
|
20
15
|
}
|
|
21
16
|
}
|
|
22
|
-
exports.AssertWithOperationId = AssertWithOperationId;
|
|
23
17
|
//# sourceMappingURL=types.js.map
|
package/src/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../libs/open-api/src/lib/types.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,8CAA8C,CAAC,SAA4B;IACzF,MAAM,SAAS,GAAG,CAAC,SAAS,EAAC,SAAS,EAAC,YAAY,CAAC,CAAC;IACrD,MAAM,IAAI,GAAQ,EAAE,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;QAC5E,IAAI,CAAC,GAAG,CAAC,GAAI,SAAiB,CAAC,GAAG,CAAC,CAAC;KACrC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAAoC;IACjE,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAA;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,SAAoC;IACxE,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;KAC7D;AACH,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsAnySchemaObject = void 0;
|
|
4
|
-
function IsAnySchemaObject(obj) {
|
|
1
|
+
export function IsAnySchemaObject(obj) {
|
|
5
2
|
return obj && obj.hasOwnProperty('type') && obj.type === 'any';
|
|
6
3
|
}
|
|
7
|
-
exports.IsAnySchemaObject = IsAnySchemaObject;
|
|
8
4
|
//# sourceMappingURL=any-schema-object.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any-schema-object.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/any-schema-object.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"any-schema-object.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/any-schema-object.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,iBAAiB,CAAC,GAAQ;IACxC,OAAO,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC;AACjE,CAAC"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
-
const config_1 = require("../config");
|
|
6
|
-
function GetParameterType(operation) {
|
|
1
|
+
import { classify } from '@rxap/schematics-utilities';
|
|
2
|
+
import { PARAMETER_FILE_SUFFIX } from '../config';
|
|
3
|
+
export function GetParameterType(operation) {
|
|
7
4
|
let parameterType = 'void';
|
|
8
5
|
if (operation.parameters && operation.parameters.length && operation.operationId) {
|
|
9
|
-
parameterType =
|
|
6
|
+
parameterType = classify([operation.operationId, PARAMETER_FILE_SUFFIX].join('-'));
|
|
10
7
|
}
|
|
11
8
|
return parameterType;
|
|
12
9
|
}
|
|
13
|
-
exports.GetParameterType = GetParameterType;
|
|
14
10
|
//# sourceMappingURL=get-parameter-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-parameter-type.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-parameter-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-parameter-type.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-parameter-type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAGlD,MAAM,UAAU,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;QAChF,aAAa,GAAG,QAAQ,CAAC,CAAE,SAAS,CAAC,WAAW,EAAE,qBAAqB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KACtF;IAED,OAAO,aAAa,CAAC;AAEvB,CAAC"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const is_reference_object_1 = require("./is-reference-object");
|
|
5
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
function GetRequestBody(operation) {
|
|
1
|
+
import { IsReferenceObject } from './is-reference-object';
|
|
2
|
+
import { IsRecord } from '@rxap/schematics-utilities';
|
|
3
|
+
export function GetRequestBody(operation) {
|
|
7
4
|
if (operation.requestBody) {
|
|
8
|
-
if (
|
|
5
|
+
if (IsReferenceObject(operation.requestBody)) {
|
|
9
6
|
throw new Error('Reference object are not supported in operation requestBody!');
|
|
10
7
|
}
|
|
11
8
|
const requestBodies = operation.requestBody.content;
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
9
|
+
if (IsRecord(requestBodies)) {
|
|
10
|
+
if (IsReferenceObject(requestBodies)) {
|
|
14
11
|
console.warn('Reference object are not supported in operation requestBody!');
|
|
15
12
|
}
|
|
16
13
|
else {
|
|
@@ -25,5 +22,4 @@ function GetRequestBody(operation) {
|
|
|
25
22
|
}
|
|
26
23
|
return null;
|
|
27
24
|
}
|
|
28
|
-
exports.GetRequestBody = GetRequestBody;
|
|
29
25
|
//# sourceMappingURL=get-reqeust-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-reqeust-body.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-reqeust-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-reqeust-body.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-reqeust-body.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,UAAU,cAAc,CAAC,SAAoC;IAEjE,IAAI,SAAS,CAAC,WAAW,EAAE;QAEzB,IAAI,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE;YAC5C,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;SACjF;QAED,MAAM,aAAa,GAA0D,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC;QAE3G,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE;YAE3B,IAAI,iBAAiB,CAAC,aAAa,CAAC,EAAE;gBACpC,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;aAC9E;iBAAM;gBACL,IAAI,aAAa,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE;oBACpD,MAAM,MAAM,GAAG,aAAa,CAAE,kBAAkB,CAAE,CAAC,MAAM,CAAC;oBAC1D,IAAI,MAAM,EAAE;wBACV,OAAO,MAAM,CAAC;qBACf;iBACF;aACF;SAEF;KAEF;IAED,OAAO,IAAI,CAAC;AAEd,CAAC"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
7
|
-
const config_1 = require("../config");
|
|
8
|
-
function GetRequestBodyType(operation) {
|
|
1
|
+
import { GetRequestBody } from './get-reqeust-body';
|
|
2
|
+
import { IsAnySchemaObject } from './any-schema-object';
|
|
3
|
+
import { classify } from '@rxap/schematics-utilities';
|
|
4
|
+
import { REQUEST_BODY_FILE_SUFFIX } from '../config';
|
|
5
|
+
export function GetRequestBodyType(operation) {
|
|
9
6
|
let requestBodyType = 'void';
|
|
10
7
|
if (operation.operationId) {
|
|
11
|
-
const requestBody =
|
|
8
|
+
const requestBody = GetRequestBody(operation);
|
|
12
9
|
if (requestBody === null) {
|
|
13
10
|
requestBodyType = 'void';
|
|
14
11
|
}
|
|
15
|
-
else if (!
|
|
16
|
-
requestBodyType =
|
|
12
|
+
else if (!IsAnySchemaObject(requestBody)) {
|
|
13
|
+
requestBodyType = classify([operation.operationId, REQUEST_BODY_FILE_SUFFIX].join('-'));
|
|
17
14
|
}
|
|
18
15
|
else {
|
|
19
16
|
requestBodyType = 'any';
|
|
@@ -21,5 +18,4 @@ function GetRequestBodyType(operation) {
|
|
|
21
18
|
}
|
|
22
19
|
return requestBodyType;
|
|
23
20
|
}
|
|
24
|
-
exports.GetRequestBodyType = GetRequestBodyType;
|
|
25
21
|
//# sourceMappingURL=get-request-body-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-request-body-type.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-request-body-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-request-body-type.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-request-body-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAGrD,MAAM,UAAU,kBAAkB,CAAC,SAAiC;IAElE,IAAI,eAAe,GAAG,MAAM,CAAC;IAE7B,IAAI,SAAS,CAAC,WAAW,EAAE;QAEzB,MAAM,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;QAE9C,IAAI,WAAW,KAAK,IAAI,EAAE;YACxB,eAAe,GAAG,MAAM,CAAC;SAC1B;aAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE;YAC1C,eAAe,GAAG,QAAQ,CAAC,CAAE,SAAS,CAAC,WAAW,EAAE,wBAAwB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC3F;aAAM;YACL,eAAe,GAAG,KAAK,CAAC;SACzB;KAEF;IAED,OAAO,eAAe,CAAC;AAEzB,CAAC"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const get_response_1 = require("./get-response");
|
|
7
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
8
|
-
function GetResponseType(operation) {
|
|
1
|
+
import { RESPONSE_FILE_SUFFIX } from '../config';
|
|
2
|
+
import { IsAnySchemaObject } from './any-schema-object';
|
|
3
|
+
import { GetResponse } from './get-response';
|
|
4
|
+
import { classify } from '@rxap/schematics-utilities';
|
|
5
|
+
export function GetResponseType(operation) {
|
|
9
6
|
let responseType = 'any';
|
|
10
7
|
if (operation.operationId) {
|
|
11
|
-
const response =
|
|
8
|
+
const response = GetResponse(operation);
|
|
12
9
|
// only generate the response interface if the type is not any
|
|
13
|
-
if (!
|
|
14
|
-
responseType =
|
|
10
|
+
if (!IsAnySchemaObject(response)) {
|
|
11
|
+
responseType = classify([operation.operationId, RESPONSE_FILE_SUFFIX].join('-'));
|
|
15
12
|
}
|
|
16
13
|
else {
|
|
17
14
|
responseType = 'void';
|
|
@@ -19,5 +16,4 @@ function GetResponseType(operation) {
|
|
|
19
16
|
}
|
|
20
17
|
return responseType;
|
|
21
18
|
}
|
|
22
|
-
exports.GetResponseType = GetResponseType;
|
|
23
19
|
//# sourceMappingURL=get-response-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-response-type.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-response-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-response-type.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-response-type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,UAAU,eAAe,CAAC,SAAoC;IAElE,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,IAAI,SAAS,CAAC,WAAW,EAAE;QAEzB,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;QAExC,8DAA8D;QAC9D,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE;YAChC,YAAY,GAAG,QAAQ,CAAC,CAAE,SAAS,CAAC,WAAW,EAAE,oBAAoB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SACpF;aAAM;YACL,YAAY,GAAG,MAAM,CAAC;SACvB;KAEF;IAED,OAAO,YAAY,CAAC;AAEtB,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GetResponse = void 0;
|
|
4
|
-
const is_reference_object_1 = require("./is-reference-object");
|
|
5
|
-
function GetResponse(operation) {
|
|
1
|
+
import { IsReferenceObject } from './is-reference-object';
|
|
2
|
+
export function GetResponse(operation) {
|
|
6
3
|
if (operation.responses) {
|
|
7
4
|
// tslint:disable:no-unnecessary-initializer
|
|
8
5
|
let response = undefined;
|
|
@@ -16,7 +13,7 @@ function GetResponse(operation) {
|
|
|
16
13
|
response = operation.responses['201'];
|
|
17
14
|
}
|
|
18
15
|
if (response) {
|
|
19
|
-
if (
|
|
16
|
+
if (IsReferenceObject(response)) {
|
|
20
17
|
console.warn('Reference object are not supported in operation responses!');
|
|
21
18
|
}
|
|
22
19
|
else {
|
|
@@ -33,5 +30,4 @@ function GetResponse(operation) {
|
|
|
33
30
|
type: 'any'
|
|
34
31
|
};
|
|
35
32
|
}
|
|
36
|
-
exports.GetResponse = GetResponse;
|
|
37
33
|
//# sourceMappingURL=get-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-response.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-response.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/get-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,UAAU,WAAW,CAAC,SAAoC;IAE9D,IAAI,SAAS,CAAC,SAAS,EAAE;QAEvB,4CAA4C;QAC5C,IAAI,QAAQ,GAAqE,SAAS,CAAC;QAE3F,IAAI,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;YACjD,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC;SACxC;aAAM,IAAI,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;YACpD,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAE,KAAK,CAAE,CAAC;SACzC;aAAM,IAAI,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;YACpD,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAE,KAAK,CAAE,CAAC;SACzC;QAED,IAAI,QAAQ,EAAE;YAEZ,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE;gBAC/B,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;aAC5E;iBAAM;gBACL,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE;oBAC3E,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAE,kBAAkB,CAAE,CAAC,MAAM,CAAC;oBAC7D,IAAI,MAAM,EAAE;wBACV,OAAO,MAAM,CAAC;qBACf;iBACF;aACF;SAEF;KAEF;IAED,OAAO;QACL,IAAI,EAAE,KAAK;KACZ,CAAC;AAEJ,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HasOperationParameters = void 0;
|
|
4
|
-
function HasOperationParameters(operation) {
|
|
1
|
+
export function HasOperationParameters(operation) {
|
|
5
2
|
return Array.isArray(operation.parameters) && operation.parameters.length !== 0;
|
|
6
3
|
}
|
|
7
|
-
exports.HasOperationParameters = HasOperationParameters;
|
|
8
4
|
//# sourceMappingURL=has-operation-paramters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-operation-paramters.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/has-operation-paramters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"has-operation-paramters.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/has-operation-paramters.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,sBAAsB,CAAC,SAAoC;IACzE,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HasOperationRequestBody = void 0;
|
|
4
|
-
function HasOperationRequestBody(operation) {
|
|
1
|
+
export function HasOperationRequestBody(operation) {
|
|
5
2
|
return !!operation.requestBody;
|
|
6
3
|
}
|
|
7
|
-
exports.HasOperationRequestBody = HasOperationRequestBody;
|
|
8
4
|
//# sourceMappingURL=has-operation-request-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-operation-request-body.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/has-operation-request-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"has-operation-request-body.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/has-operation-request-body.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,uBAAuB,CAAC,SAAoC;IAC1E,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAA;AAChC,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const http = require("http");
|
|
5
|
-
const https = require("https");
|
|
6
|
-
function HttpRequest(url) {
|
|
1
|
+
import * as http from 'http';
|
|
2
|
+
import * as https from 'https';
|
|
3
|
+
export function HttpRequest(url) {
|
|
7
4
|
function callback(resolve, reject) {
|
|
8
5
|
return function (res) {
|
|
9
6
|
const { statusCode } = res;
|
|
@@ -51,5 +48,4 @@ function HttpRequest(url) {
|
|
|
51
48
|
});
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
|
-
exports.HttpRequest = HttpRequest;
|
|
55
51
|
//# sourceMappingURL=http-request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/http-request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/http-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,UAAU,WAAW,CAAI,GAAW;IAExC,SAAS,QAAQ,CAAC,OAA6B,EAAE,MAA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,CAAC;IAED,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;QACvB,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;KACJ;SAAM;QACL,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;KACJ;AAEH,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IgnoreOperation = void 0;
|
|
4
|
-
function IgnoreOperation(tags = []) {
|
|
1
|
+
export function IgnoreOperation(tags = []) {
|
|
5
2
|
return operation => {
|
|
6
3
|
var _a;
|
|
7
4
|
if ((_a = operation === null || operation === void 0 ? void 0 : operation.tags) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -10,5 +7,4 @@ function IgnoreOperation(tags = []) {
|
|
|
10
7
|
return false;
|
|
11
8
|
};
|
|
12
9
|
}
|
|
13
|
-
exports.IgnoreOperation = IgnoreOperation;
|
|
14
10
|
//# sourceMappingURL=ignore-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignore-operation.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/ignore-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ignore-operation.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/ignore-operation.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,OAAiB,EAAE;IACjD,OAAO,SAAS,CAAC,EAAE;;QAEjB,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,MAAM,EAAE;YAC3B,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;SACvD;QAED,OAAO,KAAK,CAAC;IAEf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const response = get_response_1.GetResponse(operation);
|
|
9
|
-
if (!any_schema_object_1.IsAnySchemaObject(response)) {
|
|
10
|
-
if (!is_reference_object_1.IsReferenceObject(response)) {
|
|
1
|
+
import { GetResponse, } from './get-response';
|
|
2
|
+
import { IsAnySchemaObject } from './any-schema-object';
|
|
3
|
+
import { IsReferenceObject } from './is-reference-object';
|
|
4
|
+
export function IsCollectionResponse(operation) {
|
|
5
|
+
const response = GetResponse(operation);
|
|
6
|
+
if (!IsAnySchemaObject(response)) {
|
|
7
|
+
if (!IsReferenceObject(response)) {
|
|
11
8
|
return response.type === 'array';
|
|
12
9
|
}
|
|
13
10
|
}
|
|
14
11
|
return false;
|
|
15
12
|
}
|
|
16
|
-
exports.IsCollectionResponse = IsCollectionResponse;
|
|
17
13
|
//# sourceMappingURL=is-collection-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-collection-response.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-collection-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-collection-response.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-collection-response.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,UAAU,oBAAoB,CAAC,SAAoC;IAEvE,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IAExC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE;QAChC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE;YAChC,OAAO,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;SAClC;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsHttpMethod = void 0;
|
|
4
|
-
function IsHttpMethod(method) {
|
|
1
|
+
export function IsHttpMethod(method) {
|
|
5
2
|
return ['get', 'put', 'post', 'delete', 'patch'].includes(method);
|
|
6
3
|
}
|
|
7
|
-
exports.IsHttpMethod = IsHttpMethod;
|
|
8
4
|
//# sourceMappingURL=is-http-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-http-method.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-http-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-http-method.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-http-method.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAO,CAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsOpenApiSchemaFromPath = void 0;
|
|
4
|
-
function IsOpenApiSchemaFromPath(options) {
|
|
1
|
+
export function IsOpenApiSchemaFromPath(options) {
|
|
5
2
|
return options && options.hasOwnProperty('path');
|
|
6
3
|
}
|
|
7
|
-
exports.IsOpenApiSchemaFromPath = IsOpenApiSchemaFromPath;
|
|
8
4
|
//# sourceMappingURL=is-open-api-schema-from-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-open-api-schema-from-path.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-open-api-schema-from-path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-open-api-schema-from-path.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-open-api-schema-from-path.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,uBAAuB,CAAC,OAAsB;IAC5D,OAAO,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsOperationObject = void 0;
|
|
4
|
-
function IsOperationObject(obj) {
|
|
1
|
+
export function IsOperationObject(obj) {
|
|
5
2
|
return obj && obj.hasOwnProperty('operationId');
|
|
6
3
|
}
|
|
7
|
-
exports.IsOperationObject = IsOperationObject;
|
|
8
4
|
//# sourceMappingURL=is-operation-object.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-operation-object.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-operation-object.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-operation-object.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-operation-object.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,GAAQ;IACxC,OAAO,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsReferenceObject = void 0;
|
|
4
|
-
function IsReferenceObject(obj) {
|
|
1
|
+
export function IsReferenceObject(obj) {
|
|
5
2
|
return !!obj && obj.hasOwnProperty('$ref');
|
|
6
3
|
}
|
|
7
|
-
exports.IsReferenceObject = IsReferenceObject;
|
|
8
4
|
//# sourceMappingURL=is-reference-object.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-reference-object.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-reference-object.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-reference-object.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-reference-object.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,GAAS;IACzC,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsWithoutParameters = void 0;
|
|
4
|
-
function IsWithoutParameters(operation) {
|
|
1
|
+
export function IsWithoutParameters(operation) {
|
|
5
2
|
return !operation.parameters || !operation.parameters.length;
|
|
6
3
|
}
|
|
7
|
-
exports.IsWithoutParameters = IsWithoutParameters;
|
|
8
4
|
//# sourceMappingURL=is-without-parameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-without-parameters.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-without-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-without-parameters.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/lib/utilities/is-without-parameters.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,mBAAmB,CAAC,SAAoC;IACtE,OAAO,CAAC,SAAS,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;AAC/D,CAAC"}
|