api-spec-generator 0.0.13-alpha → 0.0.14-alpha
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/dist/OpenApiSpec/openApiSpec.d.ts +16 -0
- package/dist/OpenApiSpec/openApiSpec.d.ts.map +1 -0
- package/dist/OpenApiSpec/openApiSpec.js +33 -0
- package/dist/OpenApiSpec/openApiSpec.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +1 -1
- package/src/OpenApiSpec/openApiSpec.js +38 -0
- package/src/index.ts +1 -1
- package/tsconfig.json +3 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class OpenApiSpec {
|
|
2
|
+
private openApi;
|
|
3
|
+
private paths;
|
|
4
|
+
private components;
|
|
5
|
+
private securitySchemes;
|
|
6
|
+
private writeToYamlFile;
|
|
7
|
+
private fileName;
|
|
8
|
+
private pathToFiles;
|
|
9
|
+
getOpenApiSpecContent(): any;
|
|
10
|
+
constructor();
|
|
11
|
+
setOpenApiVersion(version: string): void;
|
|
12
|
+
setFileName(fileName: string): void;
|
|
13
|
+
setPathToFiles(pathToFiles: string): void;
|
|
14
|
+
writeOpenApiSpec(): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=openApiSpec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openApiSpec.d.ts","sourceRoot":"","sources":["../../src/OpenApiSpec/openApiSpec.ts"],"names":[],"mappings":"AAEA,qBAAa,WAAW;IACpB,OAAO,CAAC,OAAO,CAAmB;IAElC,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,UAAU,CAAW;IAC7B,OAAO,CAAC,eAAe,CAAW;IAClC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,WAAW,CAAgB;IAC5B,qBAAqB,IAAI,GAAG;;IAWnC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAInC,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIzC,gBAAgB,IAAI,IAAI;CAK3B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { writeFileSync } from "fs";
|
|
2
|
+
export class OpenApiSpec {
|
|
3
|
+
openApi = "3.0.1";
|
|
4
|
+
paths = {};
|
|
5
|
+
components = {};
|
|
6
|
+
securitySchemes = {};
|
|
7
|
+
writeToYamlFile = false;
|
|
8
|
+
fileName = "openapi-spec";
|
|
9
|
+
pathToFiles = "./";
|
|
10
|
+
getOpenApiSpecContent() {
|
|
11
|
+
return {
|
|
12
|
+
openapi: this.openApi,
|
|
13
|
+
paths: this.paths,
|
|
14
|
+
components: this.components,
|
|
15
|
+
securitySchemes: this.securitySchemes
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
constructor() { }
|
|
19
|
+
setOpenApiVersion(version) {
|
|
20
|
+
this.openApi = version;
|
|
21
|
+
}
|
|
22
|
+
setFileName(fileName) {
|
|
23
|
+
this.fileName = fileName;
|
|
24
|
+
}
|
|
25
|
+
setPathToFiles(pathToFiles) {
|
|
26
|
+
this.pathToFiles = pathToFiles;
|
|
27
|
+
}
|
|
28
|
+
writeOpenApiSpec() {
|
|
29
|
+
const specFileContent = this.getOpenApiSpecContent();
|
|
30
|
+
writeFileSync(`${this.pathToFiles}${this.fileName}.${this.writeToYamlFile ? "yaml" : "json"}`, JSON.stringify(specFileContent, null, 2));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=openApiSpec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openApiSpec.js","sourceRoot":"","sources":["../../src/OpenApiSpec/openApiSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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,WAAW,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenApiSpec = void 0;
|
|
4
|
+
var fs_1 = require("fs");
|
|
5
|
+
var OpenApiSpec = /** @class */ (function () {
|
|
6
|
+
function OpenApiSpec() {
|
|
7
|
+
this.openApi = "3.0.1";
|
|
8
|
+
this.paths = {};
|
|
9
|
+
this.components = {};
|
|
10
|
+
this.securitySchemes = {};
|
|
11
|
+
this.writeToYamlFile = false;
|
|
12
|
+
this.fileName = "openapi-spec";
|
|
13
|
+
this.pathToFiles = "./";
|
|
14
|
+
}
|
|
15
|
+
OpenApiSpec.prototype.getOpenApiSpecContent = function () {
|
|
16
|
+
return {
|
|
17
|
+
openapi: this.openApi,
|
|
18
|
+
paths: this.paths,
|
|
19
|
+
components: this.components,
|
|
20
|
+
securitySchemes: this.securitySchemes
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
OpenApiSpec.prototype.setOpenApiVersion = function (version) {
|
|
24
|
+
this.openApi = version;
|
|
25
|
+
};
|
|
26
|
+
OpenApiSpec.prototype.setFileName = function (fileName) {
|
|
27
|
+
this.fileName = fileName;
|
|
28
|
+
};
|
|
29
|
+
OpenApiSpec.prototype.setPathToFiles = function (pathToFiles) {
|
|
30
|
+
this.pathToFiles = pathToFiles;
|
|
31
|
+
};
|
|
32
|
+
OpenApiSpec.prototype.writeOpenApiSpec = function () {
|
|
33
|
+
var specFileContent = this.getOpenApiSpecContent();
|
|
34
|
+
(0, fs_1.writeFileSync)("".concat(this.pathToFiles).concat(this.fileName, ".").concat(this.writeToYamlFile ? "yaml" : "json"), JSON.stringify(specFileContent, null, 2));
|
|
35
|
+
};
|
|
36
|
+
return OpenApiSpec;
|
|
37
|
+
}());
|
|
38
|
+
exports.OpenApiSpec = OpenApiSpec;
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OpenApiSpec } from './OpenApiSpec/openApiSpec
|
|
1
|
+
import { OpenApiSpec } from './OpenApiSpec/openApiSpec';
|
|
2
2
|
export { OpenApiSpec };
|
package/tsconfig.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
// Environment Settings
|
|
9
9
|
// See also https://aka.ms/tsconfig/module
|
|
10
|
-
"module": "
|
|
10
|
+
"module": "preserve",
|
|
11
11
|
"target": "esnext",
|
|
12
12
|
"types": ["node", "jest"],
|
|
13
13
|
// For nodejs:
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"sourceMap": true,
|
|
20
20
|
"declaration": true,
|
|
21
21
|
"declarationMap": true,
|
|
22
|
-
"noEmit":
|
|
22
|
+
"noEmit": false,
|
|
23
23
|
|
|
24
24
|
// Stricter Typechecking Options
|
|
25
25
|
"noUncheckedIndexedAccess": true,
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"noUncheckedSideEffectImports": true,
|
|
42
42
|
"moduleDetection": "force",
|
|
43
43
|
"skipLibCheck": true,
|
|
44
|
-
"
|
|
44
|
+
"moduleResolution": "bundler"
|
|
45
45
|
},
|
|
46
46
|
"exclude": ["tests", "node_modules", "dist"]
|
|
47
47
|
}
|