Add true/false to auto-htmx converter (#59)

- This will allow backups to be restored, converting the value as part of the restoration
This commit is contained in:
2026-07-07 20:26:34 -04:00
parent edb376c06c
commit 8e0b2df870
3 changed files with 11 additions and 8 deletions
+4 -1
View File
@@ -15,7 +15,10 @@ module Json =
override _.WriteJson(writer: JsonWriter, value: AutoHtmxType, _: JsonSerializer) =
writer.WriteValue(string value)
override _.ReadJson(reader: JsonReader, _: Type, _: AutoHtmxType, _: bool, _: JsonSerializer) =
(string >> AutoHtmxType.Parse) reader.Value
// Backups prior to v3 will still have true/false for this field
match reader.TokenType with
| JsonToken.Boolean -> if reader.Value :?> bool then AutoHtmx else NoAutoHtmx
| _ -> (string >> AutoHtmxType.Parse) reader.Value
/// <summary>Converter for the <see cref="CategoryId" /> type</summary>
type CategoryIdConverter() =