@eventcatalog/generator-openapi 7.4.2 → 7.4.4

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
@@ -561,7 +561,7 @@ var getSummary2 = (message2) => {
561
561
  }
562
562
  return escapeSpecialCharactersThatBreakMarkdown(eventCatalogMessageSummary);
563
563
  };
564
- var buildMessage = async (pathToFile, document, operation, generateMarkdown, messageIdConfig) => {
564
+ var buildMessage = async (pathToFile, document, operation, generateMarkdown, messageIdConfig, serviceId) => {
565
565
  const requestBodiesAndResponses = await getSchemasByOperationId(pathToFile, operation.operationId);
566
566
  const extensions = operation.extensions || {};
567
567
  const operationTags = operation.tags.map((badge) => ({
@@ -584,7 +584,7 @@ var buildMessage = async (pathToFile, document, operation, generateMarkdown, mes
584
584
  }
585
585
  if (messageIdConfig?.prefixWithServiceId) {
586
586
  const separator = messageIdConfig.separator || "-";
587
- uniqueIdentifier = [apiName, uniqueIdentifier].join(separator);
587
+ uniqueIdentifier = [serviceId, uniqueIdentifier].join(separator);
588
588
  }
589
589
  return {
590
590
  id: extensions["x-eventcatalog-message-id"] || uniqueIdentifier,
@@ -2822,7 +2822,7 @@ import { join } from "path";
2822
2822
  // package.json
2823
2823
  var package_default = {
2824
2824
  name: "@eventcatalog/generator-openapi",
2825
- version: "7.4.2",
2825
+ version: "7.4.4",
2826
2826
  description: "OpenAPI generator for EventCatalog",
2827
2827
  scripts: {
2828
2828
  build: "tsup",
@@ -2886,31 +2886,34 @@ var getInstalledVersionOfPackage = (packageName) => {
2886
2886
  async function checkForPackageUpdate(packageName) {
2887
2887
  const installedVersion = getInstalledVersionOfPackage(packageName);
2888
2888
  if (!installedVersion || installedVersion === "latest") return;
2889
- const pkg = { name: packageName, version: installedVersion };
2890
- const updateNotifierModule = await import("update-notifier");
2891
- const notifier = updateNotifierModule.default({ pkg, updateCheckInterval: 0, shouldNotifyInNpmScript: true });
2892
- const info = await notifier.fetchInfo();
2893
- if (info?.type !== "latest") {
2894
- const message2 = `Package ${packageName} update available ${info.current} \u2192 ${info.latest}
2889
+ try {
2890
+ const pkg = { name: packageName, version: installedVersion };
2891
+ const updateNotifierModule = await import("update-notifier");
2892
+ const notifier = updateNotifierModule.default({ pkg, updateCheckInterval: 0, shouldNotifyInNpmScript: true });
2893
+ const info = await notifier.fetchInfo();
2894
+ if (info?.type !== "latest") {
2895
+ const message2 = `Package ${packageName} update available ${info.current} \u2192 ${info.latest}
2895
2896
  Run npm i ${packageName} to update`;
2896
- console.log(
2897
- boxen(message2, {
2898
- padding: 1,
2899
- margin: 1,
2900
- align: "center",
2901
- borderColor: "yellow",
2902
- borderStyle: {
2903
- topLeft: " ",
2904
- topRight: " ",
2905
- bottomLeft: " ",
2906
- bottomRight: " ",
2907
- right: " ",
2908
- top: "-",
2909
- bottom: "-",
2910
- left: " "
2911
- }
2912
- })
2913
- );
2897
+ console.log(
2898
+ boxen(message2, {
2899
+ padding: 1,
2900
+ margin: 1,
2901
+ align: "center",
2902
+ borderColor: "yellow",
2903
+ borderStyle: {
2904
+ topLeft: " ",
2905
+ topRight: " ",
2906
+ bottomLeft: " ",
2907
+ bottomRight: " ",
2908
+ right: " ",
2909
+ top: "-",
2910
+ bottom: "-",
2911
+ left: " "
2912
+ }
2913
+ })
2914
+ );
2915
+ }
2916
+ } catch (error) {
2914
2917
  }
2915
2918
  }
2916
2919
 
@@ -3029,7 +3032,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
3029
3032
  ...options,
3030
3033
  owners: service.setMessageOwnersToServiceOwners ? service.owners : [],
3031
3034
  serviceHasMultipleSpecFiles: Array.isArray(serviceSpec.path),
3032
- isDraft: isServiceMarkedAsDraft
3035
+ isDraft: isServiceMarkedAsDraft,
3036
+ serviceId: service.id
3033
3037
  });
3034
3038
  let owners = service.owners || [];
3035
3039
  let repository = null;
@@ -3055,6 +3059,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
3055
3059
  await writeService(
3056
3060
  {
3057
3061
  ...service,
3062
+ name: serviceSpec.name || service.name,
3063
+ summary: serviceSpec.summary || service.summary,
3058
3064
  badges: serviceBadges || service.badges,
3059
3065
  markdown: serviceMarkdown,
3060
3066
  specifications: serviceSpecifications,
@@ -3103,7 +3109,8 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, op
3103
3109
  document,
3104
3110
  operation,
3105
3111
  options.messages?.generateMarkdown,
3106
- options.messages?.id
3112
+ options.messages?.id,
3113
+ options.serviceId
3107
3114
  );
3108
3115
  let messageMarkdown = message2.markdown;
3109
3116
  const messageType = operation.type;