@eventcatalog/generator-openapi 4.0.6 → 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.mjs CHANGED
@@ -608,7 +608,7 @@ import chalk from "chalk";
608
608
  // package.json
609
609
  var package_default = {
610
610
  name: "@eventcatalog/generator-openapi",
611
- version: "4.0.6",
611
+ version: "4.0.7",
612
612
  description: "OpenAPI generator for EventCatalog",
613
613
  scripts: {
614
614
  build: "tsup",
@@ -1734,11 +1734,29 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, op
1734
1734
  }
1735
1735
  if (requestBodiesAndResponses?.responses) {
1736
1736
  for (const [statusCode, schema] of Object.entries(requestBodiesAndResponses.responses)) {
1737
+ const getContent = () => {
1738
+ try {
1739
+ return JSON.stringify(schema, null, 2);
1740
+ } catch (error) {
1741
+ const seen = /* @__PURE__ */ new WeakSet();
1742
+ return JSON.stringify(
1743
+ schema,
1744
+ (key, value) => {
1745
+ if (typeof value === "object" && value !== null) {
1746
+ if (seen.has(value)) return "[Circular]";
1747
+ seen.add(value);
1748
+ }
1749
+ return value;
1750
+ },
1751
+ 2
1752
+ );
1753
+ }
1754
+ };
1737
1755
  await addFileToMessage(
1738
1756
  message.id,
1739
1757
  {
1740
1758
  fileName: `response-${statusCode}.json`,
1741
- content: JSON.stringify(schema, null, 2)
1759
+ content: getContent()
1742
1760
  },
1743
1761
  message.version
1744
1762
  );