I’m attempting to pull a content piece that has a very involved structure. I believe I’m getting confused by the path structure in the JSON vs. how the blocks are built.
I’m attempting to resolve the story in the media field. If I were using JSONPath it would be located here: story.content.body[2].programs[12].content.tabs[3].media
I’ve tried a number of variations similar to this programs-layout.programs.program.tabs.media
Is there not an easier way to identify components you want resolved without specifying the full path? In this whole data structure I basically need all the component stories.
Hi Hannes, thank you for answering so quickly. This unblocks me! It would be really nice if there was a way to recursively fetch these values. It would simplify the logic in my Next.js data resolvers.
There were already other people who asked about this possibility. Unfortunately there are technical hurdles which prevent this from becoming a possibility:
That’s understandable. At scale (as an engineer) I can see that it would be cumbersome. Perhaps a separate service designed specifically for resolving this issue? Story Resolver or something similar would make sense. Basically supply the base query and the service iterates through all the components and resolves relations.
That’s basically what I’ve written in my client but it’s slow and cumbersome given the amount of data we’re working with. Something that fetches the data and mitigates the 100-200ms round-trips to the UUID endpoint would save a bit of effort.
Given that SB has received many similar requests and given that this may mitigate effective and/or efficient utilisation of your service, I’d strongly recommend considering it. =)