diff --git a/src/malli/clj_kondo.cljc b/src/malli/clj_kondo.cljc index 7515ef3c6..cef77f7db 100644 --- a/src/malli/clj_kondo.cljc +++ b/src/malli/clj_kondo.cljc @@ -95,7 +95,11 @@ (symbol? child) :symbol :else :any))))) -(defmethod accept :maybe [_ _ [child] _] (if (keyword? child) (keyword "nilable" (name child)) child)) +(defmethod accept :maybe [_ _ [child] _] + (cond + (= :keys (:op child)) (assoc child :nilable true) + (keyword? child) (keyword "nilable" (name child)) + :else child)) (defmethod accept :tuple [_ _ children _] children) (defmethod accept :multi [_ _ _ _] :any) ;;?? (defmethod accept :re [_ _ _ _] :string) diff --git a/test/malli/clj_kondo_test.cljc b/test/malli/clj_kondo_test.cljc index ca8e8e104..7ca6ff41b 100644 --- a/test/malli/clj_kondo_test.cljc +++ b/test/malli/clj_kondo_test.cljc @@ -44,7 +44,7 @@ :req {::id :string, :name :string, :description :nilable/string, - :select-keys {:op :keys, :req {:x :int}}, + :select-keys {:op :keys, :req {:x :int} :nilable true}, :nested {:op :keys, :req {:id :string, :price :double}}, :string-type-enum :nilable/string :keyword-type-enum :keyword