Support dotted embedding paths in nested sourced_from relationship chains#1251
Merged
Merged
Conversation
- Deal with intermediate list fields while resolving the path instead of after-the fact. - Map over the entire list of path parts instead of splitting the leaf part from the others. - Separate building the `path_segments` from concatting them to the `path_segments` array.
myronmarston
approved these changes
Jun 12, 2026
myronmarston
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! I pushed a commit with a recommended refactor. I also left some inline suggestions below which I'll apply shortly so we can get this merged. For the parent_field_name renaming I'll tackle that in a follow up PR.
Co-authored-by: Myron Marston <myron.marston@gmail.com>
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.
Why
The nested
sourced_fromfeature is meant to work for any schema, but as merged it only handled embedding fields that sit directly on each relationship's parent type. Real schemas can nest the embedded type one or more object levels down — e.g. a list ofPlayers reached viaroster.playersrather than a top-levelplayersfield. In that case, resolving theparent_relationshipfailed with a "field does not exist" error, so you simply couldn't source into a nested element unless it happened to be a direct field.This closes that gap: an embedding field referenced via
parent_field_namemay now be a dotted path that descends through intermediate object fields. The embedding path is expanded into one navigation segment per component, so the sourced data can reach elements nested arbitrarily deep.Scope / behavior notes
parent_relationshiplink, so each list level is matched by its own foreign key. Multi-link chains already support arbitrary list nesting this way.parent_field_namenow resolves by the field's declared name, consistent with howsourced_fromsource paths andequivalent_fieldalready resolve. Previously it incidentally required the internalname_in_index. Note "declared name" is not the same as "exposed in GraphQL" —indexing_onlyembedding fields are still resolvable, since they have a declared name even though they're hidden from the schema.Testing
Unit coverage added for: object→list and object-leaf dotted paths, public-name resolution with a distinct
name_in_index, the intermediate-list rejection, an unresolvable path, and a deeply nested chain that mixes object hops, multiple list links, andname_in_indexrenames.