Skip to content

feat(core/schema): extract global document references types#8973

Closed
skogsmaskin wants to merge 5 commits intomainfrom
feat/gdr-extract-schema
Closed

feat(core/schema): extract global document references types#8973
skogsmaskin wants to merge 5 commits intomainfrom
feat/gdr-extract-schema

Conversation

@skogsmaskin
Copy link
Copy Markdown
Member

@skogsmaskin skogsmaskin commented Mar 18, 2025

Description

This will extract globalDocumentReference types with extractSchema and. extractManifest.

However I'm not sure about the implications of this as I don't know how too much about how those functions are used.

Please help me review this.

What to review

That introducing this new type in the output will not break stuff somewhere?

What about the GraphQL API?

Testing

Notes for release

@skogsmaskin skogsmaskin requested a review from a team as a code owner March 18, 2025 14:56
@skogsmaskin skogsmaskin requested review from ricokahler and removed request for a team March 18, 2025 14:56
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
page-building-studio Ready Ready Preview, Comment Jan 26, 2026 4:18pm
performance-studio Ready Ready Preview, Comment Jan 26, 2026 4:18pm
test-studio Ready Ready Preview, Comment Jan 26, 2026 4:18pm
2 Skipped Deployments
Project Deployment Review Updated (UTC)
studio-workshop Ignored Ignored Preview Jan 26, 2026 4:18pm
test-next-studio Ignored Ignored Jan 26, 2026 4:18pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 35.59% 22306 / 62673
🔵 Statements 30.22% 26924 / 89067
🔵 Functions 34.13% 4558 / 13351
🔵 Branches 23.63% 17535 / 74184
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/@sanity/schema/src/sanity/extractSchema.ts 90.54% 84.54% 95.55% 90.52% 102, 113-114, 125, 129, 149, 162, 171-172, 180, 195, 249, 264-272, 299, 332, 417, 427, 544, 575-580, 639, 686, 786
Generated in workflow #50840 for commit 12cac73 by the Vitest Coverage Report Action

@github-actions
Copy link
Copy Markdown
Contributor

No changes to documentation

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2025

⚡️ Editor Performance Report

Deploying studio and running performance tests…

@skogsmaskin
Copy link
Copy Markdown
Member Author

skogsmaskin commented Mar 18, 2025

Found out that test/cli/graphql/gen3.test needs to add tests for this type.

@skogsmaskin skogsmaskin force-pushed the feat/gdr-extract-schema branch from b49da28 to 59022f0 Compare March 18, 2025 15:38
type: 'book',
},
],
type: 'globalDocumentReference',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a fix on the Create side (both backend and frontend) so we ignore gdr fields there for now.
Ie, we would have to get that out first before this can be merged.
If left as is, Create form will render this as an object with whatever fields GDR type has (i think, or it will crash, idk).

Is GDR available in the lastest version of sanity package? I can do a quick discov

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snorrees - it will go out with the release today. Was merged to next earlier today.

(I will will make the final adjustments to the AI-Assist Plugin btw as soon as I know the version number)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snorrees - to clarify my message above:

The unexposed GDR support will go out today, not this one :)

Ie, we would have to get that out first before this can be merged.

Yes. Noted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch your PR inbox

},
{
"fieldName": "productReference",
"type": "GlobalDocumentReference",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaict GlobalDocumentReference isn't declared anywhere? 🤔

Copy link
Copy Markdown
Contributor

@snorrees snorrees Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its a new core type.

@skogsmaskin its too late to remodel GDRs as just objects right? This was why assist blew up too right? And why auto updating studios with assist are gonna be in a bad way.

Copy link
Copy Markdown
Member Author

@skogsmaskin skogsmaskin Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah; it's similar to "type": "CrossDatasetReference", which is how the GQL schema types end up loooking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 27, 2025

📊 Playwright Test Report

Download Full E2E Report

This report contains test results, including videos of failing tests.

@justshiv
Copy link
Copy Markdown

Hey @skogsmaskin what's the current status on this PR? Is it worth getting this into a shippable state or can we close this?

@skogsmaskin skogsmaskin force-pushed the feat/gdr-extract-schema branch from d74cef9 to c1c12d9 Compare January 22, 2026 14:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 22, 2026

🧪 E2E Preview environment

🔑 Environment Variables for Local Testing

This is the preview URL for the E2E tests: https://e2e-studio-baxjxnrov.sanity.dev

To run the E2E tests locally, you can use the following environment variables, then run pnpm test:e2e --ui to open the Playwright test runner.

💬 Remember to build the project first with pnpm build:e2e.

  SANITY_E2E_PROJECT_ID=ittbm412
  SANITY_E2E_BASE_URL=https://e2e-studio-baxjxnrov.sanity.dev
  SANITY_E2E_DATASET="update depending the project you want to test (pr-8973-chromium-21364898781 || pr-8973-firefox-21364898781 )"
  SANITY_E2E_DATASET_CHROMIUM=pr-8973-chromium-21364898781
  SANITY_E2E_DATASET_FIREFOX=pr-8973-firefox-21364898781

@skogsmaskin skogsmaskin requested review from kbrabrand and removed request for ricokahler January 26, 2026 16:15
@skogsmaskin
Copy link
Copy Markdown
Member Author

@snorrees - I see you have added some stuff touching upon this some time after this PR. Can you please have another look?

@kristofferlund - I know you have been working lately with the schema types. Adding you as an reviewer on this.

@skogsmaskin
Copy link
Copy Markdown
Member Author

skogsmaskin commented Jan 26, 2026

Hey @skogsmaskin what's the current status on this PR? Is it worth getting this into a shippable state or can we close this?

Yes, if we want correct typings on the global document reference type (schema and GraphQL), it's worth getting this in.

It is up to date with main now. My first comment still stands though, I don't know the implications of this change (in code elsewhere), so I need help to review.

Copy link
Copy Markdown
Member

@sgulseth sgulseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is what we can support at the moment. typegen is not aware of GDRs, and has no way of resolving the external schema. I think we first need to migrate typegen to use the new schema store. For now unknown is the only thing reasonable to return for GDRs

@skogsmaskin
Copy link
Copy Markdown
Member Author

I don't think this is what we can support at the moment. typegen is not aware of GDRs, and has no way of resolving the external schema. I think we first need to migrate typegen to use the new schema store. For now unknown is the only thing reasonable to return for GDRs

Right! Sounds like something that could take a while to get in place.

@justshiv - feel free to close this if it's causing noise in the "Open PRs". But maybe we can keep the branch for future reference.

@justshiv justshiv closed this Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants