Plain text serialization
Is your feature request related to a problem? Please describe.
Currently snapper uses Json serialization. This is not well suited for my domain as my objects are F# types and their Json representation is extremely verbose compared to the default auto-generated ToString representation. This makes inspecting snapshots hard.
Describe the solution you'd like I'd like to use plain text serialization for for my snapshots.
Describe alternatives you've considered N/A
Additional context N/A
Hey @artempyanykh,
Thanks for your request. I haven't personally used F# much but your request does look quite similar to some of the other request regarding customising how Snapper serialises the snapshots. I'll have a think about how best to allow for this customisation.
Do you happen to have an example of what a snapshot looks like currently when this is used in F#?
@theramis sure, Here's the string repr:
Bind (false, "x2", Lit (Int 42), Var "x2")
And here's the JSON one:
{
"Case": "Bind",
"Fields": [
false,
"x2",
{
"Case": "Lit",
"Fields": [
{
"Case": "Int",
"Fields": [
42
]
}
]
},
{
"Case": "Var",
"Fields": [
"x2"
]
}
]
}
The original type definition can be found here: https://github.com/artempyanykh/Fang/blob/main/Core/Lang.fs Usage of sharpshooter is here: https://github.com/artempyanykh/Fang/blob/main/Tests/ParserTests.fs
Hey @artempyanykh,
do you think you could solve you issue by using this? https://theramis.github.io/Snapper/#/pages/snapper/custom_snapshot_settings
You could implement a custom converter to convert objects like these to a nicer json format?
Oh, missed the notification! Thanks for the update @theramis! Yeah, I solved my problems with serialization.