safe-json
safe-json copied to clipboard
Automatic versioning of JSON formats for Haskell data types (with backwards compatibility)
Maybe it's nice to also have a `strippedSafeToJSON` that's defined as `removeVersion . safeToJSON`? And maybe add like `strippedEncode` defined as `encode . strippedSafeToJSON`?
The `SafeJSON a =>` constraint in the `Product` instance might be superfluous. I remember removing it from `Sum`, because it wasn't necessary, but I guess I might have forgotten to...
The test functions like `migrateRoundTripProp` don't need a second type application. Adjust examples, but note that adding the second type gives guarantee it's migrating from the right type.
Would a `getVersion :: Aeson.Value -> Maybe (Version a)` be a good addition?
I could open a PR for this, but I figured a discussion might be better first. --- Right now there's no way to use `aeson`'s faster `toEncoding` JSON serialization methods...
This might help in switching from `aeson` over to `safe-json` and make functions like `removeVersion` clearer in that they remove the "safeness".
Since `safe-json-1.0.0`, the `SafeJSON` class doesn't require `FromJSON` or `ToJSON` instances (but still defaults to those if not defined) so a review of the documentation might be in order. (also...
https://github.com/Vlix/safe-json/issues/36
https://github.com/Vlix/safe-json/issues/20 This isn't complete but I wanted to make sure it is going in the right direction before completing it. Things to note: 1. `safeTo` creates a `SafeValue`. I wasn't...