Allow derived inclusion chains in filter/sort/page query strings #1756
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 using derived inclusion chains in filter/sort/page query string parameters.
For example:
The following query now applies the specified filter only on cars:
Before, the request would fail with HTTP 400:
Minor breaking API changes:
QueryStringParameterScopeExpression.Scope
: Type changed fromResourceFieldChainExpression?
toIncludeExpression?
.PaginationElementQueryStringValueExpression.Scope
: Type changed fromResourceFieldChainExpression?
toIncludeExpression?
.IQueryStringParameterScopeParser.Parse
: removedpattern
andoptions
parameters.IncludeParser.ParseInclude
/QueryStringParameterScopeParser.ParseQueryStringParameterScope
: removedsource
parameter, which is now available as a property on the base class.The breaking changes are required to support multiple derived relationships in an inclusion chain. Parsing scopes in filter/sort/page now works similarly to how the value of the
include
query string parameter is parsed.For example, assume that type
Truck
also has aWheels
to-many relationship. Thewheels
scope infilter[wheels]
is now parsed into two inclusion chains: one forCar
and one forTruck
, so that the filter can be applied to both. To visualize the change, callToFullString()
on the expression.Fixes #1642.
QUALITY CHECKLIST