@eventcatalog/generator-openapi 7.6.3 → 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
@@ -1163,7 +1163,7 @@ var require_dist = __commonJS({
1163
1163
  var http2 = __importStar(require("http"));
1164
1164
  var https_1 = require("https");
1165
1165
  __exportStar(require_helpers(), exports2);
1166
- var INTERNAL = Symbol("AgentBaseInternalState");
1166
+ var INTERNAL = /* @__PURE__ */ Symbol("AgentBaseInternalState");
1167
1167
  var Agent = class extends http2.Agent {
1168
1168
  constructor(opts) {
1169
1169
  super(opts);
@@ -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.3",
4075
+ version: "7.6.5",
4076
4076
  description: "OpenAPI generator for EventCatalog",
4077
4077
  scripts: {
4078
4078
  build: "tsup",
@@ -4109,7 +4109,7 @@ var package_default = {
4109
4109
  dependencies: {
4110
4110
  "@apidevtools/swagger-parser": "^10.1.0",
4111
4111
  "@changesets/cli": "^2.27.7",
4112
- "@eventcatalog/sdk": "^2.9.2",
4112
+ "@eventcatalog/sdk": "^2.9.6",
4113
4113
  chalk: "4.1.2",
4114
4114
  "js-yaml": "^4.1.0",
4115
4115
  "openapi-types": "^12.1.3",
@@ -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