{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
{-# OPTIONS_GHC -fno-warn-missing-export-lists #-}
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
module TestProto where
import qualified Prelude as Hs
import qualified Proto3.Suite.Class as HsProtobuf
import qualified Proto3.Suite.DotProto as HsProtobuf
import qualified Proto3.Suite.JSONPB as HsJSONPB
import Proto3.Suite.JSONPB ((.=), (.:))
import qualified Proto3.Suite.Types as HsProtobuf
import qualified Proto3.Wire as HsProtobuf
import qualified Control.Applicative as Hs
import Control.Applicative ((<*>), (<|>), (<$>))
import qualified Control.DeepSeq as Hs
import qualified Control.Monad as Hs
import qualified Data.ByteString as Hs
import qualified Data.Coerce as Hs
import qualified Data.Int as Hs (Int16, Int32, Int64)
import qualified Data.List.NonEmpty as Hs (NonEmpty(..))
import qualified Data.Map as Hs (Map, mapKeysMonotonic)
import qualified Data.Proxy as Proxy
import qualified Data.String as Hs (fromString)
import qualified Data.Text.Lazy as Hs (Text)
import qualified Data.Vector as Hs (Vector)
import qualified Data.Word as Hs (Word16, Word32, Word64)
import qualified GHC.Enum as Hs
import qualified GHC.Generics as Hs
import qualified Unsafe.Coerce as Hs
import qualified TestProtoImport
newtype Trivial = Trivial{trivialTrivialField :: Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Trivial where
nameOf _ = (Hs.fromString "Trivial")
instance HsProtobuf.HasDefault 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")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("trivialField", trivialTrivialField)]}})
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, Hs.NFData)
instance HsProtobuf.Named MultipleFields where
nameOf _ = (Hs.fromString "MultipleFields")
instance HsProtobuf.HasDefault 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")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.Float)
(HsProtobuf.Single "multiFieldFloat")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "multiFieldInt32")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Prim HsProtobuf.Int64)
(HsProtobuf.Single "multiFieldInt64")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 5)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "multiFieldString")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 6)
(HsProtobuf.Prim HsProtobuf.Bool)
(HsProtobuf.Single "multiFieldBool")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("multiFieldDouble",
multipleFieldsMultiFieldDouble),
("multiFieldFloat",
multipleFieldsMultiFieldFloat),
("multiFieldInt32",
multipleFieldsMultiFieldInt32),
("multiFieldInt64",
multipleFieldsMultiFieldInt64),
("multiFieldString",
multipleFieldsMultiFieldString),
("multiFieldBool",
multipleFieldsMultiFieldBool)]}})
data SignedInts = SignedInts{signedIntsSigned32 :: Hs.Int32,
signedIntsSigned64 :: Hs.Int64}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named SignedInts where
nameOf _ = (Hs.fromString "SignedInts")
instance HsProtobuf.HasDefault SignedInts
instance HsProtobuf.Message SignedInts where
encodeMessage _
SignedInts{signedIntsSigned32 = signedIntsSigned32,
signedIntsSigned64 = signedIntsSigned64}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Int32) @(HsProtobuf.Signed Hs.Int32)
signedIntsSigned32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(Hs.coerce @(Hs.Int64) @(HsProtobuf.Signed Hs.Int64)
signedIntsSigned64))])
decodeMessage _
= (Hs.pure SignedInts) <*>
(Hs.coerce @(_ (HsProtobuf.Signed Hs.Int32)) @(_ Hs.Int32)
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
(Hs.coerce @(_ (HsProtobuf.Signed Hs.Int64)) @(_ Hs.Int64)
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.SInt32)
(HsProtobuf.Single "signed32")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.SInt64)
(HsProtobuf.Single "signed64")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("signed32", signedIntsSigned32),
("signed64", signedIntsSigned64)]}})
newtype WithEnum = WithEnum{withEnumEnumField ::
HsProtobuf.Enumerated TestProto.WithEnum_TestEnum}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithEnum where
nameOf _ = (Hs.fromString "WithEnum")
instance HsProtobuf.HasDefault 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")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("enumField", withEnumEnumField)]}})
data WithEnum_TestEnum = WithEnum_TestEnumENUM1
| WithEnum_TestEnumENUM2
| WithEnum_TestEnumENUM3
deriving (Hs.Show, Hs.Eq, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithEnum_TestEnum where
nameOf _ = (Hs.fromString "WithEnum_TestEnum")
instance HsProtobuf.HasDefault WithEnum_TestEnum
instance Hs.Bounded WithEnum_TestEnum where
minBound = WithEnum_TestEnumENUM1
maxBound = WithEnum_TestEnumENUM3
instance Hs.Ord WithEnum_TestEnum where
compare x y
= Hs.compare (HsProtobuf.fromProtoEnum x)
(HsProtobuf.fromProtoEnum y)
instance HsProtobuf.ProtoEnum WithEnum_TestEnum where
toProtoEnumMay 0 = Hs.Just WithEnum_TestEnumENUM1
toProtoEnumMay 1 = Hs.Just WithEnum_TestEnumENUM2
toProtoEnumMay 2 = Hs.Just WithEnum_TestEnumENUM3
toProtoEnumMay _ = Hs.Nothing
fromProtoEnum (WithEnum_TestEnumENUM1) = 0
fromProtoEnum (WithEnum_TestEnumENUM2) = 1
fromProtoEnum (WithEnum_TestEnumENUM3) = 2
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 HsProtobuf.Finite WithEnum_TestEnum
newtype WithNesting = WithNesting{withNestingNestedMessage ::
Hs.Maybe TestProto.WithNesting_Nested}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithNesting where
nameOf _ = (Hs.fromString "WithNesting")
instance HsProtobuf.HasDefault WithNesting
instance HsProtobuf.Message WithNesting where
encodeMessage _
WithNesting{withNestingNestedMessage = withNestingNestedMessage}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Maybe TestProto.WithNesting_Nested)
@(HsProtobuf.Nested TestProto.WithNesting_Nested)
withNestingNestedMessage))])
decodeMessage _
= (Hs.pure WithNesting) <*>
(Hs.coerce @(_ (HsProtobuf.Nested TestProto.WithNesting_Nested))
@(_ (Hs.Maybe TestProto.WithNesting_Nested))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Nested")))
(HsProtobuf.Single "nestedMessage")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedMessage",
withNestingNestedMessage)]}})
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, Hs.NFData)
instance HsProtobuf.Named WithNesting_Nested where
nameOf _ = (Hs.fromString "WithNesting_Nested")
instance HsProtobuf.HasDefault 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)
(Hs.coerce @(Hs.Vector Hs.Int32) @(HsProtobuf.PackedVec Hs.Int32)
withNesting_NestedNestedPacked)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
(Hs.coerce @(Hs.Vector Hs.Int32) @(HsProtobuf.UnpackedVec Hs.Int32)
withNesting_NestedNestedUnpacked))])
decodeMessage _
= (Hs.pure WithNesting_Nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Int32))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3)))
<*>
(Hs.coerce @(_ (HsProtobuf.UnpackedVec Hs.Int32))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "nestedField1")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "nestedField2")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "nestedPacked")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "nestedUnpacked")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.False))]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedField1",
withNesting_NestedNestedField1),
("nestedField2",
withNesting_NestedNestedField2),
("nestedPacked",
withNesting_NestedNestedPacked),
("nestedUnpacked",
withNesting_NestedNestedUnpacked)]}})
newtype WithNestingRepeated = WithNestingRepeated{withNestingRepeatedNestedMessages
:: Hs.Vector TestProto.WithNestingRepeated_Nested}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithNestingRepeated where
nameOf _ = (Hs.fromString "WithNestingRepeated")
instance HsProtobuf.HasDefault WithNestingRepeated
instance HsProtobuf.Message WithNestingRepeated where
encodeMessage _
WithNestingRepeated{withNestingRepeatedNestedMessages =
withNestingRepeatedNestedMessages}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Vector TestProto.WithNestingRepeated_Nested)
@(HsProtobuf.NestedVec TestProto.WithNestingRepeated_Nested)
withNestingRepeatedNestedMessages))])
decodeMessage _
= (Hs.pure WithNestingRepeated) <*>
(Hs.coerce
@(_ (HsProtobuf.NestedVec TestProto.WithNestingRepeated_Nested))
@(_ (Hs.Vector TestProto.WithNestingRepeated_Nested))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated
(HsProtobuf.Named (HsProtobuf.Single "Nested")))
(HsProtobuf.Single "nestedMessages")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedMessages",
withNestingRepeatedNestedMessages)]}})
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, Hs.NFData)
instance HsProtobuf.Named WithNestingRepeated_Nested where
nameOf _ = (Hs.fromString "WithNestingRepeated_Nested")
instance HsProtobuf.HasDefault 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)
(Hs.coerce @(Hs.Vector Hs.Int32) @(HsProtobuf.PackedVec Hs.Int32)
withNestingRepeated_NestedNestedPacked)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
(Hs.coerce @(Hs.Vector Hs.Int32) @(HsProtobuf.UnpackedVec Hs.Int32)
withNestingRepeated_NestedNestedUnpacked))])
decodeMessage _
= (Hs.pure WithNestingRepeated_Nested) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Int32))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3)))
<*>
(Hs.coerce @(_ (HsProtobuf.UnpackedVec Hs.Int32))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "nestedField1")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "nestedField2")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "nestedPacked")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "nestedUnpacked")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.False))]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedField1",
withNestingRepeated_NestedNestedField1),
("nestedField2",
withNestingRepeated_NestedNestedField2),
("nestedPacked",
withNestingRepeated_NestedNestedPacked),
("nestedUnpacked",
withNestingRepeated_NestedNestedUnpacked)]}})
data NestedInts = NestedInts{nestedIntsNestedInt1 :: Hs.Int32,
nestedIntsNestedInt2 :: Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named NestedInts where
nameOf _ = (Hs.fromString "NestedInts")
instance HsProtobuf.HasDefault 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")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "nestedInt2")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedInt1", nestedIntsNestedInt1),
("nestedInt2", nestedIntsNestedInt2)]}})
newtype WithNestingRepeatedInts = WithNestingRepeatedInts{withNestingRepeatedIntsNestedInts
:: Hs.Vector TestProto.NestedInts}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithNestingRepeatedInts where
nameOf _ = (Hs.fromString "WithNestingRepeatedInts")
instance HsProtobuf.HasDefault WithNestingRepeatedInts
instance HsProtobuf.Message WithNestingRepeatedInts where
encodeMessage _
WithNestingRepeatedInts{withNestingRepeatedIntsNestedInts =
withNestingRepeatedIntsNestedInts}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Vector TestProto.NestedInts)
@(HsProtobuf.NestedVec TestProto.NestedInts)
withNestingRepeatedIntsNestedInts))])
decodeMessage _
= (Hs.pure WithNestingRepeatedInts) <*>
(Hs.coerce @(_ (HsProtobuf.NestedVec TestProto.NestedInts))
@(_ (Hs.Vector TestProto.NestedInts))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated
(HsProtobuf.Named (HsProtobuf.Single "NestedInts")))
(HsProtobuf.Single "nestedInts")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedInts",
withNestingRepeatedIntsNestedInts)]}})
newtype WithNestingInts = WithNestingInts{withNestingIntsNestedInts
:: Hs.Maybe TestProto.NestedInts}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithNestingInts where
nameOf _ = (Hs.fromString "WithNestingInts")
instance HsProtobuf.HasDefault WithNestingInts
instance HsProtobuf.Message WithNestingInts where
encodeMessage _
WithNestingInts{withNestingIntsNestedInts =
withNestingIntsNestedInts}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Maybe TestProto.NestedInts)
@(HsProtobuf.Nested TestProto.NestedInts)
withNestingIntsNestedInts))])
decodeMessage _
= (Hs.pure WithNestingInts) <*>
(Hs.coerce @(_ (HsProtobuf.Nested TestProto.NestedInts))
@(_ (Hs.Maybe TestProto.NestedInts))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim
(HsProtobuf.Named (HsProtobuf.Single "NestedInts")))
(HsProtobuf.Single "nestedInts")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("nestedInts",
withNestingIntsNestedInts)]}})
newtype WithRepetition = WithRepetition{withRepetitionRepeatedField1
:: Hs.Vector Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithRepetition where
nameOf _ = (Hs.fromString "WithRepetition")
instance HsProtobuf.HasDefault WithRepetition
instance HsProtobuf.Message WithRepetition where
encodeMessage _
WithRepetition{withRepetitionRepeatedField1 =
withRepetitionRepeatedField1}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Vector Hs.Int32) @(HsProtobuf.PackedVec Hs.Int32)
withRepetitionRepeatedField1))])
decodeMessage _
= (Hs.pure WithRepetition) <*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Int32))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "repeatedField1")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("repeatedField1",
withRepetitionRepeatedField1)]}})
data WithRepeatedSigned = WithRepeatedSigned{withRepeatedSignedR32
:: Hs.Vector Hs.Int32,
withRepeatedSignedR64 :: Hs.Vector Hs.Int64}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithRepeatedSigned where
nameOf _ = (Hs.fromString "WithRepeatedSigned")
instance HsProtobuf.HasDefault WithRepeatedSigned
instance HsProtobuf.Message WithRepeatedSigned where
encodeMessage _
WithRepeatedSigned{withRepeatedSignedR32 = withRepeatedSignedR32,
withRepeatedSignedR64 = withRepeatedSignedR64}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Vector Hs.Int32)
@(HsProtobuf.PackedVec (HsProtobuf.Signed Hs.Int32))
withRepeatedSignedR32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(Hs.coerce @(Hs.Vector Hs.Int64)
@(HsProtobuf.PackedVec (HsProtobuf.Signed Hs.Int64))
withRepeatedSignedR64))])
decodeMessage _
= (Hs.pure WithRepeatedSigned) <*>
(Hs.coerce @(_ (HsProtobuf.PackedVec (HsProtobuf.Signed Hs.Int32)))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec (HsProtobuf.Signed Hs.Int64)))
@(_ (Hs.Vector Hs.Int64))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Repeated HsProtobuf.SInt32)
(HsProtobuf.Single "r32")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Repeated HsProtobuf.SInt64)
(HsProtobuf.Single "r64")
[]
"")]
instance HsJSONPB.ToJSONPB WithRepeatedSigned where
toJSONPB (WithRepeatedSigned f1 f2)
= (HsJSONPB.object ["r32" .= f1, "r64" .= f2])
toEncodingPB (WithRepeatedSigned f1 f2)
= (HsJSONPB.pairs ["r32" .= f1, "r64" .= f2])
instance HsJSONPB.FromJSONPB WithRepeatedSigned where
parseJSONPB
= (HsJSONPB.withObject "WithRepeatedSigned"
(\ obj ->
(Hs.pure WithRepeatedSigned) <*> obj .: "r32" <*> obj .: "r64"))
instance HsJSONPB.ToJSON WithRepeatedSigned where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WithRepeatedSigned where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WithRepeatedSigned where
declareNamedSchema _
= do let declare_r32 = HsJSONPB.declareSchemaRef
withRepeatedSignedR32 <- declare_r32 Proxy.Proxy
let declare_r64 = HsJSONPB.declareSchemaRef
withRepeatedSignedR64 <- declare_r64 Proxy.Proxy
let _ = Hs.pure WithRepeatedSigned <*> HsJSONPB.asProxy declare_r32
<*> HsJSONPB.asProxy declare_r64
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WithRepeatedSigned",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("r32", withRepeatedSignedR32),
("r64", withRepeatedSignedR64)]}})
data WithFixed = WithFixed{withFixedFixed1 :: Hs.Word32,
withFixedFixed2 :: Hs.Int32, withFixedFixed3 :: Hs.Word64,
withFixedFixed4 :: Hs.Int64}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithFixed where
nameOf _ = (Hs.fromString "WithFixed")
instance HsProtobuf.HasDefault WithFixed
instance HsProtobuf.Message WithFixed where
encodeMessage _
WithFixed{withFixedFixed1 = withFixedFixed1,
withFixedFixed2 = withFixedFixed2,
withFixedFixed3 = withFixedFixed3,
withFixedFixed4 = withFixedFixed4}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Word32) @(HsProtobuf.Fixed Hs.Word32)
withFixedFixed1)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(Hs.coerce @(Hs.Int32)
@(HsProtobuf.Signed (HsProtobuf.Fixed Hs.Int32))
withFixedFixed2)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)
(Hs.coerce @(Hs.Word64) @(HsProtobuf.Fixed Hs.Word64)
withFixedFixed3)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
(Hs.coerce @(Hs.Int64)
@(HsProtobuf.Signed (HsProtobuf.Fixed Hs.Int64))
withFixedFixed4))])
decodeMessage _
= (Hs.pure WithFixed) <*>
(Hs.coerce @(_ (HsProtobuf.Fixed Hs.Word32)) @(_ Hs.Word32)
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
(Hs.coerce @(_ (HsProtobuf.Signed (HsProtobuf.Fixed Hs.Int32)))
@(_ Hs.Int32)
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
<*>
(Hs.coerce @(_ (HsProtobuf.Fixed Hs.Word64)) @(_ Hs.Word64)
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3)))
<*>
(Hs.coerce @(_ (HsProtobuf.Signed (HsProtobuf.Fixed Hs.Int64)))
@(_ Hs.Int64)
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Fixed32)
(HsProtobuf.Single "fixed1")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.SFixed32)
(HsProtobuf.Single "fixed2")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Prim HsProtobuf.Fixed64)
(HsProtobuf.Single "fixed3")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Prim HsProtobuf.SFixed64)
(HsProtobuf.Single "fixed4")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("fixed1", withFixedFixed1),
("fixed2", withFixedFixed2),
("fixed3", withFixedFixed3),
("fixed4", withFixedFixed4)]}})
data WithBytes = WithBytes{withBytesBytes1 :: Hs.ByteString,
withBytesBytes2 :: Hs.Vector Hs.ByteString}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithBytes where
nameOf _ = (Hs.fromString "WithBytes")
instance HsProtobuf.HasDefault 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)
(Hs.coerce @(Hs.Vector Hs.ByteString)
@(HsProtobuf.UnpackedVec Hs.ByteString)
withBytesBytes2))])
decodeMessage _
= (Hs.pure WithBytes) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
<*>
(Hs.coerce @(_ (HsProtobuf.UnpackedVec Hs.ByteString))
@(_ (Hs.Vector Hs.ByteString))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Bytes)
(HsProtobuf.Single "bytes1")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Repeated HsProtobuf.Bytes)
(HsProtobuf.Single "bytes2")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("bytes1", withBytesBytes1),
("bytes2", withBytesBytes2)]}})
data WithPacking = WithPacking{withPackingPacking1 ::
Hs.Vector Hs.Int32,
withPackingPacking2 :: Hs.Vector Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithPacking where
nameOf _ = (Hs.fromString "WithPacking")
instance HsProtobuf.HasDefault WithPacking
instance HsProtobuf.Message WithPacking where
encodeMessage _
WithPacking{withPackingPacking1 = withPackingPacking1,
withPackingPacking2 = withPackingPacking2}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Vector Hs.Int32) @(HsProtobuf.UnpackedVec Hs.Int32)
withPackingPacking1)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(Hs.coerce @(Hs.Vector Hs.Int32) @(HsProtobuf.PackedVec Hs.Int32)
withPackingPacking2))])
decodeMessage _
= (Hs.pure WithPacking) <*>
(Hs.coerce @(_ (HsProtobuf.UnpackedVec Hs.Int32))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Int32))
@(_ (Hs.Vector Hs.Int32))
(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))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "packing2")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("packing1", withPackingPacking1),
("packing2", withPackingPacking2)]}})
data E = EFLD0
| EFLD1
deriving (Hs.Show, Hs.Eq, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named E where
nameOf _ = (Hs.fromString "E")
instance HsProtobuf.HasDefault E
instance Hs.Bounded E where
minBound = EFLD0
maxBound = EFLD1
instance Hs.Ord E where
compare x y
= Hs.compare (HsProtobuf.fromProtoEnum x)
(HsProtobuf.fromProtoEnum y)
instance HsProtobuf.ProtoEnum E where
toProtoEnumMay 0 = Hs.Just EFLD0
toProtoEnumMay 1 = Hs.Just EFLD1
toProtoEnumMay _ = Hs.Nothing
fromProtoEnum (EFLD0) = 0
fromProtoEnum (EFLD1) = 1
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 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 Hs.Word32,
allPackedTypesPackedFixed64 :: Hs.Vector Hs.Word64,
allPackedTypesPackedFloat :: Hs.Vector Hs.Float,
allPackedTypesPackedDouble :: Hs.Vector Hs.Double,
allPackedTypesPackedSFixed32 :: Hs.Vector Hs.Int32,
allPackedTypesPackedSFixed64 :: Hs.Vector 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, Hs.NFData)
instance HsProtobuf.Named AllPackedTypes where
nameOf _ = (Hs.fromString "AllPackedTypes")
instance HsProtobuf.HasDefault 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)
(Hs.coerce @(Hs.Vector Hs.Word32) @(HsProtobuf.PackedVec Hs.Word32)
allPackedTypesPackedWord32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(Hs.coerce @(Hs.Vector Hs.Word64) @(HsProtobuf.PackedVec Hs.Word64)
allPackedTypesPackedWord64)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)
(Hs.coerce @(Hs.Vector Hs.Int32) @(HsProtobuf.PackedVec Hs.Int32)
allPackedTypesPackedInt32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)
(Hs.coerce @(Hs.Vector Hs.Int64) @(HsProtobuf.PackedVec Hs.Int64)
allPackedTypesPackedInt64)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 5)
(Hs.coerce @(Hs.Vector Hs.Word32)
@(HsProtobuf.PackedVec (HsProtobuf.Fixed Hs.Word32))
allPackedTypesPackedFixed32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 6)
(Hs.coerce @(Hs.Vector Hs.Word64)
@(HsProtobuf.PackedVec (HsProtobuf.Fixed Hs.Word64))
allPackedTypesPackedFixed64)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 7)
(Hs.coerce @(Hs.Vector Hs.Float) @(HsProtobuf.PackedVec Hs.Float)
allPackedTypesPackedFloat)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 8)
(Hs.coerce @(Hs.Vector Hs.Double) @(HsProtobuf.PackedVec Hs.Double)
allPackedTypesPackedDouble)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 9)
(Hs.coerce @(Hs.Vector Hs.Int32)
@(HsProtobuf.PackedVec (HsProtobuf.Signed (HsProtobuf.Fixed Hs.Int32)))
allPackedTypesPackedSFixed32)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 10)
(Hs.coerce @(Hs.Vector Hs.Int64)
@(HsProtobuf.PackedVec (HsProtobuf.Signed (HsProtobuf.Fixed Hs.Int64)))
allPackedTypesPackedSFixed64)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 11)
(Hs.coerce @(Hs.Vector Hs.Bool) @(HsProtobuf.PackedVec Hs.Bool)
allPackedTypesPackedBool)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 12)
(Hs.coerce @(Hs.Vector (HsProtobuf.Enumerated TestProto.E))
@(HsProtobuf.PackedVec (HsProtobuf.Enumerated TestProto.E))
allPackedTypesPackedEnum)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 13)
(Hs.coerce @(Hs.Vector (HsProtobuf.Enumerated TestProto.E))
@(HsProtobuf.UnpackedVec (HsProtobuf.Enumerated TestProto.E))
allPackedTypesUnpackedEnum))])
decodeMessage _
= (Hs.pure AllPackedTypes) <*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Word32))
@(_ (Hs.Vector Hs.Word32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Word64))
@(_ (Hs.Vector Hs.Word64))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Int32))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Int64))
@(_ (Hs.Vector Hs.Int64))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 4)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec (HsProtobuf.Fixed Hs.Word32)))
@(_ (Hs.Vector Hs.Word32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 5)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec (HsProtobuf.Fixed Hs.Word64)))
@(_ (Hs.Vector Hs.Word64))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 6)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Float))
@(_ (Hs.Vector Hs.Float))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 7)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Double))
@(_ (Hs.Vector Hs.Double))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 8)))
<*>
(Hs.coerce
@(_ (HsProtobuf.PackedVec (HsProtobuf.Signed (HsProtobuf.Fixed Hs.Int32))))
@(_ (Hs.Vector Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 9)))
<*>
(Hs.coerce
@(_ (HsProtobuf.PackedVec (HsProtobuf.Signed (HsProtobuf.Fixed Hs.Int64))))
@(_ (Hs.Vector Hs.Int64))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 10)))
<*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Bool))
@(_ (Hs.Vector Hs.Bool))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 11)))
<*>
(Hs.coerce
@(_ (HsProtobuf.PackedVec (HsProtobuf.Enumerated TestProto.E)))
@(_ (Hs.Vector (HsProtobuf.Enumerated TestProto.E)))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 12)))
<*>
(Hs.coerce
@(_ (HsProtobuf.UnpackedVec (HsProtobuf.Enumerated TestProto.E)))
@(_ (Hs.Vector (HsProtobuf.Enumerated TestProto.E)))
(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))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Repeated HsProtobuf.UInt64)
(HsProtobuf.Single "packedWord64")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Repeated HsProtobuf.Int32)
(HsProtobuf.Single "packedInt32")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)
(HsProtobuf.Repeated HsProtobuf.Int64)
(HsProtobuf.Single "packedInt64")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 5)
(HsProtobuf.Repeated HsProtobuf.Fixed32)
(HsProtobuf.Single "packedFixed32")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 6)
(HsProtobuf.Repeated HsProtobuf.Fixed64)
(HsProtobuf.Single "packedFixed64")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 7)
(HsProtobuf.Repeated HsProtobuf.Float)
(HsProtobuf.Single "packedFloat")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 8)
(HsProtobuf.Repeated HsProtobuf.Double)
(HsProtobuf.Single "packedDouble")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 9)
(HsProtobuf.Repeated HsProtobuf.SFixed32)
(HsProtobuf.Single "packedSFixed32")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 10)
(HsProtobuf.Repeated HsProtobuf.SFixed64)
(HsProtobuf.Single "packedSFixed64")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 11)
(HsProtobuf.Repeated HsProtobuf.Bool)
(HsProtobuf.Single "packedBool")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 12)
(HsProtobuf.Repeated (HsProtobuf.Named (HsProtobuf.Single "E")))
(HsProtobuf.Single "packedEnum")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.True))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 13)
(HsProtobuf.Repeated (HsProtobuf.Named (HsProtobuf.Single "E")))
(HsProtobuf.Single "unpackedEnum")
[(HsProtobuf.DotProtoOption (HsProtobuf.Single "packed")
(HsProtobuf.BoolLit Hs.False))]
"")]
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 =
Hs.Just 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)]}})
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, Hs.NFData)
instance HsProtobuf.Named OutOfOrderFields where
nameOf _ = (Hs.fromString "OutOfOrderFields")
instance HsProtobuf.HasDefault OutOfOrderFields
instance HsProtobuf.Message OutOfOrderFields where
encodeMessage _
OutOfOrderFields{outOfOrderFieldsField1 = outOfOrderFieldsField1,
outOfOrderFieldsField2 = outOfOrderFieldsField2,
outOfOrderFieldsField3 = outOfOrderFieldsField3,
outOfOrderFieldsField4 = outOfOrderFieldsField4}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2001)
(Hs.coerce @(Hs.Vector Hs.Word32) @(HsProtobuf.PackedVec Hs.Word32)
outOfOrderFieldsField1)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 101)
outOfOrderFieldsField2),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 30)
outOfOrderFieldsField3),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1002)
(Hs.coerce @(Hs.Vector Hs.Text) @(HsProtobuf.UnpackedVec Hs.Text)
outOfOrderFieldsField4))])
decodeMessage _
= (Hs.pure OutOfOrderFields) <*>
(Hs.coerce @(_ (HsProtobuf.PackedVec Hs.Word32))
@(_ (Hs.Vector Hs.Word32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2001)))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 101))
<*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 30))
<*>
(Hs.coerce @(_ (HsProtobuf.UnpackedVec Hs.Text))
@(_ (Hs.Vector Hs.Text))
(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))]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 101)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "field2")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 30)
(HsProtobuf.Prim HsProtobuf.Int64)
(HsProtobuf.Single "field3")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1002)
(HsProtobuf.Repeated HsProtobuf.String)
(HsProtobuf.Single "field4")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("field1", outOfOrderFieldsField1),
("field2", outOfOrderFieldsField2),
("field3", outOfOrderFieldsField3),
("field4", outOfOrderFieldsField4)]}})
data ShadowedMessage = ShadowedMessage{shadowedMessageName ::
Hs.Text,
shadowedMessageValue :: Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named ShadowedMessage where
nameOf _ = (Hs.fromString "ShadowedMessage")
instance HsProtobuf.HasDefault 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")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.Int32)
(HsProtobuf.Single "value")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("name", shadowedMessageName),
("value", shadowedMessageValue)]}})
data MessageShadower = MessageShadower{messageShadowerShadowedMessage
:: Hs.Maybe TestProto.MessageShadower_ShadowedMessage,
messageShadowerName :: Hs.Text}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named MessageShadower where
nameOf _ = (Hs.fromString "MessageShadower")
instance HsProtobuf.HasDefault MessageShadower
instance HsProtobuf.Message MessageShadower where
encodeMessage _
MessageShadower{messageShadowerShadowedMessage =
messageShadowerShadowedMessage,
messageShadowerName = messageShadowerName}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Maybe TestProto.MessageShadower_ShadowedMessage)
@(HsProtobuf.Nested TestProto.MessageShadower_ShadowedMessage)
messageShadowerShadowedMessage)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
messageShadowerName)])
decodeMessage _
= (Hs.pure MessageShadower) <*>
(Hs.coerce
@(_ (HsProtobuf.Nested TestProto.MessageShadower_ShadowedMessage))
@(_ (Hs.Maybe TestProto.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.Named (HsProtobuf.Single "ShadowedMessage")))
(HsProtobuf.Single "shadowed_message")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "name")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("shadowed_message",
messageShadowerShadowedMessage),
("name", messageShadowerName)]}})
data MessageShadower_ShadowedMessage = MessageShadower_ShadowedMessage{messageShadower_ShadowedMessageName
:: Hs.Text,
messageShadower_ShadowedMessageValue
:: Hs.Text}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named MessageShadower_ShadowedMessage where
nameOf _ = (Hs.fromString "MessageShadower_ShadowedMessage")
instance HsProtobuf.HasDefault 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")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Prim HsProtobuf.String)
(HsProtobuf.Single "value")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("name",
messageShadower_ShadowedMessageName),
("value",
messageShadower_ShadowedMessageValue)]}})
data WithQualifiedName = WithQualifiedName{withQualifiedNameQname1
:: Hs.Maybe TestProto.ShadowedMessage,
withQualifiedNameQname2 ::
Hs.Maybe TestProto.MessageShadower_ShadowedMessage}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WithQualifiedName where
nameOf _ = (Hs.fromString "WithQualifiedName")
instance HsProtobuf.HasDefault WithQualifiedName
instance HsProtobuf.Message WithQualifiedName where
encodeMessage _
WithQualifiedName{withQualifiedNameQname1 =
withQualifiedNameQname1,
withQualifiedNameQname2 = withQualifiedNameQname2}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 100)
(Hs.coerce @(Hs.Maybe TestProto.ShadowedMessage)
@(HsProtobuf.Nested TestProto.ShadowedMessage)
withQualifiedNameQname1)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 200)
(Hs.coerce @(Hs.Maybe TestProto.MessageShadower_ShadowedMessage)
@(HsProtobuf.Nested TestProto.MessageShadower_ShadowedMessage)
withQualifiedNameQname2))])
decodeMessage _
= (Hs.pure WithQualifiedName) <*>
(Hs.coerce @(_ (HsProtobuf.Nested TestProto.ShadowedMessage))
@(_ (Hs.Maybe TestProto.ShadowedMessage))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 100)))
<*>
(Hs.coerce
@(_ (HsProtobuf.Nested TestProto.MessageShadower_ShadowedMessage))
@(_ (Hs.Maybe TestProto.MessageShadower_ShadowedMessage))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 200)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 100)
(HsProtobuf.Prim
(HsProtobuf.Named (HsProtobuf.Single "ShadowedMessage")))
(HsProtobuf.Single "qname1")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 200)
(HsProtobuf.Prim
(HsProtobuf.Named
(HsProtobuf.Dots
(HsProtobuf.Path ("MessageShadower" Hs.:| ["ShadowedMessage"])))))
(HsProtobuf.Single "qname2")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("qname1", withQualifiedNameQname1),
("qname2", withQualifiedNameQname2)]}})
data UsingImported = UsingImported{usingImportedImportedNesting ::
Hs.Maybe TestProtoImport.WithNesting,
usingImportedLocalNesting :: Hs.Maybe TestProto.WithNesting}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named UsingImported where
nameOf _ = (Hs.fromString "UsingImported")
instance HsProtobuf.HasDefault UsingImported
instance HsProtobuf.Message UsingImported where
encodeMessage _
UsingImported{usingImportedImportedNesting =
usingImportedImportedNesting,
usingImportedLocalNesting = usingImportedLocalNesting}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 100)
(Hs.coerce @(Hs.Maybe TestProtoImport.WithNesting)
@(HsProtobuf.Nested TestProtoImport.WithNesting)
usingImportedImportedNesting)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 200)
(Hs.coerce @(Hs.Maybe TestProto.WithNesting)
@(HsProtobuf.Nested TestProto.WithNesting)
usingImportedLocalNesting))])
decodeMessage _
= (Hs.pure UsingImported) <*>
(Hs.coerce @(_ (HsProtobuf.Nested TestProtoImport.WithNesting))
@(_ (Hs.Maybe TestProtoImport.WithNesting))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 100)))
<*>
(Hs.coerce @(_ (HsProtobuf.Nested TestProto.WithNesting))
@(_ (Hs.Maybe TestProto.WithNesting))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 200)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 100)
(HsProtobuf.Prim
(HsProtobuf.Named
(HsProtobuf.Dots
(HsProtobuf.Path ("TestProtoImport" Hs.:| ["WithNesting"])))))
(HsProtobuf.Single "importedNesting")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 200)
(HsProtobuf.Prim
(HsProtobuf.Named (HsProtobuf.Single "WithNesting")))
(HsProtobuf.Single "localNesting")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("importedNesting",
usingImportedImportedNesting),
("localNesting",
usingImportedLocalNesting)]}})
newtype Wrapped = Wrapped{wrappedWrapped ::
Hs.Maybe TestProto.Wrapped}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Wrapped where
nameOf _ = (Hs.fromString "Wrapped")
instance HsProtobuf.HasDefault Wrapped
instance HsProtobuf.Message Wrapped where
encodeMessage _ Wrapped{wrappedWrapped = wrappedWrapped}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Maybe TestProto.Wrapped)
@(HsProtobuf.Nested TestProto.Wrapped)
wrappedWrapped))])
decodeMessage _
= (Hs.pure Wrapped) <*>
(Hs.coerce @(_ (HsProtobuf.Nested TestProto.Wrapped))
@(_ (Hs.Maybe TestProto.Wrapped))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Wrapped")))
(HsProtobuf.Single "wrapped")
[]
"")]
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 =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("wrapped", wrappedWrapped)]}})
data EnumAnnots = EnumAnnotsFOO
| EnumAnnotsBAR
deriving (Hs.Show, Hs.Eq, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named EnumAnnots where
nameOf _ = (Hs.fromString "EnumAnnots")
instance HsProtobuf.HasDefault EnumAnnots
instance Hs.Bounded EnumAnnots where
minBound = EnumAnnotsFOO
maxBound = EnumAnnotsBAR
instance Hs.Ord EnumAnnots where
compare x y
= Hs.compare (HsProtobuf.fromProtoEnum x)
(HsProtobuf.fromProtoEnum y)
instance HsProtobuf.ProtoEnum EnumAnnots where
toProtoEnumMay 0 = Hs.Just EnumAnnotsFOO
toProtoEnumMay 1 = Hs.Just EnumAnnotsBAR
toProtoEnumMay _ = Hs.Nothing
fromProtoEnum (EnumAnnotsFOO) = 0
fromProtoEnum (EnumAnnotsBAR) = 1
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 HsProtobuf.Finite EnumAnnots
newtype WrappedTrivial = WrappedTrivial{wrappedTrivialTrivial ::
Hs.Maybe TestProto.Trivial}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named WrappedTrivial where
nameOf _ = (Hs.fromString "WrappedTrivial")
instance HsProtobuf.HasDefault WrappedTrivial
instance HsProtobuf.Message WrappedTrivial where
encodeMessage _
WrappedTrivial{wrappedTrivialTrivial = wrappedTrivialTrivial}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Maybe TestProto.Trivial)
@(HsProtobuf.Nested TestProto.Trivial)
wrappedTrivialTrivial))])
decodeMessage _
= (Hs.pure WrappedTrivial) <*>
(Hs.coerce @(_ (HsProtobuf.Nested TestProto.Trivial))
@(_ (Hs.Maybe TestProto.Trivial))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Trivial")))
(HsProtobuf.Single "trivial")
[]
"")]
instance HsJSONPB.ToJSONPB WrappedTrivial where
toJSONPB (WrappedTrivial f1) = (HsJSONPB.object ["trivial" .= f1])
toEncodingPB (WrappedTrivial f1)
= (HsJSONPB.pairs ["trivial" .= f1])
instance HsJSONPB.FromJSONPB WrappedTrivial where
parseJSONPB
= (HsJSONPB.withObject "WrappedTrivial"
(\ obj -> (Hs.pure WrappedTrivial) <*> obj .: "trivial"))
instance HsJSONPB.ToJSON WrappedTrivial where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON WrappedTrivial where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema WrappedTrivial where
declareNamedSchema _
= do let declare_trivial = HsJSONPB.declareSchemaRef
wrappedTrivialTrivial <- declare_trivial Proxy.Proxy
let _ = Hs.pure WrappedTrivial <*> HsJSONPB.asProxy declare_trivial
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "WrappedTrivial",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("trivial", wrappedTrivialTrivial)]}})
data MapTest = MapTest{mapTestPrim :: Hs.Map Hs.Text Hs.Int32,
mapTestTrivial ::
Hs.Map Hs.Int32 (Hs.Maybe TestProto.WrappedTrivial),
mapTestSigned :: Hs.Map Hs.Int32 Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named MapTest where
nameOf _ = (Hs.fromString "MapTest")
instance HsProtobuf.HasDefault MapTest
instance HsProtobuf.Message MapTest where
encodeMessage _
MapTest{mapTestPrim = mapTestPrim, mapTestTrivial = mapTestTrivial,
mapTestSigned = mapTestSigned}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.unsafeCoerce @(Hs.Map Hs.Text Hs.Int32)
@(Hs.Map Hs.Text (HsProtobuf.Signed Hs.Int32))
mapTestPrim)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)
(Hs.unsafeCoerce
@(Hs.Map Hs.Int32 (Hs.Maybe TestProto.WrappedTrivial))
@(Hs.Map Hs.Int32 (HsProtobuf.Nested TestProto.WrappedTrivial))
mapTestTrivial)),
(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)
(Hs.unsafeCoerce @(Hs.Map Hs.Int32 Hs.Int32)
@(Hs.Map (HsProtobuf.Signed Hs.Int32) (HsProtobuf.Signed Hs.Int32))
mapTestSigned))])
decodeMessage _
= (Hs.pure MapTest) <*>
(Hs.unsafeCoerce @(_ (Hs.Map Hs.Text (HsProtobuf.Signed Hs.Int32)))
@(_ (Hs.Map Hs.Text Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
<*>
(Hs.unsafeCoerce
@(_ (Hs.Map Hs.Int32 (HsProtobuf.Nested TestProto.WrappedTrivial)))
@(_ (Hs.Map Hs.Int32 (Hs.Maybe TestProto.WrappedTrivial)))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 2)))
<*>
(Hs.unsafeCoerce
@(_ (Hs.Map (HsProtobuf.Signed Hs.Int32) (HsProtobuf.Signed Hs.Int32)))
@(_ (Hs.Map Hs.Int32 Hs.Int32))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 3)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Map HsProtobuf.String HsProtobuf.SInt32)
(HsProtobuf.Single "prim")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)
(HsProtobuf.Map HsProtobuf.Int32
(HsProtobuf.Named (HsProtobuf.Single "WrappedTrivial")))
(HsProtobuf.Single "trivial")
[]
""),
(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)
(HsProtobuf.Map HsProtobuf.SInt32 HsProtobuf.SInt32)
(HsProtobuf.Single "signed")
[]
"")]
instance HsJSONPB.ToJSONPB MapTest where
toJSONPB (MapTest f1 f2 f3)
= (HsJSONPB.object ["prim" .= f1, "trivial" .= f2, "signed" .= f3])
toEncodingPB (MapTest f1 f2 f3)
= (HsJSONPB.pairs ["prim" .= f1, "trivial" .= f2, "signed" .= f3])
instance HsJSONPB.FromJSONPB MapTest where
parseJSONPB
= (HsJSONPB.withObject "MapTest"
(\ obj ->
(Hs.pure MapTest) <*> obj .: "prim" <*> obj .: "trivial" <*>
obj .: "signed"))
instance HsJSONPB.ToJSON MapTest where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON MapTest where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema MapTest where
declareNamedSchema _
= do let declare_prim = HsJSONPB.declareSchemaRef
mapTestPrim <- declare_prim Proxy.Proxy
let declare_trivial = HsJSONPB.declareSchemaRef
mapTestTrivial <- declare_trivial Proxy.Proxy
let declare_signed = HsJSONPB.declareSchemaRef
mapTestSigned <- declare_signed Proxy.Proxy
let _ = Hs.pure MapTest <*> HsJSONPB.asProxy declare_prim <*>
HsJSONPB.asProxy declare_trivial
<*> HsJSONPB.asProxy declare_signed
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "MapTest",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("prim", mapTestPrim),
("trivial", mapTestTrivial),
("signed", mapTestSigned)]}})