♻️ Use direct schemas instead of references

Only a very common use, basic types schemas should be used as
reference (with namespaced keywords)
This commit is contained in:
Andrey Antukh
2025-08-20 09:36:49 +02:00
parent d7c19325cc
commit 575342b3bb
38 changed files with 182 additions and 258 deletions

View File

@@ -103,25 +103,25 @@
(sm/encoder ctp/schema:page sm/json-transformer)) (sm/encoder ctp/schema:page sm/json-transformer))
(def encode-shape (def encode-shape
(sm/encoder ::cts/shape sm/json-transformer)) (sm/encoder cts/schema:shape sm/json-transformer))
(def encode-media (def encode-media
(sm/encoder ::ctf/media sm/json-transformer)) (sm/encoder ctf/schema:media sm/json-transformer))
(def encode-component (def encode-component
(sm/encoder ::ctc/component sm/json-transformer)) (sm/encoder ctc/schema:component sm/json-transformer))
(def encode-color (def encode-color
(sm/encoder ctcl/schema:library-color sm/json-transformer)) (sm/encoder ctcl/schema:library-color sm/json-transformer))
(def encode-typography (def encode-typography
(sm/encoder ::cty/typography sm/json-transformer)) (sm/encoder cty/schema:typography sm/json-transformer))
(def encode-tokens-lib (def encode-tokens-lib
(sm/encoder ::cto/tokens-lib sm/json-transformer)) (sm/encoder cto/schema:tokens-lib sm/json-transformer))
(def encode-plugin-data (def encode-plugin-data
(sm/encoder ::ctpg/plugin-data sm/json-transformer)) (sm/encoder ctpg/schema:plugin-data sm/json-transformer))
(def encode-storage-object (def encode-storage-object
(sm/encoder schema:storage-object sm/json-transformer)) (sm/encoder schema:storage-object sm/json-transformer))
@@ -138,7 +138,7 @@
(sm/decoder ctf/schema:media sm/json-transformer)) (sm/decoder ctf/schema:media sm/json-transformer))
(def decode-component (def decode-component
(sm/decoder ::ctc/component sm/json-transformer)) (sm/decoder ctc/schema:component sm/json-transformer))
(def decode-color (def decode-color
(sm/decoder ctcl/schema:library-color sm/json-transformer)) (sm/decoder ctcl/schema:library-color sm/json-transformer))
@@ -147,19 +147,19 @@
(sm/decoder schema:file sm/json-transformer)) (sm/decoder schema:file sm/json-transformer))
(def decode-page (def decode-page
(sm/decoder ::ctp/page sm/json-transformer)) (sm/decoder ctp/schema:page sm/json-transformer))
(def decode-shape (def decode-shape
(sm/decoder ::cts/shape sm/json-transformer)) (sm/decoder cts/schema:shape sm/json-transformer))
(def decode-typography (def decode-typography
(sm/decoder ::cty/typography sm/json-transformer)) (sm/decoder cty/schema:typography sm/json-transformer))
(def decode-tokens-lib (def decode-tokens-lib
(sm/decoder cto/schema:tokens-lib sm/json-transformer)) (sm/decoder cto/schema:tokens-lib sm/json-transformer))
(def decode-plugin-data (def decode-plugin-data
(sm/decoder ::ctpg/plugin-data sm/json-transformer)) (sm/decoder ctpg/schema:plugin-data sm/json-transformer))
(def decode-storage-object (def decode-storage-object
(sm/decoder schema:storage-object sm/json-transformer)) (sm/decoder schema:storage-object sm/json-transformer))
@@ -173,31 +173,31 @@
(sm/check-fn schema:manifest)) (sm/check-fn schema:manifest))
(def validate-file (def validate-file
(sm/check-fn ::ctf/file)) (sm/check-fn ctf/schema:file))
(def validate-page (def validate-page
(sm/check-fn ::ctp/page)) (sm/check-fn ctp/schema:page))
(def validate-shape (def validate-shape
(sm/check-fn ::cts/shape)) (sm/check-fn cts/schema:shape))
(def validate-media (def validate-media
(sm/check-fn ::ctf/media)) (sm/check-fn ctf/schema:media))
(def validate-color (def validate-color
(sm/check-fn ctcl/schema:library-color)) (sm/check-fn ctcl/schema:library-color))
(def validate-component (def validate-component
(sm/check-fn ::ctc/component)) (sm/check-fn ctc/schema:component))
(def validate-typography (def validate-typography
(sm/check-fn ::cty/typography)) (sm/check-fn cty/schema:typography))
(def validate-tokens-lib (def validate-tokens-lib
(sm/check-fn ::cto/tokens-lib)) (sm/check-fn cto/schema:tokens-lib))
(def validate-plugin-data (def validate-plugin-data
(sm/check-fn ::ctpg/plugin-data)) (sm/check-fn ctpg/schema:plugin-data))
(def validate-storage-object (def validate-storage-object
(sm/check-fn schema:storage-object)) (sm/check-fn schema:storage-object))

View File

