sanity-codegen
sanity-codegen copied to clipboard
fix(v1): handle `_key` and `_type` in objects
Fixes https://github.com/ricokahler/sanity-codegen/issues/236
The strategy taken has been to recursively forward an ancestors
array so the parent is available when generating the types for a node. Ff current node is object and parent is array, then it add _key
and _type
.
Let me know if those fields should be added in any other cases.
Also @ricokahler I'm not able to run tests, so I have not updated them. But I think it would be good to add a case to ensure this is kept on future refactors/changes.
@ochicf is attempting to deploy a commit to the Rico Kahler Team on Vercel.
A member of the Team first needs to authorize it.
this seems very much needed .__.
@ochicf any chance you are already publishing a fixed version somewhere for the moment
this seems very much needed .__.
@ochicf any chance you are already publishing a fixed version somewhere for the moment
Hey @MurmeltierS. I have integrated all my PRs into this branch: https://github.com/OrigenStudio/sanity-codegen/tree/release/v1.0.0-alpha.next
You could take that branch, build the packages I've changed (looked for bumped versions in the package.json
) and publish it to a local installation of Verdaccio. Then you can install the package pointing to your local registry so it's installed from there. It's how I'm doing it to generate the types locally.
I'm wondering aswell if it could be possible to install it directly from GitHub? I have never tried it so not sure if can be done, but I guess even if possible, it will be complicated as it's a monorepo with multiple packages inside 🤔
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
sanity-codegen-dev | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 21, 2023 2:09pm |
Nice work @ochicf! ⭐ Would be really helpful to have this one merged.
This is great, I also need this! Thank you!
This would be a huge improvement! @ricokahler any chance this could be merged please?
@ricokahler this would a much needed feature. Do you think you can review this PR?