1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.Schemas.BooleanLike do
7 alias OpenApiSpex.Schema
14 The following values will be treated as `false`:
25 All other non-null values will be treated as `true`
28 %Schema{type: :boolean},
29 %Schema{type: :string},
30 %Schema{type: :integer}
32 "x-validate": __MODULE__
35 def cast(%Cast{value: value} = context) do
37 |> Map.put(:value, Pleroma.Web.Utils.Params.truthy_param?(value))