@@ -24,6 +24,16 @@ def authorized?(parent_object, context)
2424      end 
2525    end 
2626
27+     class  BaseInputObjectArgument  < BaseArgument 
28+       def  authorized? ( parent_object ,  context ) 
29+         super  && parent_object  != :hide3 
30+       end 
31+     end 
32+ 
33+     class  BaseInputObject  < GraphQL ::Schema ::InputObject 
34+       argument_class  BaseInputObjectArgument 
35+     end 
36+ 
2737    class  BaseField  < GraphQL ::Schema ::Field 
2838      def  initialize ( *args ,  edge_class : nil ,  **kwargs ,  &block ) 
2939        @edge_class  =  edge_class 
@@ -243,6 +253,11 @@ class LandscapeFeature < BaseEnum
243253      value  "TAR_PIT" ,  role : :hidden 
244254    end 
245255
256+     class  AddInput  < BaseInputObject 
257+       argument  :left ,  Integer ,  required : true 
258+       argument  :right ,  Integer ,  required : true 
259+     end 
260+ 
246261    class  Query  < BaseObject 
247262      def  self . authorized? ( obj ,  ctx ) 
248263        !ctx [ :query_unauthorized ] 
@@ -347,6 +362,14 @@ def lazy_integers
347362      def  replaced_object 
348363        Replaceable . new 
349364      end 
365+ 
366+       field  :add_inputs ,  Integer ,  null : true  do 
367+         argument  :input ,  AddInput ,  required : true 
368+       end 
369+ 
370+       def  add_inputs ( input :) 
371+         input [ :left ]  + input [ :right ] 
372+       end 
350373    end 
351374
352375    class  DoHiddenStuff  < GraphQL ::Schema ::RelayClassicMutation 
@@ -737,6 +760,21 @@ def auth_execute(*args)
737760      assert_equal  5 ,  visible_response [ "data" ] [ "int2" ] 
738761    end 
739762
763+     it  "halts on unauthorized input object arguments, using the parent object"  do 
764+       query  =  "{ addInputs(input: { left: 3, right: 2 }) }" 
765+       hidden_field_argument_response  =  auth_execute ( query ,  root_value : :hide2 ) 
766+       assert_nil  hidden_field_argument_response [ "data" ] . fetch ( "addInputs" ) 
767+       assert_equal  [ "Unauthorized Query: :hide2" ] ,  hidden_field_argument_response [ "errors" ] . map  {  |e | e [ "message" ]  } 
768+ 
769+       hidden_input_obj_argument_response  =  auth_execute ( query ,  root_value : :hide3 ) 
770+       assert_nil  hidden_input_obj_argument_response [ "data" ] . fetch ( "addInputs" ) 
771+       assert_equal  [ "Unauthorized Query: :hide3" ] ,  hidden_input_obj_argument_response [ "errors" ] . map  {  |e | e [ "message" ]  } 
772+ 
773+       visible_response  =  auth_execute ( query ) 
774+       assert_equal  5 ,  visible_response [ "data" ] [ "addInputs" ] 
775+       refute  visible_response . key? ( "errors" ) 
776+     end 
777+ 
740778    it  "works with edges and connections"  do 
741779      query  =  <<-GRAPHQL 
742780      { 
0 commit comments