@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.mjs CHANGED
@@ -33,8 +33,18 @@ var OpenAPIParser = class {
33
33
  await SwaggerParser.validate(api);
34
34
  }
35
35
  let document;
36
+ let dereferenced = false;
36
37
  if (dereference) {
37
- document = await SwaggerParser.dereference(api);
38
+ try {
39
+ document = await SwaggerParser.dereference(api);
40
+ dereferenced = true;
41
+ } catch {
42
+ console.warn(
43
+ `[OpenAPIParser] Warning: Could not fully dereference "${specPath}" (dangling $ref or circular ref). Proceeding without full dereferencing \u2014 some schema references may not resolve.`
44
+ );
45
+ document = api;
46
+ dereferenced = false;
47
+ }
38
48
  } else {
39
49
  document = api;
40
50
  }
@@ -42,7 +52,7 @@ var OpenAPIParser = class {
42
52
  return {
43
53
  document,
44
54
  version,
45
- dereferenced: dereference
55
+ dereferenced
46
56
  };
47
57
  } catch (error) {
48
58
  throw this.enhanceError(error, specPath);
@@ -2829,6 +2839,23 @@ var OpenAPIPlugin = class {
2829
2839
  async processIntegration(config, projectRoot) {
2830
2840
  const { name, spec, auth, mockUrl, collections, endpoints, actions } = config;
2831
2841
  console.log(` - Processing integration: ${name}`);
2842
+ const httpCollections = (collections || []).filter((c) => {
2843
+ if (c.transport === "websocket") {
2844
+ console.warn(
2845
+ ` > Skipping collection "${c.endpoint}" (transport: websocket \u2014 not yet supported)`
2846
+ );
2847
+ return false;
2848
+ }
2849
+ return true;
2850
+ });
2851
+ const hasEndpoints = endpoints && (endpoints.include?.length || endpoints.exclude?.length);
2852
+ const hasActions = actions && actions.length > 0;
2853
+ if (httpCollections.length === 0 && !hasEndpoints && !hasActions) {
2854
+ console.log(
2855
+ " > No HTTP endpoints or REST collections found \u2014 skipping (WebSocket-only integration not yet supported)"
2856
+ );
2857
+ return;
2858
+ }
2832
2859
  const specPath = spec.startsWith("http") ? spec : path2.resolve(projectRoot, spec);
2833
2860
  const parser = new OpenAPIParser();
2834
2861
  const { document } = await parser.parse(specPath);
@@ -2847,13 +2874,13 @@ var OpenAPIPlugin = class {
2847
2874
  fs2.mkdirSync(outputDir, { recursive: true });
2848
2875
  const schemaMapping = await this.generateSchemas(
2849
2876
  document,
2850
- collections || [],
2877
+ httpCollections,
2851
2878
  outputDir,
2852
2879
  name,
2853
2880
  endpointFilter
2854
2881
  );
2855
- await this.generateTypes(document, collections || [], outputDir, name);
2856
- if (collections && collections.length > 0) {
2882
+ await this.generateTypes(document, httpCollections, outputDir, name);
2883
+ if (httpCollections.length > 0) {
2857
2884
  await this.generateProvider(document, config, outputDir, name);
2858
2885
  }
2859
2886
  await this.generateClient(document, outputDir, name, schemaMapping, endpointFilter);