@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.mjs
CHANGED
|
@@ -541,6 +541,7 @@ var buildMessage = async (pathToFile, document, operation) => {
|
|
|
541
541
|
if (!operation.operationId && path3) {
|
|
542
542
|
uniqueIdentifier = uniqueIdentifier.concat(`_${path3}`);
|
|
543
543
|
}
|
|
544
|
+
const httpVerb = operation.method.toUpperCase() || "";
|
|
544
545
|
return {
|
|
545
546
|
id: extensions["x-eventcatalog-message-id"] || uniqueIdentifier,
|
|
546
547
|
version: extensions["x-eventcatalog-message-version"] || document.info.version,
|
|
@@ -549,7 +550,10 @@ var buildMessage = async (pathToFile, document, operation) => {
|
|
|
549
550
|
markdown: defaultMarkdown3(operation, requestBodiesAndResponses),
|
|
550
551
|
schemaPath: requestBodiesAndResponses?.requestBody ? "request-body.json" : "",
|
|
551
552
|
badges,
|
|
552
|
-
requestBodiesAndResponses
|
|
553
|
+
requestBodiesAndResponses,
|
|
554
|
+
sidebar: {
|
|
555
|
+
badge: httpVerb
|
|
556
|
+
}
|
|
553
557
|
};
|
|
554
558
|
};
|
|
555
559
|
|
|
@@ -608,7 +612,7 @@ import chalk from "chalk";
|
|
|
608
612
|
// package.json
|
|
609
613
|
var package_default = {
|
|
610
614
|
name: "@eventcatalog/generator-openapi",
|
|
611
|
-
version: "
|
|
615
|
+
version: "5.0.1",
|
|
612
616
|
description: "OpenAPI generator for EventCatalog",
|
|
613
617
|
scripts: {
|
|
614
618
|
build: "tsup",
|
|
@@ -644,7 +648,7 @@ var package_default = {
|
|
|
644
648
|
dependencies: {
|
|
645
649
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
646
650
|
"@changesets/cli": "^2.27.7",
|
|
647
|
-
"@eventcatalog/sdk": "^
|
|
651
|
+
"@eventcatalog/sdk": "^2.0.1",
|
|
648
652
|
chalk: "^4",
|
|
649
653
|
"js-yaml": "^4.1.0",
|
|
650
654
|
"openapi-types": "^12.1.3",
|
|
@@ -1680,10 +1684,11 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1680
1684
|
};
|
|
1681
1685
|
var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, options) => {
|
|
1682
1686
|
const operations = await getOperationsByType(pathToSpec);
|
|
1687
|
+
const sidebarBadgeType = options.sidebarBadgeType || "HTTP_METHOD";
|
|
1683
1688
|
const version = document.info.version;
|
|
1684
1689
|
let receives = [], sends = [];
|
|
1685
1690
|
for (const operation of operations) {
|
|
1686
|
-
const { requestBodiesAndResponses, ...message } = await buildMessage(pathToSpec, document, operation);
|
|
1691
|
+
const { requestBodiesAndResponses, sidebar, ...message } = await buildMessage(pathToSpec, document, operation);
|
|
1687
1692
|
let messageMarkdown = message.markdown;
|
|
1688
1693
|
const messageType = operation.type;
|
|
1689
1694
|
const messageAction = operation.action;
|
|
@@ -1708,7 +1713,13 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, op
|
|
|
1708
1713
|
messagePath = message.id;
|
|
1709
1714
|
}
|
|
1710
1715
|
await writeMessage(
|
|
1711
|
-
{
|
|
1716
|
+
{
|
|
1717
|
+
...message,
|
|
1718
|
+
markdown: messageMarkdown,
|
|
1719
|
+
...options.owners ? { owners: options.owners } : {},
|
|
1720
|
+
// only if its defined add it to the sidebar
|
|
1721
|
+
...sidebarBadgeType === "HTTP_METHOD" ? { sidebar } : {}
|
|
1722
|
+
},
|
|
1712
1723
|
{ path: messagePath, override: true }
|
|
1713
1724
|
);
|
|
1714
1725
|
if (messageAction === "sends") {
|