Skip to content

Commit 0f94148

Browse files
authored
Merge pull request #706 from metosin/openapi-query-warning-master
feat: add warning for unsupported openapi parameter schemas
2 parents 86e0441 + c89b6bb commit 0f94148

File tree

1 file changed

+4
-1
lines changed
  • modules/reitit-malli/src/reitit/coercion

1 file changed

+4
-1
lines changed

modules/reitit-malli/src/reitit/coercion/malli.cljc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@
126126
;; For :parameters we need to output an object schema with actual :properties.
127127
;; The caller will iterate through the properties and add them individually to the openapi doc.
128128
;; Thus, we deref to get the actual [:map ..] instead of some ref-schema.
129-
(json-schema/transform (m/deref model) (merge opts options))
129+
(let [should-be-map (m/deref model)]
130+
(when-not (= :map (m/type should-be-map))
131+
(println "WARNING: Unsupported schema for OpenAPI (expected :map schema)" (select-keys options [:in :parameter]) should-be-map))
132+
(json-schema/transform should-be-map (merge opts options)))
130133
(json-schema/transform model (merge opts options)))
131134
(throw
132135
(ex-info

0 commit comments

Comments
 (0)