Build against latest proto3-suite (#56)

This reflects the latest changes in generating `ToSchema` instances
This commit is contained in:
Gabriel Gonzalez 2018-04-20 13:37:12 -07:00 committed by GitHub
parent 3ee4dabc2d
commit 55f51eaa24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 89 additions and 29 deletions

View file

@ -5,6 +5,7 @@
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
module Echo where
import qualified Prelude as Hs
@ -15,6 +16,7 @@ import qualified Proto3.Suite.JSONPB as HsJSONPB
import Proto3.Suite.JSONPB ((.=), (.:))
import qualified Proto3.Wire as HsProtobuf
import Control.Applicative ((<*>), (<|>), (<$>))
import qualified Control.Applicative as Hs
import qualified Control.Monad as Hs
import qualified Data.Text.Lazy as Hs (Text)
import qualified Data.ByteString as Hs
@ -22,6 +24,7 @@ import qualified Data.String as Hs (fromString)
import qualified Data.Vector as Hs (Vector)
import qualified Data.Int as Hs (Int16, Int32, Int64)
import qualified Data.Word as Hs (Word16, Word32, Word64)
import qualified Data.Proxy as Proxy
import qualified GHC.Generics as Hs
import qualified GHC.Enum as Hs
import Network.GRPC.HighLevel.Generated as HsGRPC
@ -29,7 +32,6 @@ import Network.GRPC.HighLevel.Client as HsGRPC
import Network.GRPC.HighLevel.Server as HsGRPC hiding (serverLoop)
import Network.GRPC.HighLevel.Server.Unregistered as HsGRPC
(serverLoop)
import Network.GRPC.LowLevel.Call as HsGRPC
data Echo request response = Echo{echoDoEcho ::
request 'HsGRPC.Normal Echo.EchoRequest Echo.EchoResponse ->
@ -104,7 +106,20 @@ instance HsJSONPB.FromJSON EchoRequest where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema EchoRequest where
declareNamedSchema = HsJSONPB.genericDeclareNamedSchemaJSONPB
declareNamedSchema _
= do let declare_message = HsJSONPB.declareSchemaRef
echoRequestMessage <- declare_message Proxy.Proxy
let _ = Hs.pure EchoRequest <*> HsJSONPB.asProxy declare_message
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "EchoRequest",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("message", echoRequestMessage)]}})
data EchoResponse = EchoResponse{echoResponseMessage :: Hs.Text}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
@ -146,4 +161,17 @@ instance HsJSONPB.FromJSON EchoResponse where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema EchoResponse where
declareNamedSchema = HsJSONPB.genericDeclareNamedSchemaJSONPB
declareNamedSchema _
= do let declare_message = HsJSONPB.declareSchemaRef
echoResponseMessage <- declare_message Proxy.Proxy
let _ = Hs.pure EchoResponse <*> HsJSONPB.asProxy declare_message
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "EchoResponse",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("message", echoResponseMessage)]}})

View file

@ -5,6 +5,7 @@
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
module Arithmetic where
import qualified Prelude as Hs
@ -15,6 +16,7 @@ import qualified Proto3.Suite.JSONPB as HsJSONPB
import Proto3.Suite.JSONPB ((.=), (.:))
import qualified Proto3.Wire as HsProtobuf
import Control.Applicative ((<*>), (<|>), (<$>))
import qualified Control.Applicative as Hs
import qualified Control.Monad as Hs
import qualified Data.Text.Lazy as Hs (Text)
import qualified Data.ByteString as Hs
@ -22,6 +24,7 @@ import qualified Data.String as Hs (fromString)
import qualified Data.Vector as Hs (Vector)
import qualified Data.Int as Hs (Int16, Int32, Int64)
import qualified Data.Word as Hs (Word16, Word32, Word64)
import qualified Data.Proxy as Proxy
import qualified GHC.Generics as Hs
import qualified GHC.Enum as Hs
import Network.GRPC.HighLevel.Generated as HsGRPC
@ -29,7 +32,6 @@ import Network.GRPC.HighLevel.Client as HsGRPC
import Network.GRPC.HighLevel.Server as HsGRPC hiding (serverLoop)
import Network.GRPC.HighLevel.Server.Unregistered as HsGRPC
(serverLoop)
import Network.GRPC.LowLevel.Call as HsGRPC
data Arithmetic request response = Arithmetic{arithmeticAdd ::
request 'HsGRPC.Normal Arithmetic.TwoInts
@ -134,7 +136,23 @@ instance HsJSONPB.FromJSON TwoInts where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema TwoInts where
declareNamedSchema = HsJSONPB.genericDeclareNamedSchemaJSONPB
declareNamedSchema _
= do let declare_x = HsJSONPB.declareSchemaRef
twoIntsX <- declare_x Proxy.Proxy
let declare_y = HsJSONPB.declareSchemaRef
twoIntsY <- declare_y Proxy.Proxy
let _ = Hs.pure TwoInts <*> HsJSONPB.asProxy declare_x <*>
HsJSONPB.asProxy declare_y
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "TwoInts",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("x", twoIntsX), ("y", twoIntsY)]}})
data OneInt = OneInt{oneIntResult :: Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
@ -175,4 +193,16 @@ instance HsJSONPB.FromJSON OneInt where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema OneInt where
declareNamedSchema = HsJSONPB.genericDeclareNamedSchemaJSONPB
declareNamedSchema _
= do let declare_result = HsJSONPB.declareSchemaRef
oneIntResult <- declare_result Proxy.Proxy
let _ = Hs.pure OneInt <*> HsJSONPB.asProxy declare_result
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName = Hs.Just "OneInt",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("result", oneIntResult)]}})

