lambdaisland / lambdaisland/harvest
Shorthand opts not used during factory generation
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 14
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
The README indicates that the three variants used below are all equivalent, but the third (shorthand) version appears not to work:
(ns example1
[lambdaisland.harvest :as h])
(h/defactory user
{:user/name "Lilliam Predovic"})
[(h/build-val user {:with {:user/name "jill"}})
(h/build-val (user :with {:user/name "jill"}))
(h/build-val (user {:user/name "jill"}))]
;; => [#:user{:name "jill"}
;; #:user{:name "jill"}
;; #:user{:name "Lilliam Predovic"}]
The same issue occurs (perhaps unsurprisingly) when the call is inlined into another factory:
(ns example2
[lambdaisland.harvest :as h])
(h/defactory user
{:user/name "Lilliam Predovic"})
(h/defactory article
{:article/submitter (user {:user/name "jill"})})
(h/build-val article) ; => #:article{:submitter #:user{:name "Lilliam Predovic"}}
Just my 2¢, but I'm not really convinced all these variants need to exist—and could just lead to user confusion / limit further evolution of the API—but, as described, something is amiss in either the docs or the code.
I really like what you're doing with this library! I'm still sussing out best practices, but I look forward to using Harvest to remove a bunch of boilerplate in our tests.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the README examples for defactory and build-val, then trace the defactory and build-val entry points involved in shorthand options and inline factory generation. Confirm whether the documented variants should behave identically; done means the code and documentation agree and the shorthand calls honor the supplied options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- testing, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100