mirror of
https://github.com/metosin/reitit.git
synced 2026-02-17 16:25:57 +00:00
refactor: -get-model-apidocs for schema & spec
not used yet tho
This commit is contained in:
parent
f943b025cb
commit
051452231a
2 changed files with 14 additions and 0 deletions
|
|
@ -47,6 +47,13 @@
|
||||||
(reify coercion/Coercion
|
(reify coercion/Coercion
|
||||||
(-get-name [_] :schema)
|
(-get-name [_] :schema)
|
||||||
(-get-options [_] opts)
|
(-get-options [_] opts)
|
||||||
|
(-get-model-apidocs [_ specification model options]
|
||||||
|
(case specification
|
||||||
|
:openapi (openapi/transform model (merge opts options))
|
||||||
|
(throw
|
||||||
|
(ex-info
|
||||||
|
(str "Can't produce Schema apidocs for " specification)
|
||||||
|
{:type specification, :coercion :schema}))))
|
||||||
(-get-apidocs [_ specification {:keys [request parameters responses content-types]
|
(-get-apidocs [_ specification {:keys [request parameters responses content-types]
|
||||||
:or {content-types ["application/json"]}}]
|
:or {content-types ["application/json"]}}]
|
||||||
;; TODO: this looks identical to spec, refactor when schema is done.
|
;; TODO: this looks identical to spec, refactor when schema is done.
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,13 @@
|
||||||
(reify coercion/Coercion
|
(reify coercion/Coercion
|
||||||
(-get-name [_] :spec)
|
(-get-name [_] :spec)
|
||||||
(-get-options [_] opts)
|
(-get-options [_] opts)
|
||||||
|
(-get-model-apidocs [_ specification model options]
|
||||||
|
(case specification
|
||||||
|
:openapi (openapi/transform model (merge opts options))
|
||||||
|
(throw
|
||||||
|
(ex-info
|
||||||
|
(str "Can't produce Spec apidocs for " specification)
|
||||||
|
{:type specification, :coercion :spec}))))
|
||||||
(-get-apidocs [_ specification {:keys [request parameters responses content-types]
|
(-get-apidocs [_ specification {:keys [request parameters responses content-types]
|
||||||
:or {content-types ["application/json"]}}]
|
:or {content-types ["application/json"]}}]
|
||||||
(case specification
|
(case specification
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue