Skip to content

Commit

Permalink
Merge pull request #715 from ingesolvoll/master
Browse files Browse the repository at this point in the history
:maybe map schema can use :nilable prop in clj-kondo :op spec
  • Loading branch information
ikitommi authored Jun 26, 2022
2 parents 657d570 + 41568f0 commit b745b73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/malli/clj_kondo.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/malli/clj_kondo_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b745b73

Please sign in to comment.