From f943b025cbc23a29503dd7f5c9e97879a70ab504 Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Mon, 28 Aug 2023 08:59:58 +0300 Subject: [PATCH] refactor: no need to pass options into -get-apidocs-openapi --- modules/reitit-malli/src/reitit/coercion/malli.cljc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/reitit-malli/src/reitit/coercion/malli.cljc b/modules/reitit-malli/src/reitit/coercion/malli.cljc index e8bc2b1f..c033c5c1 100644 --- a/modules/reitit-malli/src/reitit/coercion/malli.cljc +++ b/modules/reitit-malli/src/reitit/coercion/malli.cljc @@ -133,12 +133,8 @@ ;; malli options :options nil}) -;; TODO: this is now seems like a generic transforming function that could be used in all of malli, spec, schema -;; ... just tranform the schemas in place -;; also, this has internally massive amount of duplicate code, could be simplified -;; ... tests too (defn -get-apidocs-openapi - [coercion {:keys [request parameters responses content-types] :or {content-types ["application/json"]}} options] + [coercion {:keys [request parameters responses content-types] :or {content-types ["application/json"]}}] (let [{:keys [body multipart]} parameters parameters (dissoc parameters :request :body :multipart) ->content (fn [data schema] @@ -146,7 +142,7 @@ {:schema schema} (select-keys data [:description :examples]) (:openapi data))) - ->schema-object #(coercion/-get-model-apidocs coercion :openapi %1 (merge options %2))] + ->schema-object #(coercion/-get-model-apidocs coercion :openapi %1 %2)] (merge (when (seq parameters) {:parameters @@ -243,7 +239,7 @@ (-get-options [_] opts) (-get-model-apidocs [this specification model options] (case specification - :openapi (json-schema/transform model options) + :openapi (json-schema/transform model (merge opts options)) (throw (ex-info (str "Can't produce Malli apidocs for " specification) @@ -268,7 +264,7 @@ (if (:schema $) (update $ :schema swagger/transform {:type :schema}) $))]))})) - :openapi (-get-apidocs-openapi this data options) + :openapi (-get-apidocs-openapi this data) (throw (ex-info (str "Can't produce Malli apidocs for " specification)