@stackwright-pro/openapi 0.3.0-alpha.5 → 0.3.0-alpha.6

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.d.mts CHANGED
@@ -110,6 +110,8 @@ interface OpenAPIConfig {
110
110
  slug_field: string;
111
111
  /** HTTP method for this collection endpoint — defaults to 'GET' */
112
112
  method?: string;
113
+ /** Transport protocol — 'websocket' collections are skipped during prebuild */
114
+ transport?: string;
113
115
  /** Optional filters */
114
116
  filters?: Record<string, unknown>;
115
117
  }>;
package/dist/index.d.ts CHANGED
@@ -110,6 +110,8 @@ interface OpenAPIConfig {
110
110
  slug_field: string;
111
111
  /** HTTP method for this collection endpoint — defaults to 'GET' */
112
112
  method?: string;
113
+ /** Transport protocol — 'websocket' collections are skipped during prebuild */
114
+ transport?: string;
113
115
  /** Optional filters */
114
116
  filters?: Record<string, unknown>;
115
117
  }>;
package/dist/index.js CHANGED
@@ -45,8 +45,18 @@ var OpenAPIParser = class {
45
45
  await SwaggerParser__default.default.validate(api);
46
46
  }
47
47
  let document;
48
+ let dereferenced = false;
48
49
  if (dereference) {
49
- document = await SwaggerParser__default.default.dereference(api);
50
+ try {
51
+ document = await SwaggerParser__default.default.dereference(api);
52
+ dereferenced = true;
53
+ } catch {
54
+ console.warn(
55
+ `[OpenAPIParser] Warning: Could not fully dereference "${specPath}" (dangling $ref or circular ref). Proceeding without full dereferencing \u2014 some schema references may not resolve.`
56
+ );
57
+ document = api;
58
+ dereferenced = false;
59
+ }
50
60
  } else {
51
61
  document = api;
52
62
  }
@@ -54,7 +64,7 @@ var OpenAPIParser = class {
54
64
  return {
55
65
  document,
56
66
  version,
57
- dereferenced: dereference
67
+ dereferenced
58
68
  };
59
69
  } catch (error) {
60
70
  throw this.enhanceError(error, specPath);
@@ -2841,6 +2851,23 @@ var OpenAPIPlugin = class {
2841
2851
  async processIntegration(config, projectRoot) {
2842
2852
  const { name, spec, auth, mockUrl, collections, endpoints, actions } = config;
2843
2853
  console.log(` - Processing integration: ${name}`);
2854
+ const httpCollections = (collections || []).filter((c) => {
2855
+ if (c.transport === "websocket") {
2856
+ console.warn(
2857
+ ` > Skipping collection "${c.endpoint}" (transport: websocket \u2014 not yet supported)`
2858
+ );
2859
+ return false;
2860
+ }
2861
+ return true;
2862
+ });
2863
+ const hasEndpoints = endpoints && (endpoints.include?.length || endpoints.exclude?.length);
2864
+ const hasActions = actions && actions.length > 0;
2865
+ if (httpCollections.length === 0 && !hasEndpoints && !hasActions) {
2866
+ console.log(
2867
+ " > No HTTP endpoints or REST collections found \u2014 skipping (WebSocket-only integration not yet supported)"
2868
+ );
2869
+ return;
2870
+ }
2844
2871
  const specPath = spec.startsWith("http") ? spec : path2__default.default.resolve(projectRoot, spec);
2845
2872
  const parser = new OpenAPIParser();
2846
2873
  const { document } = await parser.parse(specPath);
@@ -2859,13 +2886,13 @@ var OpenAPIPlugin = class {
2859
2886
  fs2__default.default.mkdirSync(outputDir, { recursive: true });
2860
2887
  const schemaMapping = await this.generateSchemas(
2861
2888
  document,
2862
- collections || [],
2889
+ httpCollections,
2863
2890
  outputDir,
2864
2891
  name,
2865
2892
  endpointFilter
2866
2893
  );
2867
- await this.generateTypes(document, collections || [], outputDir, name);
2868
- if (collections && collections.length > 0) {
2894
+ await this.generateTypes(document, httpCollections, outputDir, name);
2895
+ if (httpCollections.length > 0) {
2869
2896
  await this.generateProvider(document, config, outputDir, name);
2870
2897
  }
2871
2898
  await this.generateClient(document, outputDir, name, schemaMapping, endpointFilter);