mirror of
https://github.com/metosin/reitit.git
synced 2026-02-19 09:15:54 +00:00
doc: OpenAPI3 named examples in examples/http-swagger
This commit is contained in:
parent
ca9852a318
commit
5227e65029
1 changed files with 16 additions and 0 deletions
|
|
@ -112,6 +112,22 @@
|
||||||
{:status 200
|
{:status 200
|
||||||
:body {:total (+ x y)}})}
|
:body {:total (+ x y)}})}
|
||||||
:post {:summary "plus with data-spec body parameters"
|
:post {:summary "plus with data-spec body parameters"
|
||||||
|
;; OpenAPI3 named examples for request & response
|
||||||
|
:openapi {:requestBody
|
||||||
|
{:content
|
||||||
|
{"application/json"
|
||||||
|
{:examples {"add-one-one" {:summary "1+1"
|
||||||
|
:value {:x 1 :y 1}}
|
||||||
|
"add-one-two" {:summary "1+2"
|
||||||
|
:value {:x 1 :y 2}}}}}}
|
||||||
|
:responses
|
||||||
|
{200
|
||||||
|
{:content
|
||||||
|
{"application/json"
|
||||||
|
{:examples {"two" {:summary "2"
|
||||||
|
:value {:total 2}}
|
||||||
|
"three" {:summary "3"
|
||||||
|
:value {:total 3}}}}}}}}
|
||||||
:parameters {:body {:x int?, :y int?}}
|
:parameters {:body {:x int?, :y int?}}
|
||||||
:responses {200 {:body {:total int?}}}
|
:responses {200 {:body {:total int?}}}
|
||||||
:handler (fn [{{{:keys [x y]} :body} :parameters}]
|
:handler (fn [{{{:keys [x y]} :body} :parameters}]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue