Skip to content

New Backoffice: Return AnalyticsLevelViewModel instead of TelemetryLevel#13291

Closed
nikolajlauridsen wants to merge 18 commits intov11/devfrom
v11/fix/openApi_duplicate_telemetry_level
Closed

New Backoffice: Return AnalyticsLevelViewModel instead of TelemetryLevel#13291
nikolajlauridsen wants to merge 18 commits intov11/devfrom
v11/fix/openApi_duplicate_telemetry_level

Conversation

@nikolajlauridsen
Copy link
Copy Markdown
Contributor

@nikolajlauridsen nikolajlauridsen commented Oct 25, 2022

Fixes the duplicate TelemetryLevel property in the OpenApi schema.

This was caused by the PagedViewModel<Telemetry>, basically it stems from the same issue we've had before with the serialization settings used by NSwag, and being unable to really change them globally, with the main issue here being that enums are serialized to integers by default.

Specifically this comes from PagedViewModel<T>.Items not having the [JsonConverter(typeof(JsonStringEnumConverter))] (and neither should it).

I fixed this by instead returning the PagedViewModel<AnalyticsLevelViewModel>.

While it might be a bit overkill to create a ViewModel for only one property, I think it's pretty sensible since TelemetryLevel is a domain model, "it" should really not be concerned about presentation at all.

Created a new branch for this: #13298

@elit0451 elit0451 deleted the v11/fix/openApi_duplicate_telemetry_level branch October 26, 2022 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants