@eventcatalog/generator-openapi 7.1.1 → 7.2.1

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
@@ -5876,9 +5876,9 @@ var require_src = __commonJS({
5876
5876
  }
5877
5877
  });
5878
5878
 
5879
- // ../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/helpers.js
5879
+ // ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
5880
5880
  var require_helpers = __commonJS({
5881
- "../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/helpers.js"(exports) {
5881
+ "../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"(exports) {
5882
5882
  "use strict";
5883
5883
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
5884
5884
  if (k2 === void 0) k2 = k;
@@ -5946,9 +5946,9 @@ var require_helpers = __commonJS({
5946
5946
  }
5947
5947
  });
5948
5948
 
5949
- // ../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/index.js
5949
+ // ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
5950
5950
  var require_dist = __commonJS({
5951
- "../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/index.js"(exports) {
5951
+ "../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js"(exports) {
5952
5952
  "use strict";
5953
5953
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
5954
5954
  if (k2 === void 0) k2 = k;
@@ -6044,7 +6044,7 @@ var require_dist = __commonJS({
6044
6044
  // In order to properly update the socket pool, we need to call `getName()` on
6045
6045
  // the core `https.Agent` if it is a secureEndpoint.
6046
6046
  getName(options) {
6047
- const secureEndpoint = typeof options.secureEndpoint === "boolean" ? options.secureEndpoint : this.isSecureEndpoint(options);
6047
+ const secureEndpoint = this.isSecureEndpoint(options);
6048
6048
  if (secureEndpoint) {
6049
6049
  return https_1.Agent.prototype.getName.call(this, options);
6050
6050
  }
@@ -6639,10 +6639,11 @@ var getSummary = (document2) => {
6639
6639
  const summary = document2.info.description ? document2.info.description : "";
6640
6640
  return summary && summary.length < 150 ? summary : "";
6641
6641
  };
6642
- var buildService = (serviceOptions, document2) => {
6642
+ var buildService = (serviceOptions, document2, generateMarkdown) => {
6643
6643
  const schemaPath = path.basename(serviceOptions.path) || "openapi.yml";
6644
6644
  const documentTags = document2.tags || [];
6645
6645
  const serviceId = serviceOptions.id || slugify(document2.info.title, { lower: true, strict: true });
6646
+ const generatedMarkdownForService = defaultMarkdown2(document2, schemaPath);
6646
6647
  return {
6647
6648
  id: serviceId,
6648
6649
  version: document2.info.version,
@@ -6652,7 +6653,7 @@ var buildService = (serviceOptions, document2) => {
6652
6653
  specifications: {
6653
6654
  openapiPath: schemaPath
6654
6655
  },
6655
- markdown: defaultMarkdown2(document2, schemaPath),
6656
+ markdown: generateMarkdown ? generateMarkdown({ service: serviceOptions, document: document2, markdown: generatedMarkdownForService }) : generatedMarkdownForService,
6656
6657
  badges: documentTags.map((tag) => ({ content: tag.name, textColor: "blue", backgroundColor: "blue" })),
6657
6658
  owners: serviceOptions.owners || [],
6658
6659
  setMessageOwnersToServiceOwners: serviceOptions.setMessageOwnersToServiceOwners || true
@@ -6866,7 +6867,7 @@ var getSummary2 = (message) => {
6866
6867
  }
6867
6868
  return eventCatalogMessageSummary;
6868
6869
  };
6869
- var buildMessage = async (pathToFile, document2, operation) => {
6870
+ var buildMessage = async (pathToFile, document2, operation, generateMarkdown) => {
6870
6871
  const requestBodiesAndResponses = await getSchemasByOperationId(pathToFile, operation.operationId);
6871
6872
  const extensions = operation.extensions || {};
6872
6873
  const operationTags = operation.tags.map((badge) => ({
@@ -6882,12 +6883,13 @@ var buildMessage = async (pathToFile, document2, operation) => {
6882
6883
  uniqueIdentifier = uniqueIdentifier.concat(`_${path3}`);
6883
6884
  }
6884
6885
  const httpVerb = operation.method.toUpperCase() || "";
6886
+ const generatedMarkdownForMessage = defaultMarkdown3(operation, requestBodiesAndResponses);
6885
6887
  return {
6886
6888
  id: extensions["x-eventcatalog-message-id"] || uniqueIdentifier,
6887
6889
  version: extensions["x-eventcatalog-message-version"] || document2.info.version,
6888
6890
  name: extensions["x-eventcatalog-message-name"] || uniqueIdentifier,
6889
6891
  summary: getSummary2(operation),
6890
- markdown: defaultMarkdown3(operation, requestBodiesAndResponses),
6892
+ markdown: generateMarkdown ? generateMarkdown({ operation, markdown: generatedMarkdownForMessage }) : generatedMarkdownForMessage,
6891
6893
  schemaPath: requestBodiesAndResponses?.requestBody ? "request-body.json" : "",
6892
6894
  badges,
6893
6895
  requestBodiesAndResponses,
@@ -8292,7 +8294,7 @@ import { join } from "path";
8292
8294
  // package.json
8293
8295
  var package_default = {
8294
8296
  name: "@eventcatalog/generator-openapi",
8295
- version: "7.1.1",
8297
+ version: "7.2.1",
8296
8298
  description: "OpenAPI generator for EventCatalog",
8297
8299
  scripts: {
8298
8300
  build: "tsup",
@@ -9255,7 +9257,7 @@ var index_default = async (_, options) => {
9255
9257
  const document2 = specification.document;
9256
9258
  const version = document2.info.version;
9257
9259
  const specPath = specification.path;
9258
- const service = buildService({ ...serviceSpec, path: specPath }, document2);
9260
+ const service = buildService({ ...serviceSpec, path: specPath }, document2, serviceSpec.generateMarkdown);
9259
9261
  let serviceMarkdown = service.markdown;
9260
9262
  let serviceSpecificationsFiles = [];
9261
9263
  let serviceSpecifications = service.specifications;
@@ -9274,11 +9276,12 @@ Processing domain: ${domainName} (v${domainVersion})`));
9274
9276
  console.log(chalk3.cyan(` - Versioned previous domain (v${currentDomain.version})`));
9275
9277
  }
9276
9278
  if (!domain || domain && domain.version !== domainVersion) {
9279
+ const generatedMarkdownForDomain = defaultMarkdown();
9277
9280
  await writeDomain({
9278
9281
  id: domainId,
9279
9282
  name: domainName,
9280
9283
  version: domainVersion,
9281
- markdown: defaultMarkdown(),
9284
+ markdown: options.domain?.generateMarkdown ? options.domain.generateMarkdown({ domain: options.domain, markdown: generatedMarkdownForDomain }) : generatedMarkdownForDomain,
9282
9285
  ...options.domain?.owners ? { owners: options.domain.owners } : {}
9283
9286
  });
9284
9287
  console.log(chalk3.cyan(` - Domain (v${domainVersion}) created`));
@@ -9364,7 +9367,12 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document2, servicePath, o
9364
9367
  const preserveExistingMessages = options.preserveExistingMessages ?? true;
9365
9368
  let receives = [], sends = [];
9366
9369
  for (const operation of operations) {
9367
- const { requestBodiesAndResponses, sidebar, ...message } = await buildMessage(pathToSpec, document2, operation);
9370
+ const { requestBodiesAndResponses, sidebar, ...message } = await buildMessage(
9371
+ pathToSpec,
9372
+ document2,
9373
+ operation,
9374
+ options.messages?.generateMarkdown
9375
+ );
9368
9376
  let messageMarkdown = message.markdown;
9369
9377
  const messageType = operation.type;
9370
9378
  const messageAction = operation.action;