sanity-codegen icon indicating copy to clipboard operation
sanity-codegen copied to clipboard

fix(v1): handle `_key` and `_type` in objects

Open ochicf opened this issue 1 year ago • 8 comments

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 avatar Apr 03 '23 18:04 ochicf

@ochicf is attempting to deploy a commit to the Rico Kahler Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 03 '23 18:04 vercel[bot]

this seems very much needed .__.

@ochicf any chance you are already publishing a fixed version somewhere for the moment

MurmeltierS avatar Apr 18 '23 16:04 MurmeltierS

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 🤔

ochicf avatar Apr 20 '23 09:04 ochicf

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

vercel[bot] avatar May 10 '23 14:05 vercel[bot]

Nice work @ochicf! ⭐ Would be really helpful to have this one merged.

phmasek avatar Jun 19 '23 11:06 phmasek

This is great, I also need this! Thank you!

maximilianschmitt avatar Jun 24 '23 15:06 maximilianschmitt

This would be a huge improvement! @ricokahler any chance this could be merged please?

michelebruno avatar Dec 08 '23 12:12 michelebruno

@ricokahler this would a much needed feature. Do you think you can review this PR?

shreyansqt avatar Mar 14 '24 17:03 shreyansqt