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
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(
]
}
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
+++ /dev/null
-# 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