WIP on adding htmax option (#59)
This commit is contained in:
@@ -9,6 +9,14 @@ module Json =
|
||||
|
||||
open Newtonsoft.Json
|
||||
|
||||
/// <summary>Converter for the <see cref="AutoHtmxType" /> type</summary>
|
||||
type AutoHtmxTypeConverter() =
|
||||
inherit JsonConverter<AutoHtmxType>()
|
||||
override _.WriteJson(writer: JsonWriter, value: AutoHtmxType, _: JsonSerializer) =
|
||||
writer.WriteValue(string value)
|
||||
override _.ReadJson(reader: JsonReader, _: Type, _: AutoHtmxType, _: bool, _: JsonSerializer) =
|
||||
(string >> AutoHtmxType.Parse) reader.Value
|
||||
|
||||
/// <summary>Converter for the <see cref="CategoryId" /> type</summary>
|
||||
type CategoryIdConverter() =
|
||||
inherit JsonConverter<CategoryId>()
|
||||
@@ -160,7 +168,8 @@ module Json =
|
||||
/// <summary>Configure a serializer to use these converters (and other settings)</summary>
|
||||
let configure (ser: JsonSerializer) =
|
||||
// Our converters
|
||||
[ CategoryIdConverter() :> JsonConverter
|
||||
[ AutoHtmxTypeConverter() :> JsonConverter
|
||||
CategoryIdConverter()
|
||||
CommentIdConverter()
|
||||
CommentStatusConverter()
|
||||
CustomFeedIdConverter()
|
||||
|
||||
Reference in New Issue
Block a user