swaggie 1.3.0-test.2 → 1.3.0-test.3
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/gen/genTypes.js +6 -1
- package/dist/gen/refsHelper.js +1 -1
- package/dist/utils/utils.js +4 -0
- package/package.json +1 -1
package/dist/gen/genTypes.js
CHANGED
|
@@ -46,11 +46,16 @@ function renderSchema(
|
|
|
46
46
|
options
|
|
47
47
|
) {
|
|
48
48
|
const safeName = _swagger.getSafeIdentifier.call(void 0, name);
|
|
49
|
+
if (!safeName) {
|
|
50
|
+
console.warn(`Skipping schema ${name} because it is not a valid identifier`);
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
49
53
|
|
|
50
54
|
// This is an interesting case, because it is allowed but not likely to be used
|
|
51
55
|
// as it is just a reference to another schema object
|
|
52
56
|
if ('$ref' in schema) {
|
|
53
|
-
|
|
57
|
+
const refName = _swagger.getSafeIdentifier.call(void 0, schema.$ref.split('/').pop());
|
|
58
|
+
return `export type ${safeName} = ${refName || 'unknown'};`;
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
const result = [];
|
package/dist/gen/refsHelper.js
CHANGED
|
@@ -55,7 +55,7 @@ function findDirectRefs(obj, options, refs) {
|
|
|
55
55
|
|
|
56
56
|
// If the object is deprecated and we want to skip deprecated objects,
|
|
57
57
|
// we won't process it and anything below it
|
|
58
|
-
if (options.skipDeprecated &&
|
|
58
|
+
if (options.skipDeprecated && obj.deprecated) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
|
package/dist/utils/utils.js
CHANGED
|
@@ -61,6 +61,10 @@ const reservedKeywords = new Set([
|
|
|
61
61
|
* Escaping is done by adding an underscore prefix.
|
|
62
62
|
*/
|
|
63
63
|
function escapeIdentifier(name) {
|
|
64
|
+
if (!name) {
|
|
65
|
+
return name;
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
if (reservedKeywords.has(name) || /^[0-9]/.test(name)) {
|
|
65
69
|
return `_${name}`;
|
|
66
70
|
}
|