diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v2/_6_0/SlackRtm.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v2/_6_0/SlackRtm.kt new file mode 100644 index 00000000..f1fc2791 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v2/_6_0/SlackRtm.kt @@ -0,0 +1,1570 @@ +package com.asyncapi.examples.v2._6_0 + +import com.asyncapi.v2.Reference +import com.asyncapi.v2._6_0.model.channel.ChannelItem +import com.asyncapi.v2._6_0.model.channel.message.Message +import com.asyncapi.v2._6_0.model.channel.message.OneOfMessages +import com.asyncapi.v2._6_0.model.channel.operation.Operation +import com.asyncapi.v2._6_0.model.component.Components +import com.asyncapi.v2._6_0.model.info.Info +import com.asyncapi.v2._6_0.model.server.Server +import com.asyncapi.v2.schema.Schema +import com.asyncapi.v2.security_scheme.http.HttpApiKeySecurityScheme + +class SlackRtm: AbstractExampleValidationTest() { + + override fun specificationLocation(): String = "/examples/v2.6.0/slack-rtm.yml" + + override fun expectedId(): String = "wss://wss-primary.slack.com/websocket" + + override fun expectedInfo(): Info { + return Info.builder() + .title("Slack Real Time Messaging API") + .version("1.0.0") + .build() + } + + override fun expectedServers(): Map { + return mapOf( + Pair("production", + Server.builder() + .url("https://slack.com/api/rtm.connect") + .protocol("https") + .protocolVersion("1.1") + .security(listOf( + mapOf(Pair("token", emptyList())) + )) + .build() + ) + ) + } + + override fun expectedChannels(): Map { + return mapOf( + Pair("/", + ChannelItem.builder() + .publish(Operation.builder() + .message(Reference("#/components/messages/outgoingMessage")) + .build() + ) + .subscribe(Operation.builder() + .message(OneOfMessages(listOf( + Reference("#/components/messages/hello"), + Reference("#/components/messages/connectionError"), + Reference("#/components/messages/accountsChanged"), + Reference("#/components/messages/botAdded"), + Reference("#/components/messages/botChanged"), + Reference("#/components/messages/channelArchive"), + Reference("#/components/messages/channelCreated"), + Reference("#/components/messages/channelDeleted"), + Reference("#/components/messages/channelHistoryChanged"), + Reference("#/components/messages/channelJoined"), + Reference("#/components/messages/channelLeft"), + Reference("#/components/messages/channelMarked"), + Reference("#/components/messages/channelRename"), + Reference("#/components/messages/channelUnarchive"), + Reference("#/components/messages/commandsChanged"), + Reference("#/components/messages/dndUpdated"), + Reference("#/components/messages/dndUpdatedUser"), + Reference("#/components/messages/emailDomainChanged"), + Reference("#/components/messages/emojiRemoved"), + Reference("#/components/messages/emojiAdded"), + Reference("#/components/messages/fileChange"), + Reference("#/components/messages/fileCommentAdded"), + Reference("#/components/messages/fileCommentDeleted"), + Reference("#/components/messages/fileCommentEdited"), + Reference("#/components/messages/fileCreated"), + Reference("#/components/messages/fileDeleted"), + Reference("#/components/messages/filePublic"), + Reference("#/components/messages/fileShared"), + Reference("#/components/messages/fileUnshared"), + Reference("#/components/messages/goodbye"), + Reference("#/components/messages/groupArchive"), + Reference("#/components/messages/groupClose"), + Reference("#/components/messages/groupHistoryChanged"), + Reference("#/components/messages/groupJoined"), + Reference("#/components/messages/groupLeft"), + Reference("#/components/messages/groupMarked"), + Reference("#/components/messages/groupOpen"), + Reference("#/components/messages/groupRename"), + Reference("#/components/messages/groupUnarchive"), + Reference("#/components/messages/imClose"), + Reference("#/components/messages/imCreated"), + Reference("#/components/messages/imMarked"), + Reference("#/components/messages/imOpen"), + Reference("#/components/messages/manualPresenceChange"), + Reference("#/components/messages/memberJoinedChannel"), + Reference("#/components/messages/message") + ))) + .build() + ) + .build() + ) + ) + } + + override fun expectedComponents(): Components? { + return Components.builder() + .securitySchemes(mapOf( + Pair("token", HttpApiKeySecurityScheme( + null, + "token", + HttpApiKeySecurityScheme.ApiKeyLocation.QUERY + )) + )) + .schemas(mapOf( + Pair("attachment", + Schema.builder() + .type("object") + .properties(mapOf( + Pair("fallback", Schema.builder() + .type("string") + .build() + ), + Pair("color", Schema.builder() + .type("string") + .build() + ), + Pair("pretext", Schema.builder() + .type("string") + .build() + ), + Pair("author_name", Schema.builder() + .type("string") + .build() + ), + Pair("author_link", Schema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("author_icon", Schema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("title", Schema.builder() + .type("string") + .build() + ), + Pair("title_link", Schema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("text", Schema.builder() + .type("string") + .build() + ), + Pair("fields", Schema.builder() + .type("array") + .items(Schema.builder() + .type("object") + .properties(mapOf( + Pair("title", Schema.builder() + .type("string") + .build() + ), + Pair("value", Schema.builder() + .type("string") + .build() + ), + Pair("short", Schema.builder() + .type("boolean") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("image_url", Schema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("thumb_url", Schema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("footer", Schema.builder() + .type("string") + .build() + ), + Pair("footer_icon", Schema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("ts", Schema.builder() + .type("number") + .build() + ), + )) + .build() + ) + )) + .messages(mapOf( + Pair("hello", + Message.builder() + .summary("First event received upon connection.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("hello")) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("connectionError", + Message.builder() + .summary("Event received when a connection error happens.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("error")) + .build() + ), + Pair("error", Schema.builder() + .type("object") + .properties(mapOf( + Pair("code", Schema.builder().type("number").build()), + Pair("msg", Schema.builder().type("string").build()), + )) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("accountsChanged", + Message.builder() + .summary("The list of accounts a user is signed into has changed.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("accounts_changed")) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("botAdded", + Message.builder() + .summary("A bot user was added.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("bot_added")) + .build() + ), + Pair("bot", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder() + .type("string") + .build() + ), + Pair("app_id", Schema.builder() + .type("string") + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("icons", Schema.builder() + .type("object") + .additionalProperties(Schema.builder().type("string").build()) + .build() + ) + )) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("botChanged", + Message.builder() + .summary("A bot user was changed.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("bot_added")) + .build() + ), + Pair("bot", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder() + .type("string") + .build() + ), + Pair("app_id", Schema.builder() + .type("string") + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("icons", Schema.builder() + .type("object") + .additionalProperties(Schema.builder().type("string").build()) + .build() + ) + )) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("channelArchive", + Message.builder() + .summary("A channel was archived.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_archive")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("channelCreated", + Message.builder() + .summary("A channel was created.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_created")) + .build() + ), + Pair("channel", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder() + .type("string") + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("created", Schema.builder() + .type("number") + .build() + ), + Pair("creator", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("channelDeleted", + Message.builder() + .summary("A channel was deleted.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_deleted")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ) + .build() + ), + Pair("channelHistoryChanged", + Message.builder() + .summary("Bulk updates were made to a channel's history.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_history_changed")) + .build() + ), + Pair("latest", Schema.builder() + .type("string") + .build() + ), + Pair("ts", Schema.builder() + .type("string") + .build() + ), + Pair("event_ts", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ) + .build() + ), + Pair("channelJoined", + Message.builder() + .summary("You joined a channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_joined")) + .build() + ), + Pair("channel", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder() + .type("string") + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("created", Schema.builder() + .type("number") + .build() + ), + Pair("creator", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("channelLeft", + Message.builder() + .summary("You left a channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_left")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ) + .build() + ), + Pair("channelMarked", + Message.builder() + .summary("Your channel read marker was updated.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_marked")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("ts", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ) + .build() + ), + Pair("channelRename", + Message.builder() + .summary("A channel was renamed.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_rename")) + .build() + ), + Pair("channel", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder() + .type("string") + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("created", Schema.builder() + .type("number") + .build() + ) + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("channelUnarchive", + Message.builder() + .summary("A channel was unarchived.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("channel_unarchive")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("commandsChanged", + Message.builder() + .summary("A slash command has been added or changed.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("commands_changed")) + .build() + ), + Pair("event_ts", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ) + .build() + ), + Pair("dndUpdated", + Message.builder() + .summary("Do not Disturb settings changed for the current user.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("dnd_updated")) + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + Pair("dnd_status", Schema.builder() + .type("object") + .properties(mapOf( + Pair("dnd_enabled", Schema.builder() + .type("boolean") + .build() + ), + Pair("next_dnd_start_ts", Schema.builder() + .type("number") + .build() + ), + Pair("next_dnd_end_ts", Schema.builder() + .type("number") + .build() + ), + Pair("snooze_enabled", Schema.builder() + .type("boolean") + .build() + ), + Pair("snooze_endtime", Schema.builder() + .type("number") + .build() + ) + )) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("dndUpdatedUser", + Message.builder() + .summary("Do not Disturb settings changed for a member.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("dnd_updated_user")) + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + Pair("dnd_status", Schema.builder() + .type("object") + .properties(mapOf( + Pair("dnd_enabled", Schema.builder() + .type("boolean") + .build() + ), + Pair("next_dnd_start_ts", Schema.builder() + .type("number") + .build() + ), + Pair("next_dnd_end_ts", Schema.builder() + .type("number") + .build() + ) + )) + .build() + ) + )) + .build() + ) + .build() + ), + Pair("emailDomainChanged", + Message.builder() + .summary("The workspace email domain has changed.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("email_domain_changed")) + .build() + ), + Pair("email_domain", Schema.builder() + .type("string") + .build() + ), + Pair("event_ts", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("emojiRemoved", + Message.builder() + .summary("A custom emoji has been removed.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("emoji_changed")) + .build() + ), + Pair("subtype", Schema.builder() + .type("string") + .enumValue(listOf("remove")) + .build() + ), + Pair("names", Schema.builder() + .type("array") + .items(Schema.builder().type("string").build()) + .build() + ), + Pair("event_ts", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("emojiAdded", + Message.builder() + .summary("A custom emoji has been added.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("emoji_changed")) + .build() + ), + Pair("subtype", Schema.builder() + .type("string") + .enumValue(listOf("add")) + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("value", Schema.builder() + .type("string") + .format("uri") + .build() + ), + Pair("event_ts", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("fileChange", + Message.builder() + .summary("A file was changed.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_change")) + .build() + ), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("file", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder().type("string").build()), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("fileCommentAdded", + Message.builder() + .summary("A file comment was added.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_comment_added")) + .build() + ), + Pair("comment", Schema()), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("file", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder().type("string").build()), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("fileCommentDeleted", + Message.builder() + .summary("A file comment was deleted.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_comment_deleted")) + .build() + ), + Pair("comment", Schema.builder() + .type("string") + .build() + ), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("file", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder().type("string").build()), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("fileCommentEdited", + Message.builder() + .summary("A file comment was edited.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_comment_edited")) + .build() + ), + Pair("comment", Schema()), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("file", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder().type("string").build()), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("fileCreated", + Message.builder() + .summary("A file was created.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_created")) + .build() + ), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("file", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder().type("string").build()), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("fileDeleted", + Message.builder() + .summary("A file was deleted.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_deleted")) + .build() + ), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("event_ts", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("filePublic", + Message.builder() + .summary("A file was made public.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_public")) + .build() + ), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("file", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder().type("string").build()), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("fileShared", + Message.builder() + .summary("A file was shared.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_shared")) + .build() + ), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("file", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder().type("string").build()), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("fileUnshared", + Message.builder() + .summary("A file was unshared.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("file_unshared")) + .build() + ), + Pair("file_id", Schema.builder() + .type("string") + .build() + ), + Pair("file", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder().type("string").build()), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("goodbye", + Message.builder() + .summary("The server intends to close the connection soon.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("goodbye")) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupArchive", + Message.builder() + .summary("A private channel was archived.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_archive")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupClose", + Message.builder() + .summary("You closed a private channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_close")) + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupHistoryChanged", + Message.builder() + .summary("Bulk updates were made to a private channel's history.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_history_changed")) + .build() + ), + Pair("latest", Schema.builder() + .type("string") + .build() + ), + Pair("ts", Schema.builder() + .type("string") + .build() + ), + Pair("event_ts", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupJoined", + Message.builder() + .summary("You joined a private channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_joined")) + .build() + ), + Pair("channel", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder() + .type("string") + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("created", Schema.builder() + .type("number") + .build() + ), + Pair("creator", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupLeft", + Message.builder() + .summary("You left a private channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_left")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupMarked", + Message.builder() + .summary("A private channel read marker was updated.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_marked")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("ts", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupOpen", + Message.builder() + .summary("You opened a private channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_open")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupRename", + Message.builder() + .summary("A private channel was renamed.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_rename")) + .build() + ), + Pair("channel", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder() + .type("string") + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("created", Schema.builder() + .type("number") + .build() + ), + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("groupUnarchive", + Message.builder() + .summary("A private channel was unarchived.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("group_unarchive")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("imClose", + Message.builder() + .summary("You closed a DM.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("im_close")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("imCreated", + Message.builder() + .summary("A DM was created.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("im_created")) + .build() + ), + Pair("channel", Schema.builder() + .type("object") + .properties(mapOf( + Pair("id", Schema.builder() + .type("string") + .build() + ), + Pair("name", Schema.builder() + .type("string") + .build() + ), + Pair("created", Schema.builder() + .type("number") + .build() + ), + Pair("creator", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("imMarked", + Message.builder() + .summary("A direct message read marker was updated.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("im_marked")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("ts", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("imOpen", + Message.builder() + .summary("You opened a DM.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("im_open")) + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("manualPresenceChange", + Message.builder() + .summary("You manually updated your presence.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("manual_presence_change")) + .build() + ), + Pair("presence", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("memberJoinedChannel", + Message.builder() + .summary("A user joined a public or private channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("member_joined_channel")) + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("channel_type", Schema.builder() + .type("string") + .enumValue(listOf("C", "G")) + .build() + ), + Pair("team", Schema.builder() + .type("string") + .build() + ), + Pair("inviter", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("memberLeftChannel", + Message.builder() + .summary("A user left a public or private channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("member_left_channel")) + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("channel_type", Schema.builder() + .type("string") + .enumValue(listOf("C", "G")) + .build() + ), + Pair("team", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ), + Pair("message", + Message.builder() + .summary("A message was sent to a channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("message")) + .build() + ), + Pair("user", Schema.builder() + .type("string") + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("text", Schema.builder() + .type("string") + .build() + ), + Pair("ts", Schema.builder() + .type("string") + .build() + ), + Pair("attachments", Schema.builder() + .type("array") + .items(Schema.builder().ref("#/components/schemas/attachment").build()) + .build() + ), + Pair("edited", Schema.builder() + .type("object") + .properties(mapOf( + Pair("user", Schema.builder() + .type("string") + .build() + ), + Pair("ts", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ), + )) + .build() + ) + .build() + ), + Pair("outgoingMessage", + Message.builder() + .summary("A message was sent to a channel.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("type", Schema.builder() + .type("string") + .enumValue(listOf("message")) + .build() + ), + Pair("id", Schema.builder() + .type("number") + .build() + ), + Pair("channel", Schema.builder() + .type("string") + .build() + ), + Pair("text", Schema.builder() + .type("string") + .build() + ), + )) + .build() + ) + .build() + ) + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/examples/v2.6.0/slack-rtm.yml b/asyncapi-core/src/test/resources/examples/v2.6.0/slack-rtm.yml new file mode 100644 index 00000000..4c0deadd --- /dev/null +++ b/asyncapi-core/src/test/resources/examples/v2.6.0/slack-rtm.yml @@ -0,0 +1,884 @@ +asyncapi: "2.6.0" +id: 'wss://wss-primary.slack.com/websocket' +info: + title: Slack Real Time Messaging API + version: '1.0.0' + +servers: + production: + url: https://slack.com/api/rtm.connect + protocol: https + protocolVersion: '1.1' + security: + - token: [] + +channels: + /: + publish: + message: + $ref: '#/components/messages/outgoingMessage' + subscribe: + message: + oneOf: + - $ref: '#/components/messages/hello' + - $ref: '#/components/messages/connectionError' + - $ref: '#/components/messages/accountsChanged' + - $ref: '#/components/messages/botAdded' + - $ref: '#/components/messages/botChanged' + - $ref: '#/components/messages/channelArchive' + - $ref: '#/components/messages/channelCreated' + - $ref: '#/components/messages/channelDeleted' + - $ref: '#/components/messages/channelHistoryChanged' + - $ref: '#/components/messages/channelJoined' + - $ref: '#/components/messages/channelLeft' + - $ref: '#/components/messages/channelMarked' + - $ref: '#/components/messages/channelRename' + - $ref: '#/components/messages/channelUnarchive' + - $ref: '#/components/messages/commandsChanged' + - $ref: '#/components/messages/dndUpdated' + - $ref: '#/components/messages/dndUpdatedUser' + - $ref: '#/components/messages/emailDomainChanged' + - $ref: '#/components/messages/emojiRemoved' + - $ref: '#/components/messages/emojiAdded' + - $ref: '#/components/messages/fileChange' + - $ref: '#/components/messages/fileCommentAdded' + - $ref: '#/components/messages/fileCommentDeleted' + - $ref: '#/components/messages/fileCommentEdited' + - $ref: '#/components/messages/fileCreated' + - $ref: '#/components/messages/fileDeleted' + - $ref: '#/components/messages/filePublic' + - $ref: '#/components/messages/fileShared' + - $ref: '#/components/messages/fileUnshared' + - $ref: '#/components/messages/goodbye' + - $ref: '#/components/messages/groupArchive' + - $ref: '#/components/messages/groupClose' + - $ref: '#/components/messages/groupHistoryChanged' + - $ref: '#/components/messages/groupJoined' + - $ref: '#/components/messages/groupLeft' + - $ref: '#/components/messages/groupMarked' + - $ref: '#/components/messages/groupOpen' + - $ref: '#/components/messages/groupRename' + - $ref: '#/components/messages/groupUnarchive' + - $ref: '#/components/messages/imClose' + - $ref: '#/components/messages/imCreated' + - $ref: '#/components/messages/imMarked' + - $ref: '#/components/messages/imOpen' + - $ref: '#/components/messages/manualPresenceChange' + - $ref: '#/components/messages/memberJoinedChannel' + - $ref: '#/components/messages/message' + +components: + securitySchemes: + token: + type: httpApiKey + name: token + in: query + + schemas: + attachment: + type: object + properties: + fallback: + type: string + color: + type: string + pretext: + type: string + author_name: + type: string + author_link: + type: string + format: uri + author_icon: + type: string + format: uri + title: + type: string + title_link: + type: string + format: uri + text: + type: string + fields: + type: array + items: + type: object + properties: + title: + type: string + value: + type: string + short: + type: boolean + image_url: + type: string + format: uri + thumb_url: + type: string + format: uri + footer: + type: string + footer_icon: + type: string + format: uri + ts: + type: number + + messages: + hello: + summary: 'First event received upon connection.' + payload: + type: object + properties: + type: + type: string + enum: + - hello + connectionError: + summary: 'Event received when a connection error happens.' + payload: + type: object + properties: + type: + type: string + enum: + - error + error: + type: object + properties: + code: + type: number + msg: + type: string + accountsChanged: + summary: 'The list of accounts a user is signed into has changed.' + payload: + type: object + properties: + type: + type: string + enum: + - accounts_changed + botAdded: + summary: 'A bot user was added.' + payload: + type: object + properties: + type: + type: string + enum: + - bot_added + bot: + type: object + properties: + id: + type: string + app_id: + type: string + name: + type: string + icons: + type: object + additionalProperties: + type: string + botChanged: + summary: 'A bot user was changed.' + payload: + type: object + properties: + type: + type: string + enum: + - bot_added + bot: + type: object + properties: + id: + type: string + app_id: + type: string + name: + type: string + icons: + type: object + additionalProperties: + type: string + channelArchive: + summary: 'A channel was archived.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_archive + channel: + type: string + user: + type: string + channelCreated: + summary: 'A channel was created.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_created + channel: + type: object + properties: + id: + type: string + name: + type: string + created: + type: number + creator: + type: string + channelDeleted: + summary: 'A channel was deleted.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_deleted + channel: + type: string + channelHistoryChanged: + summary: 'Bulk updates were made to a channel''s history.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_history_changed + latest: + type: string + ts: + type: string + event_ts: + type: string + channelJoined: + summary: 'You joined a channel.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_joined + channel: + type: object + properties: + id: + type: string + name: + type: string + created: + type: number + creator: + type: string + channelLeft: + summary: 'You left a channel.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_left + channel: + type: string + channelMarked: + summary: 'Your channel read marker was updated.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_marked + channel: + type: string + ts: + type: string + channelRename: + summary: 'A channel was renamed.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_rename + channel: + type: object + properties: + id: + type: string + name: + type: string + created: + type: number + channelUnarchive: + summary: 'A channel was unarchived.' + payload: + type: object + properties: + type: + type: string + enum: + - channel_unarchive + channel: + type: string + user: + type: string + commandsChanged: + summary: 'A slash command has been added or changed.' + payload: + type: object + properties: + type: + type: string + enum: + - commands_changed + event_ts: + type: string + dndUpdated: + summary: 'Do not Disturb settings changed for the current user.' + payload: + type: object + properties: + type: + type: string + enum: + - dnd_updated + user: + type: string + dnd_status: + type: object + properties: + dnd_enabled: + type: boolean + next_dnd_start_ts: + type: number + next_dnd_end_ts: + type: number + snooze_enabled: + type: boolean + snooze_endtime: + type: number + dndUpdatedUser: + summary: 'Do not Disturb settings changed for a member.' + payload: + type: object + properties: + type: + type: string + enum: + - dnd_updated_user + user: + type: string + dnd_status: + type: object + properties: + dnd_enabled: + type: boolean + next_dnd_start_ts: + type: number + next_dnd_end_ts: + type: number + emailDomainChanged: + summary: 'The workspace email domain has changed.' + payload: + type: object + properties: + type: + type: string + enum: + - email_domain_changed + email_domain: + type: string + event_ts: + type: string + emojiRemoved: + summary: 'A custom emoji has been removed.' + payload: + type: object + properties: + type: + type: string + enum: + - emoji_changed + subtype: + type: string + enum: + - remove + names: + type: array + items: + type: string + event_ts: + type: string + emojiAdded: + summary: 'A custom emoji has been added.' + payload: + type: object + properties: + type: + type: string + enum: + - emoji_changed + subtype: + type: string + enum: + - add + name: + type: string + value: + type: string + format: uri + event_ts: + type: string + fileChange: + summary: 'A file was changed.' + payload: + type: object + properties: + type: + type: string + enum: + - file_change + file_id: + type: string + file: + type: object + properties: + id: + type: string + fileCommentAdded: + summary: 'A file comment was added.' + payload: + type: object + properties: + type: + type: string + enum: + - file_comment_added + comment: {} + file_id: + type: string + file: + type: object + properties: + id: + type: string + fileCommentDeleted: + summary: 'A file comment was deleted.' + payload: + type: object + properties: + type: + type: string + enum: + - file_comment_deleted + comment: + type: string + file_id: + type: string + file: + type: object + properties: + id: + type: string + fileCommentEdited: + summary: 'A file comment was edited.' + payload: + type: object + properties: + type: + type: string + enum: + - file_comment_edited + comment: {} + file_id: + type: string + file: + type: object + properties: + id: + type: string + fileCreated: + summary: 'A file was created.' + payload: + type: object + properties: + type: + type: string + enum: + - file_created + file_id: + type: string + file: + type: object + properties: + id: + type: string + fileDeleted: + summary: 'A file was deleted.' + payload: + type: object + properties: + type: + type: string + enum: + - file_deleted + file_id: + type: string + event_ts: + type: string + filePublic: + summary: 'A file was made public.' + payload: + type: object + properties: + type: + type: string + enum: + - file_public + file_id: + type: string + file: + type: object + properties: + id: + type: string + fileShared: + summary: 'A file was shared.' + payload: + type: object + properties: + type: + type: string + enum: + - file_shared + file_id: + type: string + file: + type: object + properties: + id: + type: string + fileUnshared: + summary: 'A file was unshared.' + payload: + type: object + properties: + type: + type: string + enum: + - file_unshared + file_id: + type: string + file: + type: object + properties: + id: + type: string + goodbye: + summary: 'The server intends to close the connection soon.' + payload: + type: object + properties: + type: + type: string + enum: + - goodbye + groupArchive: + summary: 'A private channel was archived.' + payload: + type: object + properties: + type: + type: string + enum: + - group_archive + channel: + type: string + groupClose: + summary: 'You closed a private channel.' + payload: + type: object + properties: + type: + type: string + enum: + - group_close + user: + type: string + channel: + type: string + groupHistoryChanged: + summary: 'Bulk updates were made to a private channel''s history.' + payload: + type: object + properties: + type: + type: string + enum: + - group_history_changed + latest: + type: string + ts: + type: string + event_ts: + type: string + groupJoined: + summary: 'You joined a private channel.' + payload: + type: object + properties: + type: + type: string + enum: + - group_joined + channel: + type: object + properties: + id: + type: string + name: + type: string + created: + type: number + creator: + type: string + groupLeft: + summary: 'You left a private channel.' + payload: + type: object + properties: + type: + type: string + enum: + - group_left + channel: + type: string + groupMarked: + summary: 'A private channel read marker was updated.' + payload: + type: object + properties: + type: + type: string + enum: + - group_marked + channel: + type: string + ts: + type: string + groupOpen: + summary: 'You opened a private channel.' + payload: + type: object + properties: + type: + type: string + enum: + - group_open + user: + type: string + channel: + type: string + groupRename: + summary: 'A private channel was renamed.' + payload: + type: object + properties: + type: + type: string + enum: + - group_rename + channel: + type: object + properties: + id: + type: string + name: + type: string + created: + type: number + groupUnarchive: + summary: 'A private channel was unarchived.' + payload: + type: object + properties: + type: + type: string + enum: + - group_unarchive + channel: + type: string + user: + type: string + imClose: + summary: 'You closed a DM.' + payload: + type: object + properties: + type: + type: string + enum: + - im_close + channel: + type: string + user: + type: string + imCreated: + summary: 'A DM was created.' + payload: + type: object + properties: + type: + type: string + enum: + - im_created + channel: + type: object + properties: + id: + type: string + name: + type: string + created: + type: number + creator: + type: string + user: + type: string + imMarked: + summary: 'A direct message read marker was updated.' + payload: + type: object + properties: + type: + type: string + enum: + - im_marked + channel: + type: string + ts: + type: string + imOpen: + summary: 'You opened a DM.' + payload: + type: object + properties: + type: + type: string + enum: + - im_open + channel: + type: string + user: + type: string + manualPresenceChange: + summary: 'You manually updated your presence.' + payload: + type: object + properties: + type: + type: string + enum: + - manual_presence_change + presence: + type: string + memberJoinedChannel: + summary: 'A user joined a public or private channel.' + payload: + type: object + properties: + type: + type: string + enum: + - member_joined_channel + user: + type: string + channel: + type: string + channel_type: + type: string + enum: + - C + - G + team: + type: string + inviter: + type: string + memberLeftChannel: + summary: 'A user left a public or private channel.' + payload: + type: object + properties: + type: + type: string + enum: + - member_left_channel + user: + type: string + channel: + type: string + channel_type: + type: string + enum: + - C + - G + team: + type: string + message: + summary: 'A message was sent to a channel.' + payload: + type: object + properties: + type: + type: string + enum: + - message + user: + type: string + channel: + type: string + text: + type: string + ts: + type: string + attachments: + type: array + items: + $ref: '#/components/schemas/attachment' + edited: + type: object + properties: + user: + type: string + ts: + type: string + outgoingMessage: + summary: 'A message was sent to a channel.' + payload: + type: object + properties: + id: + type: number + type: + type: string + enum: + - message + channel: + type: string + text: + type: string \ No newline at end of file