@@ -38,15 +38,13 @@
org.im4java.core.Info)) org.im4java.core.Info))
(def schema:upload (def schema:upload
(sm/register! [:map {:title "Upload"}
^{::sm/type ::upload} [:filename :string]
[:map {:title "Upload"} [:size ::sm/int]
[:filename :string] [:path ::fs/path]
[:size ::sm/int] [:mtype {:optional true} :string]
[:path ::fs/path] [:headers {:optional true}
[:mtype {:optional true} :string] [:map-of :string :string]]])
[:headers {:optional true}
[:map-of :string :string]]]))
(def ^:private schema:input (def ^:private schema:input
[:map {:title "Input"} [:map {:title "Input"}

View File

@@ -127,7 +127,7 @@
[:project-id ::sm/uuid] [:project-id ::sm/uuid]
[:file-id {:optional true} ::sm/uuid] [:file-id {:optional true} ::sm/uuid]
[:version {:optional true} ::sm/int] [:version {:optional true} ::sm/int]
[:file ::media/upload]]) [:file media/schema:upload]])
(sv/defmethod ::import-binfile (sv/defmethod ::import-binfile
"Import a penpot file in a binary format. If `file-id` is provided, "Import a penpot file in a binary format. If `file-id` is provided,

View File

@@ -195,7 +195,7 @@
(def schema:permissions-mixin (def schema:permissions-mixin
[:map {:title "PermissionsMixin"} [:map {:title "PermissionsMixin"}
[:permissions ::perms/permissions]]) [:permissions perms/schema:permissions]])
(def schema:file-with-permissions (def schema:file-with-permissions
[:merge {:title "FileWithPermissions"} [:merge {:title "FileWithPermissions"}

View File

@@ -79,10 +79,9 @@
;; --- MUTATION COMMAND: update-temp-file ;; --- MUTATION COMMAND: update-temp-file
(def ^:private schema:update-temp-file (def ^:private schema:update-temp-file
[:map {:title "update-temp-file"} [:map {:title "update-temp-file"}
[:changes [:vector ::cpc/change]] [:changes [:vector cpc/schema:change]]
[:revn [::sm/int {:min 0}]] [:revn [::sm/int {:min 0}]]
[:session-id ::sm/uuid] [:session-id ::sm/uuid]
[:id ::sm/uuid]]) [:id ::sm/uuid]])

View File

@@ -271,7 +271,7 @@
[:map {:title "create-file-object-thumbnail"} [:map {:title "create-file-object-thumbnail"}
[:file-id ::sm/uuid] [:file-id ::sm/uuid]
[:object-id [:string {:max 250}]] [:object-id [:string {:max 250}]]
[:media ::media/upload] [:media media/schema:upload]
[:tag {:optional true} [:string {:max 50}]]]) [:tag {:optional true} [:string {:max 50}]]])
(sv/defmethod ::create-file-object-thumbnail (sv/defmethod ::create-file-object-thumbnail
@@ -381,7 +381,7 @@
[:map {:title "create-file-thumbnail"} [:map {:title "create-file-thumbnail"}
[:file-id ::sm/uuid] [:file-id ::sm/uuid]
[:revn ::sm/int] [:revn ::sm/int]
[:media ::media/upload]]) [:media media/schema:upload]])
(sv/defmethod ::create-file-thumbnail (sv/defmethod ::create-file-thumbnail
"Creates or updates the file thumbnail. Mainly used for paint the "Creates or updates the file thumbnail. Mainly used for paint the

View File

@@ -64,10 +64,10 @@
[:revn {:min 0} ::sm/int] [:revn {:min 0} ::sm/int]
[:vern {:min 0} ::sm/int] [:vern {:min 0} ::sm/int]
[:features {:optional true} ::cfeat/features] [:features {:optional true} ::cfeat/features]
[:changes {:optional true} [:vector ::cpc/change]] [:changes {:optional true} [:vector cpc/schema:change]]
[:changes-with-metadata {:optional true} [:changes-with-metadata {:optional true}
[:vector [:map [:vector [:map
[:changes [:vector ::cpc/change]] [:changes [:vector cpc/schema:change]]
[:hint-origin {:optional true} :keyword] [:hint-origin {:optional true} :keyword]
[:hint-events {:optional true} [:vector [:string {:max 250}]]]]]] [:hint-events {:optional true} [:vector [:string {:max 250}]]]]]]
[:skip-validate {:optional true} ::sm/boolean]]) [:skip-validate {:optional true} ::sm/boolean]])
@@ -76,7 +76,7 @@
schema:update-file-result schema:update-file-result
[:vector {:title "update-file-result"} [:vector {:title "update-file-result"}
[:map [:map
[:changes [:vector ::cpc/change]] [:changes [:vector cpc/schema:change]]
[:file-id ::sm/uuid] [:file-id ::sm/uuid]
[:id ::sm/uuid] [:id ::sm/uuid]
[:revn {:min 0} ::sm/int] [:revn {:min 0} ::sm/int]

View File

@@ -48,7 +48,7 @@
[:file-id ::sm/uuid] [:file-id ::sm/uuid]
[:is-local ::sm/boolean] [:is-local ::sm/boolean]
[:name [:string {:max 250}]] [:name [:string {:max 250}]]
[:content ::media/upload]]) [:content media/schema:upload]])
(sv/defmethod ::upload-file-media-object (sv/defmethod ::upload-file-media-object
{::doc/added "1.17" {::doc/added "1.17"

View File

@@ -253,7 +253,7 @@
(def ^:private (def ^:private
schema:update-profile-photo schema:update-profile-photo
[:map {:title "update-profile-photo"} [:map {:title "update-profile-photo"}
[:file ::media/upload]]) [:file media/schema:upload]])
(sv/defmethod ::update-profile-photo (sv/defmethod ::update-profile-photo
{:doc/added "1.1" {:doc/added "1.1"

View File

@@ -12,7 +12,7 @@
[app.common.features :as cfeat] [app.common.features :as cfeat]
[app.common.schema :as sm] [app.common.schema :as sm]
[app.common.time :as ct] [app.common.time :as ct]
[app.common.types.team :as tt] [app.common.types.team :as types.team]
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.config :as cf] [app.config :as cf]
[app.db :as db] [app.db :as db]
@@ -629,7 +629,7 @@
;; assign owner role to new profile ;; assign owner role to new profile
(db/update! conn :team-profile-rel (db/update! conn :team-profile-rel
(get tt/permissions-for-role :owner) (get types.team/permissions-for-role :owner)
{:team-id id :profile-id reassign-to})) {:team-id id :profile-id reassign-to}))
;; and finally, if all other conditions does not match and the ;; and finally, if all other conditions does not match and the
@@ -742,7 +742,7 @@
:team-id team-id :team-id team-id
:role role}) :role role})
(let [params (get tt/permissions-for-role role)] (let [params (get types.team/permissions-for-role role)]
;; Only allow single owner on team ;; Only allow single owner on team
(when (= role :owner) (when (= role :owner)
(db/update! conn :team-profile-rel (db/update! conn :team-profile-rel
@@ -760,7 +760,7 @@
[:map {:title "update-team-member-role"} [:map {:title "update-team-member-role"}
[:team-id ::sm/uuid] [:team-id ::sm/uuid]
[:member-id ::sm/uuid] [:member-id ::sm/uuid]
[:role ::tt/role]]) [:role types.team/schema:role]])
(sv/defmethod ::update-team-member-role (sv/defmethod ::update-team-member-role
{::doc/added "1.17" {::doc/added "1.17"
@@ -810,7 +810,7 @@
(def ^:private schema:update-team-photo (def ^:private schema:update-team-photo
[:map {:title "update-team-photo"} [:map {:title "update-team-photo"}
[:team-id ::sm/uuid] [:team-id ::sm/uuid]
[:file ::media/upload]]) [:file media/schema:upload]])
(sv/defmethod ::update-team-photo (sv/defmethod ::update-team-photo
{::doc/added "1.17" {::doc/added "1.17"

View File

@@ -75,7 +75,7 @@
[:map [:map
[:id ::sm/uuid] [:id ::sm/uuid]
[:fullname :string]]] [:fullname :string]]]
[:role ::types.team/role] [:role types.team/schema:role]
[:email ::sm/email]]) [:email ::sm/email]])
(def ^:private check-create-invitation-params (def ^:private check-create-invitation-params
@@ -257,7 +257,7 @@
(def ^:private schema:create-team-invitations (def ^:private schema:create-team-invitations
[:map {:title "create-team-invitations"} [:map {:title "create-team-invitations"}
[:team-id ::sm/uuid] [:team-id ::sm/uuid]
[:role ::types.team/role] [:role types.team/schema:role]
[:emails [::sm/set ::sm/email]]]) [:emails [::sm/set ::sm/email]]])
(def ^:private max-invitations-by-request-threshold (def ^:private max-invitations-by-request-threshold
@@ -318,7 +318,7 @@
[:features {:optional true} ::cfeat/features] [:features {:optional true} ::cfeat/features]
[:id {:optional true} ::sm/uuid] [:id {:optional true} ::sm/uuid]
[:emails [::sm/set ::sm/email]] [:emails [::sm/set ::sm/email]]
[:role ::types.team/role]]) [:role types.team/schema:role]])
(sv/defmethod ::create-team-with-invitations (sv/defmethod ::create-team-with-invitations
{::doc/added "1.17" {::doc/added "1.17"
@@ -403,7 +403,7 @@
[:map {:title "update-team-invitation-role"} [:map {:title "update-team-invitation-role"}
[:team-id ::sm/uuid] [:team-id ::sm/uuid]
[:email ::sm/email] [:email ::sm/email]
[:role ::types.team/role]]) [:role types.team/schema:role]])
(sv/defmethod ::update-team-invitation-role (sv/defmethod ::update-team-invitation-role
{::doc/added "1.17" {::doc/added "1.17"

View File

@@ -128,7 +128,7 @@
[:iss :keyword] [:iss :keyword]
[:exp ::ct/inst] [:exp ::ct/inst]
[:profile-id ::sm/uuid] [:profile-id ::sm/uuid]
[:role ::types.team/role] [:role types.team/schema:role]
[:team-id ::sm/uuid] [:team-id ::sm/uuid]
[:member-email ::sm/email] [:member-email ::sm/email]
[:member-id {:optional true} ::sm/uuid]]) [:member-id {:optional true} ::sm/uuid]])

View File

@@ -10,15 +10,14 @@
[app.common.exceptions :as ex] [app.common.exceptions :as ex]
[app.common.schema :as sm])) [app.common.schema :as sm]))
(sm/register! (def schema:permissions
^{::sm/type ::permissions} [:map {:title "Permissions"}
[:map {:title "Permissions"} [:type {:gen/elements [:membership :share-link]} :keyword]
[:type {:gen/elements [:membership :share-link]} :keyword] [:is-owner ::sm/boolean]
[:is-owner ::sm/boolean] [:is-admin ::sm/boolean]
[:is-admin ::sm/boolean] [:can-edit ::sm/boolean]
[:can-edit ::sm/boolean] [:can-read ::sm/boolean]
[:can-read ::sm/boolean] [:is-logged ::sm/boolean]])
[:is-logged ::sm/boolean]])
(def valid-roles (def valid-roles
#{:admin :owner :editor :viewer}) #{:admin :owner :editor :viewer})

View File

@@ -86,7 +86,7 @@
(t/deftest internal-encode-decode (t/deftest internal-encode-decode
(smt/check! (smt/check!
(smt/for [data (->> (cg/map cg/uuid (sg/generator ::cts/shape)) (smt/for [data (->> (cg/map cg/uuid (sg/generator cts/schema:shape))
(cg/not-empty))] (cg/not-empty))]
(let [obj1 (omap/wrap data) (let [obj1 (omap/wrap data)
obj2 (omap/create (deref obj1)) obj2 (omap/create (deref obj1))
@@ -103,7 +103,7 @@
(t/deftest fressian-encode-decode (t/deftest fressian-encode-decode
(smt/check! (smt/check!
(smt/for [data (->> (cg/map cg/uuid (sg/generator ::cts/shape)) (smt/for [data (->> (cg/map cg/uuid (sg/generator cts/schema:shape))
(cg/not-empty) (cg/not-empty)
(cg/fmap omap/wrap) (cg/fmap omap/wrap)
(cg/fmap (fn [o] {:objects o})))] (cg/fmap (fn [o] {:objects o})))]
@@ -119,7 +119,7 @@
(t/deftest transit-encode-decode (t/deftest transit-encode-decode
(smt/check! (smt/check!
(smt/for [data (->> (cg/map cg/uuid (sg/generator ::cts/shape)) (smt/for [data (->> (cg/map cg/uuid (sg/generator cts/schema:shape))
(cg/not-empty) (cg/not-empty)
(cg/fmap omap/wrap) (cg/fmap omap/wrap)
(cg/fmap (fn [o] {:objects o})))] (cg/fmap (fn [o] {:objects o})))]

View File

@@ -112,7 +112,7 @@
[:type [:= :set-guide]] [:type [:= :set-guide]]
[:page-id ::sm/uuid] [:page-id ::sm/uuid]
[:id ::sm/uuid] [:id ::sm/uuid]
[:params [:maybe ::ctp/guide]]] [:params [:maybe ctp/schema:guide]]]
gen (->> (sg/generator schema) gen (->> (sg/generator schema)
(sg/fmap (fn [change] (sg/fmap (fn [change]
(if (some? (:params change)) (if (some? (:params change))
@@ -125,7 +125,7 @@
[:type [:= :set-flow]] [:type [:= :set-flow]]
[:page-id ::sm/uuid] [:page-id ::sm/uuid]
[:id ::sm/uuid] [:id ::sm/uuid]
[:params [:maybe ::ctp/flow]]] [:params [:maybe ctp/schema:flow]]]
gen (->> (sg/generator schema) gen (->> (sg/generator schema)
(sg/fmap (fn [change] (sg/fmap (fn [change]
@@ -329,7 +329,7 @@
[:shapes {:optional true} [:vector {:gen/max 3} ::sm/any]] [:shapes {:optional true} [:vector {:gen/max 3} ::sm/any]]
[:name {:optional true} :string] [:name {:optional true} :string]
[:variant-id {:optional true} ::sm/uuid] [:variant-id {:optional true} ::sm/uuid]
[:variant-properties {:optional true} [:vector ::ctv/variant-property]]]] [:variant-properties {:optional true} [:vector ctv/schema:variant-property]]]]
[:del-component [:del-component
[:map {:title "DelComponentChange"} [:map {:title "DelComponentChange"}
@@ -354,12 +354,12 @@
[:add-typography [:add-typography
[:map {:title "AddTypogrphyChange"} [:map {:title "AddTypogrphyChange"}
[:type [:= :add-typography]] [:type [:= :add-typography]]
[:typography ::ctt/typography]]] [:typography ctt/schema:typography]]]
[:mod-typography [:mod-typography
[:map {:title "ModTypogrphyChange"} [:map {:title "ModTypogrphyChange"}
[:type [:= :mod-typography]] [:type [:= :mod-typography]]
[:typography ::ctt/typography]]] [:typography ctt/schema:typography]]]
[:del-typography [:del-typography
[:map {:title "DelTypogrphyChange"} [:map {:title "DelTypogrphyChange"}
@@ -434,13 +434,10 @@
(def schema:changes (def schema:changes
[:sequential {:gen/max 5 :gen/min 1} schema:change]) [:sequential {:gen/max 5 :gen/min 1} schema:change])
(sm/register! ::change schema:change)
(sm/register! ::changes schema:changes)
(def valid-change? (def valid-change?
(sm/lazy-validator schema:change)) (sm/lazy-validator schema:change))
(def check-changes! (def check-changes
(sm/check-fn schema:changes)) (sm/check-fn schema:changes))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -525,7 +522,7 @@
;; When verify? false we spec the schema validation. Currently used ;; When verify? false we spec the schema validation. Currently used
;; to make just 1 validation even if the changes are applied twice ;; to make just 1 validation even if the changes are applied twice
(when verify? (when verify?
(check-changes! items)) (check-changes items))
(binding [*touched-changes* (volatile! #{}) (binding [*touched-changes* (volatile! #{})
cts/*wasm-sync* true] cts/*wasm-sync* true]

View File

@@ -24,7 +24,7 @@
[app.common.uuid :as uuid])) [app.common.uuid :as uuid]))
;; Auxiliary functions to help create a set of changes (undo + redo) ;; Auxiliary functions to help create a set of changes (undo + redo)
;; TODO: this is a duplicate schema
(def schema:changes (def schema:changes
(sm/register! (sm/register!
^{::sm/type ::changes} ^{::sm/type ::changes}
@@ -36,7 +36,7 @@
[:stack-undo? {:optional true} boolean?] [:stack-undo? {:optional true} boolean?]
[:undo-group {:optional true} ::sm/any]])) [:undo-group {:optional true} ::sm/any]]))
(def check-changes! (def check-changes
(sm/check-fn schema:changes)) (sm/check-fn schema:changes))
(defn empty-changes (defn empty-changes
@@ -168,9 +168,8 @@
(defn apply-changes-local (defn apply-changes-local
[changes & {:keys [apply-to-library?]}] [changes & {:keys [apply-to-library?]}]
(assert (assert (check-changes changes)
(check-changes! changes) "expected valid changes")
"expected valid changes")
(if-let [file-data (::file-data (meta changes))] (if-let [file-data (::file-data (meta changes))]
(let [library-data (::library-data (meta changes)) (let [library-data (::library-data (meta changes))

View File

@@ -141,7 +141,7 @@
[:path {:optional true} :string] [:path {:optional true} :string]
[:opacity {:optional true} [::sm/number {:min 0 :max 1}]] [:opacity {:optional true} [::sm/number {:min 0 :max 1}]]
[:modified-at {:optional true} ::ct/inst] [:modified-at {:optional true} ::ct/inst]
[:plugin-data {:optional true} ::ctpg/plugin-data]]) [:plugin-data {:optional true} ctpg/schema:plugin-data]])
(def schema:library-color (def schema:library-color
"Used for in-transit representation of a color (per example when user "Used for in-transit representation of a color (per example when user

View File

@@ -19,19 +19,17 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def schema:component (def schema:component
(sm/register! [:merge
^{::sm/type ::component} [:map
[:merge [:id ::sm/uuid]
[:map [:name :string]
[:id ::sm/uuid] [:path {:optional true} [:maybe :string]]
[:name :string] [:modified-at {:optional true} ::ct/inst]
[:path {:optional true} [:maybe :string]] [:objects {:gen/max 10 :optional true} ctp/schema:objects]
[:modified-at {:optional true} ::ct/inst] [:main-instance-id ::sm/uuid]
[:objects {:gen/max 10 :optional true} ctp/schema:objects] [:main-instance-page ::sm/uuid]
[:main-instance-id ::sm/uuid] [:plugin-data {:optional true} ctpg/schema:plugin-data]]
[:main-instance-page ::sm/uuid] ctv/schema:variant-component])
[:plugin-data {:optional true} ctpg/schema:plugin-data]]
ctv/schema:variant-component]))
(def check-component (def check-component
(sm/check-fn schema:component)) (sm/check-fn schema:component))

View File

@@ -110,7 +110,6 @@
(sm/register! ::data schema:data) (sm/register! ::data schema:data)
(sm/register! ::file schema:file) (sm/register! ::file schema:file)
(sm/register! ::media schema:media)
(sm/register! ::colors schema:colors) (sm/register! ::colors schema:colors)
(sm/register! ::typographies schema:typographies) (sm/register! ::typographies schema:typographies)

View File

@@ -56,14 +56,9 @@
(def schema:default-grids (def schema:default-grids
[:map {:title "PageGrid"} [:map {:title "PageGrid"}
[:square {:optional true} ::square-params] [:square {:optional true} schema:square-params]
[:row {:optional true} ::column-params] [:row {:optional true} schema:column-params]
[:column {:optional true} ::column-params]]) [:column {:optional true} schema:column-params]])
(sm/register! ::square-params schema:square-params)
(sm/register! ::column-params schema:column-params)
(sm/register! ::grid schema:grid)
(sm/register! ::default-grids schema:default-grids)
(def ^:private default-square-params (def ^:private default-square-params
{:size 16 {:size 16

View File

@@ -40,7 +40,7 @@
[:map-of {:gen/max 2} ::sm/uuid schema:guide]) [:map-of {:gen/max 2} ::sm/uuid schema:guide])
(def schema:objects (def schema:objects
[:map-of {:gen/max 5} ::sm/uuid ::cts/shape]) [:map-of {:gen/max 5} ::sm/uuid cts/schema:shape])
(def schema:comment-thread-position (def schema:comment-thread-position
[:map {:title "CommentThreadPosition"} [:map {:title "CommentThreadPosition"}
@@ -62,11 +62,6 @@
[:comment-thread-positions {:optional true} [:comment-thread-positions {:optional true}
[:map-of ::sm/uuid schema:comment-thread-position]]]) [:map-of ::sm/uuid schema:comment-thread-position]]])
(sm/register! ::objects schema:objects)
(sm/register! ::page schema:page)
(sm/register! ::guide schema:guide)
(sm/register! ::flow schema:flow)
(def valid-guide? (def valid-guide?
(sm/lazy-validator schema:guide)) (sm/lazy-validator schema:guide))

View File

@@ -6,7 +6,6 @@
(ns app.common.types.plugins (ns app.common.types.plugins
(:require (:require
[app.common.schema :as sm]
[app.common.schema.generators :as sg])) [app.common.schema.generators :as sg]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -22,13 +21,11 @@
:keyword]) :keyword])
(def schema:plugin-data (def schema:plugin-data
(sm/register! [:map-of {:gen/max 5 :title "PluginsData"}
^{::sm/type ::plugin-data} schema:keyword
[:map-of {:gen/max 5 :title "PluginsData"} [:map-of {:gen/max 5}
schema:keyword schema:string
[:map-of {:gen/max 5} schema:string]])
schema:string
schema:string]]))
(def ^:private schema:registry-entry (def ^:private schema:registry-entry
[:map [:map
@@ -47,6 +44,3 @@
[:map-of {:gen/max 5} [:map-of {:gen/max 5}
:string :string
schema:registry-entry]]]) schema:registry-entry]]])
(sm/register! ::plugin-registry schema:plugin-registry)
(sm/register! ::registry-entry schema:registry-entry)

View File

@@ -119,8 +119,6 @@
(def schema:points (def schema:points
[:vector {:gen/max 4 :gen/min 4} ::gpt/point]) [:vector {:gen/max 4 :gen/min 4} ::gpt/point])
;; FIXME: the register is necessary until this is moved to a separated
;; ns because it is used on shapes.text
(def valid-stroke-attrs (def valid-stroke-attrs
"A set used for proper check if color should contain only one of the "A set used for proper check if color should contain only one of the
attrs listed in this set." attrs listed in this set."
@@ -156,10 +154,8 @@
(sm/keys schema:stroke-attrs)) (sm/keys schema:stroke-attrs))
(def schema:stroke (def schema:stroke
(sm/register! [:and schema:stroke-attrs
^{::sm/type ::stroke} [:fn has-valid-stroke-attrs?]])
[:and schema:stroke-attrs
[:fn has-valid-stroke-attrs?]]))
(def check-stroke (def check-stroke
(sm/check-fn schema:stroke)) (sm/check-fn schema:stroke))
@@ -213,22 +209,22 @@
[:r4 {:optional true} ::sm/safe-number] [:r4 {:optional true} ::sm/safe-number]
[:opacity {:optional true} ::sm/safe-number] [:opacity {:optional true} ::sm/safe-number]
[:grids {:optional true} [:grids {:optional true}
[:vector {:gen/max 2} ::ctg/grid]] [:vector {:gen/max 2} ctg/schema:grid]]
[:exports {:optional true} [:exports {:optional true}
[:vector {:gen/max 2} ::ctse/export]] [:vector {:gen/max 2} ctse/schema:export]]
[:strokes {:optional true} [:strokes {:optional true}
[:vector {:gen/max 2} schema:stroke]] [:vector {:gen/max 2} schema:stroke]]
[:blend-mode {:optional true} [:blend-mode {:optional true}
[::sm/one-of blend-modes]] [::sm/one-of blend-modes]]
[:interactions {:optional true} [:interactions {:optional true}
[:vector {:gen/max 2} ::ctsi/interaction]] [:vector {:gen/max 2} ctsi/schema:interaction]]
[:shadow {:optional true} [:shadow {:optional true}
[:vector {:gen/max 1} ctss/schema:shadow]] [:vector {:gen/max 1} ctss/schema:shadow]]
[:blur {:optional true} ::ctsb/blur] [:blur {:optional true} ctsb/schema:blur]
[:grow-type {:optional true} [:grow-type {:optional true}
[::sm/one-of grow-types]] [::sm/one-of grow-types]]
[:applied-tokens {:optional true} cto/schema:applied-tokens] [:applied-tokens {:optional true} cto/schema:applied-tokens]
[:plugin-data {:optional true} ::ctpg/plugin-data]]) [:plugin-data {:optional true} ctpg/schema:plugin-data]])
(def schema:group-attrs (def schema:group-attrs
[:map {:title "GroupAttrs"} [:map {:title "GroupAttrs"}
@@ -274,7 +270,8 @@
(def ^:private schema:text-attrs (def ^:private schema:text-attrs
[:map {:title "TextAttrs"} [:map {:title "TextAttrs"}
[:content {:optional true} [:maybe ::ctsx/content]]]) [:position-data {:optional true} [:maybe ctsx/schema:position-data]]
[:content {:optional true} [:maybe ctsx/schema:content]]])
(defn- decode-shape (defn- decode-shape
[o] [o]
@@ -326,8 +323,8 @@
schema:shape-generic-attrs schema:shape-generic-attrs
schema:shape-geom-attrs schema:shape-geom-attrs
schema:shape-base-attrs schema:shape-base-attrs
::ctv/variant-shape ctv/schema:variant-shape
::ctv/variant-container]] ctv/schema:variant-container]]
[:bool [:bool
[:merge {:title "BoolShape"} [:merge {:title "BoolShape"}
@@ -384,13 +381,11 @@
schema:shape-base-attrs]]]) schema:shape-base-attrs]]])
(def schema:shape (def schema:shape
(sm/register! [:and {:title "Shape"
^{::sm/type ::shape} :gen/gen (shape-generator)
[:and {:title "Shape" :decode/json {:leave decode-shape}}
:gen/gen (shape-generator) [:fn shape?]
:decode/json {:leave decode-shape}} schema:shape-attrs])
[:fn shape?]
schema:shape-attrs]))
(def check-shape-generic-attrs (def check-shape-generic-attrs
(sm/check-fn schema:shape-generic-attrs)) (sm/check-fn schema:shape-generic-attrs))

View File

@@ -6,30 +6,11 @@
(ns app.common.types.shape.blur (ns app.common.types.shape.blur
(:require (:require
[app.common.schema :as sm] [app.common.schema :as sm]))
[app.common.spec :as us]
[clojure.spec.alpha :as s]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (def schema:blur
;; SPEC [:map {:title "Blur"}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [:id ::sm/uuid]
[:type [:= :layer-blur]]
(s/def ::id uuid?) [:value ::sm/safe-number]
(s/def ::type #{:layer-blur}) [:hidden :boolean]])
(s/def ::value ::us/safe-number)
(s/def ::hidden boolean?)
(s/def ::blur
(s/keys :req-un [::id ::type ::value ::hidden]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SCHEMA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(sm/register!
^{::sm/type ::blur}
[:map {:title "Blur"}
[:id ::sm/uuid]
[:type [:= :layer-blur]]
[:value ::sm/safe-number]
[:hidden :boolean]])

View File

@@ -15,5 +15,3 @@
[:type [::sm/one-of types]] [:type [::sm/one-of types]]
[:scale ::sm/safe-number] [:scale ::sm/safe-number]
[:suffix :string]]) [:suffix :string]])
(sm/register! ::export schema:export)

View File

@@ -192,8 +192,6 @@
[:prev-screen schema:prev-scren-interaction] [:prev-screen schema:prev-scren-interaction]
[:open-url schema:open-url-interaction]]]]) [:open-url schema:open-url-interaction]]]])
(sm/register! ::interaction schema:interaction)
(def check-interaction (def check-interaction
(sm/check-fn schema:interaction)) (sm/check-fn schema:interaction))

View File

@@ -7,9 +7,7 @@
(ns app.common.types.shape.text (ns app.common.types.shape.text
(:require (:require
[app.common.schema :as sm] [app.common.schema :as sm]
[app.common.types.fills :refer [schema:fill]] [app.common.types.fills :refer [schema:fill]]))
[app.common.types.shape :as-alias shape]
[app.common.types.shape.text.position-data :as-alias position-data]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SCHEMA ;; SCHEMA
@@ -63,26 +61,22 @@
[:typography-ref-id {:optional true} [:maybe ::sm/uuid]] [:typography-ref-id {:optional true} [:maybe ::sm/uuid]]
[:typography-ref-file {:optional true} [:maybe ::sm/uuid]]]]]]]]]]]]]) [:typography-ref-file {:optional true} [:maybe ::sm/uuid]]]]]]]]]]]]])
(sm/register! ::content schema:content)
(def valid-content? (def valid-content?
(sm/lazy-validator schema:content)) (sm/lazy-validator schema:content))
(sm/register! (def schema:position-data
^{::sm/type ::position-data} [:vector {:min 1 :gen/max 2}
[:vector {:min 1 :gen/max 2} [:map
[:map [:x ::sm/safe-number]
[:x ::sm/safe-number] [:y ::sm/safe-number]
[:y ::sm/safe-number] [:width ::sm/safe-number]
[:width ::sm/safe-number] [:height ::sm/safe-number]
[:height ::sm/safe-number] [:fills [:vector {:gen/max 2} schema:fill]]
[:fills [:vector {:gen/max 2} schema:fill]] [:font-family {:optional true} :string]
[:font-family {:optional true} :string] [:font-size {:optional true} :string]
[:font-size {:optional true} :string] [:font-style {:optional true} :string]
[:font-style {:optional true} :string] [:font-weight {:optional true} :string]
[:font-weight {:optional true} :string] [:rtl {:optional true} :boolean]
[:rtl {:optional true} :boolean] [:text {:optional true} :string]
[:text {:optional true} :string] [:text-decoration {:optional true} :string]
[:text-decoration {:optional true} :string] [:text-transform {:optional true} :string]]])
[:text-transform {:optional true} :string]]])

View File

@@ -17,4 +17,5 @@
:admin {:can-edit true :is-admin true :is-owner false} :admin {:can-edit true :is-admin true :is-owner false}
:owner {:can-edit true :is-admin true :is-owner true}}) :owner {:can-edit true :is-admin true :is-owner true}})
(sm/register! ::role [::sm/one-of valid-roles]) (def schema:role
[::sm/one-of {:title "TeamRole"} valid-roles])

View File

@@ -1374,7 +1374,7 @@ Will return a value that matches this schema:
(or tokens-lib (make-tokens-lib))) (or tokens-lib (make-tokens-lib)))
(def schema:tokens-lib (def schema:tokens-lib
(sm/register! (sm/type-schema
{:type ::tokens-lib {:type ::tokens-lib
:pred valid-tokens-lib? :pred valid-tokens-lib?
:type-properties :type-properties

View File

@@ -18,26 +18,24 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def schema:typography (def schema:typography
(sm/register! [:map {:title "Typography"}
^{::sm/type ::typography} [:id ::sm/uuid]
[:map {:title "Typography"} [:name :string]
[:id ::sm/uuid] [:font-id :string]
[:name :string] [:font-family :string]
[:font-id :string] [:font-variant-id :string]
[:font-family :string] [:font-size :string]
[:font-variant-id :string] [:font-weight :string]
[:font-size :string] [:font-style :string]
[:font-weight :string] [:line-height :string]
[:font-style :string] [:letter-spacing :string]
[:line-height :string] [:text-transform :string]
[:letter-spacing :string] [:modified-at {:optional true} ::ct/inst]
[:text-transform :string] [:path {:optional true} [:maybe :string]]
[:modified-at {:optional true} ::ct/inst] [:plugin-data {:optional true} ctpg/schema:plugin-data]])
[:path {:optional true} [:maybe :string]]
[:plugin-data {:optional true} ::ctpg/plugin-data]]))
(def check-typography (def check-typography
(sm/check-fn ::typography)) (sm/check-fn schema:typography))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HELPERS ;; HELPERS

View File

@@ -22,34 +22,27 @@
[:value :string]]) [:value :string]])
(def schema:variant-component (def schema:variant-component
;; A component that is part of a variant set. "A component that is part of a variant set"
(sm/register! [:map
^{::sm/type ::variant-component} [:variant-id {:optional true} ::sm/uuid]
[:map [:variant-properties {:optional true} [:vector schema:variant-property]]])
[:variant-id {:optional true} ::sm/uuid]
[:variant-properties {:optional true} [:vector schema:variant-property]]]))
(def schema:variant-shape (def schema:variant-shape
;; The root shape of the main instance of a variant component. "The root shape of the main instance of a variant component"
[:map [:map
[:variant-id {:optional true} ::sm/uuid] [:variant-id {:optional true} ::sm/uuid]
[:variant-name {:optional true} :string] [:variant-name {:optional true} :string]
[:variant-error {:optional true} :string]]) [:variant-error {:optional true} :string]])
(def schema:variant-container (def schema:variant-container
;; is a board that contains all variant components of a variant set, "Is a board that contains all variant components of a variant set,
;; for grouping them visually in the workspace. for grouping them visually in the workspace"
[:map [:map
[:is-variant-container {:optional true} :boolean]]) [:is-variant-container {:optional true} :boolean]])
(sm/register! ::variant-property schema:variant-property)
(sm/register! ::variant-shape schema:variant-shape)
(sm/register! ::variant-container schema:variant-container)
(def valid-variant-component? (def valid-variant-component?
(sm/check-fn schema:variant-component)) (sm/check-fn schema:variant-component))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def property-prefix "Property ") (def property-prefix "Property ")

View File

@@ -14,7 +14,7 @@
[app.common.types.color :refer [schema:color schema:gradient]] [app.common.types.color :refer [schema:color schema:gradient]]
[app.common.types.path :as path] [app.common.types.path :as path]
[app.common.types.plugins :refer [schema:plugin-data]] [app.common.types.plugins :refer [schema:plugin-data]]
[app.common.types.shape :as tsh] [app.common.types.shape :as tsh :refer [schema:shape]]
[app.common.types.shape.interactions :refer [schema:animation schema:interaction]] [app.common.types.shape.interactions :refer [schema:animation schema:interaction]]
[app.common.types.shape.shadow :refer [schema:shadow]] [app.common.types.shape.shadow :refer [schema:shadow]]
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
@@ -135,10 +135,10 @@
{:num 500}))) {:num 500})))
(t/deftest shape-json-roundtrip (t/deftest shape-json-roundtrip
(let [encode (sm/encoder ::tsh/shape (sm/json-transformer)) (let [encode (sm/encoder schema:shape (sm/json-transformer))
decode (sm/decoder ::tsh/shape (sm/json-transformer))] decode (sm/decoder schema:shape (sm/json-transformer))]
(smt/check! (smt/check!
(smt/for [shape (sg/generator ::tsh/shape)] (smt/for [shape (sg/generator schema:shape)]
(let [shape-1 (encode shape) (let [shape-1 (encode shape)
shape-2 (json-roundtrip shape-1) shape-2 (json-roundtrip shape-1)
shape-3 (decode shape-2)] shape-3 (decode shape-2)]

View File

@@ -7,7 +7,6 @@
(ns app.main.data.changes (ns app.main.data.changes
(:require (:require
[app.common.data :as d] [app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.files.changes :as cpc] [app.common.files.changes :as cpc]
[app.common.logging :as log] [app.common.logging :as log]
[app.common.time :as ct] [app.common.time :as ct]
@@ -106,13 +105,11 @@
[{:keys [commit-id redo-changes undo-changes origin save-undo? features [{:keys [commit-id redo-changes undo-changes origin save-undo? features
file-id file-revn file-vern undo-group tags stack-undo? source]}] file-id file-revn file-vern undo-group tags stack-undo? source]}]
(dm/assert! (assert (cpc/check-changes redo-changes)
"expect valid vector of changes for redo-changes" "expect valid vector of changes for redo-changes")
(cpc/check-changes! redo-changes))
(dm/assert! (assert (cpc/check-changes undo-changes)
"expect valid vector of changes for undo-changes" "expect valid vector of changes for undo-changes")
(cpc/check-changes! undo-changes))
(let [commit-id (or commit-id (uuid/next)) (let [commit-id (or commit-id (uuid/next))
source (d/nilv source :local) source (d/nilv source :local)

View File

@@ -760,13 +760,11 @@
(defn ext-library-changed (defn ext-library-changed
[library-id modified-at revn changes] [library-id modified-at revn changes]
(dm/assert! (assert (uuid? library-id)
"expected valid uuid for library-id" "expected valid uuid for library-id")
(uuid? library-id))
(dm/assert! (assert (ch/check-changes changes)
"expected valid changes vector" "expected valid changes vector")
(ch/check-changes! changes))
(ptk/reify ::ext-library-changed (ptk/reify ::ext-library-changed
ptk/UpdateEvent ptk/UpdateEvent

View File

@@ -236,7 +236,7 @@
[:session-id ::sm/uuid] [:session-id ::sm/uuid]
[:revn :int] [:revn :int]
[:vern :int] [:vern :int]
[:changes ::cpc/changes]]) [:changes cpc/schema:changes]])
(def ^:private check-file-change-params! (def ^:private check-file-change-params!
(sm/check-fn schema:handle-file-change)) (sm/check-fn schema:handle-file-change))
@@ -279,9 +279,8 @@
(defn handle-file-restore (defn handle-file-restore
[{:keys [file-id vern] :as msg}] [{:keys [file-id vern] :as msg}]
(dm/assert! (assert (check-file-restore-params msg)
"expected valid parameters" "expected valid parameters")
(check-file-restore-params msg))
(ptk/reify ::handle-file-restore (ptk/reify ::handle-file-restore
ptk/WatchEvent ptk/WatchEvent
@@ -302,16 +301,15 @@
[:session-id ::sm/uuid] [:session-id ::sm/uuid]
[:revn :int] [:revn :int]
[:modified-at ::ct/inst] [:modified-at ::ct/inst]
[:changes ::cpc/changes]]) [:changes cpc/schema:changes]])
(def ^:private check-library-change-params! (def ^:private check-library-change-params
(sm/check-fn schema:handle-library-change)) (sm/check-fn schema:handle-library-change))
(defn handle-library-change (defn handle-library-change
[{:keys [file-id modified-at changes revn] :as msg}] [{:keys [file-id modified-at changes revn] :as msg}]
(dm/assert! (assert (check-library-change-params msg)
"expected valid arguments" "expected valid arguments")
(check-library-change-params! msg))
(ptk/reify ::handle-library-change (ptk/reify ::handle-library-change
ptk/WatchEvent ptk/WatchEvent

View File

@@ -57,8 +57,8 @@
(def ^:private (def ^:private
schema:undo-entry schema:undo-entry
[:map {:title "undo-entry"} [:map {:title "undo-entry"}
[:undo-changes [:vector ::cpc/change]] [:undo-changes [:vector cpc/schema:change]]
[:redo-changes [:vector ::cpc/change]] [:redo-changes [:vector cpc/schema:change]]
[:undo-group ::sm/uuid] [:undo-group ::sm/uuid]
[:tags [:set :keyword]]]) [:tags [:set :keyword]]])

View File

@@ -119,7 +119,7 @@
(-> (u/proxy->interaction self) (-> (u/proxy->interaction self)
(d/patch-object params))] (d/patch-object params))]
(cond (cond
(not (sm/validate ::ctsi/interaction interaction)) (not (sm/validate ctsi/schema:interaction interaction))
(u/display-not-valid :action interaction) (u/display-not-valid :action interaction)
:else :else
@@ -453,7 +453,7 @@
(let [id (obj/get self "$id") (let [id (obj/get self "$id")
value (blur-defaults (parser/parse-blur value))] value (blur-defaults (parser/parse-blur value))]
(cond (cond
(not (sm/validate ::ctsb/blur value)) (not (sm/validate ctsb/schema:blur value))
(u/display-not-valid :blur value) (u/display-not-valid :blur value)
(not (r/check-permission plugin-id "content:write")) (not (r/check-permission plugin-id "content:write"))
@@ -470,7 +470,7 @@
(let [id (obj/get self "$id") (let [id (obj/get self "$id")
value (parser/parse-exports value)] value (parser/parse-exports value)]
(cond (cond
(not (sm/validate [:vector ::ctse/export] value)) (not (sm/validate [:vector ctse/schema:export] value))
(u/display-not-valid :exports value) (u/display-not-valid :exports value)
(not (r/check-permission plugin-id "content:write")) (not (r/check-permission plugin-id "content:write"))
@@ -1129,7 +1129,7 @@
(fn [value] (fn [value]
(let [value (parser/parse-export value)] (let [value (parser/parse-export value)]
(cond (cond
(not (sm/validate ::ctse/export value)) (not (sm/validate ctse/schema:export value))
(u/display-not-valid :export value) (u/display-not-valid :export value)
:else :else
@@ -1161,7 +1161,7 @@
(-> ctsi/default-interaction (-> ctsi/default-interaction
(d/patch-object (parser/parse-interaction trigger action delay)))] (d/patch-object (parser/parse-interaction trigger action delay)))]
(cond (cond
(not (sm/validate ::ctsi/interaction interaction)) (not (sm/validate ctsi/schema:interaction interaction))
(u/display-not-valid :addInteraction interaction) (u/display-not-valid :addInteraction interaction)
:else :else

View File

@@ -54,7 +54,7 @@
(sm/encoder types.tokens-lib/schema:tokens-lib sm/json-transformer)) (sm/encoder types.tokens-lib/schema:tokens-lib sm/json-transformer))
(def encode-plugin-data (def encode-plugin-data
(sm/encoder ::ctpg/plugin-data sm/json-transformer)) (sm/encoder ctpg/schema:plugin-data sm/json-transformer))
(def ^:private valid-buckets (def ^:private valid-buckets
#{"file-media-object" #{"file-media-object"