Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
chore(plugin): removed code to set unique messages as sdk now does this
Browse files Browse the repository at this point in the history
  • Loading branch information
boyney123 committed Oct 3, 2024
1 parent e0d3367 commit 0983eef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"@changesets/cli": "^2.27.7",
"@eventcatalog/sdk": "^0.1.3",
"@eventcatalog/sdk": "^0.1.4",
"chalk": "^4",
"openapi-types": "^12.1.3",
"slugify": "^1.6.6"
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 2 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export default async (_: any, options: Props) => {
...service,
markdown: serviceMarkdown,
specifications: serviceSpecifications,
sends: uniqueMessages(sends),
receives: uniqueMessages(receives),
sends,
receives,
},
{ path: service.id }
);
Expand Down Expand Up @@ -235,16 +235,3 @@ const processMessagesForOpenAPISpec = async (pathToSpec: string, document: OpenA
}
return { receives, sends: [] };
};

const uniqueMessages = (messages: { id: string; version: string }[]): { id: string; version: string }[] => {
const uniqueSet = new Set();

return messages.filter((message) => {
const key = `${message.id}-${message.version}`;
if (!uniqueSet.has(key)) {
uniqueSet.add(key);
return true;
}
return false;
});
};

0 comments on commit 0983eef

Please sign in to comment.