-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: traits, id and reply problems for v3 (#910)
- Loading branch information
1 parent
62c58da
commit 18ee6fe
Showing
14 changed files
with
283 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { xParserObjectUniqueId } from '../constants'; | ||
|
||
/** | ||
* This function applies unique ids for objects whose key's function as ids, ensuring that the key is part of the value. | ||
* | ||
* For v3; Apply unique ids to channel's, and message's | ||
*/ | ||
export function applyUniqueIds(structure: any) { | ||
const asyncapiVersion = structure.asyncapi.charAt(0); | ||
switch (asyncapiVersion) { | ||
case '3': | ||
if (structure.channels) { | ||
for (const [channelId, channel] of Object.entries(structure.channels as Record<string, any>)) { | ||
channel[xParserObjectUniqueId] = channelId; | ||
if (channel.messages) { | ||
for (const [messageId, message] of Object.entries(channel.messages as Record<string, any>)) { | ||
message[xParserObjectUniqueId] = messageId; | ||
} | ||
} | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.