diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-08-05 09:43:24 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-08-05 11:11:24 -0500 |
commit | b83758bd9634d4f2fb70a92159072dd44e49bb31 (patch) | |
tree | 2452e8c4e1544fc9a0ad71292901b6cd52765566 /lib/pleroma/web/api_spec/schemas | |
parent | 2b3d7794b23aac30cf8f977009d17b1abc602d19 (diff) | |
parent | 5f5dc24027ee5cfadd226c5db2e2a2bdb0ababe0 (diff) | |
download | pleroma-b83758bd9634d4f2fb70a92159072dd44e49bb31.tar.gz |
Merge remote-tracking branch 'pleroma/develop' into moderators
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..94c5020ca 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.Utils.Params.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" } } }, |