-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow nested seed packets #2
Comments
…tch the seed it's planted with. Part of #2.
Currently they're the same exact types, just aliases. The idea is that the non-expanded are the raw packet, and might include nested seeds. Part of #2.
…ough, but will soon allow nested seeds. Part of #2.
This is being developed on branch |
First look at how zod.required works. Replicate that with a thing that puts a distinctive sentinel in place every time it finds a seedReference. Then process the union of seed data and make the nested one too automatically Then do the lazy/recursive thing. Make expandSeedData throw if it finds one that doesn’t work. Then make expandSeedData work with nested data (if id is set, use that. If not, use the id from parent plus a dash and the parent peppery name |
It's a no op in terms of typing. Having a helper like this makes it a step more likely to automatically factor out making nested versions. Part of #2.
…shape. No semantic difference yet, but getting more of the type construction automated. Part of #2.
…alue automatically. No semantic difference, just the type construction for seed data is automated. There's a cast in there (as Shape) that doesn't feel right, but it still works so 🤷 Part of #2.
Everything builds and runs, but if you try to grow a sub-seed that was nested, it will fail with an invalid id warning because expandSeedData doesn't yet know how to properly unroll nested seeds. Part of #2.
…ypes. makeNestedSeedData is harder to do because of the recursive typing. Part of #2.
Just do the same typescript rewriting as done for makeSeedData. Left a comment in a few of the places where the typescript type is wrong to remind myself. Part of #2.
This will help enumerate through keys in expandSeedData. Part of #2.
…ted seed. For now it just barfs with an error. Note this means that tests currently pass, but if you run `garden` it will bail because `default.json` has a nested seed, so the seed packet will fail to parse. Part of #2.
Actually, I don't know why this works, but it does seem to work in the `garden` command at least for `nested-example`. Part of #2.
It requires an ugly type cast. 🤷 Part of #2.
One doesn't yet pass so commented out. Part of #2.
Before, the seedRference would notice things with an 'id' and match first. But we want to check for the more restrictive seedData first, because if seedReference is matched first we won't find named sub-seeds, they'll be removed by the seedPacket.parse. Part of #2.
Part of #2. Merge branch 'nested-seeds' * nested-seeds: (25 commits) Document nested seeds in README. Add another matching test for behavior from two commits ago. Add a test that now behaves correctly from last commit. Change order of union of types in makeNestedSeedReferenceProperty. Add a bunch of expandSeedPacket tests. Add a basic test for nested examples. Document the makeNestedSeedData problem, pointing at issue #16. In expandSeedData, leave behind nested seeds with proper SeedReference. Make expandSeedID return the ID it actually chose. Made expandSeedData correctly recurse into nested seeds and unroll them. Made it so expandSeedData will use the override id set within a seed if set. expandSeedData recurses through items and detects when it finds a nested seed. Create SeedDataReservedKeys. Do a hack of a fix in makeNestedSeedData. Fix typescript typing of makeSeedData to have the proper typescript types. Add a TODO based on a bug I just realized in typing. Clean up proper types of SeedData and expandSeedData. Redefine SeedPacket to actually allow nesting of any seed reference. Unexport the seedData* Zod types, since we'll have a larger number now. Make it so makeSeedData runs the makeSeedReferenceProperty on every value automatically. ...
A SeedPacket where the seeds have instead of SeedRef, a SeedData, which is expanded to be a topline seed.
id
field to seeds (which is validated to verify it matches the local ID) since some seeds will otherwise have implied IDs. If it's not filled in then it will be filled in with a generic and deterministic ID so you don't HAVE to create oneThe text was updated successfully, but these errors were encountered: