Skip to content

Commit

Permalink
Do not require Union to define authorize meta
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielpra1 committed Jun 25, 2020
1 parent d090981 commit da2eba3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion lib/middlewares/object_authorization.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ defmodule Rajska.ObjectAuthorization do

# When is a Scalar, Custom or Enum type, authorize.
defp authorize_object(%type{} = object, fields, resolution)
when type in [Scalar, Custom, Type.Enum, Type.Enum.Value] do
when type in [Scalar, Custom, Type.Enum, Type.Enum.Value, Type.Union] do
put_result(true, fields, resolution, object)
end

Expand Down
2 changes: 0 additions & 2 deletions test/middlewares/object_authorization_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ defmodule Rajska.ObjectAuthorizationTest do
end

union :union do
meta :authorize, :user

types [:wallet_balance, :user]
resolve_type fn
%{name: _}, _ -> :user
Expand Down

0 comments on commit da2eba3

Please sign in to comment.