V14: Adding the ability to conditionally serialize version bound properties for the Delivery API #16731
+321
−0
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.
Details
IncludeInApiVersionAttribute
to define API version bounds for properties. It supports both an inclusive minimum and maximum API version;IHttpContextAccessor
to access and act upon the current API version.Now, properties in
MyModel
will be included in the Delivery API response based on the specified version bounds.Test
/umbraco/delivery/api/v2/content
and GET/umbraco/delivery/api/v1/content
endpoints;/umbraco/delivery/api/v2/content/item/{id}
and GET/umbraco/delivery/api/v1/content/item/{id}
endpoints;/content
and/item
endpoints in a text comparison tool, like https://www.diffchecker.com/text-compare/ to compare next./umbraco/delivery/api/v1
and then/umbraco/delivery/api/v2
of/content
and/item
endpoints with the complete output from before (step: 4) and verify that the following properties are there or not based on ✅ and ❌ indicators: