@stackql/provider-utils 0.3.6 → 0.3.8
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/package.json +1 -1
- package/src/providerdev/analyze.js +7 -1
- package/src/providerdev/split.js +18 -15
package/package.json
CHANGED
|
@@ -172,12 +172,18 @@ export async function analyze(options) {
|
|
|
172
172
|
const filepath = path.join(inputDir, filename);
|
|
173
173
|
const spec = loadSpec(filepath);
|
|
174
174
|
|
|
175
|
+
const relevantVerbs = ["get", "put", "post", "patch", "delete"];
|
|
176
|
+
|
|
175
177
|
for (const [pathKey, pathItem] of Object.entries(spec.paths || {})) {
|
|
176
178
|
for (const [verb, operation] of Object.entries(pathItem)) {
|
|
177
179
|
if (typeof operation !== 'object' || operation === null) {
|
|
178
180
|
continue;
|
|
179
181
|
}
|
|
180
|
-
|
|
182
|
+
if(!relevantVerbs.includes(verb)) {
|
|
183
|
+
logger.info(`Skipping irrelevant operation: ${verb}`);
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
|
|
181
187
|
// Then in the operation processing loop:
|
|
182
188
|
const operationId = operation.operationId || '';
|
|
183
189
|
// Check if operation is already mapped in CSV
|
package/src/providerdev/split.js
CHANGED
|
@@ -160,26 +160,29 @@ function getAllRefs(obj) {
|
|
|
160
160
|
*/
|
|
161
161
|
function getPathLevelRefs(pathItem) {
|
|
162
162
|
const refs = new Set();
|
|
163
|
+
const relevantVerbs = ["get", "put", "post", "patch", "delete"];
|
|
163
164
|
|
|
164
165
|
// Check for path-level parameters
|
|
165
166
|
if (pathItem.parameters) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
refs.add(ref);
|
|
173
|
-
}
|
|
167
|
+
// Only collect path parameters if they're used by relevant operations
|
|
168
|
+
let hasRelevantOperation = false;
|
|
169
|
+
for (const verb of relevantVerbs) {
|
|
170
|
+
if (pathItem[verb] && typeof pathItem[verb] === 'object') {
|
|
171
|
+
hasRelevantOperation = true;
|
|
172
|
+
break;
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
175
|
+
|
|
176
|
+
if (hasRelevantOperation) {
|
|
177
|
+
for (const param of pathItem.parameters) {
|
|
178
|
+
if (param.$ref) {
|
|
179
|
+
refs.add(param.$ref);
|
|
180
|
+
} else if (typeof param === 'object') {
|
|
181
|
+
// Extract refs from schema if present
|
|
182
|
+
for (const ref of getAllRefs(param)) {
|
|
183
|
+
refs.add(ref);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
}
|