@dotflash/openapi-semantic-generator 0.1.2 → 0.1.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/{chunk-PLFFT6WD.js → chunk-QEPXZXK5.js} +8 -2
- package/dist/cli.cjs +8 -2
- package/dist/cli.js +1 -1
- package/dist/index.cjs +8 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -37,7 +37,9 @@ async function extractMetadata(specPath) {
|
|
|
37
37
|
if (typedDetails.requestBody) {
|
|
38
38
|
}
|
|
39
39
|
operations.push({
|
|
40
|
-
operationId:
|
|
40
|
+
operationId: toCamelCase(
|
|
41
|
+
typedDetails.operationId || `${method}_${path4.replace(/\//g, "_")}`
|
|
42
|
+
),
|
|
41
43
|
summary: typedDetails.summary,
|
|
42
44
|
description: typedDetails.description,
|
|
43
45
|
httpMethod: method.toUpperCase(),
|
|
@@ -65,6 +67,9 @@ async function extractMetadata(specPath) {
|
|
|
65
67
|
}))
|
|
66
68
|
};
|
|
67
69
|
}
|
|
70
|
+
function toCamelCase(str) {
|
|
71
|
+
return str.replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase()).replace(/[^a-zA-Z0-9]/g, "");
|
|
72
|
+
}
|
|
68
73
|
function cleanDescription(desc) {
|
|
69
74
|
if (!desc) return "";
|
|
70
75
|
return desc.split("\n").filter((line) => {
|
|
@@ -99,9 +104,10 @@ async function scanGeneratedFiles(outputDir, metadata, options = {}) {
|
|
|
99
104
|
let matchedApi = apis[0];
|
|
100
105
|
if (op.tags && op.tags.length > 0) {
|
|
101
106
|
const primaryTag = op.tags[0].toLowerCase();
|
|
107
|
+
const normalizedTag = primaryTag.replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
102
108
|
const found = apis.find((api) => {
|
|
103
109
|
const fileName = api.className.toLowerCase();
|
|
104
|
-
return fileName.includes(primaryTag);
|
|
110
|
+
return fileName.includes(normalizedTag) || fileName.includes(primaryTag.replace(/\s+/g, ""));
|
|
105
111
|
});
|
|
106
112
|
if (found) {
|
|
107
113
|
matchedApi = found;
|
package/dist/cli.cjs
CHANGED
|
@@ -75,7 +75,9 @@ async function extractMetadata(specPath) {
|
|
|
75
75
|
if (typedDetails.requestBody) {
|
|
76
76
|
}
|
|
77
77
|
operations.push({
|
|
78
|
-
operationId:
|
|
78
|
+
operationId: toCamelCase(
|
|
79
|
+
typedDetails.operationId || `${method}_${path5.replace(/\//g, "_")}`
|
|
80
|
+
),
|
|
79
81
|
summary: typedDetails.summary,
|
|
80
82
|
description: typedDetails.description,
|
|
81
83
|
httpMethod: method.toUpperCase(),
|
|
@@ -103,6 +105,9 @@ async function extractMetadata(specPath) {
|
|
|
103
105
|
}))
|
|
104
106
|
};
|
|
105
107
|
}
|
|
108
|
+
function toCamelCase(str) {
|
|
109
|
+
return str.replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase()).replace(/[^a-zA-Z0-9]/g, "");
|
|
110
|
+
}
|
|
106
111
|
function cleanDescription(desc) {
|
|
107
112
|
if (!desc) return "";
|
|
108
113
|
return desc.split("\n").filter((line) => {
|
|
@@ -137,9 +142,10 @@ async function scanGeneratedFiles(outputDir, metadata, options = {}) {
|
|
|
137
142
|
let matchedApi = apis[0];
|
|
138
143
|
if (op.tags && op.tags.length > 0) {
|
|
139
144
|
const primaryTag = op.tags[0].toLowerCase();
|
|
145
|
+
const normalizedTag = primaryTag.replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
140
146
|
const found = apis.find((api) => {
|
|
141
147
|
const fileName = api.className.toLowerCase();
|
|
142
|
-
return fileName.includes(primaryTag);
|
|
148
|
+
return fileName.includes(normalizedTag) || fileName.includes(primaryTag.replace(/\s+/g, ""));
|
|
143
149
|
});
|
|
144
150
|
if (found) {
|
|
145
151
|
matchedApi = found;
|
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -84,7 +84,9 @@ async function extractMetadata(specPath) {
|
|
|
84
84
|
if (typedDetails.requestBody) {
|
|
85
85
|
}
|
|
86
86
|
operations.push({
|
|
87
|
-
operationId:
|
|
87
|
+
operationId: toCamelCase(
|
|
88
|
+
typedDetails.operationId || `${method}_${path4.replace(/\//g, "_")}`
|
|
89
|
+
),
|
|
88
90
|
summary: typedDetails.summary,
|
|
89
91
|
description: typedDetails.description,
|
|
90
92
|
httpMethod: method.toUpperCase(),
|
|
@@ -112,6 +114,9 @@ async function extractMetadata(specPath) {
|
|
|
112
114
|
}))
|
|
113
115
|
};
|
|
114
116
|
}
|
|
117
|
+
function toCamelCase(str) {
|
|
118
|
+
return str.replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase()).replace(/[^a-zA-Z0-9]/g, "");
|
|
119
|
+
}
|
|
115
120
|
function cleanDescription(desc) {
|
|
116
121
|
if (!desc) return "";
|
|
117
122
|
return desc.split("\n").filter((line) => {
|
|
@@ -146,9 +151,10 @@ async function scanGeneratedFiles(outputDir, metadata, options = {}) {
|
|
|
146
151
|
let matchedApi = apis[0];
|
|
147
152
|
if (op.tags && op.tags.length > 0) {
|
|
148
153
|
const primaryTag = op.tags[0].toLowerCase();
|
|
154
|
+
const normalizedTag = primaryTag.replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
149
155
|
const found = apis.find((api) => {
|
|
150
156
|
const fileName = api.className.toLowerCase();
|
|
151
|
-
return fileName.includes(primaryTag);
|
|
157
|
+
return fileName.includes(normalizedTag) || fileName.includes(primaryTag.replace(/\s+/g, ""));
|
|
152
158
|
});
|
|
153
159
|
if (found) {
|
|
154
160
|
matchedApi = found;
|
package/dist/index.js
CHANGED