feat: add warning for unsupported openapi parameter schemas

for #705
This commit is contained in:
Joel Kaasinen 2024-10-30 09:58:32 +02:00
parent f6b8054669
commit c89b6bbe31

View file

@ -126,7 +126,10 @@
;; For :parameters we need to output an object schema with actual :properties. ;; 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. ;; 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. ;; 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))) (json-schema/transform model (merge opts options)))
(throw (throw
(ex-info (ex-info