@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackql/provider-utils",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Utilities for building StackQL providers from OpenAPI specifications.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -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
@@ -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
- for (const param of pathItem.parameters) {
167
- if (param.$ref) {
168
- refs.add(param.$ref);
169
- } else if (typeof param === 'object') {
170
- // Extract refs from schema if present
171
- for (const ref of getAllRefs(param)) {
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
- // Check other non-operation fields
179
- for (const [key, value] of Object.entries(pathItem)) {
180
- if (!OPERATIONS.includes(key) && typeof value === 'object') {
181
- for (const ref of getAllRefs(value)) {
182
- refs.add(ref);
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
  }