API Specs: many dialyzer errors

Too many to include in a commit log

Module instead of schema was being passed
This commit is contained in:
Mark Felder 2024-01-29 17:10:28 -05:00
parent 4fc177eb46
commit 2de84e2e3b
15 changed files with 47 additions and 27 deletions

View File

@ -62,7 +62,7 @@ defmodule Pleroma.Web.ApiSpec.Helpers do
Operation.parameter( Operation.parameter(
:with_relationships, :with_relationships,
:query, :query,
BooleanLike, BooleanLike.schema(),
"Embed relationships into accounts. **If this parameter is not set account's `pleroma.relationship` is going to be `null`.**" "Embed relationships into accounts. **If this parameter is not set account's `pleroma.relationship` is going to be `null`.**"
) )
end end

View File

@ -122,22 +122,27 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
parameters: parameters:
[ [
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}, %Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
Operation.parameter(:pinned, :query, BooleanLike, "Include only pinned statuses"), Operation.parameter(
:pinned,
:query,
BooleanLike.schema(),
"Include only pinned statuses"
),
Operation.parameter(:tagged, :query, :string, "With tag"), Operation.parameter(:tagged, :query, :string, "With tag"),
Operation.parameter( Operation.parameter(
:only_media, :only_media,
:query, :query,
BooleanLike, BooleanLike.schema(),
"Include only statuses with media attached" "Include only statuses with media attached"
), ),
Operation.parameter( Operation.parameter(
:with_muted, :with_muted,
:query, :query,
BooleanLike, BooleanLike.schema(),
"Include statuses from muted accounts." "Include statuses from muted accounts."
), ),
Operation.parameter(:exclude_reblogs, :query, BooleanLike, "Exclude reblogs"), Operation.parameter(:exclude_reblogs, :query, BooleanLike.schema(), "Exclude reblogs"),
Operation.parameter(:exclude_replies, :query, BooleanLike, "Exclude replies"), Operation.parameter(:exclude_replies, :query, BooleanLike.schema(), "Exclude replies"),
Operation.parameter( Operation.parameter(
:exclude_visibilities, :exclude_visibilities,
:query, :query,
@ -147,7 +152,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
Operation.parameter( Operation.parameter(
:with_muted, :with_muted,
:query, :query,
BooleanLike, BooleanLike.schema(),
"Include reactions from muted accounts." "Include reactions from muted accounts."
) )
] ++ pagination_params(), ] ++ pagination_params(),

View File

@ -141,7 +141,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.ReportOperation do
end end
def id_param do def id_param do
Operation.parameter(:id, :path, FlakeID, "Report ID", Operation.parameter(:id, :path, FlakeID.schema(), "Report ID",
example: "9umDrYheeY451cQnEe", example: "9umDrYheeY451cQnEe",
required: true required: true
) )

View File

@ -137,7 +137,12 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
"Deprecated due to no support for pagination. Using [/api/v2/pleroma/chats](#operation/ChatController.index2) instead is recommended.", "Deprecated due to no support for pagination. Using [/api/v2/pleroma/chats](#operation/ChatController.index2) instead is recommended.",
operationId: "ChatController.index", operationId: "ChatController.index",
parameters: [ parameters: [
Operation.parameter(:with_muted, :query, BooleanLike, "Include chats from muted users") Operation.parameter(
:with_muted,
:query,
BooleanLike.schema(),
"Include chats from muted users"
)
], ],
responses: %{ responses: %{
200 => Operation.response("The chats of the user", "application/json", chats_response()) 200 => Operation.response("The chats of the user", "application/json", chats_response())
@ -156,7 +161,12 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
summary: "Retrieve list of chats", summary: "Retrieve list of chats",
operationId: "ChatController.index2", operationId: "ChatController.index2",
parameters: [ parameters: [
Operation.parameter(:with_muted, :query, BooleanLike, "Include chats from muted users") Operation.parameter(
:with_muted,
:query,
BooleanLike.schema(),
"Include chats from muted users"
)
| pagination_params() | pagination_params()
], ],
responses: %{ responses: %{

View File

@ -29,7 +29,7 @@ defmodule Pleroma.Web.ApiSpec.DirectoryOperation do
"Order by recent activity or account creation", "Order by recent activity or account creation",
required: nil required: nil
), ),
Operation.parameter(:local, :query, BooleanLike, "Include local users only") Operation.parameter(:local, :query, BooleanLike.schema(), "Include local users only")
] ++ pagination_params(), ] ++ pagination_params(),
responses: %{ responses: %{
200 => 200 =>

View File

@ -21,7 +21,7 @@ defmodule Pleroma.Web.ApiSpec.EmojiReactionOperation do
summary: summary:
"Get an object of emoji to account mappings with accounts that reacted to the post", "Get an object of emoji to account mappings with accounts that reacted to the post",
parameters: [ parameters: [
Operation.parameter(:id, :path, FlakeID, "Status ID", required: true), Operation.parameter(:id, :path, FlakeID.schema(), "Status ID", required: true),
Operation.parameter(:emoji, :path, :string, "Filter by a single unicode emoji", Operation.parameter(:emoji, :path, :string, "Filter by a single unicode emoji",
required: nil required: nil
), ),
@ -45,7 +45,7 @@ defmodule Pleroma.Web.ApiSpec.EmojiReactionOperation do
tags: ["Emoji reactions"], tags: ["Emoji reactions"],
summary: "React to a post with a unicode emoji", summary: "React to a post with a unicode emoji",
parameters: [ parameters: [
Operation.parameter(:id, :path, FlakeID, "Status ID", required: true), Operation.parameter(:id, :path, FlakeID.schema(), "Status ID", required: true),
Operation.parameter(:emoji, :path, :string, "A single character unicode emoji", Operation.parameter(:emoji, :path, :string, "A single character unicode emoji",
required: true required: true
) )
@ -64,7 +64,7 @@ defmodule Pleroma.Web.ApiSpec.EmojiReactionOperation do
tags: ["Emoji reactions"], tags: ["Emoji reactions"],
summary: "Remove a reaction to a post with a unicode emoji", summary: "Remove a reaction to a post with a unicode emoji",
parameters: [ parameters: [
Operation.parameter(:id, :path, FlakeID, "Status ID", required: true), Operation.parameter(:id, :path, FlakeID.schema(), "Status ID", required: true),
Operation.parameter(:emoji, :path, :string, "A single character unicode emoji", Operation.parameter(:emoji, :path, :string, "A single character unicode emoji",
required: true required: true
) )

View File

@ -62,7 +62,7 @@ defmodule Pleroma.Web.ApiSpec.NotificationOperation do
Operation.parameter( Operation.parameter(
:with_muted, :with_muted,
:query, :query,
BooleanLike, BooleanLike.schema(),
"Include the notifications from muted users" "Include the notifications from muted users"
) )
] ++ pagination_params(), ] ++ pagination_params(),

View File

@ -142,7 +142,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaAccountOperation do
end end
defp id_param do defp id_param do
Operation.parameter(:id, :path, FlakeID, "Account ID", Operation.parameter(:id, :path, FlakeID.schema(), "Account ID",
example: "9umDrYheeY451cQnEe", example: "9umDrYheeY451cQnEe",
required: true required: true
) )

View File

@ -37,7 +37,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaStatusOperation do
end end
def id_param do def id_param do
Operation.parameter(:id, :path, FlakeID, "Status ID", Operation.parameter(:id, :path, FlakeID.schema(), "Status ID",
example: "9umDrYheeY451cQnEe", example: "9umDrYheeY451cQnEe",
required: true required: true
) )

View File

@ -47,7 +47,7 @@ defmodule Pleroma.Web.ApiSpec.PollOperation do
end end
defp id_param do defp id_param do
Operation.parameter(:id, :path, FlakeID, "Poll ID", Operation.parameter(:id, :path, FlakeID.schema(), "Poll ID",
example: "123", example: "123",
required: true required: true
) )

View File

@ -88,7 +88,7 @@ defmodule Pleroma.Web.ApiSpec.ScheduledActivityOperation do
end end
defp id_param do defp id_param do
Operation.parameter(:id, :path, FlakeID, "Poll ID", Operation.parameter(:id, :path, FlakeID.schema(), "Poll ID",
example: "123", example: "123",
required: true required: true
) )

View File

@ -70,7 +70,7 @@ defmodule Pleroma.Web.ApiSpec.SearchOperation do
Operation.parameter( Operation.parameter(
:account_id, :account_id,
:query, :query,
FlakeID, FlakeID.schema(),
"If provided, statuses returned will be authored only by this account" "If provided, statuses returned will be authored only by this account"
), ),
Operation.parameter( Operation.parameter(
@ -116,7 +116,7 @@ defmodule Pleroma.Web.ApiSpec.SearchOperation do
Operation.parameter( Operation.parameter(
:account_id, :account_id,
:query, :query,
FlakeID, FlakeID.schema(),
"If provided, statuses returned will be authored only by this account" "If provided, statuses returned will be authored only by this account"
), ),
Operation.parameter( Operation.parameter(

View File

@ -39,7 +39,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
Operation.parameter( Operation.parameter(
:with_muted, :with_muted,
:query, :query,
BooleanLike, BooleanLike.schema(),
"Include reactions from muted acccounts." "Include reactions from muted acccounts."
) )
], ],
@ -82,7 +82,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
Operation.parameter( Operation.parameter(
:with_muted, :with_muted,
:query, :query,
BooleanLike, BooleanLike.schema(),
"Include reactions from muted acccounts." "Include reactions from muted acccounts."
) )
], ],
@ -685,7 +685,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
end end
def id_param do def id_param do
Operation.parameter(:id, :path, FlakeID, "Status ID", Operation.parameter(:id, :path, FlakeID.schema(), "Status ID",
example: "9umDrYheeY451cQnEe", example: "9umDrYheeY451cQnEe",
required: true required: true
) )

View File

@ -176,7 +176,12 @@ defmodule Pleroma.Web.ApiSpec.TimelineOperation do
end end
defp with_muted_param do defp with_muted_param do
Operation.parameter(:with_muted, :query, BooleanLike, "Include activities by muted users") Operation.parameter(
:with_muted,
:query,
BooleanLike.schema(),
"Include activities by muted users"
)
end end
defp exclude_visibilities_param do defp exclude_visibilities_param do

View File

@ -146,13 +146,13 @@ defmodule Pleroma.Web.ApiSpec.TwitterUtilOperation do
Operation.parameter( Operation.parameter(
:block_from_strangers, :block_from_strangers,
:query, :query,
BooleanLike, BooleanLike.schema(),
"blocks notifications from accounts you do not follow" "blocks notifications from accounts you do not follow"
), ),
Operation.parameter( Operation.parameter(
:hide_notification_contents, :hide_notification_contents,
:query, :query,
BooleanLike, BooleanLike.schema(),
"removes the contents of a message from the push notification" "removes the contents of a message from the push notification"
) )
], ],