mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
🐛 Fix small issues in validate functions
This commit is contained in:
parent
fb36b77bd1
commit
ae793c079b
@ -71,7 +71,7 @@
|
|||||||
:code code
|
:code code
|
||||||
:hint msg
|
:hint msg
|
||||||
:args args
|
:args args
|
||||||
::explain (str/format "file %s\npage %s\nshape %s"
|
::explain (str/format "file %s, page %s, shape %s"
|
||||||
(:id file)
|
(:id file)
|
||||||
(:id page)
|
(:id page)
|
||||||
(:id shape))})
|
(:id shape))})
|
||||||
@ -239,7 +239,7 @@
|
|||||||
(validate-component-root shape file page)
|
(validate-component-root shape file page)
|
||||||
(validate-component-not-ref shape file page)
|
(validate-component-not-ref shape file page)
|
||||||
(doseq [child-id (:shapes shape)]
|
(doseq [child-id (:shapes shape)]
|
||||||
(validate-shape child-id file page libraries :context :main-top :clear-errors? false)))
|
(validate-shape child-id file page libraries :context :main-top)))
|
||||||
|
|
||||||
(defn validate-shape-main-root-nested
|
(defn validate-shape-main-root-nested
|
||||||
"Root shape of a nested main instance
|
"Root shape of a nested main instance
|
||||||
@ -251,7 +251,7 @@
|
|||||||
(validate-component-not-root shape file page)
|
(validate-component-not-root shape file page)
|
||||||
(validate-component-not-ref shape file page)
|
(validate-component-not-ref shape file page)
|
||||||
(doseq [child-id (:shapes shape)]
|
(doseq [child-id (:shapes shape)]
|
||||||
(validate-shape child-id file page libraries :context :main-nested :clear-errors? false)))
|
(validate-shape child-id file page libraries :context :main-nested)))
|
||||||
|
|
||||||
(defn validate-shape-copy-root-top
|
(defn validate-shape-copy-root-top
|
||||||
"Root shape of a top copy instance
|
"Root shape of a top copy instance
|
||||||
@ -264,7 +264,7 @@
|
|||||||
(validate-component-root shape file page)
|
(validate-component-root shape file page)
|
||||||
(validate-component-ref shape file page libraries)
|
(validate-component-ref shape file page libraries)
|
||||||
(doseq [child-id (:shapes shape)]
|
(doseq [child-id (:shapes shape)]
|
||||||
(validate-shape child-id file page libraries :context :copy-top :clear-errors? false)))
|
(validate-shape child-id file page libraries :context :copy-top)))
|
||||||
|
|
||||||
(defn validate-shape-copy-root-nested
|
(defn validate-shape-copy-root-nested
|
||||||
"Root shape of a nested copy instance
|
"Root shape of a nested copy instance
|
||||||
@ -276,7 +276,7 @@
|
|||||||
(validate-component-not-root shape file page)
|
(validate-component-not-root shape file page)
|
||||||
(validate-component-ref shape file page libraries)
|
(validate-component-ref shape file page libraries)
|
||||||
(doseq [child-id (:shapes shape)]
|
(doseq [child-id (:shapes shape)]
|
||||||
(validate-shape child-id file page libraries :context :copy-nested :clear-errors? false)))
|
(validate-shape child-id file page libraries :context :copy-nested)))
|
||||||
|
|
||||||
(defn validate-shape-main-not-root
|
(defn validate-shape-main-not-root
|
||||||
"Not-root shape of a main instance
|
"Not-root shape of a main instance
|
||||||
@ -286,7 +286,7 @@
|
|||||||
(validate-component-not-root shape file page)
|
(validate-component-not-root shape file page)
|
||||||
(validate-component-not-ref shape file page)
|
(validate-component-not-ref shape file page)
|
||||||
(doseq [child-id (:shapes shape)]
|
(doseq [child-id (:shapes shape)]
|
||||||
(validate-shape child-id file page libraries :context :main-any :clear-errors? false)))
|
(validate-shape child-id file page libraries :context :main-any)))
|
||||||
|
|
||||||
(defn validate-shape-copy-not-root
|
(defn validate-shape-copy-not-root
|
||||||
"Not-root shape of a copy instance
|
"Not-root shape of a copy instance
|
||||||
@ -296,7 +296,7 @@
|
|||||||
(validate-component-not-root shape file page)
|
(validate-component-not-root shape file page)
|
||||||
(validate-component-ref shape file page libraries)
|
(validate-component-ref shape file page libraries)
|
||||||
(doseq [child-id (:shapes shape)]
|
(doseq [child-id (:shapes shape)]
|
||||||
(validate-shape child-id file page libraries :context :copy-any :clear-errors? false)))
|
(validate-shape child-id file page libraries :context :copy-any)))
|
||||||
|
|
||||||
(defn validate-shape-not-component
|
(defn validate-shape-not-component
|
||||||
"Shape is not in a component or is a fostered children
|
"Shape is not in a component or is a fostered children
|
||||||
@ -306,7 +306,7 @@
|
|||||||
(validate-component-not-root shape file page)
|
(validate-component-not-root shape file page)
|
||||||
(validate-component-not-ref shape file page)
|
(validate-component-not-ref shape file page)
|
||||||
(doseq [child-id (:shapes shape)]
|
(doseq [child-id (:shapes shape)]
|
||||||
(validate-shape child-id file page libraries :context :not-component :clear-errors? false)))
|
(validate-shape child-id file page libraries :context :not-component)))
|
||||||
|
|
||||||
(defn validate-shape
|
(defn validate-shape
|
||||||
"Validate referential integrity and semantic coherence of a shape and all its children.
|
"Validate referential integrity and semantic coherence of a shape and all its children.
|
||||||
@ -321,8 +321,8 @@
|
|||||||
:copy-any"
|
:copy-any"
|
||||||
[shape-id file page libraries & {:keys [context throw?]
|
[shape-id file page libraries & {:keys [context throw?]
|
||||||
:or {context :not-component
|
:or {context :not-component
|
||||||
throw? false}}]
|
throw? nil}}]
|
||||||
(binding [*throw-on-error* throw?
|
(binding [*throw-on-error* (if (some? throw?) throw? *throw-on-error*)
|
||||||
*errors* (or *errors* (volatile! []))]
|
*errors* (or *errors* (volatile! []))]
|
||||||
(let [shape (ctst/get-shape page shape-id)]
|
(let [shape (ctst/get-shape page shape-id)]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user