aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/api_spec/schemas
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-07-27 08:29:53 -0500
committerAlex Gleason <alex@alexgleason.me>2021-07-27 08:29:53 -0500
commit33a19c002a9196cb67d3379d5237f9490c957f1b (patch)
treeba6cbd601f1c20560d627677b1332324898fb01f /lib/pleroma/web/api_spec/schemas
parent94db0b7cd604022c65b9f70e5c5a939ac3ed4801 (diff)
parent7acdab1f305bac744a302e3b44e2e920d6bc8a47 (diff)
downloadpleroma-33a19c002a9196cb67d3379d5237f9490c957f1b.tar.gz
Merge remote-tracking branch 'pleroma/develop' into errorview-json-fix
Diffstat (limited to 'lib/pleroma/web/api_spec/schemas')
-rw-r--r--lib/pleroma/web/api_spec/schemas/boolean_like.ex10
-rw-r--r--lib/pleroma/web/api_spec/schemas/status.ex7
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"
}
}
},