json-rpc 1.0.4 → 1.1.0
raw patch · 5 files changed
+30/−15 lines, 5 filesdep +attoparsec-aesondep ~aesonPVP ok
version bump matches the API change (PVP)
Dependencies added: attoparsec-aeson
Dependency ranges changed: aeson
API changes (from Hackage documentation)
- Network.JSONRPC: errorParams :: Value -> ErrorObj
+ Network.JSONRPC: errorParams :: Value -> String -> ErrorObj
Files
- CHANGELOG.md +5/−0
- json-rpc.cabal +15/−9
- src/Network/JSONRPC/Arbitrary.hs +4/−1
- src/Network/JSONRPC/Data.hs +5/−5
- src/Network/JSONRPC/Interface.hs +1/−0
CHANGELOG.md view
@@ -4,6 +4,11 @@ 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.1.0 - 2023-12-29++### Changed+- Update dependency to Aeson 2.2.+ ## 1.0.4 - 2022-05-15 ### Fixed
json-rpc.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack ----- hash: 4e2a99d4fdf85a19844c7bf16c14016bfd147baa005a628bebb4ea97823c379c+-- hash: e0d0e4a6940f7d7d8752f6f8bc7749d96342dbc95525d41d2e9d23fddfa5bcf7 name: json-rpc-version: 1.0.4+version: 1.1.0 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,8 +39,9 @@ ghc-options: -Wall build-depends: QuickCheck- , aeson >=2.0.3.0+ , aeson >=2.2 , attoparsec+ , attoparsec-aeson , base >=4.6 && <5 , bytestring , conduit@@ -63,7 +64,8 @@ Paths_json_rpc build-depends: QuickCheck- , aeson >=2.0.3.0+ , aeson >=2.2+ , attoparsec-aeson , base >=4.6 && <5 , bytestring , conduit@@ -85,7 +87,8 @@ Paths_json_rpc build-depends: QuickCheck- , aeson >=2.0.3.0+ , aeson >=2.2+ , attoparsec-aeson , base >=4.6 && <5 , bytestring , conduit@@ -107,7 +110,8 @@ Paths_json_rpc build-depends: QuickCheck- , aeson >=2.0.3.0+ , aeson >=2.2+ , attoparsec-aeson , base >=4.6 && <5 , bytestring , conduit@@ -129,7 +133,8 @@ Paths_json_rpc build-depends: QuickCheck- , aeson >=2.0.3.0+ , aeson >=2.2+ , attoparsec-aeson , base >=4.6 && <5 , bytestring , conduit@@ -155,7 +160,8 @@ ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: QuickCheck- , aeson >=2.0.3.0+ , aeson >=2.2+ , attoparsec-aeson , base >=4.6 && <5 , bytestring , conduit
src/Network/JSONRPC/Arbitrary.hs view
@@ -2,6 +2,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Network.JSONRPC.Arbitrary where +import Data.Aeson import Data.Text (Text) import qualified Data.Text as T import Network.JSONRPC.Data@@ -22,10 +23,12 @@ instance Arbitrary Response where arbitrary = oneof- [ Response <$> arbitrary <*> arbitrary <*> arbitrary+ [ Response <$> arbitrary <*> res <*> arbitrary , ResponseError <$> arbitrary <*> arbitrary <*> arbitrary , OrphanError <$> arbitrary <*> arbitrary ]+ where+ res = arbitrary `suchThat` (/= Null) instance Arbitrary ErrorObj where
src/Network/JSONRPC/Data.hs view
@@ -95,9 +95,9 @@ case parserM of Nothing -> Left $ errorMethod m Just parser ->- case parseMaybe parser p of- Nothing -> Left $ errorParams p- Just q -> Right q+ case parseEither parser p of+ Left e -> Left $ errorParams p e+ Right q -> Right q where m = getReqMethod req p = getReqParams req@@ -288,8 +288,8 @@ errorInvalid = ErrorObj "Invalid request" (-32600) -- | Invalid params.-errorParams :: Value -> ErrorObj-errorParams = ErrorObj "Invalid params" (-32602)+errorParams :: Value -> String -> ErrorObj+errorParams v e = ErrorObj ("Invalid params: " ++ e) (-32602) v -- | Method not found. errorMethod :: Method -> ErrorObj
src/Network/JSONRPC/Interface.hs view
@@ -40,6 +40,7 @@ import Control.Monad.Reader import Control.Monad.State import Data.Aeson+import Data.Aeson.Parser import Data.Aeson.Types (parseMaybe) import Data.Attoparsec.ByteString import Data.ByteString (ByteString)