💄 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)
:details errors)))
(declare compare-slots)
;; Optional check to look for missing swap slots.

View file

@ -15,7 +15,7 @@
[app.common.types.component :as ctk]
[app.common.types.components-list :as ctkl]
[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.layout :as ctl]
[app.common.types.text :as cttx]
@ -30,21 +30,22 @@
(def valid-container-types
#{:page :component})
(sm/register!
^{::sm/type ::container}
[:map
[:id ::sm/uuid]
[:type {:optional true}
[::sm/one-of valid-container-types]]
[:name :string]
[:path {:optional true} [:maybe :string]]
[:modified-at {:optional true} ::sm/inst]
[:objects {:optional true}
[:map-of {:gen/max 10} ::sm/uuid :map]]
[:plugin-data {:optional true} ::ctpg/plugin-data]])
(def schema:container
(sm/register!
^{::sm/type ::container}
[:map
[:id ::sm/uuid]
[:type {:optional true}
[::sm/one-of valid-container-types]]
[:name :string]
[:path {:optional true} [:maybe :string]]
[:modified-at {:optional true} ::sm/inst]
[:objects {:optional true}
[:map-of {:gen/max 10} ::sm/uuid :map]]
[:plugin-data {:optional true} schema:plugin-data]]))
(def check-container
(sm/check-fn ::container))
(sm/check-fn schema:container))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HELPERS

View file

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

View file

@ -53,10 +53,10 @@
[:name :string]
[:index {:optional true} ::sm/int]
[:objects schema:objects]
[:default-grids {:optional true} ::ctg/default-grids]
[:default-grids {:optional true} ctg/schema:default-grids]
[:flows {:optional true} schema:flows]
[: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]
[:comment-thread-positions {:optional true}