From 6d0c185db5c620cc4ad4226c57c12154fd2a7c22 Mon Sep 17 00:00:00 2001 From: Ambrose Bonnaire-Sergeant Date: Thu, 11 Apr 2024 11:51:56 -0500 Subject: [PATCH] dirty --- src/ring/swagger/json_schema_dirty.clj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ring/swagger/json_schema_dirty.clj b/src/ring/swagger/json_schema_dirty.clj index 8f0ea2c..8edbc78 100644 --- a/src/ring/swagger/json_schema_dirty.clj +++ b/src/ring/swagger/json_schema_dirty.clj @@ -6,18 +6,18 @@ (extend-protocol json-schema/JsonSchema schema.experimental.abstract_map.AbstractSchema - (convert [e {:keys [properties? schema-type] - :or {properties? true}} ] + (convert [e {:keys [properties?] + :or {properties? true} :as options}] (if properties? (merge {:discriminator (name (:dispatch-key e))} - (json-schema/->swagger (:schema e) {:properties? properties? :schema-type schema-type})) - (json-schema/reference e schema-type))) + (json-schema/->swagger (:schema e) (assoc options :properties? properties?))) + (json-schema/reference e options))) schema.experimental.abstract_map.SchemaExtension - (convert [e {:keys [schema-type] :as options}] - {:allOf [(json-schema/->swagger (:base-schema e) {:properties? false :schema-type schema-type}) + (convert [e options] + {:allOf [(json-schema/->swagger (:base-schema e) (assoc options :properties? false)) ; Find which keys are also in base-schema and don't include them in these properties (json-schema/->swagger (let [base-keys (set (keys (:schema (:base-schema e)))) m (:extended-schema e)] (into (empty m) (remove (comp base-keys key) m))) - {:properties? true :schema-type schema-type})]})) + (assoc options :properties? true))]}))