@eventcatalog/generator-openapi 5.0.1 → 5.0.2

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.2",
616
617
  description: "OpenAPI generator for EventCatalog",
617
618
  scripts: {
618
619
  build: "tsup",
@@ -1683,7 +1684,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1683
1684
  }
1684
1685
  };
1685
1686
  var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, options) => {
1686
- const operations = await getOperationsByType(pathToSpec);
1687
+ const operations = await getOperationsByType(pathToSpec, options.httpMethodsToMessages);
1687
1688
  const sidebarBadgeType = options.sidebarBadgeType || "HTTP_METHOD";
1688
1689
  const version = document.info.version;
1689
1690
  let receives = [], sends = [];