mirror of
https://github.com/penpot/penpot.git
synced 2026-02-12 22:53:02 +00:00
✨ Make component path mandatory on validations
And ensure it already present with a migration
This commit is contained in:
@@ -317,8 +317,7 @@
|
||||
[:type [:= :add-component]]
|
||||
[:id ::sm/uuid]
|
||||
[:name :string]
|
||||
[:shapes {:optional true} [:vector {:gen/max 3} ::sm/any]]
|
||||
[:path {:optional true} :string]
|
||||
[:path :string]
|
||||
[:main-instance-id ::sm/uuid]
|
||||
[:main-instance-page ::sm/uuid]
|
||||
;; Only used by external processes (like Penpot SDK)
|
||||
@@ -331,7 +330,6 @@
|
||||
[:id ::sm/uuid]
|
||||
[:name {:optional true} :string]
|
||||
[:path {:optional true} :string]
|
||||
[:shapes {:optional true} [:vector {:gen/max 3} ::sm/any]]
|
||||
[:variant-id {:optional true} ::sm/uuid]
|
||||
[:variant-properties {:optional true} [:vector ctv/schema:variant-property]]]]
|
||||
|
||||
|
||||
@@ -1605,6 +1605,13 @@
|
||||
(update :pages-index d/update-vals update-container)
|
||||
(d/update-when :components d/update-vals update-container))))
|
||||
|
||||
(defmethod migrate-data "0013-fix-component-path"
|
||||
[data _]
|
||||
(let [update-component
|
||||
(fn [component]
|
||||
(update component :path #(d/nilv % "")))]
|
||||
(d/update-when data :components d/update-vals update-component)))
|
||||
|
||||
(def available-migrations
|
||||
(into (d/ordered-set)
|
||||
["legacy-2"
|
||||
@@ -1673,4 +1680,5 @@
|
||||
"0009-add-partial-text-touched-flags"
|
||||
"0010-fix-swap-slots-pointing-non-existent-shapes"
|
||||
"0011-fix-invalid-text-touched-flags"
|
||||
"0012-fix-position-data"]))
|
||||
"0012-fix-position-data"
|
||||
"0013-fix-component-path"]))
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
[:map
|
||||
[:id ::sm/uuid]
|
||||
[:name :string]
|
||||
[:path {:optional true} [:maybe :string]]
|
||||
[:path :string]
|
||||
[:modified-at {:optional true} ::ct/inst]
|
||||
[:objects {:gen/max 10 :optional true} ctp/schema:objects]
|
||||
[:main-instance-id ::sm/uuid]
|
||||
|
||||
Reference in New Issue
Block a user