@eventcatalog/generator-openapi 4.0.7 → 5.0.1
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -552,6 +552,7 @@ var buildMessage = async (pathToFile, document, operation) => {
|
|
|
552
552
|
if (!operation.operationId && path3) {
|
|
553
553
|
uniqueIdentifier = uniqueIdentifier.concat(`_${path3}`);
|
|
554
554
|
}
|
|
555
|
+
const httpVerb = operation.method.toUpperCase() || "";
|
|
555
556
|
return {
|
|
556
557
|
id: extensions["x-eventcatalog-message-id"] || uniqueIdentifier,
|
|
557
558
|
version: extensions["x-eventcatalog-message-version"] || document.info.version,
|
|
@@ -560,7 +561,10 @@ var buildMessage = async (pathToFile, document, operation) => {
|
|
|
560
561
|
markdown: defaultMarkdown3(operation, requestBodiesAndResponses),
|
|
561
562
|
schemaPath: requestBodiesAndResponses?.requestBody ? "request-body.json" : "",
|
|
562
563
|
badges,
|
|
563
|
-
requestBodiesAndResponses
|
|
564
|
+
requestBodiesAndResponses,
|
|
565
|
+
sidebar: {
|
|
566
|
+
badge: httpVerb
|
|
567
|
+
}
|
|
564
568
|
};
|
|
565
569
|
};
|
|
566
570
|
|
|
@@ -619,7 +623,7 @@ var import_chalk = __toESM(require("chalk"));
|
|
|
619
623
|
// package.json
|
|
620
624
|
var package_default = {
|
|
621
625
|
name: "@eventcatalog/generator-openapi",
|
|
622
|
-
version: "
|
|
626
|
+
version: "5.0.1",
|
|
623
627
|
description: "OpenAPI generator for EventCatalog",
|
|
624
628
|
scripts: {
|
|
625
629
|
build: "tsup",
|
|
@@ -655,7 +659,7 @@ var package_default = {
|
|
|
655
659
|
dependencies: {
|
|
656
660
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
657
661
|
"@changesets/cli": "^2.27.7",
|
|
658
|
-
"@eventcatalog/sdk": "^
|
|
662
|
+
"@eventcatalog/sdk": "^2.0.1",
|
|
659
663
|
chalk: "^4",
|
|
660
664
|
"js-yaml": "^4.1.0",
|
|
661
665
|
"openapi-types": "^12.1.3",
|
|
@@ -1691,10 +1695,11 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1691
1695
|
};
|
|
1692
1696
|
var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, options) => {
|
|
1693
1697
|
const operations = await getOperationsByType(pathToSpec);
|
|
1698
|
+
const sidebarBadgeType = options.sidebarBadgeType || "HTTP_METHOD";
|
|
1694
1699
|
const version = document.info.version;
|
|
1695
1700
|
let receives = [], sends = [];
|
|
1696
1701
|
for (const operation of operations) {
|
|
1697
|
-
const { requestBodiesAndResponses, ...message } = await buildMessage(pathToSpec, document, operation);
|
|
1702
|
+
const { requestBodiesAndResponses, sidebar, ...message } = await buildMessage(pathToSpec, document, operation);
|
|
1698
1703
|
let messageMarkdown = message.markdown;
|
|
1699
1704
|
const messageType = operation.type;
|
|
1700
1705
|
const messageAction = operation.action;
|
|
@@ -1719,7 +1724,13 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, op
|
|
|
1719
1724
|
messagePath = message.id;
|
|
1720
1725
|
}
|
|
1721
1726
|
await writeMessage(
|
|
1722
|
-
{
|
|
1727
|
+
{
|
|
1728
|
+
...message,
|
|
1729
|
+
markdown: messageMarkdown,
|
|
1730
|
+
...options.owners ? { owners: options.owners } : {},
|
|
1731
|
+
// only if its defined add it to the sidebar
|
|
1732
|
+
...sidebarBadgeType === "HTTP_METHOD" ? { sidebar } : {}
|
|
1733
|
+
},
|
|
1723
1734
|
{ path: messagePath, override: true }
|
|
1724
1735
|
);
|
|
1725
1736
|
if (messageAction === "sends") {
|