Skip to content

Commit

Permalink
fix: relax value type check
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Mar 25, 2024
1 parent b500041 commit dacbd71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/datascript/db.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@
:key :db/isComponent})))

(validate-schema-key a :db/unique (:db/unique kv) #{:db.unique/value :db.unique/identity})
(validate-schema-key a :db/valueType (:db/valueType kv) #{:db.type/ref :db.type/tuple})
(validate-schema-key a :db/valueType (:db/valueType kv) ds/type?)
(validate-schema-key a :db/cardinality (:db/cardinality kv) #{:db.cardinality/one :db.cardinality/many})

;; tuple should have tupleAttrs
Expand Down
9 changes: 9 additions & 0 deletions src/datascript/schema.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@

(defn schema-entity? [entity]
(some #(contains? entity %) schema-keys))

(def type?
#{:db.type/number
:db.type/instant
:db.type/keyword
:db.type/ref
:db.type/string
:db.type/uuid
:db.type/tuple})

0 comments on commit dacbd71

Please sign in to comment.