View file

@ -1,27 +1,29 @@
{ mkDerivation, aeson, aeson-pretty, attoparsec, base
, base64-bytestring, bytestring, cereal, containers, deepseq
, doctest, fetchgit, foldl, haskell-src, lens, mtl
, neat-interpolation, optparse-generic, parsec, parsers, pretty
, pretty-show, proto3-wire, QuickCheck, range-set-list, safe
, semigroups, stdenv, swagger2, system-filepath, tasty, tasty-hunit
, tasty-quickcheck, text, transformers, turtle, vector
, base64-bytestring, binary, bytestring, cereal, containers
, deepseq, doctest, fetchgit, foldl, hashable, haskell-src
, insert-ordered-containers, lens, mtl, neat-interpolation
, optparse-generic, parsec, parsers, pretty, pretty-show
, proto3-wire, QuickCheck, range-set-list, safe, semigroups, stdenv
, swagger2, system-filepath, tasty, tasty-hunit, tasty-quickcheck
, text, transformers, turtle, vector
}:
mkDerivation {
pname = "proto3-suite";
version = "0.1.0.0";
version = "0.2.0.0";
src = fetchgit {
url = "https://github.com/awakenetworks/proto3-suite";
sha256 = "1q7fyavirkb5lh8qic4sc67jbakafr8msj6k2i29drzfpv2gbvzq";
rev = "bb66853dcaa7372ef061cf83f39e4ba5193898de";
url = "https://github.com/awakesecurity/proto3-suite.git";
sha256 = "1khix03a4hwaqc192s523rjlsk1iq923ndmrj5myh61fr1fpcbaq";
rev = "c103a8c6d3c16515fe2e9ea7f932d54729db2f5f";
};
isLibrary = true;
isExecutable = true;
enableSeparateDataOutput = true;
libraryHaskellDepends = [
aeson aeson-pretty attoparsec base base64-bytestring bytestring
cereal containers deepseq foldl haskell-src lens mtl
neat-interpolation parsec parsers pretty pretty-show proto3-wire
QuickCheck safe semigroups swagger2 system-filepath text
transformers turtle vector
aeson aeson-pretty attoparsec base base64-bytestring binary
bytestring cereal containers deepseq foldl hashable haskell-src
insert-ordered-containers lens mtl neat-interpolation parsec
parsers pretty pretty-show proto3-wire QuickCheck safe semigroups
swagger2 system-filepath text transformers turtle vector
];
executableHaskellDepends = [
base containers optparse-generic proto3-wire range-set-list
@ -29,8 +31,8 @@ mkDerivation {
];
testHaskellDepends = [
aeson attoparsec base base64-bytestring bytestring cereal doctest
pretty-show proto3-wire QuickCheck semigroups tasty tasty-hunit
tasty-quickcheck text transformers turtle vector
pretty-show proto3-wire QuickCheck semigroups swagger2 tasty
tasty-hunit tasty-quickcheck text transformers turtle vector
];
description = "A low level library for writing out data in the Protocol Buffers wire format";
license = stdenv.lib.licenses.asl20;