feat: allow deriveLinkedEntries to create multiple derived entries []#1533
Open
jjolton-contentful wants to merge 3 commits intomainfrom
Open
feat: allow deriveLinkedEntries to create multiple derived entries []#1533jjolton-contentful wants to merge 3 commits intomainfrom
jjolton-contentful wants to merge 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR extends the existing deriveLinkedEntries functionality to support creating multiple derived entries per source entry and locale, while maintaining full backwards compatibility. The enhancement enables migrations to convert JSON fields into normalized child entries with deterministic IDs and flexible publishing controls.
Key changes:
- Added multi-entry mode via new
deriveEntriesForLocalefunction that returns an array of child entries - Introduced deterministic ID generation with customizable
derivedEntryIdfunction - Added granular publishing control for derived children through
publishDerivedoption
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/interfaces/entry-derive.ts | Added new optional properties for multi-entry mode with detailed JSDoc documentation |
| src/lib/action/entry-derive.ts | Implemented multi-entry derivation logic with validation, upsert semantics, and deterministic ID generation |
| src/lib/intent-validator/entry-derive.ts | Updated validation schema to accept new optional properties while maintaining backwards compatibility |
| test/unit/lib/actions/entry-derive.spec.js | Added comprehensive tests for multi-entry mode including empty array handling |
| test/unit/lib/intent-validator/entry-derive.spec.ts | Added validation test for multi-entry mode configuration |
| README.md | Updated documentation with detailed examples and usage patterns for both single and multi-entry modes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deriveLinkedEntries, enabling 0..N child entries per source/locale and populating an Array<Link> field.deriveEntriesForLocale(multi-mode)derivedEntryId(deterministic IDs)publishDerived(child publishing)Description
linkContentTypewhere applicable.deriveEntryForLocale.Motivation and Context
A user asked for an easy way to convert a JSON field into many linked entries (e.g., fanning out arrays/objects into normalized child entries). This change adds multi-entry derivation so migrations can deterministically create 0..N child entries per locale and link them back, making that workflow simple and repeatable without breaking existing scripts.