@eventcatalog/generator-openapi 5.0.2 → 5.0.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.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -5
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.mts +4 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -387,6 +387,19 @@ async function getSchemasByOperationId(filePath, operationId) {
|
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
+
function getDeprecatedValues(openAPIOperation) {
|
|
391
|
+
const deprecatedDate = openAPIOperation["x-eventcatalog-deprecated-date"] || null;
|
|
392
|
+
const deprecatedMessage = openAPIOperation["x-eventcatalog-deprecated-message"] || null;
|
|
393
|
+
const isNativeDeprecated = openAPIOperation.deprecated;
|
|
394
|
+
let deprecated = isNativeDeprecated;
|
|
395
|
+
if (deprecatedDate) {
|
|
396
|
+
deprecated = {
|
|
397
|
+
date: deprecatedDate,
|
|
398
|
+
message: deprecatedMessage
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
return deprecated;
|
|
402
|
+
}
|
|
390
403
|
async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
391
404
|
try {
|
|
392
405
|
const api = await import_swagger_parser.default.validate(openApiPath);
|
|
@@ -396,6 +409,7 @@ async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
|
396
409
|
for (const method in pathItem) {
|
|
397
410
|
const openAPIOperation = pathItem[method];
|
|
398
411
|
const defaultMessageType = httpMethodsToMessages?.[method.toUpperCase()] || DEFAULT_MESSAGE_TYPE;
|
|
412
|
+
const deprecated = getDeprecatedValues(openAPIOperation);
|
|
399
413
|
const messageType = openAPIOperation["x-eventcatalog-message-type"] || defaultMessageType;
|
|
400
414
|
const messageAction = openAPIOperation["x-eventcatalog-message-action"] === "sends" ? "sends" : "receives";
|
|
401
415
|
const extensions = Object.keys(openAPIOperation).reduce((acc, key) => {
|
|
@@ -414,7 +428,8 @@ async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
|
414
428
|
description: openAPIOperation.description,
|
|
415
429
|
summary: openAPIOperation.summary,
|
|
416
430
|
tags: openAPIOperation.tags || [],
|
|
417
|
-
extensions
|
|
431
|
+
extensions,
|
|
432
|
+
...deprecated ? { deprecated } : {}
|
|
418
433
|
};
|
|
419
434
|
operations.push(operation);
|
|
420
435
|
}
|
|
@@ -565,7 +580,8 @@ var buildMessage = async (pathToFile, document, operation) => {
|
|
|
565
580
|
requestBodiesAndResponses,
|
|
566
581
|
sidebar: {
|
|
567
582
|
badge: httpVerb
|
|
568
|
-
}
|
|
583
|
+
},
|
|
584
|
+
...operation.deprecated ? { deprecated: operation.deprecated } : {}
|
|
569
585
|
};
|
|
570
586
|
};
|
|
571
587
|
|
|
@@ -624,7 +640,7 @@ var import_chalk = __toESM(require("chalk"));
|
|
|
624
640
|
// package.json
|
|
625
641
|
var package_default = {
|
|
626
642
|
name: "@eventcatalog/generator-openapi",
|
|
627
|
-
version: "5.0.
|
|
643
|
+
version: "5.0.4",
|
|
628
644
|
description: "OpenAPI generator for EventCatalog",
|
|
629
645
|
scripts: {
|
|
630
646
|
build: "tsup",
|
|
@@ -660,7 +676,7 @@ var package_default = {
|
|
|
660
676
|
dependencies: {
|
|
661
677
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
662
678
|
"@changesets/cli": "^2.27.7",
|
|
663
|
-
"@eventcatalog/sdk": "^2.
|
|
679
|
+
"@eventcatalog/sdk": "^2.2.6",
|
|
664
680
|
chalk: "^4",
|
|
665
681
|
"js-yaml": "^4.1.0",
|
|
666
682
|
"openapi-types": "^12.1.3",
|
|
@@ -1641,6 +1657,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1641
1657
|
});
|
|
1642
1658
|
let owners = service.owners || [];
|
|
1643
1659
|
let repository = null;
|
|
1660
|
+
let styles2 = null;
|
|
1644
1661
|
const latestServiceInCatalog = await getService(service.id, "latest");
|
|
1645
1662
|
console.log(import_chalk3.default.blue(`Processing service: ${document.info.title} (v${version})`));
|
|
1646
1663
|
if (latestServiceInCatalog) {
|
|
@@ -1649,6 +1666,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1649
1666
|
sends = latestServiceInCatalog.sends || [];
|
|
1650
1667
|
owners = latestServiceInCatalog.owners || [];
|
|
1651
1668
|
repository = latestServiceInCatalog.repository || null;
|
|
1669
|
+
styles2 = latestServiceInCatalog.styles || null;
|
|
1652
1670
|
serviceSpecifications = {
|
|
1653
1671
|
...serviceSpecifications,
|
|
1654
1672
|
...latestServiceInCatalog.specifications
|
|
@@ -1669,7 +1687,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1669
1687
|
sends,
|
|
1670
1688
|
receives,
|
|
1671
1689
|
...owners ? { owners } : {},
|
|
1672
|
-
...repository ? { repository } : {}
|
|
1690
|
+
...repository ? { repository } : {},
|
|
1691
|
+
...styles2 ? { styles: styles2 } : {}
|
|
1673
1692
|
},
|
|
1674
1693
|
{ path: (0, import_node_path.join)(servicePath), override: true }
|
|
1675
1694
|
);
|