Closed milt closed 7 years ago
Thank you for this very high quality bug report!
You're welcome, but be careful what you wish for... Our team is an endless source of datomic edge cases. ;)
The fix for this issue created a new problem. Prior to commit 831336998, a query using pull with a relation binding (see below) returned a list of maps. After that commit, it returns a list of list of maps.
Example:
{:get #vase/query
{:name :control-server.v1/controls-state
:query [:find [(pull ?control [*
{:control/desired-state [:db/ident]}
{:control/actual-state [:db/ident]}]) ...]
:in $
:where [?control :control/name]]}}
Description
When I use the #vase/query literal to perform a query without any trailing interceptors, queries with a non sequential find-spec (like a single scalar value or a pulled map) generate an error. Queries with nil results also generate a spec error, but don't throw.
Expected Behavior
When I write a query like so:
I should get a result that is just the user's eid.
Actual Behavior
If the user exists, It throws:
If the user doesn't exist, I get:
Steps to reproduce
/user/:id
GET route query to return a scalar result (add.
)/user/:id
(5). Query/user/:id
for a user that doesn't exist (to see the spec error)I made an example repo with the template + modifications here
Environment
Operating System (including version).
Mac OS X 10.12.3
Your current Leiningen/Boot/Maven version (
lein --version
)Leiningen 2.7.1 on Java 1.8.0_111 Java HotSpot(TM) 64-Bit Server VM
Pedestal and Vase version
0.5.2/0.9.0