Validate shape on add-object to catch malformed inputs early (#9291)

Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
Dexterity
2026-05-19 11:37:48 -04:00
committed by GitHub
parent 83cc71e585
commit bcc0b0d313

View File

@@ -19,6 +19,7 @@
[app.common.types.component :as ctk]
[app.common.types.file :as ctf]
[app.common.types.path :as path]
[app.common.types.shape :as cts]
[app.common.types.shape.layout :as ctl]
[app.common.types.tokens-lib :as ctob]
[app.common.uuid :as uuid]
@@ -410,12 +411,9 @@
(add-object changes obj nil))
([changes obj {:keys [index ignore-touched] :or {index ::undefined ignore-touched false}}]
;; FIXME: add shape validation
(assert-page-id! changes)
(assert-objects! changes)
(let [obj (cond-> obj
(let [obj (cond-> (cts/check-shape obj)
(not= index ::undefined)
(assoc ::index index))