@eventcatalog/generator-openapi 4.0.6 → 5.0.0

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.6",
622
+ version: "5.0.0",
623
623
  description: "OpenAPI generator for EventCatalog",
624
624
  scripts: {
625
625
  build: "tsup",
@@ -655,7 +655,7 @@ var package_default = {
655
655
  dependencies: {
656
656
  "@apidevtools/swagger-parser": "^10.1.0",
657
657
  "@changesets/cli": "^2.27.7",
658
- "@eventcatalog/sdk": "^1.4.8",
658
+ "@eventcatalog/sdk": "^2.0.0",
659
659
  chalk: "^4",
660
660
  "js-yaml": "^4.1.0",
661
661
  "openapi-types": "^12.1.3",
@@ -1745,11 +1745,29 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, op
1745
1745
  }
1746
1746
  if (requestBodiesAndResponses?.responses) {
1747
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
+ };
1748
1766
  await addFileToMessage(
1749
1767
  message.id,
1750
1768
  {
1751
1769
  fileName: `response-${statusCode}.json`,
1752
- content: JSON.stringify(schema, null, 2)
1770
+ content: getContent()
1753
1771
  },
1754
1772
  message.version
1755
1773
  );