Introduce path provider and resolver for the Content Delivery API #15922
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.


Prerequisites
Description
In certain cases it would be nice to be able to customise the content paths returned by the Content Delivery API - for example if one has a collection of shared content that is reused between multiple roots (sites).
This PR introduces the content path provider and the matching content path resolver. Think of these as URL Provider and Content Finder for the Content Delivery API here.
The core implementations (
ApiContentPathProvider,ApiContentPathResolver) are left public and unsealed to enable extendability.Testing this PR
Consider a content structure like this:
The following code adds custom paths to "Root One" and everything below (prefixes the content path with
/my-path):This should yield custom paths for published content in the Content Delivery API output
...while unpublished content retains the default preview path (remember to supply an API key to fetch unpublished content):
It should be possible to request the content by the custom path:
...and unpublished content by the preview path: