Generic API client: include parent fields in child resource #355
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.
Tell us what you do here
verified source
)Relevant issue
issue #313
More PR info
This PR allows adding arbitrary fields from the parent resource in the child resource. Example: In Workable, jobs/{shortcode}/recruiters does not include the jobs shortcode. Thus, the response does not tell to which job a recruiter belongs.
For example, a child resource can be specified as follows in order to include
confidential
andid
from thejobs
resource in thejobs_id_approval_flows
resource:The resulting fields in the child resource are
_jobs_confidential
and_jobs_id
.Validation
Marked yellow: The parent's resource name is the prefix for its field in the child. This is to avoid name collisions.
Marked green & blue: the field names of the parent are the field names in the child:
Data is loaded. Note that
id
and_jobs_id
are identical which proves that the correct values are taken from the parent record: