From 04f7a6b25157a1ea4069eaf0cb4d674c85be429f Mon Sep 17 00:00:00 2001 From: Ambrose Bonnaire-Sergeant Date: Tue, 16 Jul 2024 15:29:45 -0500 Subject: [PATCH] fix --- src/malli/core.cljc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/malli/core.cljc b/src/malli/core.cljc index 21f63779a..437c16d15 100644 --- a/src/malli/core.cljc +++ b/src/malli/core.cljc @@ -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)]