Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Jul 16, 2024
1 parent 70020b7 commit 04f7a6b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/malli/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,16 @@
(defn- -lookup [?schema options]
(let [registry (-registry options)]
(or (mr/-schema registry ?schema)
(some-> registry (mr/-schema (c/type ?schema)) (-into-schema nil [?schema] options)))))
(when-some [p (some-> registry (mr/-schema (c/type ?schema)))]
(when (= p (-parent ?schema))
(-fail! ::infinitely-expanding-schema {:schema ?schema}))
(-into-schema p nil [?schema] options)))))

(defn- -lookup! [?schema ?form f rec options]
(when (contains? (::seen-lookup!-form options) ?form)
(-fail! ::infinitely-expanding-schema {:schema ?schema :form ?form}))
(let [options (update options ::seen-lookup!-form (fnil conj #{}) ?form)]
(or (and f (f ?schema) ?schema)
(if-let [?schema' (-lookup ?schema options)]
(cond-> ?schema' rec (recur ?form f rec options))
(-fail! ::invalid-schema {:schema ?schema, :form ?form})))))
(or (and f (f ?schema) ?schema)
(if-let [?schema' (-lookup ?schema options)]
(cond-> ?schema' rec (-lookup! ?form f rec options))
(-fail! ::invalid-schema {:schema ?schema, :form ?form}))))

(defn -properties-and-options [properties options f]
(if-let [r (:registry properties)]
Expand Down

0 comments on commit 04f7a6b

Please sign in to comment.