Fork me on GitHub
#datascript
<
2016-10-05
>
odinodin11:10:45

Anyone used spec with DataScript? Need tips on how to deal with the fact that entities are not maps, and specifically how to get the same functionality as clojure.spec/keys but for Datascript entities

misha15:10:46

@tonsky is there a reason you disallow any datomic's :db.types other than :db.type/ref? introduces extra schema transformation step, and reduces automatic data validation capabilities, e.g. if I know attribute is :db.type/double, I can enforce it to be number in cljs by just looking inside datascript db, w/o having to keep original datomic schema around

Niki15:10:59

@odinodin does spec care if entities are real maps or not?

misha15:10:05

This is counter-intuitive (why else would I specify data type if it isn’t validated later?)
sort of makes sense. on the other hand - the only schema-related validation is about isComponent=true without db.valueType=ref, which makes this question pretty much open

Niki15:10:53

it’s not about schema validation, but about values validation

misha15:10:12

now ds schema validation is neither strict, nor completely open

misha15:10:00

do you do any values validation? I am looking at (and talking about) this: https://github.com/tonsky/datascript/blob/master/src/datascript/db.cljc#L538-L559

Niki15:10:33

what about that piece of code?

misha15:10:49

it's neither too strict, nor too open, which raises all those if I can use :db/fulltext=true, why not :db.valueType=long? questions

Niki15:10:26

I can make it more strict if you want to

misha15:10:21

actually, list of every meaningful-to-datascript datomic schema attributes would be helpful. https://github.com/tonsky/datascript#differences-from-datomic readme is not very straightforward or complete about "which datomic attributes actually have any effect (or required) in ds"

Niki16:10:30

yep, PR welcome

Niki16:10:03

DS has a lot of docs missing

misha16:10:14

next topic: any plans on supporting :db/idents the way datomic does? w/o "tips&tricks" workaround

Niki16:10:37

no plans