-
Notifications
You must be signed in to change notification settings - Fork 19
fix(v1): handle _key
and _type
in objects
#294
base: alpha
Are you sure you want to change the base?
Conversation
@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 |
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 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 ↗︎
|
_key: string; | ||
_type: "objectLike"; | ||
properties?: { | ||
_key: string; | ||
_type: "propertyPair"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ricokahler the tests failed here because these properties are being generated now, so I added them aswell to make the tests pass. I think it makes sense but I'm not fully sure these properties are there in this case?
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? |
Fixes #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.