diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-05-19 14:27:59 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-05-19 14:27:59 -0500 |
commit | 0461794375ebd22a91548f20d736da624e38c06a (patch) | |
tree | 2d579f1d08c264c32d4692ceaf0468158211b775 /lib/pleroma/web/api_spec/schemas | |
parent | e3173a279dad89dfce6eae89368ad3ba180c0490 (diff) | |
parent | 8e9f032f25251d910b59c55226d10a305bad3cba (diff) | |
download | pleroma-0461794375ebd22a91548f20d736da624e38c06a.tar.gz |
Merge remote-tracking branch 'pleroma/develop' into plug-runtime-dev
Diffstat (limited to 'lib/pleroma/web/api_spec/schemas')
-rw-r--r-- | lib/pleroma/web/api_spec/schemas/boolean_like.ex | 10 | ||||
-rw-r--r-- | lib/pleroma/web/api_spec/schemas/status.ex | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/pleroma/web/api_spec/schemas/boolean_like.ex b/lib/pleroma/web/api_spec/schemas/boolean_like.ex index eb001c5bb..778158f66 100644 --- a/lib/pleroma/web/api_spec/schemas/boolean_like.ex +++ b/lib/pleroma/web/api_spec/schemas/boolean_like.ex @@ -3,6 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.BooleanLike do + alias OpenApiSpex.Cast alias OpenApiSpex.Schema require OpenApiSpex @@ -27,10 +28,13 @@ defmodule Pleroma.Web.ApiSpec.Schemas.BooleanLike do %Schema{type: :boolean}, %Schema{type: :string}, %Schema{type: :integer} - ] + ], + "x-validate": __MODULE__ }) - def after_cast(value, _schmea) do - {:ok, Pleroma.Web.ControllerHelper.truthy_param?(value)} + def cast(%Cast{value: value} = context) do + context + |> Map.put(:value, Pleroma.Web.ControllerHelper.truthy_param?(value)) + |> Cast.ok() end end diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex index 42fa98718..3d042dc19 100644 --- a/lib/pleroma/web/api_spec/schemas/status.ex +++ b/lib/pleroma/web/api_spec/schemas/status.ex @@ -194,6 +194,13 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do parent_visible: %Schema{ type: :boolean, description: "`true` if the parent post is visible to the user" + }, + pinned_at: %Schema{ + type: :string, + format: "date-time", + nullable: true, + description: + "A datetime (ISO 8601) that states when the post was pinned or `null` if the post is not pinned" } } }, |