@stackwright-pro/openapi 0.3.0-alpha.11 → 0.3.0-alpha.12

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/index.js CHANGED
@@ -2878,6 +2878,14 @@ var OpenAPIPlugin = class {
2878
2878
  async processIntegration(config, projectRoot) {
2879
2879
  const { name, spec, auth, mockUrl, collections, endpoints, actions } = config;
2880
2880
  console.log(` - Processing integration: ${name}`);
2881
+ const specPath = spec.startsWith("http") ? spec : path2__default.default.resolve(projectRoot, spec);
2882
+ const parser = new OpenAPIParser();
2883
+ const { document } = await parser.parse(specPath);
2884
+ if (mockUrl) {
2885
+ const originalServer = document.servers?.[0]?.url || "unknown";
2886
+ document.servers = [{ url: mockUrl }];
2887
+ console.log(` > Using mock URL: ${mockUrl} (was: ${originalServer})`);
2888
+ }
2881
2889
  const httpCollections = (collections || []).filter((c) => {
2882
2890
  if (c.transport === "websocket") {
2883
2891
  console.warn(
@@ -2887,22 +2895,18 @@ var OpenAPIPlugin = class {
2887
2895
  }
2888
2896
  return true;
2889
2897
  });
2898
+ const HTTP_METHODS = ["get", "post", "put", "patch", "delete", "head", "options"];
2899
+ const specHasHttpPaths = Object.values(document.paths || {}).some(
2900
+ (pathItem) => HTTP_METHODS.some((m) => pathItem?.[m])
2901
+ );
2890
2902
  const hasEndpoints = endpoints && (endpoints.include?.length || endpoints.exclude?.length);
2891
2903
  const hasActions = actions && actions.length > 0;
2892
- if (httpCollections.length === 0 && !hasEndpoints && !hasActions) {
2904
+ if (!specHasHttpPaths && httpCollections.length === 0 && !hasEndpoints && !hasActions) {
2893
2905
  console.log(
2894
- " > No HTTP endpoints or REST collections found \u2014 skipping (WebSocket-only integration not yet supported)"
2906
+ " > Spec has no HTTP paths \u2014 skipping (WebSocket-only spec not yet supported)"
2895
2907
  );
2896
2908
  return;
2897
2909
  }
2898
- const specPath = spec.startsWith("http") ? spec : path2__default.default.resolve(projectRoot, spec);
2899
- const parser = new OpenAPIParser();
2900
- const { document } = await parser.parse(specPath);
2901
- if (mockUrl) {
2902
- const originalServer = document.servers?.[0]?.url || "unknown";
2903
- document.servers = [{ url: mockUrl }];
2904
- console.log(` > Using mock URL: ${mockUrl} (was: ${originalServer})`);
2905
- }
2906
2910
  const endpointFilter = new EndpointFilter(endpoints);
2907
2911
  if (endpoints && (endpoints.include?.length || endpoints.exclude?.length)) {
2908
2912
  const includeStr = endpoints.include?.join(", ") || "/**";