This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-02
Channels
- # announcements (1)
- # babashka (19)
- # beginners (85)
- # calva (1)
- # cider (23)
- # clara (19)
- # clj-kondo (28)
- # clojars (4)
- # clojure (60)
- # clojure-australia (8)
- # clojure-dev (14)
- # clojure-europe (117)
- # clojure-nl (3)
- # clojure-uk (11)
- # clojurescript (68)
- # conjure (2)
- # core-async (39)
- # cryogen (11)
- # cursive (7)
- # data-science (1)
- # datomic (9)
- # emacs (10)
- # etaoin (1)
- # events (1)
- # fulcro (1)
- # helix (10)
- # jobs (4)
- # kaocha (2)
- # keechma (3)
- # leiningen (1)
- # malli (6)
- # pathom (15)
- # pedestal (10)
- # re-frame (5)
- # reitit (1)
- # remote-jobs (1)
- # rum (3)
- # shadow-cljs (18)
- # tools-deps (30)
- # vim (6)
Hello, I'm discovering Datomic entity specs. I tried to trigger an spec error and here is the message:
"Entity temp-id missing attributes clojure.lang.LazySeq@e65620e6 of spec :admin/validate"
The doc example gives:
"Entity 42 missing attributes [:user/email] of by :user/validate"}
Clearly, the serialization of the missing attribute seems to go wrong.
I'm using the latest version of Datomic (`1.0.6202` ).
Is it a known problem?Here is the spec:
{:db/ident :admin/validate
:db.entity/attrs [:admin/email :admin/hashed_password]}
and here are the attribute declarations:
{:db/ident :admin/email
:db/valueType :db.type/string
:db/unique :db.unique/identity
:db/cardinality :db.cardinality/one
:db.attr/preds myproject.entities.entity/email?}
{:db/ident :admin/hashed_password
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
The only "particular" thing that I see is that the email field has an attibute predicate.
ThanksHey @U94V75LDV I've made a ticket to look at this more closely. I'll keep you updated on what I find could you DM me an e-mail so I can contact you in the event that this slack convo gets archived while I am poking around?
i’ve bumped into this as well, and i’m curious if Jaret ever found a reason for the LazySeq?
(def page-schema [{:db/ident :page/id
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity}
{:db/ident :page/url
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :page/fetched
:db/valueType :db.type/instant
:db/cardinality :db.cardinality/one}
;;
{:db/ident :page/validate
:db.entity/attrs [:page/id :page/url :page/fetched]}
])
(d/transact conn {:tx-data [{:db/id "p1"
#_#_:page/id "p1"
:page/url ""
:page/fetched (java.util.Date.)
:db/ensure :page/validate}
]})
Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
Entity p1 missing attributes clojure.lang.LazySeq@3ca6a52d of spec :page/validate
Oh man what a blast from the past! Let me see if I can find the ticket and figure out what we figured out here
Also I noted those points that seem weird:
1 - The documentation says: :db/ensure
is a virtual attribute. It is not added in the database; instead it triggers checkes based on the named entity. When I then pull all the attributes of the entity, the :db/ensure
field appears.
{:db/id 17592186045425,
:db/ensure [#:db{:id 17592186045420}],
:user/hashed-password "...",
...}
I then don't get what is a "virtual attribute" then.
2 - After transacting successfully an entity with its spec "activated", I could then retract a field without triggering the entity spec:
(datomic.api/transact
conn*
[[:db/retract 17592186045425 :user/hashed_password]])
The resulting entity viiolates the spec but nothing was triggered. Is it the desired behaviour of entity specs?
Thanks