@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.mjs
CHANGED
|
@@ -376,6 +376,19 @@ async function getSchemasByOperationId(filePath, operationId) {
|
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
+
function getDeprecatedValues(openAPIOperation) {
|
|
380
|
+
const deprecatedDate = openAPIOperation["x-eventcatalog-deprecated-date"] || null;
|
|
381
|
+
const deprecatedMessage = openAPIOperation["x-eventcatalog-deprecated-message"] || null;
|
|
382
|
+
const isNativeDeprecated = openAPIOperation.deprecated;
|
|
383
|
+
let deprecated = isNativeDeprecated;
|
|
384
|
+
if (deprecatedDate) {
|
|
385
|
+
deprecated = {
|
|
386
|
+
date: deprecatedDate,
|
|
387
|
+
message: deprecatedMessage
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
return deprecated;
|
|
391
|
+
}
|
|
379
392
|
async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
380
393
|
try {
|
|
381
394
|
const api = await SwaggerParser.validate(openApiPath);
|
|
@@ -385,6 +398,7 @@ async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
|
385
398
|
for (const method in pathItem) {
|
|
386
399
|
const openAPIOperation = pathItem[method];
|
|
387
400
|
const defaultMessageType = httpMethodsToMessages?.[method.toUpperCase()] || DEFAULT_MESSAGE_TYPE;
|
|
401
|
+
const deprecated = getDeprecatedValues(openAPIOperation);
|
|
388
402
|
const messageType = openAPIOperation["x-eventcatalog-message-type"] || defaultMessageType;
|
|
389
403
|
const messageAction = openAPIOperation["x-eventcatalog-message-action"] === "sends" ? "sends" : "receives";
|
|
390
404
|
const extensions = Object.keys(openAPIOperation).reduce((acc, key) => {
|
|
@@ -403,7 +417,8 @@ async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
|
403
417
|
description: openAPIOperation.description,
|
|
404
418
|
summary: openAPIOperation.summary,
|
|
405
419
|
tags: openAPIOperation.tags || [],
|
|
406
|
-
extensions
|
|
420
|
+
extensions,
|
|
421
|
+
...deprecated ? { deprecated } : {}
|
|
407
422
|
};
|
|
408
423
|
operations.push(operation);
|
|
409
424
|
}
|
|
@@ -554,7 +569,8 @@ var buildMessage = async (pathToFile, document, operation) => {
|
|
|
554
569
|
requestBodiesAndResponses,
|
|
555
570
|
sidebar: {
|
|
556
571
|
badge: httpVerb
|
|
557
|
-
}
|
|
572
|
+
},
|
|
573
|
+
...operation.deprecated ? { deprecated: operation.deprecated } : {}
|
|
558
574
|
};
|
|
559
575
|
};
|
|
560
576
|
|
|
@@ -613,7 +629,7 @@ import chalk from "chalk";
|
|
|
613
629
|
// package.json
|
|
614
630
|
var package_default = {
|
|
615
631
|
name: "@eventcatalog/generator-openapi",
|
|
616
|
-
version: "5.0.
|
|
632
|
+
version: "5.0.4",
|
|
617
633
|
description: "OpenAPI generator for EventCatalog",
|
|
618
634
|
scripts: {
|
|
619
635
|
build: "tsup",
|
|
@@ -649,7 +665,7 @@ var package_default = {
|
|
|
649
665
|
dependencies: {
|
|
650
666
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
651
667
|
"@changesets/cli": "^2.27.7",
|
|
652
|
-
"@eventcatalog/sdk": "^2.
|
|
668
|
+
"@eventcatalog/sdk": "^2.2.6",
|
|
653
669
|
chalk: "^4",
|
|
654
670
|
"js-yaml": "^4.1.0",
|
|
655
671
|
"openapi-types": "^12.1.3",
|
|
@@ -1630,6 +1646,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1630
1646
|
});
|
|
1631
1647
|
let owners = service.owners || [];
|
|
1632
1648
|
let repository = null;
|
|
1649
|
+
let styles2 = null;
|
|
1633
1650
|
const latestServiceInCatalog = await getService(service.id, "latest");
|
|
1634
1651
|
console.log(chalk3.blue(`Processing service: ${document.info.title} (v${version})`));
|
|
1635
1652
|
if (latestServiceInCatalog) {
|
|
@@ -1638,6 +1655,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1638
1655
|
sends = latestServiceInCatalog.sends || [];
|
|
1639
1656
|
owners = latestServiceInCatalog.owners || [];
|
|
1640
1657
|
repository = latestServiceInCatalog.repository || null;
|
|
1658
|
+
styles2 = latestServiceInCatalog.styles || null;
|
|
1641
1659
|
serviceSpecifications = {
|
|
1642
1660
|
...serviceSpecifications,
|
|
1643
1661
|
...latestServiceInCatalog.specifications
|
|
@@ -1658,7 +1676,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1658
1676
|
sends,
|
|
1659
1677
|
receives,
|
|
1660
1678
|
...owners ? { owners } : {},
|
|
1661
|
-
...repository ? { repository } : {}
|
|
1679
|
+
...repository ? { repository } : {},
|
|
1680
|
+
...styles2 ? { styles: styles2 } : {}
|
|
1662
1681
|
},
|
|
1663
1682
|
{ path: join(servicePath), override: true }
|
|
1664
1683
|
);
|