@eventcatalog/generator-openapi 5.0.1 → 5.0.3

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
@@ -376,7 +376,7 @@ async function getSchemasByOperationId(filePath, operationId) {
376
376
  return;
377
377
  }
378
378
  }
379
- async function getOperationsByType(openApiPath) {
379
+ async function getOperationsByType(openApiPath, httpMethodsToMessages) {
380
380
  try {
381
381
  const api = await SwaggerParser.validate(openApiPath);
382
382
  const operations = [];
@@ -384,7 +384,8 @@ async function getOperationsByType(openApiPath) {
384
384
  const pathItem = api.paths[path3];
385
385
  for (const method in pathItem) {
386
386
  const openAPIOperation = pathItem[method];
387
- const messageType = openAPIOperation["x-eventcatalog-message-type"] || DEFAULT_MESSAGE_TYPE;
387
+ const defaultMessageType = httpMethodsToMessages?.[method.toUpperCase()] || DEFAULT_MESSAGE_TYPE;
388
+ const messageType = openAPIOperation["x-eventcatalog-message-type"] || defaultMessageType;
388
389
  const messageAction = openAPIOperation["x-eventcatalog-message-action"] === "sends" ? "sends" : "receives";
389
390
  const extensions = Object.keys(openAPIOperation).reduce((acc, key) => {
390
391
  if (key.startsWith("x-eventcatalog-")) {
@@ -612,7 +613,7 @@ import chalk from "chalk";
612
613
  // package.json
613
614
  var package_default = {
614
615
  name: "@eventcatalog/generator-openapi",
615
- version: "5.0.1",
616
+ version: "5.0.3",
616
617
  description: "OpenAPI generator for EventCatalog",
617
618
  scripts: {
618
619
  build: "tsup",
@@ -648,7 +649,7 @@ var package_default = {
648
649
  dependencies: {
649
650
  "@apidevtools/swagger-parser": "^10.1.0",
650
651
  "@changesets/cli": "^2.27.7",
651
- "@eventcatalog/sdk": "^2.0.1",
652
+ "@eventcatalog/sdk": "^2.2.4",
652
653
  chalk: "^4",
653
654
  "js-yaml": "^4.1.0",
654
655
  "openapi-types": "^12.1.3",
@@ -1629,6 +1630,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1629
1630
  });
1630
1631
  let owners = service.owners || [];
1631
1632
  let repository = null;
1633
+ let styles2 = null;
1632
1634
  const latestServiceInCatalog = await getService(service.id, "latest");
1633
1635
  console.log(chalk3.blue(`Processing service: ${document.info.title} (v${version})`));
1634
1636
  if (latestServiceInCatalog) {
@@ -1637,6 +1639,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1637
1639
  sends = latestServiceInCatalog.sends || [];
1638
1640
  owners = latestServiceInCatalog.owners || [];
1639
1641
  repository = latestServiceInCatalog.repository || null;
1642
+ styles2 = latestServiceInCatalog.styles || null;
1640
1643
  serviceSpecifications = {
1641
1644
  ...serviceSpecifications,
1642
1645
  ...latestServiceInCatalog.specifications
@@ -1657,7 +1660,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
1657
1660
  sends,
1658
1661
  receives,
1659
1662
  ...owners ? { owners } : {},
1660
- ...repository ? { repository } : {}
1663
+ ...repository ? { repository } : {},
1664
+ ...styles2 ? { styles: styles2 } : {}
1661
1665
  },
1662
1666
  { path: join(servicePath), override: true }
1663
1667
  );
@@ -1683,7 +1687,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1683
1687
  }
1684
1688
  };
1685
1689
  var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, options) => {
1686
- const operations = await getOperationsByType(pathToSpec);
1690
+ const operations = await getOperationsByType(pathToSpec, options.httpMethodsToMessages);
1687
1691
  const sidebarBadgeType = options.sidebarBadgeType || "HTTP_METHOD";
1688
1692
  const version = document.info.version;
1689
1693
  let receives = [], sends = [];