From c89b6bbe3102388816fe7629ca13d24a2340166d Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Wed, 30 Oct 2024 09:58:32 +0200 Subject: [PATCH] feat: add warning for unsupported openapi parameter schemas for #705 --- modules/reitit-malli/src/reitit/coercion/malli.cljc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/reitit-malli/src/reitit/coercion/malli.cljc b/modules/reitit-malli/src/reitit/coercion/malli.cljc index 5057eb9e..b94b17b3 100644 --- a/modules/reitit-malli/src/reitit/coercion/malli.cljc +++ b/modules/reitit-malli/src/reitit/coercion/malli.cljc @@ -126,7 +126,10 @@ ;; For :parameters we need to output an object schema with actual :properties. ;; The caller will iterate through the properties and add them individually to the openapi doc. ;; Thus, we deref to get the actual [:map ..] instead of some ref-schema. - (json-schema/transform (m/deref model) (merge opts options)) + (let [should-be-map (m/deref model)] + (when-not (= :map (m/type should-be-map)) + (println "WARNING: Unsupported schema for OpenAPI (expected :map schema)" (select-keys options [:in :parameter]) should-be-map)) + (json-schema/transform should-be-map (merge opts options))) (json-schema/transform model (merge opts options))) (throw (ex-info