Skip to content

Commit c77fb3c

Browse files
committed
Always write required json properties
1 parent e770009 commit c77fb3c

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

PlexCleaner.schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@
239239
},
240240
"required": [
241241
"Video",
242-
"Audio"
242+
"Audio",
243+
"Global"
243244
]
244245
},
245246
"HandBrakeOptions": {

PlexCleaner/ConvertOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public record FfMpegOptions
2424
public string Audio { get; set; } = string.Empty;
2525

2626
// v3 : Value no longer needs defaults
27+
[JsonRequired]
2728
public string Global { get; set; } = string.Empty;
2829

2930
// v3 : Removed

PlexCleaner/JsonSerialization.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ private sealed class IgnoreEmptyStringTypeInfoResolver(IJsonTypeInfoResolver inn
5151
continue;
5252
}
5353

54+
if (property.IsRequired)
55+
{
56+
continue;
57+
}
58+
5459
Func<object, object?, bool>? existing = property.ShouldSerialize;
5560
property.ShouldSerialize = (obj, value) =>
5661
!string.IsNullOrEmpty(value as string)

0 commit comments

Comments
 (0)