mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
Merge pull request #740 from metosin/openapi-multi-example
doc: add :multi, :enum etc to examples/openapi
This commit is contained in:
commit
524d0d4d57
1 changed files with 26 additions and 0 deletions
|
|
@ -137,6 +137,32 @@
|
|||
{:from "0003"
|
||||
:amount -6.5}]}})}}]
|
||||
|
||||
["/complex"
|
||||
{:post {:summary "Complex schema with :multi, :enum, :tuple etc."
|
||||
:request {:content
|
||||
{:default
|
||||
{:schema [:map
|
||||
[:vector-of-tuples [:vector [:tuple :string :int]]]
|
||||
[:regex [:re "[0-9]+"]]
|
||||
[:enum [:enum 1 3 5 42]]
|
||||
[:multi [:multi {:dispatch :type}
|
||||
[:literal [:map
|
||||
[:type [:= :literal]]
|
||||
[:value [:or :int :string]]]]
|
||||
[:reference [:map
|
||||
[:type [:= :reference]]
|
||||
[:description :string]
|
||||
[:ref :uuid]]]]]]
|
||||
:example {:vector-of-tuples [["a" 1] ["b" 2]]
|
||||
:regex "01234"
|
||||
:enum 5
|
||||
:multi {:type :literal
|
||||
:value "x"}}}}}
|
||||
:responses {200 {:content {:default {:schema [:map]}}}}
|
||||
:handler (fn [request]
|
||||
{:status 200
|
||||
:body (:body request)})}}]
|
||||
|
||||
["/secure"
|
||||
{:tags #{"secure"}
|
||||
:openapi {:security [{"auth" []}]}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue