Add JSON roundtrip tests for Datafield and WithQuery
@anoe This MR revert the Datafield
instance to not use the Generic
-based derived FromJSON
and ToJSON
, in favour of some manual instance which won't change based on the changes to the data structure.
I have also written roundtrip tests for WithQuery
and Datafield
, and in the process I have discovered a bug with the JSON instances of FlowSocialListWith
, which were not roundtripping (I have now fixed it).
I have also added a regression test to make sure that we can decode the JSON the frontend will send us into a valid Haskell type, failing if that's not the case. Hopefully this should catch future regressions.