mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
chore: allow page: []
in new pagination error
This commit is contained in:
parent
9924cfc7c0
commit
0c767d0fa1
2 changed files with 2 additions and 2 deletions
|
@ -1197,7 +1197,7 @@ defmodule Ash.Api do
|
|||
end
|
||||
|
||||
defp pagination_check(action, resource, opts) do
|
||||
if Keyword.get(opts, :page) && !Map.get(action, :pagination) do
|
||||
if Keyword.get(opts, :page) && Keyword.get(opts, :page) != [] && !Map.get(action, :pagination) do
|
||||
{:error,
|
||||
Ash.Error.to_error_class(
|
||||
PageRequiresPagination.exception(resource: resource, action: action)
|
||||
|
|
|
@ -259,7 +259,7 @@ defmodule Ash.Test.Actions.ReadTest do
|
|||
test "raises an error when page is sent but pagination is not enabled on a resource" do
|
||||
res =
|
||||
assert_raise Ash.Error.Invalid, fn ->
|
||||
Api.read!(Post, page: [])
|
||||
Api.read!(Post, page: [limit: 10])
|
||||
end
|
||||
|
||||
assert %Ash.Error.Invalid.PageRequiresPagination{resource: Post, action: _} = hd(res.errors)
|
||||
|
|
Loading…
Reference in a new issue