mirror of
https://github.com/penpot/penpot.git
synced 2025-06-17 00:01:39 +02:00
🐛 Fix uuid encode/decode on schema
This commit is contained in:
parent
38e5c161e7
commit
a4145a30f5
1 changed files with 11 additions and 5 deletions
|
@ -395,9 +395,15 @@
|
|||
|
||||
(defn parse-uuid
|
||||
[s]
|
||||
(if (string? s)
|
||||
(some->> (re-matches uuid-rx s) uuid/uuid)
|
||||
s))
|
||||
(try
|
||||
(uuid/parse s)
|
||||
(catch #?(:clj Exception :cljs :default) _cause
|
||||
s)))
|
||||
|
||||
(defn encode-uuid
|
||||
[v]
|
||||
(when (uuid? v)
|
||||
(str v)))
|
||||
|
||||
(register!
|
||||
{:type ::uuid
|
||||
|
@ -409,8 +415,8 @@
|
|||
:gen/gen (sg/uuid)
|
||||
:decode/string parse-uuid
|
||||
:decode/json parse-uuid
|
||||
:encode/string str
|
||||
:encode/json str
|
||||
:encode/string encode-uuid
|
||||
:encode/json encode-uuid
|
||||
::oapi/type "string"
|
||||
::oapi/format "uuid"}})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue