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.
This PR adds support for resolving relations in Storyblok. See https://www.storyblok.com/docs/api/content-delivery#core-resources/stories/retrieve-one-story for the
resolve_relations
param.If you for example have a blogpost component, with a field 'author', Singe-Option and source Stories:
You can add
resolve_relations=author
when fetching the blogpost. This 'inlines' the author data in the response. When not usingresolve_relations
you will only get a 'uid' value of the referenced story:This PR checks if the value of a field is a
uid
and if so does the request again but then with theresolve_relations
option enabled.As a consumer of the API it's not possible to know upfront that a field is reference to another story, therefore we need to do two requests, which feels wrong, but I don't see another way. Except for maybe adding configuration in backend, where you configure relations per component. But then you always need to add it there too after adding a relation in Storyblok, with this approach it works instantly when changing a component.
ps. not sure why github lists 6 commits instead of 2. I pulled upstream first...