diff options
author | lain <lain@soykaf.club> | 2020-05-06 08:40:04 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-06 08:40:04 +0000 |
commit | 76c1a7a34be73731158f9347f5a7df60d267d6e3 (patch) | |
tree | f4e80d5e1e389da5224b1bf0eb76f52d8403ca64 /lib/pleroma/web/api_spec/schemas | |
parent | 7612d9403dbaa6741b28dcf427ecad8fd0f70c30 (diff) | |
parent | 3a45952a3a324e5fb823e9bdf3ffe19fb3923cb3 (diff) | |
download | pleroma-76c1a7a34be73731158f9347f5a7df60d267d6e3.tar.gz |
Merge branch 'openapi/conversations' into 'develop'
Add OpenAPI spec for ConversationController
See merge request pleroma/pleroma!2445
Diffstat (limited to 'lib/pleroma/web/api_spec/schemas')
-rw-r--r-- | lib/pleroma/web/api_spec/schemas/conversation.ex | 41 | ||||
-rw-r--r-- | lib/pleroma/web/api_spec/schemas/status.ex | 7 |
2 files changed, 47 insertions, 1 deletions
diff --git a/lib/pleroma/web/api_spec/schemas/conversation.ex b/lib/pleroma/web/api_spec/schemas/conversation.ex new file mode 100644 index 000000000..d8ff5ba26 --- /dev/null +++ b/lib/pleroma/web/api_spec/schemas/conversation.ex @@ -0,0 +1,41 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ApiSpec.Schemas.Conversation do + alias OpenApiSpex.Schema + alias Pleroma.Web.ApiSpec.Schemas.Account + alias Pleroma.Web.ApiSpec.Schemas.Status + + require OpenApiSpex + + OpenApiSpex.schema(%{ + title: "Conversation", + description: "Represents a conversation with \"direct message\" visibility.", + type: :object, + required: [:id, :accounts, :unread], + properties: %{ + id: %Schema{type: :string}, + accounts: %Schema{ + type: :array, + items: Account, + description: "Participants in the conversation" + }, + unread: %Schema{ + type: :boolean, + description: "Is the conversation currently marked as unread?" + }, + # last_status: Status + last_status: %Schema{ + allOf: [Status], + description: "The last status in the conversation, to be used for optional display" + } + }, + example: %{ + "id" => "418450", + "unread" => true, + "accounts" => [Account.schema().example], + "last_status" => Status.schema().example + } + }) +end diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex index d44636a48..7a804461f 100644 --- a/lib/pleroma/web/api_spec/schemas/status.ex +++ b/lib/pleroma/web/api_spec/schemas/status.ex @@ -72,7 +72,12 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do properties: %{ content: %Schema{type: :object, additionalProperties: %Schema{type: :string}}, conversation_id: %Schema{type: :integer}, - direct_conversation_id: %Schema{type: :string, nullable: true}, + direct_conversation_id: %Schema{ + type: :integer, + nullable: true, + description: + "The ID of the Mastodon direct message conversation the status is associated with (if any)" + }, emoji_reactions: %Schema{ type: :array, items: %Schema{ |