@@ -344,6 +344,30 @@ def assert_validation_warns(object, warning)
344344 end
345345 }
346346
347+ let ( :deprecated_optional_argument ) {
348+ GraphQL ::Argument . define do
349+ name "Something"
350+ deprecation_reason "Don't use me"
351+ type GraphQL ::INT_TYPE
352+ end
353+ }
354+
355+ let ( :deprecated_required_argument ) {
356+ GraphQL ::Argument . define do
357+ name "Something"
358+ deprecation_reason "Don't use me"
359+ type !GraphQL ::INT_TYPE
360+ end
361+ }
362+
363+ let ( :invalid_deprecation_reason_argument ) {
364+ GraphQL ::Argument . define do
365+ name "Something"
366+ deprecation_reason 1
367+ type GraphQL ::INT_TYPE
368+ end
369+ }
370+
347371 it "requires the type is a Base type" do
348372 assert_error_includes untyped_argument , "must be a valid input type (Scalar or InputObject), not Symbol"
349373 end
@@ -359,6 +383,18 @@ def assert_validation_warns(object, warning)
359383 it "allows null default value for nullable argument" do
360384 assert_nil GraphQL ::Schema ::Validation . validate ( null_default_value )
361385 end
386+
387+ it "allows deprecated optional arguments" do
388+ assert_nil GraphQL ::Schema ::Validation . validate ( deprecated_optional_argument )
389+ end
390+
391+ it "disallows deprecated required arguments" do
392+ assert_error_includes deprecated_required_argument , "must be optional because it's deprecated"
393+ end
394+
395+ it "disallows non-string deprecation reasons" do
396+ assert_error_includes invalid_deprecation_reason_argument , "deprecation_reason must return String or NilClass, not #{ integer_class_name } (1)"
397+ end
362398 end
363399
364400 describe "validating instrumentation" do
0 commit comments