API Docs: Switch some added 404 API response to ApiNotFoundError schema

This commit is contained in:
Phantasm 2025-12-12 21:17:58 +01:00
commit d36d0abd27
No known key found for this signature in database
GPG key ID: 2669E588BCC634C8
3 changed files with 6 additions and 30 deletions

View file

@ -37,7 +37,7 @@ defmodule Pleroma.Web.ApiSpec.EmojiReactionOperation do
operationId: "EmojiReactionController.index",
responses: %{
200 => array_of_reactions_response(),
404 => Operation.response("Access denied", "application/json", ApiError)
404 => Operation.response("Access denied", "application/json", ApiNotFoundError)
}
}
end

View file

@ -7,6 +7,7 @@ defmodule Pleroma.Web.ApiSpec.ReportOperation do
alias OpenApiSpex.Schema
alias Pleroma.Web.ApiSpec.Helpers
alias Pleroma.Web.ApiSpec.Schemas.ApiError
alias Pleroma.Web.ApiSpec.Schemas.ApiNotFoundError
alias Pleroma.Web.ApiSpec.Schemas.BooleanLike
def open_api_operation(action) do
@ -25,16 +26,7 @@ defmodule Pleroma.Web.ApiSpec.ReportOperation do
responses: %{
200 => Operation.response("Report", "application/json", create_response()),
400 => Operation.response("Report", "application/json", ApiError),
404 =>
Operation.response(
"Report",
"application/json",
%Schema{
allOf: [ApiError],
title: "Report",
example: %{"error" => "Record not found"}
}
)
404 => Operation.response("Report", "application/json", ApiNotFoundError)
}
}
end

View file

@ -244,14 +244,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
"error" => "You have already pinned the maximum number of statuses"
}
}),
404 =>
Operation.response("Not found", "application/json", %Schema{
allOf: [ApiError],
title: "Not Found",
example: %{
"error" => "Record not found"
}
}),
404 => Operation.response("Not found", "application/json", ApiNotFoundError),
422 =>
Operation.response(
"Unprocessable Entity",
@ -341,7 +334,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
responses: %{
200 => status_response(),
400 => Operation.response("Error", "application/json", ApiError),
404 => Operation.response("Not found", "application/json", ApiError)
404 => Operation.response("Not found", "application/json", ApiNotFoundError)
}
}
end
@ -358,16 +351,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
responses: %{
200 => status_response(),
400 => Operation.response("Error", "application/json", ApiError),
404 =>
Operation.response(
"Not Found",
"application/json",
%Schema{
allOf: [ApiError],
title: "Error",
example: %{"error" => "Record not found"}
}
)
404 => Operation.response("Not Found", "application/json", ApiNotFoundError)
}
}
end