Skip to content
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

fix(typegen): dont treat all document type refs as references #7366

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

sgulseth
Copy link
Member

Description

It's possible to reference a document the same way as an object is referenced. However, they will not get the builtin attributes that are available on a document stored in Content Lake. The Studio treats it as a "normal" object. Since we are making some assumption around document we are inlining the whole object whenever this happens, it's an edge case and not a recommended pattern as it is mixing concerns.

What to review

Correctness. This change also changed a snapshot in the existing test. This is because the referenced block type from the fixture is using "author" as a inline type reference, but also using author as a reference.

Testing

Updated the current snapshots and added a specific test for inlined documents

Notes for release

TypeGen: Fixes an edge case where referencing documents with a normal "type"-reference, and not a "reference-type" reference extracted an incorrect representation of the schema.

Fixes #6913

It's possible to reference a document the same way as an object is
referenced. However, they will not get the builtin attributes that are
available on a document stored in Content Lake. The Studio treats it as
a "normal" object. Since we are making some assumption around document
we are inlining the whole object whenever this happens, it's an edge
case and not a recommended pattern as it is mixing concerns.
@sgulseth sgulseth requested a review from rexxars August 13, 2024 17:23
@sgulseth sgulseth requested a review from a team as a code owner August 13, 2024 17:23
Copy link

vercel bot commented Aug 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 5:27pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 5:27pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 5:27pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 5:27pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 5:27pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Aug 13, 2024 5:27pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

Component Testing Report Updated Aug 13, 2024 5:43 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 0s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 37s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 44s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 46s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 15s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 8s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 26s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 17s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ❌ Failed (Inspect) 1m 25s 20 0 1
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 1m 51s 30 0 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 20s 3 0 0

Copy link
Member

@rexxars rexxars left a comment

Choose a reason for hiding this comment

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

👏

@sgulseth sgulseth added this pull request to the merge queue Aug 13, 2024
Merged via the queue into next with commit 32958d3 Aug 13, 2024
42 checks passed
@sgulseth sgulseth deleted the fix/inline-document-refs branch August 13, 2024 19:06
cngonzalez pushed a commit that referenced this pull request Aug 20, 2024
It's possible to reference a document the same way as an object is
referenced. However, they will not get the builtin attributes that are
available on a document stored in Content Lake. The Studio treats it as
a "normal" object. Since we are making some assumption around document
we are inlining the whole object whenever this happens, it's an edge
case and not a recommended pattern as it is mixing concerns.
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.

Schema extract always assumes inline referenced documents are References
2 participants