💄 Use resolved schemas instead of references

For several schemas on common types
This commit is contained in:
Andrey Antukh 2025-07-08 08:51:19 +02:00
parent 7e493376a4
commit ea0044f69a
4 changed files with 24 additions and 24 deletions

View file

@ -669,7 +669,6 @@
:file-id (:id file) :file-id (:id file)
:details errors))) :details errors)))
(declare compare-slots) (declare compare-slots)
;; Optional check to look for missing swap slots. ;; Optional check to look for missing swap slots.

View file

@ -15,7 +15,7 @@
[app.common.types.component :as ctk] [app.common.types.component :as ctk]
[app.common.types.components-list :as ctkl] [app.common.types.components-list :as ctkl]
[app.common.types.pages-list :as ctpl] [app.common.types.pages-list :as ctpl]
[app.common.types.plugins :as ctpg] [app.common.types.plugins :refer [schema:plugin-data]]
[app.common.types.shape-tree :as ctst] [app.common.types.shape-tree :as ctst]
[app.common.types.shape.layout :as ctl] [app.common.types.shape.layout :as ctl]
[app.common.types.text :as cttx] [app.common.types.text :as cttx]
@ -30,6 +30,7 @@
(def valid-container-types (def valid-container-types
#{:page :component}) #{:page :component})
(def schema:container
(sm/register! (sm/register!
^{::sm/type ::container} ^{::sm/type ::container}
[:map [:map
@ -41,10 +42,10 @@
[:modified-at {:optional true} ::sm/inst] [:modified-at {:optional true} ::sm/inst]
[:objects {:optional true} [:objects {:optional true}
[:map-of {:gen/max 10} ::sm/uuid :map]] [:map-of {:gen/max 10} ::sm/uuid :map]]
[:plugin-data {:optional true} ::ctpg/plugin-data]]) [:plugin-data {:optional true} schema:plugin-data]]))
(def check-container (def check-container
(sm/check-fn ::container)) (sm/check-fn schema:container))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HELPERS ;; HELPERS

View file

@ -23,9 +23,9 @@
[app.common.types.container :as ctn] [app.common.types.container :as ctn]
[app.common.types.page :as ctp] [app.common.types.page :as ctp]
[app.common.types.pages-list :as ctpl] [app.common.types.pages-list :as ctpl]
[app.common.types.plugins :as ctpg] [app.common.types.plugins :refer [schema:plugin-data]]
[app.common.types.shape-tree :as ctst] [app.common.types.shape-tree :as ctst]
[app.common.types.tokens-lib :as ctl] [app.common.types.tokens-lib :refer [schema:tokens-lib]]
[app.common.types.typographies-list :as ctyl] [app.common.types.typographies-list :as ctyl]
[app.common.types.typography :as cty] [app.common.types.typography :as cty]
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
@ -61,13 +61,13 @@
[:map-of {:gen/max 5} ::sm/uuid ctc/schema:library-color]) [:map-of {:gen/max 5} ::sm/uuid ctc/schema:library-color])
(def schema:components (def schema:components
[:map-of {:gen/max 5} ::sm/uuid ::ctn/container]) [:map-of {:gen/max 5} ::sm/uuid ctn/schema:container])
(def schema:typographies (def schema:typographies
[:map-of {:gen/max 2} ::sm/uuid ::cty/typography]) [:map-of {:gen/max 2} ::sm/uuid cty/schema:typography])
(def schema:pages-index (def schema:pages-index
[:map-of {:gen/max 5} ::sm/uuid ::ctp/page]) [:map-of {:gen/max 5} ::sm/uuid ctp/schema:page])
(def schema:options (def schema:options
[:map {:title "FileOptions"} [:map {:title "FileOptions"}
@ -82,8 +82,8 @@
[:colors {:optional true} schema:colors] [:colors {:optional true} schema:colors]
[:components {:optional true} schema:components] [:components {:optional true} schema:components]
[:typographies {:optional true} schema:typographies] [:typographies {:optional true} schema:typographies]
[:plugin-data {:optional true} ::ctpg/plugin-data] [:plugin-data {:optional true} schema:plugin-data]
[:tokens-lib {:optional true} ::ctl/tokens-lib]]) [:tokens-lib {:optional true} schema:tokens-lib]])
(def schema:file (def schema:file
"A schema for validate a file data structure; data is optional "A schema for validate a file data structure; data is optional

View file

@ -53,10 +53,10 @@
[:name :string] [:name :string]
[:index {:optional true} ::sm/int] [:index {:optional true} ::sm/int]
[:objects schema:objects] [:objects schema:objects]
[:default-grids {:optional true} ::ctg/default-grids] [:default-grids {:optional true} ctg/schema:default-grids]
[:flows {:optional true} schema:flows] [:flows {:optional true} schema:flows]
[:guides {:optional true} schema:guides] [:guides {:optional true} schema:guides]
[:plugin-data {:optional true} ::ctpg/plugin-data] [:plugin-data {:optional true} ctpg/schema:plugin-data]
[:background {:optional true} ctc/schema:hex-color] [:background {:optional true} ctc/schema:hex-color]
[:comment-thread-positions {:optional true} [:comment-thread-positions {:optional true}