refactor: Do not fail on missing DTO properties

Previously, if Sonarr or Radarr added a new property to a DTO, Recyclarr
would fail when attempting to deserialize those responses. The purpose
of this was to catch compatibility issues early. However, this actually
prohibits a more useful case: Deserializing only data we care about and
having the freedom to ignore other, superfluous stuff.
commitlint
Robert Dailey 2 years ago
parent 081856e19e
commit 56666a245a

@ -92,11 +92,6 @@ public abstract class ServiceCommand : BaseCommand, IServiceCommand
{
var jsonSettings = new JsonSerializerSettings
{
// This is important. If any DTOs are missing members, say, if Radarr or Sonarr adds one in a future
// version, this needs to fail to indicate that a software change is required. Otherwise, we lose
// state between when we request settings, and re-apply them again with a few properties modified.
MissingMemberHandling = MissingMemberHandling.Error,
// This makes sure that null properties, such as maxSize and preferredSize in Radarr
// Quality Definitions, do not get written out to JSON request bodies.
NullValueHandling = NullValueHandling.Ignore

Loading…
Cancel
Save