From 051452231a073b1e15563db953cfebd541641482 Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Mon, 28 Aug 2023 09:02:11 +0300 Subject: [PATCH] refactor: -get-model-apidocs for schema & spec not used yet tho --- modules/reitit-schema/src/reitit/coercion/schema.cljc | 7 +++++++ modules/reitit-spec/src/reitit/coercion/spec.cljc | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/modules/reitit-schema/src/reitit/coercion/schema.cljc b/modules/reitit-schema/src/reitit/coercion/schema.cljc index e0822ad9..24acf220 100644 --- a/modules/reitit-schema/src/reitit/coercion/schema.cljc +++ b/modules/reitit-schema/src/reitit/coercion/schema.cljc @@ -47,6 +47,13 @@ (reify coercion/Coercion (-get-name [_] :schema) (-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] :or {content-types ["application/json"]}}] ;; TODO: this looks identical to spec, refactor when schema is done. diff --git a/modules/reitit-spec/src/reitit/coercion/spec.cljc b/modules/reitit-spec/src/reitit/coercion/spec.cljc index 98ff9e37..da5cfdd1 100644 --- a/modules/reitit-spec/src/reitit/coercion/spec.cljc +++ b/modules/reitit-spec/src/reitit/coercion/spec.cljc @@ -88,6 +88,13 @@ (reify coercion/Coercion (-get-name [_] :spec) (-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] :or {content-types ["application/json"]}}] (case specification