@eventcatalog/generator-openapi 7.6.4 → 7.6.5

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
@@ -4072,7 +4072,7 @@ var import_node_path = require("path");
4072
4072
  // package.json
4073
4073
  var package_default = {
4074
4074
  name: "@eventcatalog/generator-openapi",
4075
- version: "7.6.4",
4075
+ version: "7.6.5",
4076
4076
  description: "OpenAPI generator for EventCatalog",
4077
4077
  scripts: {
4078
4078
  build: "tsup",
@@ -4185,6 +4185,13 @@ var isVersionLessThan = (version, givenVersion) => {
4185
4185
  var toUniqueArray = (array) => {
4186
4186
  return array.filter((item, index, self) => index === self.findIndex((t) => t.id === item.id && t.version === item.version));
4187
4187
  };
4188
+ var mergeOpenApiIntoSpecifications = (existingSpecs, openapiFileName) => {
4189
+ if (Array.isArray(existingSpecs)) {
4190
+ return [...existingSpecs.filter((spec) => spec.type !== "openapi"), { type: "openapi", path: openapiFileName }];
4191
+ }
4192
+ const { openapiPath: _, ...rest } = existingSpecs || {};
4193
+ return { openapiPath: openapiFileName, ...rest };
4194
+ };
4188
4195
  var index_default = async (_, options) => {
4189
4196
  if (!process.env.PROJECT_DIR) {
4190
4197
  process.env.PROJECT_DIR = process.cwd();
@@ -4323,10 +4330,9 @@ Processing domain: ${domainName} (v${domainVersion})`));
4323
4330
  serviceAttachments = latestServiceInCatalog.attachments || null;
4324
4331
  serviceWritesTo = latestServiceInCatalog.writesTo || [];
4325
4332
  serviceReadsFrom = latestServiceInCatalog.readsFrom || [];
4326
- serviceSpecifications = {
4327
- ...serviceSpecifications,
4328
- ...persistPreviousSpecificationFiles ? latestServiceInCatalog.specifications : {}
4329
- };
4333
+ if (persistPreviousSpecificationFiles && latestServiceInCatalog.specifications) {
4334
+ serviceSpecifications = mergeOpenApiIntoSpecifications(latestServiceInCatalog.specifications, service.schemaPath);
4335
+ }
4330
4336
  if (latestServiceInCatalog.version === version) {
4331
4337
  receives = latestServiceInCatalog.receives ? (
4332
4338
  // @ts-ignore