@eventcatalog/generator-openapi 4.0.5 → 4.0.7

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
@@ -619,7 +619,7 @@ var import_chalk = __toESM(require("chalk"));
619
619
  // package.json
620
620
  var package_default = {
621
621
  name: "@eventcatalog/generator-openapi",
622
- version: "4.0.5",
622
+ version: "4.0.7",
623
623
  description: "OpenAPI generator for EventCatalog",
624
624
  scripts: {
625
625
  build: "tsup",
@@ -1527,7 +1527,8 @@ var getInstalledVersionOfPackage = (packageName) => {
1527
1527
  const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
1528
1528
  const pkg = import_fs.default.readFileSync(import_path2.default.join(PROJECT_DIR, "package.json"), "utf8");
1529
1529
  const json = JSON.parse(pkg);
1530
- return json.dependencies[packageName];
1530
+ const version = json.dependencies[packageName];
1531
+ return version?.replace(/[\^~><=]/g, "");
1531
1532
  } catch (error) {
1532
1533
  return null;
1533
1534
  }
@@ -1744,11 +1745,29 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, op
1744
1745
  }
1745
1746
  if (requestBodiesAndResponses?.responses) {
1746
1747
  for (const [statusCode, schema] of Object.entries(requestBodiesAndResponses.responses)) {
1748
+ const getContent = () => {
1749
+ try {
1750
+ return JSON.stringify(schema, null, 2);
1751
+ } catch (error) {
1752
+ const seen = /* @__PURE__ */ new WeakSet();
1753
+ return JSON.stringify(
1754
+ schema,
1755
+ (key, value) => {
1756
+ if (typeof value === "object" && value !== null) {
1757
+ if (seen.has(value)) return "[Circular]";
1758
+ seen.add(value);
1759
+ }
1760
+ return value;
1761
+ },
1762
+ 2
1763
+ );
1764
+ }
1765
+ };
1747
1766
  await addFileToMessage(
1748
1767
  message.id,
1749
1768
  {
1750
1769
  fileName: `response-${statusCode}.json`,
1751
- content: JSON.stringify(schema, null, 2)
1770
+ content: getContent()
1752
1771
  },
1753
1772
  message.version
1754
1773
  );