aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/pleroma/web/api_spec/operations/chat_operation.ex18
-rw-r--r--lib/pleroma/web/api_spec/schemas/chat_message_create_request.ex21
2 files changed, 16 insertions, 23 deletions
diff --git a/lib/pleroma/web/api_spec/operations/chat_operation.ex b/lib/pleroma/web/api_spec/operations/chat_operation.ex
index ad05f5ac7..e8b5eff1f 100644
--- a/lib/pleroma/web/api_spec/operations/chat_operation.ex
+++ b/lib/pleroma/web/api_spec/operations/chat_operation.ex
@@ -7,7 +7,6 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
alias OpenApiSpex.Schema
alias Pleroma.Web.ApiSpec.Schemas.Chat
alias Pleroma.Web.ApiSpec.Schemas.ChatMessage
- alias Pleroma.Web.ApiSpec.Schemas.ChatMessageCreateRequest
import Pleroma.Web.ApiSpec.Helpers
@@ -97,7 +96,7 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
parameters: [
Operation.parameter(:id, :path, :string, "The ID of the Chat")
],
- requestBody: request_body("Parameters", ChatMessageCreateRequest, required: true),
+ requestBody: request_body("Parameters", chat_message_create(), required: true),
responses: %{
200 =>
Operation.response(
@@ -208,4 +207,19 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
]
}
end
+
+ def chat_message_create do
+ %Schema{
+ title: "ChatMessageCreateRequest",
+ description: "POST body for creating an chat message",
+ type: :object,
+ properties: %{
+ content: %Schema{type: :string, description: "The content of your message"}
+ },
+ required: [:content],
+ example: %{
+ "content" => "Hey wanna buy feet pics?"
+ }
+ }
+ end
end
diff --git a/lib/pleroma/web/api_spec/schemas/chat_message_create_request.ex b/lib/pleroma/web/api_spec/schemas/chat_message_create_request.ex
deleted file mode 100644
index 8e1b7af14..000000000
--- a/lib/pleroma/web/api_spec/schemas/chat_message_create_request.ex
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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.ChatMessageCreateRequest do
- alias OpenApiSpex.Schema
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "ChatMessageCreateRequest",
- description: "POST body for creating an chat message",
- type: :object,
- properties: %{
- content: %Schema{type: :string, description: "The content of your message"}
- },
- required: [:content],
- example: %{
- "content" => "Hey wanna buy feet pics?"
- }
- })
-end