Pleroma.Web.PleromaAPI.EmojiPackController: dialyzer errors

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:112:no_return
Function download/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:114:call
The function call will not succeed.

Phoenix.Controller.json(_conn :: %{:body_params => %{:name => _, :url => _, _ => _}, _ => _}, <<111, 107>>)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:117:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{:body_params => %{:name => _, :url => _, _ => _}, _ => _},
  :internal_server_error
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:122:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{:body_params => %{:name => _, :url => _, _ => _}, _ => _},
  :internal_server_error
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:127:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{:body_params => %{:name => _, :url => _, _ => _}, _ => _},
  :internal_server_error
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:187:no_return
Function update/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:189:call
The function call will not succeed.

Phoenix.Controller.json(_conn :: %{:body_params => %{:metadata => _, _ => _}, _ => _}, map())

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:192:call
The function call will not succeed.

Plug.Conn.put_status(_conn :: %{:body_params => %{:metadata => _, _ => _}, _ => _}, :bad_request)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:203:call
The function call will not succeed.

Plug.Conn.put_status(_conn :: %{:body_params => %{:metadata => _, _ => _}, _ => _}, :internal_server_error) ::
  :ok
def a() do
  :ok
end

breaks the contract
(t(), status()) :: t()
This commit is contained in:
Mark Felder 2024-01-28 12:47:32 -05:00
parent a32d6b3aa4
commit 77bf617c4b
2 changed files with 8 additions and 28 deletions

View File

@ -130,15 +130,15 @@ def download_operation do
defp download_request do
%Schema{
type: :object,
required: [:url, :name],
required: ["url", "name"],
properties: %{
url: %Schema{
"url" => %Schema{
type: :string,
format: :uri,
description: "URL of the instance to download from"
},
name: %Schema{type: :string, format: :uri, description: "Pack Name"},
as: %Schema{type: :string, format: :uri, description: "Save as"}
"name" => %Schema{type: :string, format: :uri, description: "Pack Name"},
"as" => %Schema{type: :string, format: :uri, description: "Save as"}
}
}
end
@ -302,27 +302,7 @@ defp files_object do
defp update_request do
%Schema{
type: :object,
properties: %{
metadata: %Schema{
type: :object,
description: "Metadata to replace the old one",
properties: %{
license: %Schema{type: :string},
homepage: %Schema{type: :string, format: :uri},
description: %Schema{type: :string},
"fallback-src": %Schema{
type: :string,
format: :uri,
description: "Fallback url to download pack from"
},
"fallback-src-sha256": %Schema{
type: :string,
description: "SHA256 encoded for fallback pack archive"
},
"share-files": %Schema{type: :boolean, description: "Is pack allowed for sharing?"}
}
}
}
properties: %{"metadata" => metadata()}
}
end

View File

@ -109,8 +109,8 @@ def archive(conn, %{name: name}) do
end
end
def download(%{body_params: %{url: url, name: name} = params} = conn, _) do
with {:ok, _pack} <- Pack.download(name, url, params[:as]) do
def download(%{body_params: %{"url" => url, "name" => name} = params} = conn, _) do
with {:ok, _pack} <- Pack.download(name, url, params["as"]) do
json(conn, "ok")
else
{:error, :not_shareable} ->
@ -184,7 +184,7 @@ def delete(conn, %{name: name}) do
end
end
def update(%{body_params: %{metadata: metadata}} = conn, %{name: name}) do
def update(%{body_params: %{"metadata" => metadata}} = conn, %{name: name}) do
with {:ok, pack} <- Pack.update_metadata(name, metadata) do
json(conn, pack.pack)
else