@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.mjs CHANGED
@@ -4067,7 +4067,7 @@ import { join } from "path";
4067
4067
  // package.json
4068
4068
  var package_default = {
4069
4069
  name: "@eventcatalog/generator-openapi",
4070
- version: "7.6.4",
4070
+ version: "7.6.5",
4071
4071
  description: "OpenAPI generator for EventCatalog",
4072
4072
  scripts: {
4073
4073
  build: "tsup",
@@ -4180,6 +4180,13 @@ var isVersionLessThan = (version, givenVersion) => {
4180
4180
  var toUniqueArray = (array) => {
4181
4181
  return array.filter((item, index, self) => index === self.findIndex((t) => t.id === item.id && t.version === item.version));
4182
4182
  };
4183
+ var mergeOpenApiIntoSpecifications = (existingSpecs, openapiFileName) => {
4184
+ if (Array.isArray(existingSpecs)) {
4185
+ return [...existingSpecs.filter((spec) => spec.type !== "openapi"), { type: "openapi", path: openapiFileName }];
4186
+ }
4187
+ const { openapiPath: _, ...rest } = existingSpecs || {};
4188
+ return { openapiPath: openapiFileName, ...rest };
4189
+ };
4183
4190
  var index_default = async (_, options) => {
4184
4191
  if (!process.env.PROJECT_DIR) {
4185
4192
  process.env.PROJECT_DIR = process.cwd();
@@ -4318,10 +4325,9 @@ Processing domain: ${domainName} (v${domainVersion})`));
4318
4325
  serviceAttachments = latestServiceInCatalog.attachments || null;
4319
4326
  serviceWritesTo = latestServiceInCatalog.writesTo || [];
4320
4327
  serviceReadsFrom = latestServiceInCatalog.readsFrom || [];
4321
- serviceSpecifications = {
4322
- ...serviceSpecifications,
4323
- ...persistPreviousSpecificationFiles ? latestServiceInCatalog.specifications : {}
4324
- };
4328
+ if (persistPreviousSpecificationFiles && latestServiceInCatalog.specifications) {
4329
+ serviceSpecifications = mergeOpenApiIntoSpecifications(latestServiceInCatalog.specifications, service.schemaPath);
4330
+ }
4325
4331
  if (latestServiceInCatalog.version === version) {
4326
4332
  receives = latestServiceInCatalog.receives ? (
4327
4333
  // @ts-ignore