This:
JsonFSharpOptions.Default()
.WithOverrides(fun o -> dict [
typeof<Foo>, o.WithOverrideMembers(dict [
"Field1", [ JsonNameAttribute "MyField" ]
])
])
could be nicer like this:
JsonFSharpOptions.Default()
.WithOverride<Foo>(_.WithOverrideMember("Field1", [ JsonNameAttribute "MyField" ]))
It would also give us an opportunity to give the options in the function passed to WithOverride a type parameter, which in turn could be used by WithOverrideMember:
JsonFSharpOptions.Default()
// Typed field accessor, possible because we know the type being overridden!
.WithOverride<Foo>(_.WithOverrideMember(_.Field1, [ JsonNameAttribute "MyField" ]))
Or even:
JsonFSharpOptions.Default()
// The second type parameter is the type of Field1, it can be replaced with _
.WithOverride<Foo, int>(_.Field1, [ JsonnameAttribute "MyField ])
This:
could be nicer like this:
It would also give us an opportunity to give the options in the function passed to
WithOverridea type parameter, which in turn could be used byWithOverrideMember:Or even: