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.RenderError do
8 alias OpenApiSpex.Plug.JsonRenderError
12 def init(opts), do: opts
16 def call(%{private: %{open_api_spex: %{operation_id: "AccountController.create"}}} = conn, _) do
18 |> Conn.put_status(:bad_request)
19 |> Phoenix.Controller.json(%{"error" => "Missing parameters"})
22 def call(conn, reason) do
23 opts = JsonRenderError.init(reason)
25 JsonRenderError.call(conn, opts)