Open mitchkyle-reify opened 1 year ago
I haven't looked at this in detail yet but this but from the description most of these are supported in the work I've done at https://github.com/donut-power/datapotato . I think only Dynamically load builtin generation functions
might not be supported (I'm not sure what it means because I haven't looked)
Would you like to look at datapotato together some time?
BTW I think it's really cool that you're looking at these issues! I'm just hoping we don't end up with duplicated effort
Thanks, I'm struggling with boot at the moment. it's giving me a strange error that I think is related to being on an M1 mac.
And that error on the CI seems like how I'm doing the dynamic loading might not work with clojurescript.
I'll read through datapotato, I was hoping for something backwards compatible with spec-gen because I need to add it to a code base that already uses that :P
It’s actually backwards compatible :) wouldn’t want to leave y’all high and dry
Also, datapotato doesn’t use boot, it’s just deps. The only change you’d need to make would be changing the required namespace
I like datapotato, I like the next.jdbc integration, I like the improved data generations, a few issues though, I would have to go through the whole codebase and replace :spec-gen
with :generate
which is a pain but not then end of the world, the other is if I have an entity with fields called :generator
or :schema
, I don't seem to be able to overwrite them without the generation failing.
This PR can be like a drop-in enhancement for spec-gen, which is really what we need for the task at hand. I appreciate you taking the time to help me; If you'd rather put your focus towards datapotato rather than this repo, I would completely understand, and we could take it from here.
New pushed changes:
franken-gen
to specmonstah.generate
for clarity@mitchkyle-reify I think it would be really useful to get on a zoom about this. How would you feel about that? I'm not sure I understand the issue you're running into when you mention having an entity with :generator
or :schema
fields.
Also, I get wanting to move forward with this so that you can meet your needs and move on. I'd like to chat about that more. If zoom doesn't work I'll try to put my thoughts together here. I'm nonrecursive on Clojurians slack, and nonrecursive@gmail.com if you'd like to get in touch
OK I think I see what you mean about :generator
and :schema
. I've updated datapotato so that overwriting generated values per entity looks like this:
(dc/generate potato-db {:todo [[:_ {:generate {:set {:todo-title "..."}}}]]}
You can also specify other :generate
config per-entity:
(deftest specify-generate-in-query
(testing "can specify generate options in query terms"
(let [gen (dc/generate
{:schema spec-schema
:generate {:generator spec-generator}}
{:todo-list [[1 {:generate {:schema [:map
[:id ID]
[:created-by-id ID]
[:title [:enum "todo list title"]]]
:generator malli-generator}}]]})]
(is (= "todo list title"
(get-in gen [:tl0 :title]))))))
I've also addressed the :spec-gen
issue so that you shouldn't have to rewrite existing occurrences of :spec-gen
.
This PR is being flagged as STALE because it has not had recent activity in the last 60 days. It will be closed if no further activity occurs in the next 14 days. If you believe this repo should be excluded from this process, please add the repo to this list.
franken-gen
is an iteration onspec-gen
, schemas and queries from spec-gen are fully backwards compatible.Features:
:spec-gen
to:set
to make the intention more clear. the:spec-gen
key is still accepted for backwards compatibilityWhat do we think of this approach? I know it changes the intentions for visiting a bit but I think it makes using specmonstah for generating data more intuitive. Regarding the name, I called it
franken-gen
because it stitches together different generation mechanisms, and it leans away from the "spec" and into the "monstah" motif. I am open to alternatives though.PS: Some changes that are in master related to the release are included in this PR.