diff --git a/src/com/walmartlabs/lacinia/schema.clj b/src/com/walmartlabs/lacinia/schema.clj index 0e6afd0a..255c3272 100644 --- a/src/com/walmartlabs/lacinia/schema.clj +++ b/src/com/walmartlabs/lacinia/schema.clj @@ -1878,7 +1878,7 @@ (map-kvs compile-directive-args (assoc directive-defs :deprecated {:args {:reason {:type 'String}} - :locations #{:field-definition :enum-value}}))))) + :locations #{:argument-definition :enum-value :field-definition :input-field-definition}}))))) (defn ^:private validate-directives-by-category [schema category] diff --git a/test/com/walmartlabs/lacinia/directives_test.clj b/test/com/walmartlabs/lacinia/directives_test.clj index b69766b7..a8567bb3 100644 --- a/test/com/walmartlabs/lacinia/directives_test.clj +++ b/test/com/walmartlabs/lacinia/directives_test.clj @@ -348,8 +348,10 @@ (deftest union-directive-inapplicable (directive-test "Directive @deprecated on union `Ebb' is not applicable." - {:allowed-locations #{:enum-value - :field-definition} + {:allowed-locations #{:argument-definition + :enum-value + :field-definition + :input-field-definition} :directive-type :deprecated :union :Ebb} {:objects @@ -374,8 +376,10 @@ (deftest scalar-directive-inapplicable (directive-test "Directive @deprecated on scalar `Ebb' is not applicable." - {:allowed-locations #{:enum-value - :field-definition} + {:allowed-locations #{:argument-definition + :enum-value + :field-definition + :input-field-definition} :directive-type :deprecated :scalar :Ebb} {:scalars @@ -493,6 +497,18 @@ (is (= true (get-in schema [:Account :fields :id :deprecated]))))) +(deftest can-deprecate-input-fields + (let [schema (schema/compile + {:input-objects + {:Character + {:description "A character" + :fields {:name {:type '(non-null String) + :description "Character name"} + :weapon {:type '(non-null String) + :directives [{:directive-type :deprecated}] + :description "Weapon of choice"}}}}})] + ;; Exception is not thrown + (is (any? schema)))) (deftest can-deprecate-enum-values (let [schema (schema/compile