{:user [[1 {:spec-gen {:username "barb"}}]]
:post [[1 {:spec-gen {:content "so good to be barb"}}]]}
You can also specify that you don't want an ent to reference one of the ents defined in its schema. For example, if a :todo-list's :owner-id is optional and you don't want it to be present, you could do this:
::sm/omit prevents the referenced ent from even being created in the ent db. It's as if the :owner-id relation didn't exist in the schema. spec generation respects this and omits :owner-id from the map it generates. If you want the key :owner-id to be present with the value nil, you'd have to specify that like this:
We're using the same specs and schema as in . Things get interesting at line 34, where we have this query:
In the we saw that query terms could take an optional map. Here, the optional maps are {:spec-gen {:username "barb"}} and {:spec-gen {:content "so good to be barb"}} . When you include :spec-gen key, the associated map is merged into whatever value is generated by clojure.spec.