0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-18 21:06:11 -05:00

Add validation for shapes.

This commit is contained in:
Andrey Antukh 2015-12-29 23:40:01 +02:00
parent 3fcd21635e
commit e07ada5ad4
2 changed files with 4 additions and 4 deletions

View file

@ -91,11 +91,10 @@
(-apply-update [_ state] (-apply-update [_ state]
(assoc-in state [:workspace :selected] #{})))) (assoc-in state [:workspace :selected] #{}))))
;; TODO: validate shape
(defn add-shape (defn add-shape
"Mark a shape selected for drawing in the canvas." "Mark a shape selected for drawing in the canvas."
[shape props] [shape props]
(sc/validate! +shape-schema+ shape)
(sc/validate! +shape-props-schema+ props) (sc/validate! +shape-props-schema+ props)
(reify (reify
rs/UpdateEvent rs/UpdateEvent

View file

@ -1,7 +1,8 @@
(ns uxbox.schema (ns uxbox.schema
(:refer-clojure :exclude [keyword uuid]) (:refer-clojure :exclude [keyword uuid vector])
(:require [bouncer.core :as b] (:require [bouncer.core :as b]
[bouncer.validators :as v])) [bouncer.validators :as v]
[uxbox.shapes :refer (shape?)]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Validators ;; Validators