0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 16:00:19 -05:00

🐛 Fix regression on sm/vec and sm/set schemas

Introduced in previous commits
This commit is contained in:
Andrey Antukh 2024-11-08 19:50:59 +01:00
parent 960f095c1b
commit 0d08549a04

View file

@ -451,9 +451,18 @@
decode decode
(fn [v] (fn [v]
(if (string? v) (cond
(string? v)
(let [v (str/split v #"[\s,]+")] (let [v (str/split v #"[\s,]+")]
(into #{} xf:filter-word-strings v)) (into #{} xf:filter-word-strings v))
(set? v)
v
(coll? v)
(into #{} v)
:else
v)) v))
encode-string-child encode-string-child
@ -481,9 +490,7 @@
::oapi/items {:type "string"} ::oapi/items {:type "string"}
::oapi/unique-items true}}))}) ::oapi/unique-items true}}))})
(register! ::set type:set) (def type:vec
(register! ::vec
{:type :vector {:type :vector
:min 0 :min 0
:max 1 :max 1
@ -525,9 +532,18 @@
decode decode
(fn [v] (fn [v]
(if (string? v) (cond
(string? v)
(let [v (str/split v #"[\s,]+")] (let [v (str/split v #"[\s,]+")]
(into #{} xf:filter-word-strings v)) (into [] xf:filter-word-strings v))
(vector? v)
v
(coll? v)
(into [] v)
:else
v)) v))
encode-string-child encode-string-child
@ -554,6 +570,9 @@
::oapi/items {:type "string"} ::oapi/items {:type "string"}
::oapi/unique-items true}}))}) ::oapi/unique-items true}}))})
(register! ::set type:set)
(register! ::vec type:vec)
(register! ::set-of-strings (register! ::set-of-strings
{:type ::set-of-strings {:type ::set-of-strings
:pred #(and (set? %) (every? string? %)) :pred #(and (set? %) (every? string? %))