swaggie 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
+
var _utils = require('../utils');
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Converts a parameter object to a TypeScript type.
|
|
@@ -107,8 +108,9 @@ function getTypeFromObject(
|
|
|
107
108
|
for (const prop of props) {
|
|
108
109
|
const propDefinition = schema.properties[prop];
|
|
109
110
|
const isRequired = required.includes(prop);
|
|
111
|
+
const safePropName = _utils.escapePropName.call(void 0, prop);
|
|
110
112
|
result.push(
|
|
111
|
-
`${
|
|
113
|
+
`${safePropName}${isRequired ? '' : '?'}: ${getTypeFromSchema(propDefinition, options)};`
|
|
112
114
|
);
|
|
113
115
|
}
|
|
114
116
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _nodefs = require('node:fs'); var _nodefs2 = _interopRequireDefault(_nodefs);
|
|
2
|
-
var
|
|
2
|
+
var _yaml = require('yaml');
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -41,7 +41,7 @@ function readLocalFile(filePath) {
|
|
|
41
41
|
function parseFileContents(contents, path) {
|
|
42
42
|
// If the path ends with .yaml or .yml, parse as YAML
|
|
43
43
|
if (/.ya?ml$/i.test(path)) {
|
|
44
|
-
return
|
|
44
|
+
return _yaml.parse.call(void 0, contents);
|
|
45
45
|
}
|
|
46
46
|
// If the path ends with .json, parse as JSON
|
|
47
47
|
if (/.json$/i.test(path)) {
|
|
@@ -54,5 +54,5 @@ function parseFileContents(contents, path) {
|
|
|
54
54
|
return JSON.parse(contents);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
return
|
|
57
|
+
return _yaml.parse.call(void 0, contents);
|
|
58
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swaggie",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Generate TypeScript REST client code from an OpenAPI spec",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Piotr Dabrowski",
|
|
@@ -50,14 +50,13 @@
|
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"case": "^1.6.3",
|
|
53
|
-
"commander": "^14.0.
|
|
54
|
-
"eta": "^4.5.
|
|
55
|
-
"
|
|
53
|
+
"commander": "^14.0.3",
|
|
54
|
+
"eta": "^4.5.1",
|
|
55
|
+
"yaml": "^2.8.2",
|
|
56
56
|
"nanocolors": "^0.2.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"
|
|
60
|
-
"bun-types": "1.3.5",
|
|
59
|
+
"bun-types": "1.3.9",
|
|
61
60
|
"openapi-types": "^12.1.3",
|
|
62
61
|
"sucrase": "3.35.1",
|
|
63
62
|
"typescript": "5.9.3"
|