proto3-suite-0.3.0.0: gen/TestProto.hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# 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 TestProto where
import qualified Prelude as Hs
import qualified Proto3.Suite.DhallPB as HsDhallPb
import qualified Proto3.Suite.DotProto as HsProtobuf
import qualified Proto3.Suite.Types as HsProtobuf
import qualified Proto3.Suite.Class as HsProtobuf
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
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 qualified TestProtoImport
data Trivial = Trivial{trivialTrivialField :: Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named Trivial where
nameOf _ = (Hs.fromString "Trivial")
instance HsProtobuf.Message Trivial where
encodeMessage _ Trivial{trivialTrivialField = trivialTrivialField}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
trivialTrivialField)])
decodeMessage _
= (Hs.pure Trivial) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "trivialField")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB Trivial where
toJSONPB (Trivial f1) = (HsJSONPB.object ["trivialField" .= f1])
toEncodingPB (Trivial f1) = (HsJSONPB.pairs ["trivialField" .= f1])
instance HsJSONPB.FromJSONPB Trivial where
parseJSONPB
= (HsJSONPB.withObject "Trivial"
(\ obj -> (Hs.pure Trivial) <*> obj .: "trivialField"))
instance HsJSONPB.ToJSON Trivial where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Trivial where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Trivial where
declareNamedSchema _
= do let declare_trivialField = HsJSONPB.declareSchemaRef
trivialTrivialField <- declare_trivialField Proxy.Proxy
let _ = Hs.pure Trivial <*> HsJSONPB.asProxy declare_trivialField
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Trivial",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("trivialField", trivialTrivialField)]}})
instance HsDhallPb.Interpret Trivial
instance HsDhallPb.Inject Trivial
data MultipleFields = MultipleFields{multipleFieldsMultiFieldDouble
:: Hs.Double,
multipleFieldsMultiFieldFloat :: Hs.Float,
multipleFieldsMultiFieldInt32 :: Hs.Int32,
multipleFieldsMultiFieldInt64 :: Hs.Int64,
multipleFieldsMultiFieldString :: Hs.Text,
multipleFieldsMultiFieldBool :: Hs.Bool}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named MultipleFields where
nameOf _ = (Hs.fromString "MultipleFields")
instance HsProtobuf.Message MultipleFields where
encodeMessage _
MultipleFields{multipleFieldsMultiFieldDouble =
multipleFieldsMultiFieldDouble,
multipleFieldsMultiFieldFloat = multipleFieldsMultiFieldFloat,
multipleFieldsMultiFieldInt32 = multipleFieldsMultiFieldInt32,
multipleFieldsMultiFieldInt64 = multipleFieldsMultiFieldInt64,
multipleFieldsMultiFieldString = multipleFieldsMultiFieldString,
multipleFieldsMultiFieldBool = multipleFieldsMultiFieldBool}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
multipleFieldsMultiFieldDouble),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
multipleFieldsMultiFieldFloat),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)
multipleFieldsMultiFieldInt32),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
multipleFieldsMultiFieldInt64),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 5)
multipleFieldsMultiFieldString),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 6)
multipleFieldsMultiFieldBool)])
decodeMessage _
= (Hs.pure MultipleFields) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 5))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 6))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Double)
(HsProtobuf.Single "multiFieldDouble")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.Float)
(HsProtobuf.Single "multiFieldFloat")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "multiFieldInt32")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Prim HsProtobuf.Int64)
(HsProtobuf.Single "multiFieldInt64")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 5)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "multiFieldString")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 6)
(HsProtobuf.Prim HsProtobuf.Bool)
(HsProtobuf.Single "multiFieldBool")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB MultipleFields where
toJSONPB (MultipleFields f1 f2 f3 f4 f5 f6)
= (HsJSONPB.object
["multiFieldDouble" .= f1, "multiFieldFloat" .= f2,
"multiFieldInt32" .= f3, "multiFieldInt64" .= f4,
"multiFieldString" .= f5, "multiFieldBool" .= f6])
toEncodingPB (MultipleFields f1 f2 f3 f4 f5 f6)
= (HsJSONPB.pairs
["multiFieldDouble" .= f1, "multiFieldFloat" .= f2,
"multiFieldInt32" .= f3, "multiFieldInt64" .= f4,
"multiFieldString" .= f5, "multiFieldBool" .= f6])
instance HsJSONPB.FromJSONPB MultipleFields where
parseJSONPB
= (HsJSONPB.withObject "MultipleFields"
(\ obj ->
(Hs.pure MultipleFields) <*> obj .: "multiFieldDouble" <*>
obj .: "multiFieldFloat"
<*> obj .: "multiFieldInt32"
<*> obj .: "multiFieldInt64"
<*> obj .: "multiFieldString"
<*> obj .: "multiFieldBool"))
instance HsJSONPB.ToJSON MultipleFields where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON MultipleFields where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema MultipleFields where
declareNamedSchema _
= do let declare_multiFieldDouble = HsJSONPB.declareSchemaRef
multipleFieldsMultiFieldDouble <- declare_multiFieldDouble
Proxy.Proxy
let declare_multiFieldFloat = HsJSONPB.declareSchemaRef
multipleFieldsMultiFieldFloat <- declare_multiFieldFloat
Proxy.Proxy
let declare_multiFieldInt32 = HsJSONPB.declareSchemaRef
multipleFieldsMultiFieldInt32 <- declare_multiFieldInt32
Proxy.Proxy
let declare_multiFieldInt64 = HsJSONPB.declareSchemaRef
multipleFieldsMultiFieldInt64 <- declare_multiFieldInt64
Proxy.Proxy
let declare_multiFieldString = HsJSONPB.declareSchemaRef
multipleFieldsMultiFieldString <- declare_multiFieldString
Proxy.Proxy
let declare_multiFieldBool = HsJSONPB.declareSchemaRef
multipleFieldsMultiFieldBool <- declare_multiFieldBool Proxy.Proxy
let _ = Hs.pure MultipleFields <*>
HsJSONPB.asProxy declare_multiFieldDouble
<*> HsJSONPB.asProxy declare_multiFieldFloat
<*> HsJSONPB.asProxy declare_multiFieldInt32
<*> HsJSONPB.asProxy declare_multiFieldInt64
<*> HsJSONPB.asProxy declare_multiFieldString
<*> HsJSONPB.asProxy declare_multiFieldBool
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "MultipleFields",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("multiFieldDouble",
multipleFieldsMultiFieldDouble),
("multiFieldFloat",
multipleFieldsMultiFieldFloat),
("multiFieldInt32",
multipleFieldsMultiFieldInt32),
("multiFieldInt64",
multipleFieldsMultiFieldInt64),
("multiFieldString",
multipleFieldsMultiFieldString),
("multiFieldBool",
multipleFieldsMultiFieldBool)]}})
instance HsDhallPb.Interpret MultipleFields
instance HsDhallPb.Inject MultipleFields
data SignedInts = SignedInts{signedIntsSigned32 :: Hs.Int32,
signedIntsSigned64 :: Hs.Int64}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named SignedInts where
nameOf _ = (Hs.fromString "SignedInts")
instance HsProtobuf.Message SignedInts where
encodeMessage _
SignedInts{signedIntsSigned32 = signedIntsSigned32,
signedIntsSigned64 = signedIntsSigned64}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Signed signedIntsSigned32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Signed signedIntsSigned64))])
decodeMessage _
= (Hs.pure SignedInts) <*>
((Hs.pure HsProtobuf.signed) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
((Hs.pure HsProtobuf.signed) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.SInt32)
(HsProtobuf.Single "signed32")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.SInt64)
(HsProtobuf.Single "signed64")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB SignedInts where
toJSONPB (SignedInts f1 f2)
= (HsJSONPB.object ["signed32" .= f1, "signed64" .= f2])
toEncodingPB (SignedInts f1 f2)
= (HsJSONPB.pairs ["signed32" .= f1, "signed64" .= f2])
instance HsJSONPB.FromJSONPB SignedInts where
parseJSONPB
= (HsJSONPB.withObject "SignedInts"
(\ obj ->
(Hs.pure SignedInts) <*> obj .: "signed32" <*> obj .: "signed64"))
instance HsJSONPB.ToJSON SignedInts where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON SignedInts where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema SignedInts where
declareNamedSchema _
= do let declare_signed32 = HsJSONPB.declareSchemaRef
signedIntsSigned32 <- declare_signed32 Proxy.Proxy
let declare_signed64 = HsJSONPB.declareSchemaRef
signedIntsSigned64 <- declare_signed64 Proxy.Proxy
let _ = Hs.pure SignedInts <*> HsJSONPB.asProxy declare_signed32
<*> HsJSONPB.asProxy declare_signed64
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "SignedInts",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("signed32", signedIntsSigned32),
("signed64", signedIntsSigned64)]}})
instance HsDhallPb.Interpret SignedInts
instance HsDhallPb.Inject SignedInts
data WithEnum = WithEnum{withEnumEnumField ::
HsProtobuf.Enumerated TestProto.WithEnum_TestEnum}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithEnum where
nameOf _ = (Hs.fromString "WithEnum")
instance HsProtobuf.Message WithEnum where
encodeMessage _ WithEnum{withEnumEnumField = withEnumEnumField}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
withEnumEnumField)])
decodeMessage _
= (Hs.pure WithEnum) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "TestEnum")))
(HsProtobuf.Single "enumField")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithEnum where
toJSONPB (WithEnum f1) = (HsJSONPB.object ["enumField" .= f1])
toEncodingPB (WithEnum f1) = (HsJSONPB.pairs ["enumField" .= f1])
instance HsJSONPB.FromJSONPB WithEnum where
parseJSONPB
= (HsJSONPB.withObject "WithEnum"
(\ obj -> (Hs.pure WithEnum) <*> obj .: "enumField"))
instance HsJSONPB.ToJSON WithEnum where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithEnum where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithEnum where
declareNamedSchema _
= do let declare_enumField = HsJSONPB.declareSchemaRef
withEnumEnumField <- declare_enumField Proxy.Proxy
let _ = Hs.pure WithEnum <*> HsJSONPB.asProxy declare_enumField
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithEnum",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("enumField", withEnumEnumField)]}})
instance HsDhallPb.Interpret WithEnum
instance HsDhallPb.Inject WithEnum
data WithEnum_TestEnum = WithEnum_TestEnumENUM1
| WithEnum_TestEnumENUM2
| WithEnum_TestEnumENUM3
deriving (Hs.Show, Hs.Bounded, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithEnum_TestEnum where
nameOf _ = (Hs.fromString "WithEnum_TestEnum")
instance Hs.Enum WithEnum_TestEnum where
toEnum 0 = WithEnum_TestEnumENUM1
toEnum 1 = WithEnum_TestEnumENUM2
toEnum 2 = WithEnum_TestEnumENUM3
toEnum i = (Hs.toEnumError "WithEnum_TestEnum" i (0 :: Hs.Int, 2))
fromEnum (WithEnum_TestEnumENUM1) = 0
fromEnum (WithEnum_TestEnumENUM2) = 1
fromEnum (WithEnum_TestEnumENUM3) = 2
succ (WithEnum_TestEnumENUM1) = WithEnum_TestEnumENUM2
succ (WithEnum_TestEnumENUM2) = WithEnum_TestEnumENUM3
succ _ = Hs.succError "WithEnum_TestEnum"
pred (WithEnum_TestEnumENUM2) = WithEnum_TestEnumENUM1
pred (WithEnum_TestEnumENUM3) = WithEnum_TestEnumENUM2
pred _ = Hs.predError "WithEnum_TestEnum"
instance HsJSONPB.ToJSONPB WithEnum_TestEnum where
toJSONPB x _ = HsJSONPB.enumFieldString x
toEncodingPB x _ = HsJSONPB.enumFieldEncoding x
instance HsJSONPB.FromJSONPB WithEnum_TestEnum where
parseJSONPB (HsJSONPB.String "ENUM1")
= Hs.pure WithEnum_TestEnumENUM1
parseJSONPB (HsJSONPB.String "ENUM2")
= Hs.pure WithEnum_TestEnumENUM2
parseJSONPB (HsJSONPB.String "ENUM3")
= Hs.pure WithEnum_TestEnumENUM3
parseJSONPB v = (HsJSONPB.typeMismatch "WithEnum_TestEnum" v)
instance HsJSONPB.ToJSON WithEnum_TestEnum where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithEnum_TestEnum where
parseJSON = HsJSONPB.parseJSONPB
instance HsDhallPb.Interpret WithEnum_TestEnum
instance HsDhallPb.Inject WithEnum_TestEnum
instance HsProtobuf.Finite WithEnum_TestEnum
data WithNesting = WithNesting{withNestingNestedMessage ::
Hs.Maybe TestProto.WithNesting_Nested}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithNesting where
nameOf _ = (Hs.fromString "WithNesting")
instance HsProtobuf.Message WithNesting where
encodeMessage _
WithNesting{withNestingNestedMessage = withNestingNestedMessage}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Nested withNestingNestedMessage))])
decodeMessage _
= (Hs.pure WithNesting) <*>
((Hs.pure HsProtobuf.nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Nested")))
(HsProtobuf.Single "nestedMessage")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithNesting where
toJSONPB (WithNesting f1)
= (HsJSONPB.object ["nestedMessage" .= f1])
toEncodingPB (WithNesting f1)
= (HsJSONPB.pairs ["nestedMessage" .= f1])
instance HsJSONPB.FromJSONPB WithNesting where
parseJSONPB
= (HsJSONPB.withObject "WithNesting"
(\ obj -> (Hs.pure WithNesting) <*> obj .: "nestedMessage"))
instance HsJSONPB.ToJSON WithNesting where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithNesting where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithNesting where
declareNamedSchema _
= do let declare_nestedMessage = HsJSONPB.declareSchemaRef
withNestingNestedMessage <- declare_nestedMessage Proxy.Proxy
let _ = Hs.pure WithNesting <*>
HsJSONPB.asProxy declare_nestedMessage
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithNesting",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedMessage",
withNestingNestedMessage)]}})
instance HsDhallPb.Interpret WithNesting
instance HsDhallPb.Inject WithNesting
data WithNesting_Nested = WithNesting_Nested{withNesting_NestedNestedField1
:: Hs.Text,
withNesting_NestedNestedField2 :: Hs.Int32,
withNesting_NestedNestedPacked :: Hs.Vector Hs.Int32,
withNesting_NestedNestedUnpacked :: Hs.Vector Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithNesting_Nested where
nameOf _ = (Hs.fromString "WithNesting_Nested")
instance HsProtobuf.Message WithNesting_Nested where
encodeMessage _
WithNesting_Nested{withNesting_NestedNestedField1 =
withNesting_NestedNestedField1,
withNesting_NestedNestedField2 = withNesting_NestedNestedField2,
withNesting_NestedNestedPacked = withNesting_NestedNestedPacked,
withNesting_NestedNestedUnpacked =
withNesting_NestedNestedUnpacked}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
withNesting_NestedNestedField1),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
withNesting_NestedNestedField2),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)
(HsProtobuf.PackedVec withNesting_NestedNestedPacked)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
(HsProtobuf.UnpackedVec withNesting_NestedNestedUnpacked))])
decodeMessage _
= (Hs.pure WithNesting_Nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3)))
<*>
((Hs.pure HsProtobuf.unpackedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "nestedField1")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "nestedField2")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "nestedPacked")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "nestedUnpacked")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.False))]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithNesting_Nested where
toJSONPB (WithNesting_Nested f1 f2 f3 f4)
= (HsJSONPB.object
["nestedField1" .= f1, "nestedField2" .= f2, "nestedPacked" .= f3,
"nestedUnpacked" .= f4])
toEncodingPB (WithNesting_Nested f1 f2 f3 f4)
= (HsJSONPB.pairs
["nestedField1" .= f1, "nestedField2" .= f2, "nestedPacked" .= f3,
"nestedUnpacked" .= f4])
instance HsJSONPB.FromJSONPB WithNesting_Nested where
parseJSONPB
= (HsJSONPB.withObject "WithNesting_Nested"
(\ obj ->
(Hs.pure WithNesting_Nested) <*> obj .: "nestedField1" <*>
obj .: "nestedField2"
<*> obj .: "nestedPacked"
<*> obj .: "nestedUnpacked"))
instance HsJSONPB.ToJSON WithNesting_Nested where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithNesting_Nested where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithNesting_Nested where
declareNamedSchema _
= do let declare_nestedField1 = HsJSONPB.declareSchemaRef
withNesting_NestedNestedField1 <- declare_nestedField1 Proxy.Proxy
let declare_nestedField2 = HsJSONPB.declareSchemaRef
withNesting_NestedNestedField2 <- declare_nestedField2 Proxy.Proxy
let declare_nestedPacked = HsJSONPB.declareSchemaRef
withNesting_NestedNestedPacked <- declare_nestedPacked Proxy.Proxy
let declare_nestedUnpacked = HsJSONPB.declareSchemaRef
withNesting_NestedNestedUnpacked <- declare_nestedUnpacked
Proxy.Proxy
let _ = Hs.pure WithNesting_Nested <*>
HsJSONPB.asProxy declare_nestedField1
<*> HsJSONPB.asProxy declare_nestedField2
<*> HsJSONPB.asProxy declare_nestedPacked
<*> HsJSONPB.asProxy declare_nestedUnpacked
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithNesting_Nested",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedField1",
withNesting_NestedNestedField1),
("nestedField2",
withNesting_NestedNestedField2),
("nestedPacked",
withNesting_NestedNestedPacked),
("nestedUnpacked",
withNesting_NestedNestedUnpacked)]}})
instance HsDhallPb.Interpret WithNesting_Nested
instance HsDhallPb.Inject WithNesting_Nested
data WithNestingRepeated = WithNestingRepeated{withNestingRepeatedNestedMessages
:: Hs.Vector TestProto.WithNestingRepeated_Nested}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithNestingRepeated where
nameOf _ = (Hs.fromString "WithNestingRepeated")
instance HsProtobuf.Message WithNestingRepeated where
encodeMessage _
WithNestingRepeated{withNestingRepeatedNestedMessages =
withNestingRepeatedNestedMessages}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.NestedVec withNestingRepeatedNestedMessages))])
decodeMessage _
= (Hs.pure WithNestingRepeated) <*>
((Hs.pure HsProtobuf.nestedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated
(HsProtobuf.Named (HsProtobuf.Single "Nested")))
(HsProtobuf.Single "nestedMessages")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithNestingRepeated where
toJSONPB (WithNestingRepeated f1)
= (HsJSONPB.object ["nestedMessages" .= f1])
toEncodingPB (WithNestingRepeated f1)
= (HsJSONPB.pairs ["nestedMessages" .= f1])
instance HsJSONPB.FromJSONPB WithNestingRepeated where
parseJSONPB
= (HsJSONPB.withObject "WithNestingRepeated"
(\ obj ->
(Hs.pure WithNestingRepeated) <*> obj .: "nestedMessages"))
instance HsJSONPB.ToJSON WithNestingRepeated where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithNestingRepeated where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithNestingRepeated where
declareNamedSchema _
= do let declare_nestedMessages = HsJSONPB.declareSchemaRef
withNestingRepeatedNestedMessages <- declare_nestedMessages
Proxy.Proxy
let _ = Hs.pure WithNestingRepeated <*>
HsJSONPB.asProxy declare_nestedMessages
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithNestingRepeated",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedMessages",
withNestingRepeatedNestedMessages)]}})
instance HsDhallPb.Interpret WithNestingRepeated
instance HsDhallPb.Inject WithNestingRepeated
data WithNestingRepeated_Nested = WithNestingRepeated_Nested{withNestingRepeated_NestedNestedField1
:: Hs.Text,
withNestingRepeated_NestedNestedField2
:: Hs.Int32,
withNestingRepeated_NestedNestedPacked
:: Hs.Vector Hs.Int32,
withNestingRepeated_NestedNestedUnpacked
:: Hs.Vector Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithNestingRepeated_Nested where
nameOf _ = (Hs.fromString "WithNestingRepeated_Nested")
instance HsProtobuf.Message WithNestingRepeated_Nested where
encodeMessage _
WithNestingRepeated_Nested{withNestingRepeated_NestedNestedField1 =
withNestingRepeated_NestedNestedField1,
withNestingRepeated_NestedNestedField2 =
withNestingRepeated_NestedNestedField2,
withNestingRepeated_NestedNestedPacked =
withNestingRepeated_NestedNestedPacked,
withNestingRepeated_NestedNestedUnpacked =
withNestingRepeated_NestedNestedUnpacked}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
withNestingRepeated_NestedNestedField1),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
withNestingRepeated_NestedNestedField2),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)
(HsProtobuf.PackedVec withNestingRepeated_NestedNestedPacked)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
(HsProtobuf.UnpackedVec
withNestingRepeated_NestedNestedUnpacked))])
decodeMessage _
= (Hs.pure WithNestingRepeated_Nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3)))
<*>
((Hs.pure HsProtobuf.unpackedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "nestedField1")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "nestedField2")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "nestedPacked")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "nestedUnpacked")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.False))]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithNestingRepeated_Nested where
toJSONPB (WithNestingRepeated_Nested f1 f2 f3 f4)
= (HsJSONPB.object
["nestedField1" .= f1, "nestedField2" .= f2, "nestedPacked" .= f3,
"nestedUnpacked" .= f4])
toEncodingPB (WithNestingRepeated_Nested f1 f2 f3 f4)
= (HsJSONPB.pairs
["nestedField1" .= f1, "nestedField2" .= f2, "nestedPacked" .= f3,
"nestedUnpacked" .= f4])
instance HsJSONPB.FromJSONPB WithNestingRepeated_Nested where
parseJSONPB
= (HsJSONPB.withObject "WithNestingRepeated_Nested"
(\ obj ->
(Hs.pure WithNestingRepeated_Nested) <*> obj .: "nestedField1" <*>
obj .: "nestedField2"
<*> obj .: "nestedPacked"
<*> obj .: "nestedUnpacked"))
instance HsJSONPB.ToJSON WithNestingRepeated_Nested where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithNestingRepeated_Nested where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithNestingRepeated_Nested where
declareNamedSchema _
= do let declare_nestedField1 = HsJSONPB.declareSchemaRef
withNestingRepeated_NestedNestedField1 <- declare_nestedField1
Proxy.Proxy
let declare_nestedField2 = HsJSONPB.declareSchemaRef
withNestingRepeated_NestedNestedField2 <- declare_nestedField2
Proxy.Proxy
let declare_nestedPacked = HsJSONPB.declareSchemaRef
withNestingRepeated_NestedNestedPacked <- declare_nestedPacked
Proxy.Proxy
let declare_nestedUnpacked = HsJSONPB.declareSchemaRef
withNestingRepeated_NestedNestedUnpacked <- declare_nestedUnpacked
Proxy.Proxy
let _ = Hs.pure WithNestingRepeated_Nested <*>
HsJSONPB.asProxy declare_nestedField1
<*> HsJSONPB.asProxy declare_nestedField2
<*> HsJSONPB.asProxy declare_nestedPacked
<*> HsJSONPB.asProxy declare_nestedUnpacked
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithNestingRepeated_Nested",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedField1",
withNestingRepeated_NestedNestedField1),
("nestedField2",
withNestingRepeated_NestedNestedField2),
("nestedPacked",
withNestingRepeated_NestedNestedPacked),
("nestedUnpacked",
withNestingRepeated_NestedNestedUnpacked)]}})
instance HsDhallPb.Interpret WithNestingRepeated_Nested
instance HsDhallPb.Inject WithNestingRepeated_Nested
data NestedInts = NestedInts{nestedIntsNestedInt1 :: Hs.Int32,
nestedIntsNestedInt2 :: Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named NestedInts where
nameOf _ = (Hs.fromString "NestedInts")
instance HsProtobuf.Message NestedInts where
encodeMessage _
NestedInts{nestedIntsNestedInt1 = nestedIntsNestedInt1,
nestedIntsNestedInt2 = nestedIntsNestedInt2}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
nestedIntsNestedInt1),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
nestedIntsNestedInt2)])
decodeMessage _
= (Hs.pure NestedInts) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "nestedInt1")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "nestedInt2")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB NestedInts where
toJSONPB (NestedInts f1 f2)
= (HsJSONPB.object ["nestedInt1" .= f1, "nestedInt2" .= f2])
toEncodingPB (NestedInts f1 f2)
= (HsJSONPB.pairs ["nestedInt1" .= f1, "nestedInt2" .= f2])
instance HsJSONPB.FromJSONPB NestedInts where
parseJSONPB
= (HsJSONPB.withObject "NestedInts"
(\ obj ->
(Hs.pure NestedInts) <*> obj .: "nestedInt1" <*>
obj .: "nestedInt2"))
instance HsJSONPB.ToJSON NestedInts where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON NestedInts where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema NestedInts where
declareNamedSchema _
= do let declare_nestedInt1 = HsJSONPB.declareSchemaRef
nestedIntsNestedInt1 <- declare_nestedInt1 Proxy.Proxy
let declare_nestedInt2 = HsJSONPB.declareSchemaRef
nestedIntsNestedInt2 <- declare_nestedInt2 Proxy.Proxy
let _ = Hs.pure NestedInts <*> HsJSONPB.asProxy declare_nestedInt1
<*> HsJSONPB.asProxy declare_nestedInt2
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "NestedInts",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedInt1", nestedIntsNestedInt1),
("nestedInt2", nestedIntsNestedInt2)]}})
instance HsDhallPb.Interpret NestedInts
instance HsDhallPb.Inject NestedInts
data WithNestingRepeatedInts = WithNestingRepeatedInts{withNestingRepeatedIntsNestedInts
:: Hs.Vector TestProto.NestedInts}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithNestingRepeatedInts where
nameOf _ = (Hs.fromString "WithNestingRepeatedInts")
instance HsProtobuf.Message WithNestingRepeatedInts where
encodeMessage _
WithNestingRepeatedInts{withNestingRepeatedIntsNestedInts =
withNestingRepeatedIntsNestedInts}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.NestedVec withNestingRepeatedIntsNestedInts))])
decodeMessage _
= (Hs.pure WithNestingRepeatedInts) <*>
((Hs.pure HsProtobuf.nestedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated
(HsProtobuf.Named (HsProtobuf.Single "NestedInts")))
(HsProtobuf.Single "nestedInts")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithNestingRepeatedInts where
toJSONPB (WithNestingRepeatedInts f1)
= (HsJSONPB.object ["nestedInts" .= f1])
toEncodingPB (WithNestingRepeatedInts f1)
= (HsJSONPB.pairs ["nestedInts" .= f1])
instance HsJSONPB.FromJSONPB WithNestingRepeatedInts where
parseJSONPB
= (HsJSONPB.withObject "WithNestingRepeatedInts"
(\ obj ->
(Hs.pure WithNestingRepeatedInts) <*> obj .: "nestedInts"))
instance HsJSONPB.ToJSON WithNestingRepeatedInts where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithNestingRepeatedInts where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithNestingRepeatedInts where
declareNamedSchema _
= do let declare_nestedInts = HsJSONPB.declareSchemaRef
withNestingRepeatedIntsNestedInts <- declare_nestedInts Proxy.Proxy
let _ = Hs.pure WithNestingRepeatedInts <*>
HsJSONPB.asProxy declare_nestedInts
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithNestingRepeatedInts",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedInts",
withNestingRepeatedIntsNestedInts)]}})
instance HsDhallPb.Interpret WithNestingRepeatedInts
instance HsDhallPb.Inject WithNestingRepeatedInts
data WithNestingInts = WithNestingInts{withNestingIntsNestedInts ::
Hs.Maybe TestProto.NestedInts}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithNestingInts where
nameOf _ = (Hs.fromString "WithNestingInts")
instance HsProtobuf.Message WithNestingInts where
encodeMessage _
WithNestingInts{withNestingIntsNestedInts =
withNestingIntsNestedInts}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Nested withNestingIntsNestedInts))])
decodeMessage _
= (Hs.pure WithNestingInts) <*>
((Hs.pure HsProtobuf.nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim
(HsProtobuf.Named (HsProtobuf.Single "NestedInts")))
(HsProtobuf.Single "nestedInts")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithNestingInts where
toJSONPB (WithNestingInts f1)
= (HsJSONPB.object ["nestedInts" .= f1])
toEncodingPB (WithNestingInts f1)
= (HsJSONPB.pairs ["nestedInts" .= f1])
instance HsJSONPB.FromJSONPB WithNestingInts where
parseJSONPB
= (HsJSONPB.withObject "WithNestingInts"
(\ obj -> (Hs.pure WithNestingInts) <*> obj .: "nestedInts"))
instance HsJSONPB.ToJSON WithNestingInts where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithNestingInts where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithNestingInts where
declareNamedSchema _
= do let declare_nestedInts = HsJSONPB.declareSchemaRef
withNestingIntsNestedInts <- declare_nestedInts Proxy.Proxy
let _ = Hs.pure WithNestingInts <*>
HsJSONPB.asProxy declare_nestedInts
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithNestingInts",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedInts",
withNestingIntsNestedInts)]}})
instance HsDhallPb.Interpret WithNestingInts
instance HsDhallPb.Inject WithNestingInts
data WithRepetition = WithRepetition{withRepetitionRepeatedField1
:: Hs.Vector Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithRepetition where
nameOf _ = (Hs.fromString "WithRepetition")
instance HsProtobuf.Message WithRepetition where
encodeMessage _
WithRepetition{withRepetitionRepeatedField1 =
withRepetitionRepeatedField1}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.PackedVec withRepetitionRepeatedField1))])
decodeMessage _
= (Hs.pure WithRepetition) <*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "repeatedField1")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithRepetition where
toJSONPB (WithRepetition f1)
= (HsJSONPB.object ["repeatedField1" .= f1])
toEncodingPB (WithRepetition f1)
= (HsJSONPB.pairs ["repeatedField1" .= f1])
instance HsJSONPB.FromJSONPB WithRepetition where
parseJSONPB
= (HsJSONPB.withObject "WithRepetition"
(\ obj -> (Hs.pure WithRepetition) <*> obj .: "repeatedField1"))
instance HsJSONPB.ToJSON WithRepetition where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithRepetition where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithRepetition where
declareNamedSchema _
= do let declare_repeatedField1 = HsJSONPB.declareSchemaRef
withRepetitionRepeatedField1 <- declare_repeatedField1 Proxy.Proxy
let _ = Hs.pure WithRepetition <*>
HsJSONPB.asProxy declare_repeatedField1
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithRepetition",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("repeatedField1",
withRepetitionRepeatedField1)]}})
instance HsDhallPb.Interpret WithRepetition
instance HsDhallPb.Inject WithRepetition
data WithFixed = WithFixed{withFixedFixed1 ::
HsProtobuf.Fixed Hs.Word32,
withFixedFixed2 :: HsProtobuf.Fixed Hs.Int32,
withFixedFixed3 :: HsProtobuf.Fixed Hs.Word64,
withFixedFixed4 :: HsProtobuf.Fixed Hs.Int64}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithFixed where
nameOf _ = (Hs.fromString "WithFixed")
instance HsProtobuf.Message WithFixed where
encodeMessage _
WithFixed{withFixedFixed1 = withFixedFixed1,
withFixedFixed2 = withFixedFixed2,
withFixedFixed3 = withFixedFixed3,
withFixedFixed4 = withFixedFixed4}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
withFixedFixed1),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Signed withFixedFixed2)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)
withFixedFixed3),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Signed withFixedFixed4))])
decodeMessage _
= (Hs.pure WithFixed) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
((Hs.pure HsProtobuf.signed) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3))
<*>
((Hs.pure HsProtobuf.signed) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Fixed32)
(HsProtobuf.Single "fixed1")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.SFixed32)
(HsProtobuf.Single "fixed2")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Prim HsProtobuf.Fixed64)
(HsProtobuf.Single "fixed3")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Prim HsProtobuf.SFixed64)
(HsProtobuf.Single "fixed4")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithFixed where
toJSONPB (WithFixed f1 f2 f3 f4)
= (HsJSONPB.object
["fixed1" .= f1, "fixed2" .= f2, "fixed3" .= f3, "fixed4" .= f4])
toEncodingPB (WithFixed f1 f2 f3 f4)
= (HsJSONPB.pairs
["fixed1" .= f1, "fixed2" .= f2, "fixed3" .= f3, "fixed4" .= f4])
instance HsJSONPB.FromJSONPB WithFixed where
parseJSONPB
= (HsJSONPB.withObject "WithFixed"
(\ obj ->
(Hs.pure WithFixed) <*> obj .: "fixed1" <*> obj .: "fixed2" <*>
obj .: "fixed3"
<*> obj .: "fixed4"))
instance HsJSONPB.ToJSON WithFixed where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithFixed where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithFixed where
declareNamedSchema _
= do let declare_fixed1 = HsJSONPB.declareSchemaRef
withFixedFixed1 <- declare_fixed1 Proxy.Proxy
let declare_fixed2 = HsJSONPB.declareSchemaRef
withFixedFixed2 <- declare_fixed2 Proxy.Proxy
let declare_fixed3 = HsJSONPB.declareSchemaRef
withFixedFixed3 <- declare_fixed3 Proxy.Proxy
let declare_fixed4 = HsJSONPB.declareSchemaRef
withFixedFixed4 <- declare_fixed4 Proxy.Proxy
let _ = Hs.pure WithFixed <*> HsJSONPB.asProxy declare_fixed1 <*>
HsJSONPB.asProxy declare_fixed2
<*> HsJSONPB.asProxy declare_fixed3
<*> HsJSONPB.asProxy declare_fixed4
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithFixed",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("fixed1", withFixedFixed1),
("fixed2", withFixedFixed2),
("fixed3", withFixedFixed3),
("fixed4", withFixedFixed4)]}})
instance HsDhallPb.Interpret WithFixed
instance HsDhallPb.Inject WithFixed
data WithBytes = WithBytes{withBytesBytes1 :: Hs.ByteString,
withBytesBytes2 :: Hs.Vector Hs.ByteString}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithBytes where
nameOf _ = (Hs.fromString "WithBytes")
instance HsProtobuf.Message WithBytes where
encodeMessage _
WithBytes{withBytesBytes1 = withBytesBytes1,
withBytesBytes2 = withBytesBytes2}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
withBytesBytes1),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(HsProtobuf.UnpackedVec withBytesBytes2))])
decodeMessage _
= (Hs.pure WithBytes) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
((Hs.pure HsProtobuf.unpackedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Bytes)
(HsProtobuf.Single "bytes1")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Repeated HsProtobuf.Bytes)
(HsProtobuf.Single "bytes2")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithBytes where
toJSONPB (WithBytes f1 f2)
= (HsJSONPB.object ["bytes1" .= f1, "bytes2" .= f2])
toEncodingPB (WithBytes f1 f2)
= (HsJSONPB.pairs ["bytes1" .= f1, "bytes2" .= f2])
instance HsJSONPB.FromJSONPB WithBytes where
parseJSONPB
= (HsJSONPB.withObject "WithBytes"
(\ obj ->
(Hs.pure WithBytes) <*> obj .: "bytes1" <*> obj .: "bytes2"))
instance HsJSONPB.ToJSON WithBytes where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithBytes where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithBytes where
declareNamedSchema _
= do let declare_bytes1 = HsJSONPB.declareSchemaRef
withBytesBytes1 <- declare_bytes1 Proxy.Proxy
let declare_bytes2 = HsJSONPB.declareSchemaRef
withBytesBytes2 <- declare_bytes2 Proxy.Proxy
let _ = Hs.pure WithBytes <*> HsJSONPB.asProxy declare_bytes1 <*>
HsJSONPB.asProxy declare_bytes2
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithBytes",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("bytes1", withBytesBytes1),
("bytes2", withBytesBytes2)]}})
instance HsDhallPb.Interpret WithBytes
instance HsDhallPb.Inject WithBytes
data WithPacking = WithPacking{withPackingPacking1 ::
Hs.Vector Hs.Int32,
withPackingPacking2 :: Hs.Vector Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithPacking where
nameOf _ = (Hs.fromString "WithPacking")
instance HsProtobuf.Message WithPacking where
encodeMessage _
WithPacking{withPackingPacking1 = withPackingPacking1,
withPackingPacking2 = withPackingPacking2}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.UnpackedVec withPackingPacking1)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(HsProtobuf.PackedVec withPackingPacking2))])
decodeMessage _
= (Hs.pure WithPacking) <*>
((Hs.pure HsProtobuf.unpackedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "packing1")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.False))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "packing2")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithPacking where
toJSONPB (WithPacking f1 f2)
= (HsJSONPB.object ["packing1" .= f1, "packing2" .= f2])
toEncodingPB (WithPacking f1 f2)
= (HsJSONPB.pairs ["packing1" .= f1, "packing2" .= f2])
instance HsJSONPB.FromJSONPB WithPacking where
parseJSONPB
= (HsJSONPB.withObject "WithPacking"
(\ obj ->
(Hs.pure WithPacking) <*> obj .: "packing1" <*> obj .: "packing2"))
instance HsJSONPB.ToJSON WithPacking where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithPacking where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithPacking where
declareNamedSchema _
= do let declare_packing1 = HsJSONPB.declareSchemaRef
withPackingPacking1 <- declare_packing1 Proxy.Proxy
let declare_packing2 = HsJSONPB.declareSchemaRef
withPackingPacking2 <- declare_packing2 Proxy.Proxy
let _ = Hs.pure WithPacking <*> HsJSONPB.asProxy declare_packing1
<*> HsJSONPB.asProxy declare_packing2
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithPacking",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("packing1", withPackingPacking1),
("packing2", withPackingPacking2)]}})
instance HsDhallPb.Interpret WithPacking
instance HsDhallPb.Inject WithPacking
data E = EFLD0
| EFLD1
deriving (Hs.Show, Hs.Bounded, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named E where
nameOf _ = (Hs.fromString "E")
instance Hs.Enum E where
toEnum 0 = EFLD0
toEnum 1 = EFLD1
toEnum i = (Hs.toEnumError "E" i (0 :: Hs.Int, 1))
fromEnum (EFLD0) = 0
fromEnum (EFLD1) = 1
succ (EFLD0) = EFLD1
succ _ = Hs.succError "E"
pred (EFLD1) = EFLD0
pred _ = Hs.predError "E"
instance HsJSONPB.ToJSONPB E where
toJSONPB x _ = HsJSONPB.enumFieldString x
toEncodingPB x _ = HsJSONPB.enumFieldEncoding x
instance HsJSONPB.FromJSONPB E where
parseJSONPB (HsJSONPB.String "FLD0") = Hs.pure EFLD0
parseJSONPB (HsJSONPB.String "FLD1") = Hs.pure EFLD1
parseJSONPB v = (HsJSONPB.typeMismatch "E" v)
instance HsJSONPB.ToJSON E where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON E where
parseJSON = HsJSONPB.parseJSONPB
instance HsDhallPb.Interpret E
instance HsDhallPb.Inject E
instance HsProtobuf.Finite E
data AllPackedTypes = AllPackedTypes{allPackedTypesPackedWord32 ::
Hs.Vector Hs.Word32,
allPackedTypesPackedWord64 :: Hs.Vector Hs.Word64,
allPackedTypesPackedInt32 :: Hs.Vector Hs.Int32,
allPackedTypesPackedInt64 :: Hs.Vector Hs.Int64,
allPackedTypesPackedFixed32 ::
Hs.Vector (HsProtobuf.Fixed Hs.Word32),
allPackedTypesPackedFixed64 ::
Hs.Vector (HsProtobuf.Fixed Hs.Word64),
allPackedTypesPackedFloat :: Hs.Vector Hs.Float,
allPackedTypesPackedDouble :: Hs.Vector Hs.Double,
allPackedTypesPackedSFixed32 ::
Hs.Vector (HsProtobuf.Fixed Hs.Int32),
allPackedTypesPackedSFixed64 ::
Hs.Vector (HsProtobuf.Fixed Hs.Int64),
allPackedTypesPackedBool :: Hs.Vector Hs.Bool,
allPackedTypesPackedEnum ::
Hs.Vector (HsProtobuf.Enumerated TestProto.E),
allPackedTypesUnpackedEnum ::
Hs.Vector (HsProtobuf.Enumerated TestProto.E)}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named AllPackedTypes where
nameOf _ = (Hs.fromString "AllPackedTypes")
instance HsProtobuf.Message AllPackedTypes where
encodeMessage _
AllPackedTypes{allPackedTypesPackedWord32 =
allPackedTypesPackedWord32,
allPackedTypesPackedWord64 = allPackedTypesPackedWord64,
allPackedTypesPackedInt32 = allPackedTypesPackedInt32,
allPackedTypesPackedInt64 = allPackedTypesPackedInt64,
allPackedTypesPackedFixed32 = allPackedTypesPackedFixed32,
allPackedTypesPackedFixed64 = allPackedTypesPackedFixed64,
allPackedTypesPackedFloat = allPackedTypesPackedFloat,
allPackedTypesPackedDouble = allPackedTypesPackedDouble,
allPackedTypesPackedSFixed32 = allPackedTypesPackedSFixed32,
allPackedTypesPackedSFixed64 = allPackedTypesPackedSFixed64,
allPackedTypesPackedBool = allPackedTypesPackedBool,
allPackedTypesPackedEnum = allPackedTypesPackedEnum,
allPackedTypesUnpackedEnum = allPackedTypesUnpackedEnum}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.PackedVec allPackedTypesPackedWord32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(HsProtobuf.PackedVec allPackedTypesPackedWord64)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)
(HsProtobuf.PackedVec allPackedTypesPackedInt32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
(HsProtobuf.PackedVec allPackedTypesPackedInt64)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 5)
(HsProtobuf.PackedVec allPackedTypesPackedFixed32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 6)
(HsProtobuf.PackedVec allPackedTypesPackedFixed64)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 7)
(HsProtobuf.PackedVec allPackedTypesPackedFloat)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 8)
(HsProtobuf.PackedVec allPackedTypesPackedDouble)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 9)
(HsProtobuf.PackedVec
(Hs.fmap HsProtobuf.Signed allPackedTypesPackedSFixed32))),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 10)
(HsProtobuf.PackedVec
(Hs.fmap HsProtobuf.Signed allPackedTypesPackedSFixed64))),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 11)
(HsProtobuf.PackedVec allPackedTypesPackedBool)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 12)
(HsProtobuf.PackedVec allPackedTypesPackedEnum)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 13)
(HsProtobuf.UnpackedVec allPackedTypesUnpackedEnum))])
decodeMessage _
= (Hs.pure AllPackedTypes) <*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 5)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 6)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 7)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 8)))
<*>
((Hs.pure (Hs.fmap HsProtobuf.signed)) <*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 9))))
<*>
((Hs.pure (Hs.fmap HsProtobuf.signed)) <*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 10))))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 11)))
<*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 12)))
<*>
((Hs.pure HsProtobuf.unpackedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 13)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated HsProtobuf.UInt32)
(HsProtobuf.Single "packedWord32")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Repeated HsProtobuf.UInt64)
(HsProtobuf.Single "packedWord64")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "packedInt32")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Repeated HsProtobuf.Int64)
(HsProtobuf.Single "packedInt64")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 5)
(HsProtobuf.Repeated HsProtobuf.Fixed32)
(HsProtobuf.Single "packedFixed32")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 6)
(HsProtobuf.Repeated HsProtobuf.Fixed64)
(HsProtobuf.Single "packedFixed64")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 7)
(HsProtobuf.Repeated HsProtobuf.Float)
(HsProtobuf.Single "packedFloat")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 8)
(HsProtobuf.Repeated HsProtobuf.Double)
(HsProtobuf.Single "packedDouble")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 9)
(HsProtobuf.Repeated HsProtobuf.SFixed32)
(HsProtobuf.Single "packedSFixed32")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 10)
(HsProtobuf.Repeated HsProtobuf.SFixed64)
(HsProtobuf.Single "packedSFixed64")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 11)
(HsProtobuf.Repeated HsProtobuf.Bool)
(HsProtobuf.Single "packedBool")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 12)
(HsProtobuf.Repeated (HsProtobuf.Named (HsProtobuf.Single "E")))
(HsProtobuf.Single "packedEnum")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 13)
(HsProtobuf.Repeated (HsProtobuf.Named (HsProtobuf.Single "E")))
(HsProtobuf.Single "unpackedEnum")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.False))]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB AllPackedTypes where
toJSONPB
(AllPackedTypes f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13)
= (HsJSONPB.object
["packedWord32" .= f1, "packedWord64" .= f2, "packedInt32" .= f3,
"packedInt64" .= f4, "packedFixed32" .= f5, "packedFixed64" .= f6,
"packedFloat" .= f7, "packedDouble" .= f8, "packedSFixed32" .= f9,
"packedSFixed64" .= f10, "packedBool" .= f11, "packedEnum" .= f12,
"unpackedEnum" .= f13])
toEncodingPB
(AllPackedTypes f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13)
= (HsJSONPB.pairs
["packedWord32" .= f1, "packedWord64" .= f2, "packedInt32" .= f3,
"packedInt64" .= f4, "packedFixed32" .= f5, "packedFixed64" .= f6,
"packedFloat" .= f7, "packedDouble" .= f8, "packedSFixed32" .= f9,
"packedSFixed64" .= f10, "packedBool" .= f11, "packedEnum" .= f12,
"unpackedEnum" .= f13])
instance HsJSONPB.FromJSONPB AllPackedTypes where
parseJSONPB
= (HsJSONPB.withObject "AllPackedTypes"
(\ obj ->
(Hs.pure AllPackedTypes) <*> obj .: "packedWord32" <*>
obj .: "packedWord64"
<*> obj .: "packedInt32"
<*> obj .: "packedInt64"
<*> obj .: "packedFixed32"
<*> obj .: "packedFixed64"
<*> obj .: "packedFloat"
<*> obj .: "packedDouble"
<*> obj .: "packedSFixed32"
<*> obj .: "packedSFixed64"
<*> obj .: "packedBool"
<*> obj .: "packedEnum"
<*> obj .: "unpackedEnum"))
instance HsJSONPB.ToJSON AllPackedTypes where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON AllPackedTypes where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema AllPackedTypes where
declareNamedSchema _
= do let declare_packedWord32 = HsJSONPB.declareSchemaRef
allPackedTypesPackedWord32 <- declare_packedWord32 Proxy.Proxy
let declare_packedWord64 = HsJSONPB.declareSchemaRef
allPackedTypesPackedWord64 <- declare_packedWord64 Proxy.Proxy
let declare_packedInt32 = HsJSONPB.declareSchemaRef
allPackedTypesPackedInt32 <- declare_packedInt32 Proxy.Proxy
let declare_packedInt64 = HsJSONPB.declareSchemaRef
allPackedTypesPackedInt64 <- declare_packedInt64 Proxy.Proxy
let declare_packedFixed32 = HsJSONPB.declareSchemaRef
allPackedTypesPackedFixed32 <- declare_packedFixed32 Proxy.Proxy
let declare_packedFixed64 = HsJSONPB.declareSchemaRef
allPackedTypesPackedFixed64 <- declare_packedFixed64 Proxy.Proxy
let declare_packedFloat = HsJSONPB.declareSchemaRef
allPackedTypesPackedFloat <- declare_packedFloat Proxy.Proxy
let declare_packedDouble = HsJSONPB.declareSchemaRef
allPackedTypesPackedDouble <- declare_packedDouble Proxy.Proxy
let declare_packedSFixed32 = HsJSONPB.declareSchemaRef
allPackedTypesPackedSFixed32 <- declare_packedSFixed32 Proxy.Proxy
let declare_packedSFixed64 = HsJSONPB.declareSchemaRef
allPackedTypesPackedSFixed64 <- declare_packedSFixed64 Proxy.Proxy
let declare_packedBool = HsJSONPB.declareSchemaRef
allPackedTypesPackedBool <- declare_packedBool Proxy.Proxy
let declare_packedEnum = HsJSONPB.declareSchemaRef
allPackedTypesPackedEnum <- declare_packedEnum Proxy.Proxy
let declare_unpackedEnum = HsJSONPB.declareSchemaRef
allPackedTypesUnpackedEnum <- declare_unpackedEnum Proxy.Proxy
let _ = Hs.pure AllPackedTypes <*>
HsJSONPB.asProxy declare_packedWord32
<*> HsJSONPB.asProxy declare_packedWord64
<*> HsJSONPB.asProxy declare_packedInt32
<*> HsJSONPB.asProxy declare_packedInt64
<*> HsJSONPB.asProxy declare_packedFixed32
<*> HsJSONPB.asProxy declare_packedFixed64
<*> HsJSONPB.asProxy declare_packedFloat
<*> HsJSONPB.asProxy declare_packedDouble
<*> HsJSONPB.asProxy declare_packedSFixed32
<*> HsJSONPB.asProxy declare_packedSFixed64
<*> HsJSONPB.asProxy declare_packedBool
<*> HsJSONPB.asProxy declare_packedEnum
<*> HsJSONPB.asProxy declare_unpackedEnum
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "AllPackedTypes",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("packedWord32",
allPackedTypesPackedWord32),
("packedWord64",
allPackedTypesPackedWord64),
("packedInt32", allPackedTypesPackedInt32),
("packedInt64", allPackedTypesPackedInt64),
("packedFixed32",
allPackedTypesPackedFixed32),
("packedFixed64",
allPackedTypesPackedFixed64),
("packedFloat", allPackedTypesPackedFloat),
("packedDouble",
allPackedTypesPackedDouble),
("packedSFixed32",
allPackedTypesPackedSFixed32),
("packedSFixed64",
allPackedTypesPackedSFixed64),
("packedBool", allPackedTypesPackedBool),
("packedEnum", allPackedTypesPackedEnum),
("unpackedEnum",
allPackedTypesUnpackedEnum)]}})
instance HsDhallPb.Interpret AllPackedTypes
instance HsDhallPb.Inject AllPackedTypes
data OutOfOrderFields = OutOfOrderFields{outOfOrderFieldsField1 ::
Hs.Vector Hs.Word32,
outOfOrderFieldsField2 :: Hs.Text,
outOfOrderFieldsField3 :: Hs.Int64,
outOfOrderFieldsField4 :: Hs.Vector Hs.Text}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named OutOfOrderFields where
nameOf _ = (Hs.fromString "OutOfOrderFields")
instance HsProtobuf.Message OutOfOrderFields where
encodeMessage _
OutOfOrderFields{outOfOrderFieldsField1 = outOfOrderFieldsField1,
outOfOrderFieldsField2 = outOfOrderFieldsField2,
outOfOrderFieldsField3 = outOfOrderFieldsField3,
outOfOrderFieldsField4 = outOfOrderFieldsField4}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2001)
(HsProtobuf.PackedVec outOfOrderFieldsField1)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 101)
outOfOrderFieldsField2),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 30)
outOfOrderFieldsField3),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1002)
(HsProtobuf.UnpackedVec outOfOrderFieldsField4))])
decodeMessage _
= (Hs.pure OutOfOrderFields) <*>
((Hs.pure HsProtobuf.packedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2001)))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 101))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 30))
<*>
((Hs.pure HsProtobuf.unpackedvec) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1002)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2001)
(HsProtobuf.Repeated HsProtobuf.UInt32)
(HsProtobuf.Single "field1")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 101)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "field2")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 30)
(HsProtobuf.Prim HsProtobuf.Int64)
(HsProtobuf.Single "field3")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1002)
(HsProtobuf.Repeated HsProtobuf.String)
(HsProtobuf.Single "field4")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB OutOfOrderFields where
toJSONPB (OutOfOrderFields f2001 f101 f30 f1002)
= (HsJSONPB.object
["field1" .= f2001, "field2" .= f101, "field3" .= f30,
"field4" .= f1002])
toEncodingPB (OutOfOrderFields f2001 f101 f30 f1002)
= (HsJSONPB.pairs
["field1" .= f2001, "field2" .= f101, "field3" .= f30,
"field4" .= f1002])
instance HsJSONPB.FromJSONPB OutOfOrderFields where
parseJSONPB
= (HsJSONPB.withObject "OutOfOrderFields"
(\ obj ->
(Hs.pure OutOfOrderFields) <*> obj .: "field1" <*> obj .: "field2"
<*> obj .: "field3"
<*> obj .: "field4"))
instance HsJSONPB.ToJSON OutOfOrderFields where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON OutOfOrderFields where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema OutOfOrderFields where
declareNamedSchema _
= do let declare_field1 = HsJSONPB.declareSchemaRef
outOfOrderFieldsField1 <- declare_field1 Proxy.Proxy
let declare_field2 = HsJSONPB.declareSchemaRef
outOfOrderFieldsField2 <- declare_field2 Proxy.Proxy
let declare_field3 = HsJSONPB.declareSchemaRef
outOfOrderFieldsField3 <- declare_field3 Proxy.Proxy
let declare_field4 = HsJSONPB.declareSchemaRef
outOfOrderFieldsField4 <- declare_field4 Proxy.Proxy
let _ = Hs.pure OutOfOrderFields <*>
HsJSONPB.asProxy declare_field1
<*> HsJSONPB.asProxy declare_field2
<*> HsJSONPB.asProxy declare_field3
<*> HsJSONPB.asProxy declare_field4
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "OutOfOrderFields",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("field1", outOfOrderFieldsField1),
("field2", outOfOrderFieldsField2),
("field3", outOfOrderFieldsField3),
("field4", outOfOrderFieldsField4)]}})
instance HsDhallPb.Interpret OutOfOrderFields
instance HsDhallPb.Inject OutOfOrderFields
data ShadowedMessage = ShadowedMessage{shadowedMessageName ::
Hs.Text,
shadowedMessageValue :: Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named ShadowedMessage where
nameOf _ = (Hs.fromString "ShadowedMessage")
instance HsProtobuf.Message ShadowedMessage where
encodeMessage _
ShadowedMessage{shadowedMessageName = shadowedMessageName,
shadowedMessageValue = shadowedMessageValue}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
shadowedMessageName),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
shadowedMessageValue)])
decodeMessage _
= (Hs.pure ShadowedMessage) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "name")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "value")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB ShadowedMessage where
toJSONPB (ShadowedMessage f2 f1)
= (HsJSONPB.object ["name" .= f2, "value" .= f1])
toEncodingPB (ShadowedMessage f2 f1)
= (HsJSONPB.pairs ["name" .= f2, "value" .= f1])
instance HsJSONPB.FromJSONPB ShadowedMessage where
parseJSONPB
= (HsJSONPB.withObject "ShadowedMessage"
(\ obj ->
(Hs.pure ShadowedMessage) <*> obj .: "name" <*> obj .: "value"))
instance HsJSONPB.ToJSON ShadowedMessage where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON ShadowedMessage where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema ShadowedMessage where
declareNamedSchema _
= do let declare_name = HsJSONPB.declareSchemaRef
shadowedMessageName <- declare_name Proxy.Proxy
let declare_value = HsJSONPB.declareSchemaRef
shadowedMessageValue <- declare_value Proxy.Proxy
let _ = Hs.pure ShadowedMessage <*> HsJSONPB.asProxy declare_name
<*> HsJSONPB.asProxy declare_value
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "ShadowedMessage",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("name", shadowedMessageName),
("value", shadowedMessageValue)]}})
instance HsDhallPb.Interpret ShadowedMessage
instance HsDhallPb.Inject ShadowedMessage
data MessageShadower = MessageShadower{messageShadowerShadowedMessage
:: Hs.Maybe TestProto.MessageShadower_ShadowedMessage,
messageShadowerName :: Hs.Text}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named MessageShadower where
nameOf _ = (Hs.fromString "MessageShadower")
instance HsProtobuf.Message MessageShadower where
encodeMessage _
MessageShadower{messageShadowerShadowedMessage =
messageShadowerShadowedMessage,
messageShadowerName = messageShadowerName}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Nested messageShadowerShadowedMessage)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
messageShadowerName)])
decodeMessage _
= (Hs.pure MessageShadower) <*>
((Hs.pure HsProtobuf.nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim
(HsProtobuf.Named (HsProtobuf.Single "ShadowedMessage")))
(HsProtobuf.Single "shadowed_message")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "name")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB MessageShadower where
toJSONPB (MessageShadower f1 f2)
= (HsJSONPB.object ["shadowed_message" .= f1, "name" .= f2])
toEncodingPB (MessageShadower f1 f2)
= (HsJSONPB.pairs ["shadowed_message" .= f1, "name" .= f2])
instance HsJSONPB.FromJSONPB MessageShadower where
parseJSONPB
= (HsJSONPB.withObject "MessageShadower"
(\ obj ->
(Hs.pure MessageShadower) <*> obj .: "shadowed_message" <*>
obj .: "name"))
instance HsJSONPB.ToJSON MessageShadower where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON MessageShadower where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema MessageShadower where
declareNamedSchema _
= do let declare_shadowed_message = HsJSONPB.declareSchemaRef
messageShadowerShadowedMessage <- declare_shadowed_message
Proxy.Proxy
let declare_name = HsJSONPB.declareSchemaRef
messageShadowerName <- declare_name Proxy.Proxy
let _ = Hs.pure MessageShadower <*>
HsJSONPB.asProxy declare_shadowed_message
<*> HsJSONPB.asProxy declare_name
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "MessageShadower",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("shadowed_message",
messageShadowerShadowedMessage),
("name", messageShadowerName)]}})
instance HsDhallPb.Interpret MessageShadower
instance HsDhallPb.Inject MessageShadower
data MessageShadower_ShadowedMessage = MessageShadower_ShadowedMessage{messageShadower_ShadowedMessageName
:: Hs.Text,
messageShadower_ShadowedMessageValue
:: Hs.Text}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named MessageShadower_ShadowedMessage where
nameOf _ = (Hs.fromString "MessageShadower_ShadowedMessage")
instance HsProtobuf.Message MessageShadower_ShadowedMessage where
encodeMessage _
MessageShadower_ShadowedMessage{messageShadower_ShadowedMessageName
= messageShadower_ShadowedMessageName,
messageShadower_ShadowedMessageValue =
messageShadower_ShadowedMessageValue}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
messageShadower_ShadowedMessageName),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
messageShadower_ShadowedMessageValue)])
decodeMessage _
= (Hs.pure MessageShadower_ShadowedMessage) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "name")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "value")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB MessageShadower_ShadowedMessage where
toJSONPB (MessageShadower_ShadowedMessage f1 f2)
= (HsJSONPB.object ["name" .= f1, "value" .= f2])
toEncodingPB (MessageShadower_ShadowedMessage f1 f2)
= (HsJSONPB.pairs ["name" .= f1, "value" .= f2])
instance HsJSONPB.FromJSONPB MessageShadower_ShadowedMessage where
parseJSONPB
= (HsJSONPB.withObject "MessageShadower_ShadowedMessage"
(\ obj ->
(Hs.pure MessageShadower_ShadowedMessage) <*> obj .: "name" <*>
obj .: "value"))
instance HsJSONPB.ToJSON MessageShadower_ShadowedMessage where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON MessageShadower_ShadowedMessage where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema MessageShadower_ShadowedMessage where
declareNamedSchema _
= do let declare_name = HsJSONPB.declareSchemaRef
messageShadower_ShadowedMessageName <- declare_name Proxy.Proxy
let declare_value = HsJSONPB.declareSchemaRef
messageShadower_ShadowedMessageValue <- declare_value Proxy.Proxy
let _ = Hs.pure MessageShadower_ShadowedMessage <*>
HsJSONPB.asProxy declare_name
<*> HsJSONPB.asProxy declare_value
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "MessageShadower_ShadowedMessage",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("name",
messageShadower_ShadowedMessageName),
("value",
messageShadower_ShadowedMessageValue)]}})
instance HsDhallPb.Interpret MessageShadower_ShadowedMessage
instance HsDhallPb.Inject MessageShadower_ShadowedMessage
data WithQualifiedName = WithQualifiedName{withQualifiedNameQname1
:: Hs.Maybe TestProto.ShadowedMessage,
withQualifiedNameQname2 ::
Hs.Maybe TestProto.MessageShadower_ShadowedMessage}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named WithQualifiedName where
nameOf _ = (Hs.fromString "WithQualifiedName")
instance HsProtobuf.Message WithQualifiedName where
encodeMessage _
WithQualifiedName{withQualifiedNameQname1 =
withQualifiedNameQname1,
withQualifiedNameQname2 = withQualifiedNameQname2}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 100)
(HsProtobuf.Nested withQualifiedNameQname1)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 200)
(HsProtobuf.Nested withQualifiedNameQname2))])
decodeMessage _
= (Hs.pure WithQualifiedName) <*>
((Hs.pure HsProtobuf.nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 100)))
<*>
((Hs.pure HsProtobuf.nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 200)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 100)
(HsProtobuf.Prim
(HsProtobuf.Named (HsProtobuf.Single "ShadowedMessage")))
(HsProtobuf.Single "qname1")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 200)
(HsProtobuf.Prim
(HsProtobuf.Named
(HsProtobuf.Dots
(HsProtobuf.Path ["MessageShadower", "ShadowedMessage"]))))
(HsProtobuf.Single "qname2")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB WithQualifiedName where
toJSONPB (WithQualifiedName f100 f200)
= (HsJSONPB.object ["qname1" .= f100, "qname2" .= f200])
toEncodingPB (WithQualifiedName f100 f200)
= (HsJSONPB.pairs ["qname1" .= f100, "qname2" .= f200])
instance HsJSONPB.FromJSONPB WithQualifiedName where
parseJSONPB
= (HsJSONPB.withObject "WithQualifiedName"
(\ obj ->
(Hs.pure WithQualifiedName) <*> obj .: "qname1" <*>
obj .: "qname2"))
instance HsJSONPB.ToJSON WithQualifiedName where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithQualifiedName where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithQualifiedName where
declareNamedSchema _
= do let declare_qname1 = HsJSONPB.declareSchemaRef
withQualifiedNameQname1 <- declare_qname1 Proxy.Proxy
let declare_qname2 = HsJSONPB.declareSchemaRef
withQualifiedNameQname2 <- declare_qname2 Proxy.Proxy
let _ = Hs.pure WithQualifiedName <*>
HsJSONPB.asProxy declare_qname1
<*> HsJSONPB.asProxy declare_qname2
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithQualifiedName",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("qname1", withQualifiedNameQname1),
("qname2", withQualifiedNameQname2)]}})
instance HsDhallPb.Interpret WithQualifiedName
instance HsDhallPb.Inject WithQualifiedName
data UsingImported = UsingImported{usingImportedImportedNesting ::
Hs.Maybe TestProtoImport.WithNesting,
usingImportedLocalNesting :: Hs.Maybe TestProto.WithNesting}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named UsingImported where
nameOf _ = (Hs.fromString "UsingImported")
instance HsProtobuf.Message UsingImported where
encodeMessage _
UsingImported{usingImportedImportedNesting =
usingImportedImportedNesting,
usingImportedLocalNesting = usingImportedLocalNesting}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 100)
(HsProtobuf.Nested usingImportedImportedNesting)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 200)
(HsProtobuf.Nested usingImportedLocalNesting))])
decodeMessage _
= (Hs.pure UsingImported) <*>
((Hs.pure HsProtobuf.nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 100)))
<*>
((Hs.pure HsProtobuf.nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 200)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 100)
(HsProtobuf.Prim
(HsProtobuf.Named
(HsProtobuf.Dots
(HsProtobuf.Path ["TestProtoImport", "WithNesting"]))))
(HsProtobuf.Single "importedNesting")
[]
Hs.Nothing),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 200)
(HsProtobuf.Prim
(HsProtobuf.Named (HsProtobuf.Single "WithNesting")))
(HsProtobuf.Single "localNesting")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB UsingImported where
toJSONPB (UsingImported f100 f200)
= (HsJSONPB.object
["importedNesting" .= f100, "localNesting" .= f200])
toEncodingPB (UsingImported f100 f200)
= (HsJSONPB.pairs
["importedNesting" .= f100, "localNesting" .= f200])
instance HsJSONPB.FromJSONPB UsingImported where
parseJSONPB
= (HsJSONPB.withObject "UsingImported"
(\ obj ->
(Hs.pure UsingImported) <*> obj .: "importedNesting" <*>
obj .: "localNesting"))
instance HsJSONPB.ToJSON UsingImported where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON UsingImported where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema UsingImported where
declareNamedSchema _
= do let declare_importedNesting = HsJSONPB.declareSchemaRef
usingImportedImportedNesting <- declare_importedNesting Proxy.Proxy
let declare_localNesting = HsJSONPB.declareSchemaRef
usingImportedLocalNesting <- declare_localNesting Proxy.Proxy
let _ = Hs.pure UsingImported <*>
HsJSONPB.asProxy declare_importedNesting
<*> HsJSONPB.asProxy declare_localNesting
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "UsingImported",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("importedNesting",
usingImportedImportedNesting),
("localNesting",
usingImportedLocalNesting)]}})
instance HsDhallPb.Interpret UsingImported
instance HsDhallPb.Inject UsingImported
data Wrapped = Wrapped{wrappedWrapped ::
Hs.Maybe TestProto.Wrapped}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named Wrapped where
nameOf _ = (Hs.fromString "Wrapped")
instance HsProtobuf.Message Wrapped where
encodeMessage _ Wrapped{wrappedWrapped = wrappedWrapped}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Nested wrappedWrapped))])
decodeMessage _
= (Hs.pure Wrapped) <*>
((Hs.pure HsProtobuf.nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Wrapped")))
(HsProtobuf.Single "wrapped")
[]
Hs.Nothing)]
instance HsJSONPB.ToJSONPB Wrapped where
toJSONPB (Wrapped f1) = (HsJSONPB.object ["wrapped" .= f1])
toEncodingPB (Wrapped f1) = (HsJSONPB.pairs ["wrapped" .= f1])
instance HsJSONPB.FromJSONPB Wrapped where
parseJSONPB
= (HsJSONPB.withObject "Wrapped"
(\ obj -> (Hs.pure Wrapped) <*> obj .: "wrapped"))
instance HsJSONPB.ToJSON Wrapped where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Wrapped where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Wrapped where
declareNamedSchema _
= do let declare_wrapped = HsJSONPB.declareSchemaRef
wrappedWrapped <- declare_wrapped Proxy.Proxy
let _ = Hs.pure Wrapped <*> HsJSONPB.asProxy declare_wrapped
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Wrapped",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("wrapped", wrappedWrapped)]}})
instance HsDhallPb.Interpret Wrapped
instance HsDhallPb.Inject Wrapped
data EnumAnnots = EnumAnnotsFOO
| EnumAnnotsBAR
deriving (Hs.Show, Hs.Bounded, Hs.Eq, Hs.Ord, Hs.Generic)
instance HsProtobuf.Named EnumAnnots where
nameOf _ = (Hs.fromString "EnumAnnots")
instance Hs.Enum EnumAnnots where
toEnum 0 = EnumAnnotsFOO
toEnum 1 = EnumAnnotsBAR
toEnum i = (Hs.toEnumError "EnumAnnots" i (0 :: Hs.Int, 1))
fromEnum (EnumAnnotsFOO) = 0
fromEnum (EnumAnnotsBAR) = 1
succ (EnumAnnotsFOO) = EnumAnnotsBAR
succ _ = Hs.succError "EnumAnnots"
pred (EnumAnnotsBAR) = EnumAnnotsFOO
pred _ = Hs.predError "EnumAnnots"
instance HsJSONPB.ToJSONPB EnumAnnots where
toJSONPB x _ = HsJSONPB.enumFieldString x
toEncodingPB x _ = HsJSONPB.enumFieldEncoding x
instance HsJSONPB.FromJSONPB EnumAnnots where
parseJSONPB (HsJSONPB.String "FOO") = Hs.pure EnumAnnotsFOO
parseJSONPB (HsJSONPB.String "BAR") = Hs.pure EnumAnnotsBAR
parseJSONPB v = (HsJSONPB.typeMismatch "EnumAnnots" v)
instance HsJSONPB.ToJSON EnumAnnots where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON EnumAnnots where
parseJSON = HsJSONPB.parseJSONPB
instance HsDhallPb.Interpret EnumAnnots
instance HsDhallPb.Inject EnumAnnots
instance HsProtobuf.Finite EnumAnnots