API Docs: Switch some added 404 API response to ApiNotFoundError schema
This commit is contained in:
parent
49a5630c75
commit
d36d0abd27
3 changed files with 6 additions and 30 deletions
|
|
@ -37,7 +37,7 @@ defmodule Pleroma.Web.ApiSpec.EmojiReactionOperation do
|
||||||
operationId: "EmojiReactionController.index",
|
operationId: "EmojiReactionController.index",
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => array_of_reactions_response(),
|
200 => array_of_reactions_response(),
|
||||||
404 => Operation.response("Access denied", "application/json", ApiError)
|
404 => Operation.response("Access denied", "application/json", ApiNotFoundError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ defmodule Pleroma.Web.ApiSpec.ReportOperation do
|
||||||
alias OpenApiSpex.Schema
|
alias OpenApiSpex.Schema
|
||||||
alias Pleroma.Web.ApiSpec.Helpers
|
alias Pleroma.Web.ApiSpec.Helpers
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.ApiError
|
alias Pleroma.Web.ApiSpec.Schemas.ApiError
|
||||||
|
alias Pleroma.Web.ApiSpec.Schemas.ApiNotFoundError
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.BooleanLike
|
alias Pleroma.Web.ApiSpec.Schemas.BooleanLike
|
||||||
|
|
||||||
def open_api_operation(action) do
|
def open_api_operation(action) do
|
||||||
|
|
@ -25,16 +26,7 @@ defmodule Pleroma.Web.ApiSpec.ReportOperation do
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => Operation.response("Report", "application/json", create_response()),
|
200 => Operation.response("Report", "application/json", create_response()),
|
||||||
400 => Operation.response("Report", "application/json", ApiError),
|
400 => Operation.response("Report", "application/json", ApiError),
|
||||||
404 =>
|
404 => Operation.response("Report", "application/json", ApiNotFoundError)
|
||||||
Operation.response(
|
|
||||||
"Report",
|
|
||||||
"application/json",
|
|
||||||
%Schema{
|
|
||||||
allOf: [ApiError],
|
|
||||||
title: "Report",
|
|
||||||
example: %{"error" => "Record not found"}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -244,14 +244,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
|
||||||
"error" => "You have already pinned the maximum number of statuses"
|
"error" => "You have already pinned the maximum number of statuses"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
404 =>
|
404 => Operation.response("Not found", "application/json", ApiNotFoundError),
|
||||||
Operation.response("Not found", "application/json", %Schema{
|
|
||||||
allOf: [ApiError],
|
|
||||||
title: "Not Found",
|
|
||||||
example: %{
|
|
||||||
"error" => "Record not found"
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
422 =>
|
422 =>
|
||||||
Operation.response(
|
Operation.response(
|
||||||
"Unprocessable Entity",
|
"Unprocessable Entity",
|
||||||
|
|
@ -341,7 +334,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => status_response(),
|
200 => status_response(),
|
||||||
400 => Operation.response("Error", "application/json", ApiError),
|
400 => Operation.response("Error", "application/json", ApiError),
|
||||||
404 => Operation.response("Not found", "application/json", ApiError)
|
404 => Operation.response("Not found", "application/json", ApiNotFoundError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -358,16 +351,7 @@ defmodule Pleroma.Web.ApiSpec.StatusOperation do
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => status_response(),
|
200 => status_response(),
|
||||||
400 => Operation.response("Error", "application/json", ApiError),
|
400 => Operation.response("Error", "application/json", ApiError),
|
||||||
404 =>
|
404 => Operation.response("Not Found", "application/json", ApiNotFoundError)
|
||||||
Operation.response(
|
|
||||||
"Not Found",
|
|
||||||
"application/json",
|
|
||||||
%Schema{
|
|
||||||
allOf: [ApiError],
|
|
||||||
title: "Error",
|
|
||||||
example: %{"error" => "Record not found"}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue