OpenAPI: fix various errors pointed out by editor.swagger.io
[akkoma] / lib / pleroma / web / api_spec / schemas / scheduled_status.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do
6 alias OpenApiSpex.Schema
7 alias Pleroma.Web.ApiSpec.Schemas.Attachment
8 alias Pleroma.Web.ApiSpec.Schemas.Poll
9 alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
10
11 require OpenApiSpex
12
13 OpenApiSpex.schema(%{
14 title: "ScheduledStatus",
15 description: "Represents a status that will be published at a future scheduled date.",
16 type: :object,
17 required: [:id, :scheduled_at, :params],
18 properties: %{
19 id: %Schema{type: :string},
20 scheduled_at: %Schema{type: :string, format: :"date-time"},
21 media_attachments: %Schema{type: :array, items: Attachment},
22 params: %Schema{
23 type: :object,
24 required: [:text, :visibility],
25 properties: %{
26 text: %Schema{type: :string, nullable: true},
27 media_ids: %Schema{type: :array, nullable: true, items: %Schema{type: :string}},
28 sensitive: %Schema{type: :boolean, nullable: true},
29 spoiler_text: %Schema{type: :string, nullable: true},
30 visibility: %Schema{allOf: [VisibilityScope], nullable: true},
31 scheduled_at: %Schema{type: :string, format: :"date-time", nullable: true},
32 poll: %Schema{allOf: [Poll], nullable: true},
33 in_reply_to_id: %Schema{type: :string, nullable: true}
34 }
35 }
36 },
37 example: %{
38 id: "3221",
39 scheduled_at: "2019-12-05T12:33:01.000Z",
40 params: %{
41 text: "test content",
42 media_ids: nil,
43 sensitive: nil,
44 spoiler_text: nil,
45 visibility: nil,
46 scheduled_at: nil,
47 poll: nil,
48 idempotency: nil,
49 in_reply_to_id: nil
50 },
51 media_attachments: [Attachment.schema().example]
52 }
53 })
54 end