@@ -518,42 +518,7 @@ app supports), opposed to the [Ring Spec](https://github.com/mmcgrana/ring/blob/
518518 (ok (str " hello, " name))))
519519```
520520
521- ## Response-models (pre 0.21 .0)
522-
523- Key `:responses` takes a map of http-status-code -> model map, which translates to both return model coercion and
524- to swagger `responseMessages` description. Models can be decorated with `:message` meta-data.
525-
526- ```clojure
527- (GET* " /" []
528- :query-params [return :- (s/enum :200 :403 :404 )]
529- :responses {403 (with-meta {:code s/Str} {:message " spiders?" })
530- 404 (with-meta {:reason s/Str} {:message " lost?" })}
531- :return Total
532- :summary " multiple returns models"
533- (case return
534- :200 (ok {:total 42 })
535- :403 (forbidden {:code " forest" })
536- :404 (not-found {:reason " lost" })))
537- ```
538-
539- The `:return` maps the model just to the response 200 , so one can also say:
540-
541- ```clojure
542- (GET* " /" []
543- :query-params [return :- (s/enum :200 :403 :404 )]
544- :responses {200 (with-meta Total {:message " happy path" })
545- 403 (with-meta {:code s/Str} {:message " spiders?" })
546- 404 (with-meta {:reason s/Str} {:message " lost?" })}
547- :summary " multiple returns models"
548- (case return
549- :200 (ok {:total 42 })
550- :403 (forbidden {:code " forest" })
551- :404 (not-found {:reason " lost" })))
552- ```
553-
554- ## Response-models (post 0.21 .0)
555-
556- This stuff works with `0.21 .0-SNAPSHOT`.
521+ ## Response-models
557522
558523Key `:responses` takes a map of http-status-code to schema-definitions map
559524(with optional `:schema`, `:description` and `:headers` keys). `:schema` defines the return model
0 commit comments