Merge pull request #740 from metosin/openapi-multi-example

doc: add :multi, :enum etc to examples/openapi
This commit is contained in:
Joel Kaasinen 2025-05-13 09:18:20 +03:00 committed by GitHub
commit 524d0d4d57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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" []}]}}