Merge pull request #625 from metosin/openapi-descriptions

new schema-tools version fixes #612 for spec
This commit is contained in:
Joel Kaasinen 2023-05-17 17:59:20 +03:00 committed by GitHub
commit 2e555a1453
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 14 deletions

View file

@ -12,6 +12,10 @@ We use [Break Versioning][breakver]. The version numbers follow a `<major>.<mino
[breakver]: https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md [breakver]: https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md
## Unreleased
* OpenAPI 3 parameter descriptions get populated from malli/spec/schema descriptions. [#612](https://github.com/metosin/reitit/issues/612)
## 0.7.3-alpha3 (2023-05-05) ## 0.7.3-alpha3 (2023-05-05)
* Compile `reitit.Trie` with Java 1.8 target for compatibility * Compile `reitit.Trie` with Java 1.8 target for compatibility

View file

@ -87,7 +87,7 @@
[org.clojure/clojurescript "1.10.773"] [org.clojure/clojurescript "1.10.773"]
;; modules dependencies ;; modules dependencies
[metosin/schema-tools "0.13.0"] [metosin/schema-tools "0.13.1"]
[metosin/spec-tools "0.10.5"] [metosin/spec-tools "0.10.5"]
[metosin/muuntaja "0.6.8"] [metosin/muuntaja "0.6.8"]
[metosin/sieppari "0.0.0-alpha13"] [metosin/sieppari "0.0.0-alpha13"]

View file

@ -366,7 +366,8 @@
(deftest all-parameter-types-test (deftest all-parameter-types-test
(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 (schema-tools.core/schema s/Str
{:description (str "description " nom)})})]
[#'spec/coercion (fn [nom] {nom (st/spec {:spec string? [#'spec/coercion (fn [nom] {nom (st/spec {:spec string?
:description (str "description " nom)})})]]] :description (str "description " nom)})})]]]
(testing coercion (testing coercion
@ -396,30 +397,22 @@
(is (match? [{:in "query" (is (match? [{:in "query"
:name "q" :name "q"
:required true :required true
:description (if (not= #'schema/coercion coercion) :description "description :q"
"description :q"
"")
:schema {:type "string"}} :schema {:type "string"}}
{:in "header" {:in "header"
:name "h" :name "h"
:required true :required true
:description (if (not= #'schema/coercion coercion) :description "description :h"
"description :h"
"")
:schema {:type "string"}} :schema {:type "string"}}
{:in "cookie" {:in "cookie"
:name "c" :name "c"
:required true :required true
:description (if (not= #'schema/coercion coercion) :description "description :c"
"description :c"
"")
:schema {:type "string"}} :schema {:type "string"}}
{:in "path" {:in "path"
:name "p" :name "p"
:required true :required true
:description (if (not= #'schema/coercion coercion) :description "description :p"
"description :p"
"")
:schema {:type "string"}}] :schema {:type "string"}}]
(-> spec (-> spec
(get-in [:paths "/parameters" :post :parameters]) (get-in [:paths "/parameters" :post :parameters])