packages feed

digestive-functors-aeson 1.1.26 → 1.1.27

raw patch · 4 files changed

+132/−11 lines, 4 files

Files

Changelog.md view
@@ -1,27 +1,143 @@-# 1.1.26 -- 2018-07-06+# Changelog +## 1.1.27 -- 2019-02-16++- Make `jsonErrors` total. Thanks to @gelisam for this fix! See+  https://github.com/ocharles/digestive-functors-aeson/pull/12 for more+  information.++## 1.1.26 -- 2018-07-06+ - Increase the upper bound of `lens`. -# 1.1.25+## 1.1.25  - Increase the upper bound of `aeson`. -# 1.1.24+## 1.1.24  - Increase upper bound of `aeson`. -# 1.1.23+## 1.1.23  - Increase upper bound of `lens`. -# 1.1.22+## 1.1.22  - Increase upper bound of `aeson`. -# 1.1.21+## 1.1.21  - Increase upper bounds on `base` and `lens`. -# 1.1.19+## 1.1.20 +- Update upper bounds of `base` and `lens`.++## 1.1.19+ - Builds with `aeson-0.11`.++## 1.1.18++- Update upper bounds of `aeson`.++## 1.1.17++- Update upper bounds of `lens`.++## 1.1.16++- Update upper bounds of `lens`.++## 1.1.15++- Update upper bounds of `aeson` and `lens`.++## 1.1.14++- Update upper bounds to base < 4.9, digestive-functors < 0.9, lens < 4.10++## 1.1.13++- Builds with lens < 4.8.++## 1.1.12.1++- 1.1.12 included old test code which fails tests. This release includes the correct+  code.++## 1.1.12++- Builds with lens < 4.7.++## 1.1.11++- Builds with 4.4 <= lens < 4.5, aeson < 0.9. This increases the lower-bound on+  the lens dependency.++## 1.1.10++- Builds with lens < 4.4.++## 1.1.9++- Builds with lens < 4.3.++## 1.1.8++- Builds with base 4.7++## 1.1.7++- Correctly parse 'true' and 'false'. Now parses 'true' to be the string "on",+  which means that the 'bool' form provided by `digestive-functors` works as+  expected.++## 1.1.6++- Build with `lens` 4.1.++## 1.1.5++- Upgraded to `lens` 4.0. Dropped `lens-aeson` dependency.++## 1.1.4++- Upgraded to `digestive-functors` 0.7.++## 1.1.3++- This version only includes distribution changes+- The cabal file now correctly specifies the correct version of+  the digestive-functors-aeson build dependency.+- Tests are now ran using tasty rather than test-framework.++## 1.1.2++- Support top level lists. This means you can now parse the JSON document+  `[ 0, 1, 2 ]` with the form `listOf stringRead`.++## 1.1++- Support lists++-----++## 1.0.2++- Added `jsonErrors`, which can transform a `ToJSON a => View a` into a aeson+  `Value`. This respects the validation hierarchy.+- Tests!++-----++## 1.0.1++- Added a dependency on the `Safe` package to build with GHC < 7.6.++-----++## 1.0.0++- Initial release
digestive-functors-aeson.cabal view
@@ -1,6 +1,6 @@ name: digestive-functors-aeson category: Web, JSON-version: 1.1.26+version: 1.1.27 license: GPL-3 license-file: LICENSE author: Oliver Charles
src/Text/Digestive/Aeson.hs view
@@ -74,7 +74,7 @@ -} jsonErrors :: ToJSON a => View a -> Value jsonErrors v =-  fromMaybe (error "Unable to construct error response")+  fromMaybe (object [])             (foldl encodeError Nothing (viewErrors v))   where     encodeError json (path, message) =
test/Tests.hs view
@@ -37,10 +37,15 @@ testPokemon :: TestTree testPokemon = testGroup "Pokemon tests" [ testPokemonOk, testPokemonInvalid ]   where-    testPokemonOk = testCase "Submit pokeForm with valid data" $-        (runIdentity $ snd <$> digestJSON pokeForm json) @?= Just expected+    testPokemonOk =+        let (v, r) = runIdentity $ digestJSON pokeForm json+        in testGroup "Submit pokeForm with valid data/check error view"+             [ testCase "Passed validation" $ r @?= Just expected+             , testCase "jsonErrors shows no errors" $ jsonErrors v @?= errors+             ]       where         (Just json) = decode "{\"name\":\"Pikachu\", \"number\":\"25\"}"+        (Just errors) = decode "{}"         expected = Pokemon { pokemonName = "Pikachu", pokemonNumber = 25 }      testPokemonInvalid =