equipped 5.0.0-beta.12 → 5.0.0-beta.13
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 +7 -0
- package/lib/scripts/json-schema.js +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [5.0.0-beta.13](https://github.com/kevinand11/equipped/compare/v5.0.0-beta.12...v5.0.0-beta.13) (2024-06-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add description for each status code ([064a686](https://github.com/kevinand11/equipped/commit/064a68647ea91a5791aad75b1b95988accc38b32))
|
|
11
|
+
|
|
5
12
|
## [5.0.0-beta.12](https://github.com/kevinand11/equipped/compare/v5.0.0-beta.11...v5.0.0-beta.12) (2024-06-01)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -26,7 +26,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.generateJSONSchema = void 0;
|
|
27
27
|
const ts_oas_1 = __importStar(require("ts-oas"));
|
|
28
28
|
const instance_1 = require("../instance");
|
|
29
|
+
const server_1 = require("../server");
|
|
29
30
|
const fileSchema = { type: 'string', format: 'binary' };
|
|
31
|
+
const statusCodes = Object.entries(server_1.StatusCodes);
|
|
30
32
|
function generateJSONSchema(patterns, paths, options) {
|
|
31
33
|
const tsProgram = (0, ts_oas_1.createProgram)(paths, options?.tsConfigPath);
|
|
32
34
|
const logger = instance_1.Instance.createLogger();
|
|
@@ -47,6 +49,13 @@ function generateJSONSchema(patterns, paths, options) {
|
|
|
47
49
|
return { ...acc, ...cur.properties };
|
|
48
50
|
return acc;
|
|
49
51
|
}, {}) ?? undefined;
|
|
52
|
+
if (response) {
|
|
53
|
+
for (const [key, value] of Object.entries(response)) {
|
|
54
|
+
const status = statusCodes.find(([_, code]) => code.toString() === key);
|
|
55
|
+
if (status)
|
|
56
|
+
value['description'] = `${status[0]} Response`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
50
59
|
const body = def.body ?? {};
|
|
51
60
|
if (def.files?.properties) {
|
|
52
61
|
const files = def.files ?? {};
|