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))]}))