mirror of
https://github.com/metosin/reitit.git
synced 2025-12-18 17:01:11 +00:00
test: openapi parameter descriptions via spec
This commit is contained in:
parent
b56c15b64c
commit
c443adbfca
1 changed files with 6 additions and 5 deletions
|
|
@ -367,7 +367,8 @@
|
||||||
(doseq [[coercion ->schema]
|
(doseq [[coercion ->schema]
|
||||||
[[#'malli/coercion (fn [nom] [:map [nom [:string {:description (str "description " nom)}]]])]
|
[[#'malli/coercion (fn [nom] [:map [nom [:string {:description (str "description " nom)}]]])]
|
||||||
[#'schema/coercion (fn [nom] {nom s/Str})]
|
[#'schema/coercion (fn [nom] {nom s/Str})]
|
||||||
[#'spec/coercion (fn [nom] {nom string?})]]]
|
[#'spec/coercion (fn [nom] {nom (st/spec {:spec string?
|
||||||
|
:description (str "description " nom)})})]]]
|
||||||
(testing coercion
|
(testing coercion
|
||||||
(let [app (ring/ring-handler
|
(let [app (ring/ring-handler
|
||||||
(ring/router
|
(ring/router
|
||||||
|
|
@ -395,28 +396,28 @@
|
||||||
(is (match? [{:in "query"
|
(is (match? [{:in "query"
|
||||||
:name "q"
|
:name "q"
|
||||||
:required true
|
:required true
|
||||||
:description (if (= #'malli/coercion coercion)
|
:description (if (not= #'schema/coercion coercion)
|
||||||
"description :q"
|
"description :q"
|
||||||
"")
|
"")
|
||||||
:schema {:type "string"}}
|
:schema {:type "string"}}
|
||||||
{:in "header"
|
{:in "header"
|
||||||
:name "h"
|
:name "h"
|
||||||
:required true
|
:required true
|
||||||
:description (if (= #'malli/coercion coercion)
|
:description (if (not= #'schema/coercion coercion)
|
||||||
"description :h"
|
"description :h"
|
||||||
"")
|
"")
|
||||||
:schema {:type "string"}}
|
:schema {:type "string"}}
|
||||||
{:in "cookie"
|
{:in "cookie"
|
||||||
:name "c"
|
:name "c"
|
||||||
:required true
|
:required true
|
||||||
:description (if (= #'malli/coercion coercion)
|
:description (if (not= #'schema/coercion coercion)
|
||||||
"description :c"
|
"description :c"
|
||||||
"")
|
"")
|
||||||
:schema {:type "string"}}
|
:schema {:type "string"}}
|
||||||
{:in "path"
|
{:in "path"
|
||||||
:name "p"
|
:name "p"
|
||||||
:required true
|
:required true
|
||||||
:description (if (= #'malli/coercion coercion)
|
:description (if (not= #'schema/coercion coercion)
|
||||||
"description :p"
|
"description :p"
|
||||||
"")
|
"")
|
||||||
:schema {:type "string"}}]
|
:schema {:type "string"}}]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue