1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.Helpers do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
9 def request_body(description, schema_ref, opts \\ []) do
10 media_types = ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"]
14 |> Enum.map(fn type ->
16 %OpenApiSpex.MediaType{
18 example: opts[:example],
19 examples: opts[:examples]
24 %OpenApiSpex.RequestBody{
25 description: description,
27 required: opts[:required] || false
31 def pagination_params do
33 Operation.parameter(:max_id, :query, :string, "Return items older than this ID"),
34 Operation.parameter(:min_id, :query, :string, "Return the oldest items newer than this ID"),
39 "Return the newest items newer than this ID"
44 %Schema{type: :integer, default: 20, maximum: 40},