Skip to content

Commit

Permalink
Merge pull request #677 from metosin/improve-swagger-var-tests
Browse files Browse the repository at this point in the history
test: add response schema to reitit.swagger-test/malli-var-test
  • Loading branch information
opqdonut authored Apr 26, 2024
2 parents 15790f3 + 18550cd commit 275b789
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions test/cljc/reitit/swagger_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -513,18 +513,20 @@
(def Plus [:map
[:x #'X]
[:y #'Y]])
(def Result [:map [:result :int]])

(deftest malli-var-test
(let [app (ring/ring-handler
(ring/router
[["/post"
{:post {:coercion malli/coercion
:parameters {:body #'Plus}
:responses {200 {:body #'Result}}
:handler identity}}]
["/get"
{:get {:coercion malli/coercion
:parameters {:query
#'Plus}
:parameters {:query #'Plus}
:responses {200 {:body #'Result}}
:handler identity}}]
["/swagger.json"
{:get {:no-doc true
Expand All @@ -537,15 +539,18 @@
"reitit.swagger-test/X" {:format "int64",
:type "integer"},
"reitit.swagger-test/Y" {:format "int64",
:type "integer"}},
:type "integer"},
"reitit.swagger-test/Result" {:type "object",
:properties {:result {:type "integer", :format "int64"}},
:required [:result]}},
:paths {"/post" {:post {:parameters [{:description "",
:in "body",
:name "body",
:required true,
:schema {:$ref "#/definitions/reitit.swagger-test~1Plus"}}],
:responses {:default {:description ""}}}}
"/get" {:get {:responses {:default {:description ""}}
:parameters [{:in "query"
:schema {:$ref "#/definitions/reitit.swagger-test~1Plus"}}]
:responses {200 {:description ""
:schema {:$ref "#/definitions/reitit.swagger-test~1Result"}}}}}
"/get" {:get {:parameters [{:in "query"
:name :x
:description ""
:type "integer"
Expand All @@ -556,7 +561,9 @@
:description ""
:type "integer"
:required true
:format "int64"}]}}}
:format "int64"}]
:responses {200 {:description ""
:schema {:$ref "#/definitions/reitit.swagger-test~1Result"}}}}}}
:swagger "2.0",
:x-id #{:reitit.swagger/default}}
spec))))

0 comments on commit 275b789

Please sign in to comment.