json-rpc 1.0.3 → 1.0.4
raw patch · 4 files changed
+22/−33 lines, 4 filesdep ~aeson
Dependency ranges changed: aeson
Files
- CHANGELOG.md +9/−0
- json-rpc.cabal +9/−9
- src/Network/JSONRPC/Arbitrary.hs +0/−18
- src/Network/JSONRPC/Data.hs +4/−6
CHANGELOG.md view
@@ -4,6 +4,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 1.0.4 - 2022-05-15++### Fixed+- Remove `Arbitrary Value` instance because it is already provided by the `aeson` package.++### Changed+- Relax restrictions on `params` field for JSON-RPCv1 requests.+- Bump minimum version of `aeson` accordingly.+ ## 1.0.3 - 2020-06-19 ### Changed
json-rpc.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack ----- hash: 77cd2980380a86ce6731e9afcae7c2ecc42257843e71231bcebaba6929bee5c8+-- hash: 4e2a99d4fdf85a19844c7bf16c14016bfd147baa005a628bebb4ea97823c379c name: json-rpc-version: 1.0.3+version: 1.0.4 synopsis: Fully-featured JSON-RPC 2.0 library description: Please see the README on GitHub at <https://github.com/jprupp/json-rpc#readme> category: Network@@ -39,7 +39,7 @@ ghc-options: -Wall build-depends: QuickCheck- , aeson+ , aeson >=2.0.3.0 , attoparsec , base >=4.6 && <5 , bytestring@@ -63,7 +63,7 @@ Paths_json_rpc build-depends: QuickCheck- , aeson+ , aeson >=2.0.3.0 , base >=4.6 && <5 , bytestring , conduit@@ -85,7 +85,7 @@ Paths_json_rpc build-depends: QuickCheck- , aeson+ , aeson >=2.0.3.0 , base >=4.6 && <5 , bytestring , conduit@@ -107,7 +107,7 @@ Paths_json_rpc build-depends: QuickCheck- , aeson+ , aeson >=2.0.3.0 , base >=4.6 && <5 , bytestring , conduit@@ -129,7 +129,7 @@ Paths_json_rpc build-depends: QuickCheck- , aeson+ , aeson >=2.0.3.0 , base >=4.6 && <5 , bytestring , conduit@@ -155,7 +155,7 @@ ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: QuickCheck- , aeson+ , aeson >=2.0.3.0 , base >=4.6 && <5 , bytestring , conduit
src/Network/JSONRPC/Arbitrary.hs view
@@ -2,8 +2,6 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Network.JSONRPC.Arbitrary where -import Data.Aeson.Types-import qualified Data.HashMap.Strict as M import Data.Text (Text) import qualified Data.Text as T import Network.JSONRPC.Data@@ -61,20 +59,4 @@ instance Arbitrary Id where arbitrary = IdInt <$> arbitraryBoundedRandom--instance Arbitrary Value where- arbitrary = resize 10 $ oneof [nonull, lsn, objn] where- nonull = oneof- [ toJSON <$> (arbitrary :: Gen String)- , toJSON <$> (arbitrary :: Gen Int)- , toJSON <$> (arbitrary :: Gen Double)- , toJSON <$> (arbitrary :: Gen Bool)- ]- val = oneof [ nonull, return Null ]- ls = toJSON <$> listOf val- obj = toJSON . M.fromList <$> listOf ps- ps = (,) <$> (arbitrary :: Gen String) <*> oneof [val, ls]- lsn = toJSON <$> listOf (oneof [ls, obj, val])- objn = toJSON . M.fromList <$> listOf psn- psn = (,) <$> (arbitrary :: Gen String) <*> oneof [val, ls, obj]
src/Network/JSONRPC/Data.hs view
@@ -78,15 +78,13 @@ toJSON (Request V2 m p i) = object $ case p of Null -> [jr2, "method" .= m, "id" .= i] _ -> [jr2, "method" .= m, "id" .= i, "params" .= p]- toJSON (Request V1 m p i) = object $ case p of- Null -> ["method" .= m, "params" .= emptyArray, "id" .= i]- _ -> ["method" .= m, "params" .= p, "id" .= i]+ toJSON (Request V1 m p i) =+ object ["method" .= m, "params" .= p, "id" .= i] toJSON (Notif V2 m p) = object $ case p of Null -> [jr2, "method" .= m] _ -> [jr2, "method" .= m, "params" .= p]- toJSON (Notif V1 m p) = object $ case p of- Null -> ["method" .= m, "params" .= emptyArray, "id" .= Null]- _ -> ["method" .= m, "params" .= p, "id" .= Null]+ toJSON (Notif V1 m p) =+ object ["method" .= m, "params" .= p, "id" .= Null] class FromRequest q where -- | Parser for params Value in JSON-RPC request.