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.
Notes
With the switch to Swashbuckle, we had some trouble serializing plain
object
types, when receiving one of these types, we would convert it into aJsonElement
, which is hard to work with.This PR remedies that, instead of converting object types to JsonElement, we instead convert the objects to
JsonObject
.This gave us some additional challenges, because we can't "just" add our Converters and be done with it. As that would also force anyone using Umbraco to serialize our way (or other projects, like the incoming content delivery API)
We have resolved this by adding our own
AddJsonOptions
extension, that now also takes a settings name.We can then register our options like so:
And decorate our controller with:
AddJsonOptions()
How to test
(Try a few different endpoints, they should work as expected)
TelemetryViewModel
class like so:https://localhost:44331/umbraco/management/api/v1/telemetry/level
SetTelemetryController.SetConsentLevel
method