proto3-suite 0.5.0 → 0.5.1
raw patch · 14 files changed
+45/−4363 lines, 14 filesdep ~basedep ~bytestringdep ~proto3-wirenew-uploader
Dependency ranges changed: base, bytestring, proto3-wire, turtle
Files
- CHANGELOG.md +6/−0
- gen/.gitignore +0/−0
- gen/TestProto.hs +0/−2740
- gen/TestProtoImport.hs +0/−213
- gen/TestProtoNestedMessage.hs +0/−283
- gen/TestProtoOneof.hs +0/−837
- gen/TestProtoOneofImport.hs +0/−259
- proto3-suite.cabal +16/−10
- src/Proto3/Suite/DotProto/AST.hs +1/−2
- src/Proto3/Suite/DotProto/Generate.hs +6/−6
- src/Proto3/Suite/DotProto/Internal.hs +11/−7
- src/Proto3/Suite/DotProto/Parsing.hs +2/−3
- src/Proto3/Suite/DotProto/Rendering.hs +1/−1
- tools/canonicalize-proto-file/Main.hs +2/−2
CHANGELOG.md view
@@ -1,3 +1,9 @@++# 0.5.1+* Support newer versions of proto3-wire, bytestring, and turtle+* Increase minimum version of base for canonicalize-proto-file from 4.8 to 4.11++# 0.5.0 * [BREAKING CHANGE: Proto3 standard compatibility improvements](https://github.com/awakesecurity/proto3-suite/pull/143) * This is a breaking change due to adding a new `DotProtoMessageOption` constructor to `DotProtoMessagePart`, which requires updating any
+ gen/.gitignore view
− gen/TestProto.hs
@@ -1,2740 +0,0 @@-{-# 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)]}})
− gen/TestProtoImport.hs
@@ -1,213 +0,0 @@-{-# 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 TestProtoImport 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- -data WithNesting = WithNesting{withNestingNestedMessage1 ::- Hs.Maybe TestProtoImport.WithNesting_Nested,- withNestingNestedMessage2 ::- Hs.Maybe TestProtoImport.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{withNestingNestedMessage1 = withNestingNestedMessage1,- withNestingNestedMessage2 = withNestingNestedMessage2}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- (Hs.coerce @(Hs.Maybe TestProtoImport.WithNesting_Nested)- @(HsProtobuf.Nested TestProtoImport.WithNesting_Nested)- withNestingNestedMessage1)),- (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 100)- (Hs.coerce @(Hs.Maybe TestProtoImport.WithNesting_Nested)- @(HsProtobuf.Nested TestProtoImport.WithNesting_Nested)- withNestingNestedMessage2))])- decodeMessage _- = (Hs.pure WithNesting) <*>- (Hs.coerce- @(_ (HsProtobuf.Nested TestProtoImport.WithNesting_Nested))- @(_ (Hs.Maybe TestProtoImport.WithNesting_Nested))- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 1)))- <*>- (Hs.coerce- @(_ (HsProtobuf.Nested TestProtoImport.WithNesting_Nested))- @(_ (Hs.Maybe TestProtoImport.WithNesting_Nested))- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 100)))- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)- (HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Nested")))- (HsProtobuf.Single "nestedMessage1")- []- ""),- (HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 100)- (HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Nested")))- (HsProtobuf.Single "nestedMessage2")- []- "")]- -instance HsJSONPB.ToJSONPB WithNesting where- toJSONPB (WithNesting f1 f100)- = (HsJSONPB.object- ["nestedMessage1" .= f1, "nestedMessage2" .= f100])- toEncodingPB (WithNesting f1 f100)- = (HsJSONPB.pairs- ["nestedMessage1" .= f1, "nestedMessage2" .= f100])- -instance HsJSONPB.FromJSONPB WithNesting where- parseJSONPB- = (HsJSONPB.withObject "WithNesting"- (\ obj ->- (Hs.pure WithNesting) <*> obj .: "nestedMessage1" <*>- obj .: "nestedMessage2"))- -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_nestedMessage1 = HsJSONPB.declareSchemaRef- withNestingNestedMessage1 <- declare_nestedMessage1 Proxy.Proxy- let declare_nestedMessage2 = HsJSONPB.declareSchemaRef- withNestingNestedMessage2 <- declare_nestedMessage2 Proxy.Proxy- let _ = Hs.pure WithNesting <*>- HsJSONPB.asProxy declare_nestedMessage1- <*> HsJSONPB.asProxy declare_nestedMessage2- 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- [("nestedMessage1",- withNestingNestedMessage1),- ("nestedMessage2",- withNestingNestedMessage2)]}})- -data WithNesting_Nested = WithNesting_Nested{withNesting_NestedNestedField1- :: Hs.Int32,- withNesting_NestedNestedField2 :: 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}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- withNesting_NestedNestedField1),- (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)- withNesting_NestedNestedField2)])- decodeMessage _- = (Hs.pure WithNesting_Nested) <*>- (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 "nestedField1")- []- ""),- (HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)- (HsProtobuf.Prim HsProtobuf.Int32)- (HsProtobuf.Single "nestedField2")- []- "")]- -instance HsJSONPB.ToJSONPB WithNesting_Nested where- toJSONPB (WithNesting_Nested f1 f2)- = (HsJSONPB.object ["nestedField1" .= f1, "nestedField2" .= f2])- toEncodingPB (WithNesting_Nested f1 f2)- = (HsJSONPB.pairs ["nestedField1" .= f1, "nestedField2" .= f2])- -instance HsJSONPB.FromJSONPB WithNesting_Nested where- parseJSONPB- = (HsJSONPB.withObject "WithNesting_Nested"- (\ obj ->- (Hs.pure WithNesting_Nested) <*> obj .: "nestedField1" <*>- obj .: "nestedField2"))- -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 _ = Hs.pure WithNesting_Nested <*>- HsJSONPB.asProxy declare_nestedField1- <*> HsJSONPB.asProxy declare_nestedField2- 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)]}})
− gen/TestProtoNestedMessage.hs
@@ -1,283 +0,0 @@-{-# 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 TestProtoNestedMessage 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- -newtype Request = Request{requestFoo ::- Hs.Maybe TestProtoNestedMessage.Request_Foo}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named Request where- nameOf _ = (Hs.fromString "Request")- -instance HsProtobuf.HasDefault Request- -instance HsProtobuf.Message Request where- encodeMessage _ Request{requestFoo = requestFoo}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- (Hs.coerce @(Hs.Maybe TestProtoNestedMessage.Request_Foo)- @(HsProtobuf.Nested TestProtoNestedMessage.Request_Foo)- requestFoo))])- decodeMessage _- = (Hs.pure Request) <*>- (Hs.coerce- @(_ (HsProtobuf.Nested TestProtoNestedMessage.Request_Foo))- @(_ (Hs.Maybe TestProtoNestedMessage.Request_Foo))- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 1)))- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)- (HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Foo")))- (HsProtobuf.Single "foo")- []- "")]- -instance HsJSONPB.ToJSONPB Request where- toJSONPB (Request f1) = (HsJSONPB.object ["foo" .= f1])- toEncodingPB (Request f1) = (HsJSONPB.pairs ["foo" .= f1])- -instance HsJSONPB.FromJSONPB Request where- parseJSONPB- = (HsJSONPB.withObject "Request"- (\ obj -> (Hs.pure Request) <*> obj .: "foo"))- -instance HsJSONPB.ToJSON Request where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON Request where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema Request where- declareNamedSchema _- = do let declare_foo = HsJSONPB.declareSchemaRef- requestFoo <- declare_foo Proxy.Proxy- let _ = Hs.pure Request <*> HsJSONPB.asProxy declare_foo- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "Request",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("foo", requestFoo)]}})- -newtype Request_Foo = Request_Foo{request_FooBar ::- Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named Request_Foo where- nameOf _ = (Hs.fromString "Request_Foo")- -instance HsProtobuf.HasDefault Request_Foo- -instance HsProtobuf.Message Request_Foo where- encodeMessage _ Request_Foo{request_FooBar = request_FooBar}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- (Hs.coerce @(Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar)- @(HsProtobuf.Nested TestProtoNestedMessage.Request_Foo_Bar)- request_FooBar))])- decodeMessage _- = (Hs.pure Request_Foo) <*>- (Hs.coerce- @(_ (HsProtobuf.Nested TestProtoNestedMessage.Request_Foo_Bar))- @(_ (Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar))- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 1)))- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)- (HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Bar")))- (HsProtobuf.Single "bar")- []- "")]- -instance HsJSONPB.ToJSONPB Request_Foo where- toJSONPB (Request_Foo f1) = (HsJSONPB.object ["bar" .= f1])- toEncodingPB (Request_Foo f1) = (HsJSONPB.pairs ["bar" .= f1])- -instance HsJSONPB.FromJSONPB Request_Foo where- parseJSONPB- = (HsJSONPB.withObject "Request_Foo"- (\ obj -> (Hs.pure Request_Foo) <*> obj .: "bar"))- -instance HsJSONPB.ToJSON Request_Foo where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON Request_Foo where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema Request_Foo where- declareNamedSchema _- = do let declare_bar = HsJSONPB.declareSchemaRef- request_FooBar <- declare_bar Proxy.Proxy- let _ = Hs.pure Request_Foo <*> HsJSONPB.asProxy declare_bar- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "Request_Foo",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("bar", request_FooBar)]}})- -newtype Request_Foo_Bar = Request_Foo_Bar{request_Foo_BarBuz ::- Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar_Buz}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named Request_Foo_Bar where- nameOf _ = (Hs.fromString "Request_Foo_Bar")- -instance HsProtobuf.HasDefault Request_Foo_Bar- -instance HsProtobuf.Message Request_Foo_Bar where- encodeMessage _- Request_Foo_Bar{request_Foo_BarBuz = request_Foo_BarBuz}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- (Hs.coerce @(Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar_Buz)- @(HsProtobuf.Nested TestProtoNestedMessage.Request_Foo_Bar_Buz)- request_Foo_BarBuz))])- decodeMessage _- = (Hs.pure Request_Foo_Bar) <*>- (Hs.coerce- @(_ (HsProtobuf.Nested TestProtoNestedMessage.Request_Foo_Bar_Buz))- @(_ (Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar_Buz))- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 1)))- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)- (HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Buz")))- (HsProtobuf.Single "buz")- []- "")]- -instance HsJSONPB.ToJSONPB Request_Foo_Bar where- toJSONPB (Request_Foo_Bar f1) = (HsJSONPB.object ["buz" .= f1])- toEncodingPB (Request_Foo_Bar f1) = (HsJSONPB.pairs ["buz" .= f1])- -instance HsJSONPB.FromJSONPB Request_Foo_Bar where- parseJSONPB- = (HsJSONPB.withObject "Request_Foo_Bar"- (\ obj -> (Hs.pure Request_Foo_Bar) <*> obj .: "buz"))- -instance HsJSONPB.ToJSON Request_Foo_Bar where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON Request_Foo_Bar where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema Request_Foo_Bar where- declareNamedSchema _- = do let declare_buz = HsJSONPB.declareSchemaRef- request_Foo_BarBuz <- declare_buz Proxy.Proxy- let _ = Hs.pure Request_Foo_Bar <*> HsJSONPB.asProxy declare_buz- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "Request_Foo_Bar",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("buz", request_Foo_BarBuz)]}})- -newtype Request_Foo_Bar_Buz = Request_Foo_Bar_Buz{request_Foo_Bar_BuzX- :: Hs.Word32}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named Request_Foo_Bar_Buz where- nameOf _ = (Hs.fromString "Request_Foo_Bar_Buz")- -instance HsProtobuf.HasDefault Request_Foo_Bar_Buz- -instance HsProtobuf.Message Request_Foo_Bar_Buz where- encodeMessage _- Request_Foo_Bar_Buz{request_Foo_Bar_BuzX = request_Foo_Bar_BuzX}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- request_Foo_Bar_BuzX)])- decodeMessage _- = (Hs.pure Request_Foo_Bar_Buz) <*>- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 1))- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)- (HsProtobuf.Prim HsProtobuf.UInt32)- (HsProtobuf.Single "x")- []- "")]- -instance HsJSONPB.ToJSONPB Request_Foo_Bar_Buz where- toJSONPB (Request_Foo_Bar_Buz f1) = (HsJSONPB.object ["x" .= f1])- toEncodingPB (Request_Foo_Bar_Buz f1)- = (HsJSONPB.pairs ["x" .= f1])- -instance HsJSONPB.FromJSONPB Request_Foo_Bar_Buz where- parseJSONPB- = (HsJSONPB.withObject "Request_Foo_Bar_Buz"- (\ obj -> (Hs.pure Request_Foo_Bar_Buz) <*> obj .: "x"))- -instance HsJSONPB.ToJSON Request_Foo_Bar_Buz where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON Request_Foo_Bar_Buz where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema Request_Foo_Bar_Buz where- declareNamedSchema _- = do let declare_x = HsJSONPB.declareSchemaRef- request_Foo_Bar_BuzX <- declare_x Proxy.Proxy- let _ = Hs.pure Request_Foo_Bar_Buz <*> HsJSONPB.asProxy declare_x- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "Request_Foo_Bar_Buz",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("x", request_Foo_Bar_BuzX)]}})
− gen/TestProtoOneof.hs
@@ -1,837 +0,0 @@-{-# 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 TestProtoOneof 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 TestProtoOneofImport- -newtype DummyMsg = DummyMsg{dummyMsgDummy :: Hs.Int32}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named DummyMsg where- nameOf _ = (Hs.fromString "DummyMsg")- -instance HsProtobuf.HasDefault DummyMsg- -instance HsProtobuf.Message DummyMsg where- encodeMessage _ DummyMsg{dummyMsgDummy = dummyMsgDummy}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- dummyMsgDummy)])- decodeMessage _- = (Hs.pure DummyMsg) <*>- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 1))- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)- (HsProtobuf.Prim HsProtobuf.Int32)- (HsProtobuf.Single "dummy")- []- "")]- -instance HsJSONPB.ToJSONPB DummyMsg where- toJSONPB (DummyMsg f1) = (HsJSONPB.object ["dummy" .= f1])- toEncodingPB (DummyMsg f1) = (HsJSONPB.pairs ["dummy" .= f1])- -instance HsJSONPB.FromJSONPB DummyMsg where- parseJSONPB- = (HsJSONPB.withObject "DummyMsg"- (\ obj -> (Hs.pure DummyMsg) <*> obj .: "dummy"))- -instance HsJSONPB.ToJSON DummyMsg where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON DummyMsg where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema DummyMsg where- declareNamedSchema _- = do let declare_dummy = HsJSONPB.declareSchemaRef- dummyMsgDummy <- declare_dummy Proxy.Proxy- let _ = Hs.pure DummyMsg <*> HsJSONPB.asProxy declare_dummy- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "DummyMsg",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("dummy", dummyMsgDummy)]}})- -data DummyEnum = DummyEnumDUMMY0- | DummyEnumDUMMY1- deriving (Hs.Show, Hs.Eq, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named DummyEnum where- nameOf _ = (Hs.fromString "DummyEnum")- -instance HsProtobuf.HasDefault DummyEnum- -instance Hs.Bounded DummyEnum where- minBound = DummyEnumDUMMY0- maxBound = DummyEnumDUMMY1- -instance Hs.Ord DummyEnum where- compare x y- = Hs.compare (HsProtobuf.fromProtoEnum x)- (HsProtobuf.fromProtoEnum y)- -instance HsProtobuf.ProtoEnum DummyEnum where- toProtoEnumMay 0 = Hs.Just DummyEnumDUMMY0- toProtoEnumMay 1 = Hs.Just DummyEnumDUMMY1- toProtoEnumMay _ = Hs.Nothing- fromProtoEnum (DummyEnumDUMMY0) = 0- fromProtoEnum (DummyEnumDUMMY1) = 1- -instance HsJSONPB.ToJSONPB DummyEnum where- toJSONPB x _ = HsJSONPB.enumFieldString x- toEncodingPB x _ = HsJSONPB.enumFieldEncoding x- -instance HsJSONPB.FromJSONPB DummyEnum where- parseJSONPB (HsJSONPB.String "DUMMY0") = Hs.pure DummyEnumDUMMY0- parseJSONPB (HsJSONPB.String "DUMMY1") = Hs.pure DummyEnumDUMMY1- parseJSONPB v = (HsJSONPB.typeMismatch "DummyEnum" v)- -instance HsJSONPB.ToJSON DummyEnum where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON DummyEnum where- parseJSON = HsJSONPB.parseJSONPB- -instance HsProtobuf.Finite DummyEnum- -data Something = Something{somethingValue :: Hs.Int64,- somethingAnother :: Hs.Int32,- somethingPickOne :: Hs.Maybe SomethingPickOne}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named Something where- nameOf _ = (Hs.fromString "Something")- -instance HsProtobuf.HasDefault Something- -instance HsProtobuf.Message Something where- encodeMessage _- Something{somethingValue = somethingValue,- somethingAnother = somethingAnother,- somethingPickOne = somethingPickOne}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- (Hs.coerce @(Hs.Int64) @(HsProtobuf.Signed Hs.Int64)- somethingValue)),- (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)- (Hs.coerce @(Hs.Int32) @(HsProtobuf.Signed Hs.Int32)- somethingAnother)),- case somethingPickOne of- Hs.Nothing -> Hs.mempty- Hs.Just x- -> case x of- SomethingPickOneName y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)- (HsProtobuf.ForceEmit y))- SomethingPickOneSomeid y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 9)- (HsProtobuf.ForceEmit y))- SomethingPickOneDummyMsg1 y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 10)- (Hs.coerce @(Hs.Maybe TestProtoOneof.DummyMsg)- @(HsProtobuf.Nested TestProtoOneof.DummyMsg)- (Hs.Just y)))- SomethingPickOneDummyMsg2 y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 11)- (Hs.coerce @(Hs.Maybe TestProtoOneof.DummyMsg)- @(HsProtobuf.Nested TestProtoOneof.DummyMsg)- (Hs.Just y)))- SomethingPickOneDummyEnum y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 12)- (HsProtobuf.ForceEmit y))])- decodeMessage _- = (Hs.pure Something) <*>- (Hs.coerce @(_ (HsProtobuf.Signed Hs.Int64)) @(_ Hs.Int64)- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 1)))- <*>- (Hs.coerce @(_ (HsProtobuf.Signed Hs.Int32)) @(_ Hs.Int32)- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 2)))- <*>- (HsProtobuf.oneof Hs.Nothing- [((HsProtobuf.FieldNumber 4),- (Hs.pure (Hs.Just Hs.. SomethingPickOneName)) <*>- HsProtobuf.decodeMessageField),- ((HsProtobuf.FieldNumber 9),- (Hs.pure (Hs.Just Hs.. SomethingPickOneSomeid)) <*>- HsProtobuf.decodeMessageField),- ((HsProtobuf.FieldNumber 10),- (Hs.pure (Hs.fmap SomethingPickOneDummyMsg1)) <*>- (Hs.coerce @(_ (HsProtobuf.Nested TestProtoOneof.DummyMsg))- @(_ (Hs.Maybe TestProtoOneof.DummyMsg))- HsProtobuf.decodeMessageField)),- ((HsProtobuf.FieldNumber 11),- (Hs.pure (Hs.fmap SomethingPickOneDummyMsg2)) <*>- (Hs.coerce @(_ (HsProtobuf.Nested TestProtoOneof.DummyMsg))- @(_ (Hs.Maybe TestProtoOneof.DummyMsg))- HsProtobuf.decodeMessageField)),- ((HsProtobuf.FieldNumber 12),- (Hs.pure (Hs.Just Hs.. SomethingPickOneDummyEnum)) <*>- HsProtobuf.decodeMessageField)])- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)- (HsProtobuf.Prim HsProtobuf.SInt64)- (HsProtobuf.Single "value")- []- ""),- (HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)- (HsProtobuf.Prim HsProtobuf.SInt32)- (HsProtobuf.Single "another")- []- "")]- -instance HsJSONPB.ToJSONPB Something where- toJSONPB (Something f1 f2 f4_or_f9_or_f10_or_f11_or_f12)- = (HsJSONPB.object- ["value" .= f1, "another" .= f2,- (let encodePickOne- = (case f4_or_f9_or_f10_or_f11_or_f12 of- Hs.Just (SomethingPickOneName f4) -> (HsJSONPB.pair "name" f4)- Hs.Just (SomethingPickOneSomeid f9) -> (HsJSONPB.pair "someid" f9)- Hs.Just (SomethingPickOneDummyMsg1 f10)- -> (HsJSONPB.pair "dummyMsg1" f10)- Hs.Just (SomethingPickOneDummyMsg2 f11)- -> (HsJSONPB.pair "dummyMsg2" f11)- Hs.Just (SomethingPickOneDummyEnum f12)- -> (HsJSONPB.pair "dummyEnum" f12)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("pickOne" .= (HsJSONPB.objectOrNull [encodePickOne] options))- options- else encodePickOne options)])- toEncodingPB (Something f1 f2 f4_or_f9_or_f10_or_f11_or_f12)- = (HsJSONPB.pairs- ["value" .= f1, "another" .= f2,- (let encodePickOne- = (case f4_or_f9_or_f10_or_f11_or_f12 of- Hs.Just (SomethingPickOneName f4) -> (HsJSONPB.pair "name" f4)- Hs.Just (SomethingPickOneSomeid f9) -> (HsJSONPB.pair "someid" f9)- Hs.Just (SomethingPickOneDummyMsg1 f10)- -> (HsJSONPB.pair "dummyMsg1" f10)- Hs.Just (SomethingPickOneDummyMsg2 f11)- -> (HsJSONPB.pair "dummyMsg2" f11)- Hs.Just (SomethingPickOneDummyEnum f12)- -> (HsJSONPB.pair "dummyEnum" f12)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("pickOne" .= (HsJSONPB.pairsOrNull [encodePickOne] options))- options- else encodePickOne options)])- -instance HsJSONPB.FromJSONPB Something where- parseJSONPB- = (HsJSONPB.withObject "Something"- (\ obj ->- (Hs.pure Something) <*> obj .: "value" <*> obj .: "another" <*>- (let parsePickOne parseObj- = Hs.msum- [Hs.Just Hs.. SomethingPickOneName <$>- (HsJSONPB.parseField parseObj "name"),- Hs.Just Hs.. SomethingPickOneSomeid <$>- (HsJSONPB.parseField parseObj "someid"),- Hs.Just Hs.. SomethingPickOneDummyMsg1 <$>- (HsJSONPB.parseField parseObj "dummyMsg1"),- Hs.Just Hs.. SomethingPickOneDummyMsg2 <$>- (HsJSONPB.parseField parseObj "dummyMsg2"),- Hs.Just Hs.. SomethingPickOneDummyEnum <$>- (HsJSONPB.parseField parseObj "dummyEnum"),- Hs.pure Hs.Nothing]- in- ((obj .: "pickOne") Hs.>>=- (HsJSONPB.withObject "pickOne" parsePickOne))- <|> (parsePickOne obj))))- -instance HsJSONPB.ToJSON Something where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON Something where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema Something where- declareNamedSchema _- = do let declare_value = HsJSONPB.declareSchemaRef- somethingValue <- declare_value Proxy.Proxy- let declare_another = HsJSONPB.declareSchemaRef- somethingAnother <- declare_another Proxy.Proxy- let declare_pickOne = HsJSONPB.declareSchemaRef- somethingPickOne <- declare_pickOne Proxy.Proxy- let _ = Hs.pure Something <*> HsJSONPB.asProxy declare_value <*>- HsJSONPB.asProxy declare_another- <*> HsJSONPB.asProxy declare_pickOne- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "Something",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("value", somethingValue),- ("another", somethingAnother),- ("pickOne", somethingPickOne)]}})- -data SomethingPickOne = SomethingPickOneName Hs.Text- | SomethingPickOneSomeid Hs.Int32- | SomethingPickOneDummyMsg1 TestProtoOneof.DummyMsg- | SomethingPickOneDummyMsg2 TestProtoOneof.DummyMsg- | SomethingPickOneDummyEnum (HsProtobuf.Enumerated- TestProtoOneof.DummyEnum)- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named SomethingPickOne where- nameOf _ = (Hs.fromString "SomethingPickOne")- -instance HsJSONPB.ToSchema SomethingPickOne where- declareNamedSchema _- = do let declare_name = HsJSONPB.declareSchemaRef- somethingPickOneName <- declare_name Proxy.Proxy- let _ = Hs.pure SomethingPickOneName <*>- HsJSONPB.asProxy declare_name- let declare_someid = HsJSONPB.declareSchemaRef- somethingPickOneSomeid <- declare_someid Proxy.Proxy- let _ = Hs.pure SomethingPickOneSomeid <*>- HsJSONPB.asProxy declare_someid- let declare_dummyMsg1 = HsJSONPB.declareSchemaRef- somethingPickOneDummyMsg1 <- declare_dummyMsg1 Proxy.Proxy- let _ = Hs.pure SomethingPickOneDummyMsg1 <*>- HsJSONPB.asProxy declare_dummyMsg1- let declare_dummyMsg2 = HsJSONPB.declareSchemaRef- somethingPickOneDummyMsg2 <- declare_dummyMsg2 Proxy.Proxy- let _ = Hs.pure SomethingPickOneDummyMsg2 <*>- HsJSONPB.asProxy declare_dummyMsg2- let declare_dummyEnum = HsJSONPB.declareSchemaRef- somethingPickOneDummyEnum <- declare_dummyEnum Proxy.Proxy- let _ = Hs.pure SomethingPickOneDummyEnum <*>- HsJSONPB.asProxy declare_dummyEnum- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "SomethingPickOne",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("name", somethingPickOneName),- ("someid", somethingPickOneSomeid),- ("dummyMsg1", somethingPickOneDummyMsg1),- ("dummyMsg2", somethingPickOneDummyMsg2),- ("dummyEnum", somethingPickOneDummyEnum)],- HsJSONPB._schemaMinProperties = Hs.Just 1,- HsJSONPB._schemaMaxProperties = Hs.Just 1}})- -data OneofFirst = OneofFirst{oneofFirstFirst ::- Hs.Maybe OneofFirstFirst,- oneofFirstLast :: Hs.Int32}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named OneofFirst where- nameOf _ = (Hs.fromString "OneofFirst")- -instance HsProtobuf.HasDefault OneofFirst- -instance HsProtobuf.Message OneofFirst where- encodeMessage _- OneofFirst{oneofFirstFirst = oneofFirstFirst,- oneofFirstLast = oneofFirstLast}- = (Hs.mconcat- [case oneofFirstFirst of- Hs.Nothing -> Hs.mempty- Hs.Just x- -> case x of- OneofFirstFirstChoice1 y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- (HsProtobuf.ForceEmit y))- OneofFirstFirstChoice2 y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)- (HsProtobuf.ForceEmit y)),- (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)- oneofFirstLast)])- decodeMessage _- = (Hs.pure OneofFirst) <*>- (HsProtobuf.oneof Hs.Nothing- [((HsProtobuf.FieldNumber 1),- (Hs.pure (Hs.Just Hs.. OneofFirstFirstChoice1)) <*>- HsProtobuf.decodeMessageField),- ((HsProtobuf.FieldNumber 2),- (Hs.pure (Hs.Just Hs.. OneofFirstFirstChoice2)) <*>- HsProtobuf.decodeMessageField)])- <*>- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 3))- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 3)- (HsProtobuf.Prim HsProtobuf.Int32)- (HsProtobuf.Single "last")- []- "")]- -instance HsJSONPB.ToJSONPB OneofFirst where- toJSONPB (OneofFirst f1_or_f2 f3)- = (HsJSONPB.object- [(let encodeFirst- = (case f1_or_f2 of- Hs.Just (OneofFirstFirstChoice1 f1) -> (HsJSONPB.pair "choice1" f1)- Hs.Just (OneofFirstFirstChoice2 f2) -> (HsJSONPB.pair "choice2" f2)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("first" .= (HsJSONPB.objectOrNull [encodeFirst] options)) options- else encodeFirst options),- "last" .= f3])- toEncodingPB (OneofFirst f1_or_f2 f3)- = (HsJSONPB.pairs- [(let encodeFirst- = (case f1_or_f2 of- Hs.Just (OneofFirstFirstChoice1 f1) -> (HsJSONPB.pair "choice1" f1)- Hs.Just (OneofFirstFirstChoice2 f2) -> (HsJSONPB.pair "choice2" f2)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("first" .= (HsJSONPB.pairsOrNull [encodeFirst] options)) options- else encodeFirst options),- "last" .= f3])- -instance HsJSONPB.FromJSONPB OneofFirst where- parseJSONPB- = (HsJSONPB.withObject "OneofFirst"- (\ obj ->- (Hs.pure OneofFirst) <*>- (let parseFirst parseObj- = Hs.msum- [Hs.Just Hs.. OneofFirstFirstChoice1 <$>- (HsJSONPB.parseField parseObj "choice1"),- Hs.Just Hs.. OneofFirstFirstChoice2 <$>- (HsJSONPB.parseField parseObj "choice2"),- Hs.pure Hs.Nothing]- in- ((obj .: "first") Hs.>>= (HsJSONPB.withObject "first" parseFirst))- <|> (parseFirst obj))- <*> obj .: "last"))- -instance HsJSONPB.ToJSON OneofFirst where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON OneofFirst where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema OneofFirst where- declareNamedSchema _- = do let declare_first = HsJSONPB.declareSchemaRef- oneofFirstFirst <- declare_first Proxy.Proxy- let declare_last = HsJSONPB.declareSchemaRef- oneofFirstLast <- declare_last Proxy.Proxy- let _ = Hs.pure OneofFirst <*> HsJSONPB.asProxy declare_first <*>- HsJSONPB.asProxy declare_last- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "OneofFirst",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("first", oneofFirstFirst),- ("last", oneofFirstLast)]}})- -data OneofFirstFirst = OneofFirstFirstChoice1 Hs.Text- | OneofFirstFirstChoice2 Hs.Text- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named OneofFirstFirst where- nameOf _ = (Hs.fromString "OneofFirstFirst")- -instance HsJSONPB.ToSchema OneofFirstFirst where- declareNamedSchema _- = do let declare_choice1 = HsJSONPB.declareSchemaRef- oneofFirstFirstChoice1 <- declare_choice1 Proxy.Proxy- let _ = Hs.pure OneofFirstFirstChoice1 <*>- HsJSONPB.asProxy declare_choice1- let declare_choice2 = HsJSONPB.declareSchemaRef- oneofFirstFirstChoice2 <- declare_choice2 Proxy.Proxy- let _ = Hs.pure OneofFirstFirstChoice2 <*>- HsJSONPB.asProxy declare_choice2- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "OneofFirstFirst",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("choice1", oneofFirstFirstChoice1),- ("choice2", oneofFirstFirstChoice2)],- HsJSONPB._schemaMinProperties = Hs.Just 1,- HsJSONPB._schemaMaxProperties = Hs.Just 1}})- -data OneofMiddle = OneofMiddle{oneofMiddleFirst :: Hs.Int32,- oneofMiddleMiddle :: Hs.Maybe OneofMiddleMiddle,- oneofMiddleLast :: Hs.Int32}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named OneofMiddle where- nameOf _ = (Hs.fromString "OneofMiddle")- -instance HsProtobuf.HasDefault OneofMiddle- -instance HsProtobuf.Message OneofMiddle where- encodeMessage _- OneofMiddle{oneofMiddleFirst = oneofMiddleFirst,- oneofMiddleMiddle = oneofMiddleMiddle,- oneofMiddleLast = oneofMiddleLast}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- oneofMiddleFirst),- case oneofMiddleMiddle of- Hs.Nothing -> Hs.mempty- Hs.Just x- -> case x of- OneofMiddleMiddleChoice1 y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)- (HsProtobuf.ForceEmit y))- OneofMiddleMiddleChoice2 y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)- (HsProtobuf.ForceEmit y)),- (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 4)- oneofMiddleLast)])- decodeMessage _- = (Hs.pure OneofMiddle) <*>- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 1))- <*>- (HsProtobuf.oneof Hs.Nothing- [((HsProtobuf.FieldNumber 2),- (Hs.pure (Hs.Just Hs.. OneofMiddleMiddleChoice1)) <*>- HsProtobuf.decodeMessageField),- ((HsProtobuf.FieldNumber 3),- (Hs.pure (Hs.Just Hs.. OneofMiddleMiddleChoice2)) <*>- HsProtobuf.decodeMessageField)])- <*>- (HsProtobuf.at HsProtobuf.decodeMessageField- (HsProtobuf.FieldNumber 4))- dotProto _- = [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)- (HsProtobuf.Prim HsProtobuf.Int32)- (HsProtobuf.Single "first")- []- ""),- (HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 4)- (HsProtobuf.Prim HsProtobuf.Int32)- (HsProtobuf.Single "last")- []- "")]- -instance HsJSONPB.ToJSONPB OneofMiddle where- toJSONPB (OneofMiddle f1 f2_or_f3 f4)- = (HsJSONPB.object- ["first" .= f1,- (let encodeMiddle- = (case f2_or_f3 of- Hs.Just (OneofMiddleMiddleChoice1 f2)- -> (HsJSONPB.pair "choice1" f2)- Hs.Just (OneofMiddleMiddleChoice2 f3)- -> (HsJSONPB.pair "choice2" f3)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("middle" .= (HsJSONPB.objectOrNull [encodeMiddle] options))- options- else encodeMiddle options),- "last" .= f4])- toEncodingPB (OneofMiddle f1 f2_or_f3 f4)- = (HsJSONPB.pairs- ["first" .= f1,- (let encodeMiddle- = (case f2_or_f3 of- Hs.Just (OneofMiddleMiddleChoice1 f2)- -> (HsJSONPB.pair "choice1" f2)- Hs.Just (OneofMiddleMiddleChoice2 f3)- -> (HsJSONPB.pair "choice2" f3)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("middle" .= (HsJSONPB.pairsOrNull [encodeMiddle] options)) options- else encodeMiddle options),- "last" .= f4])- -instance HsJSONPB.FromJSONPB OneofMiddle where- parseJSONPB- = (HsJSONPB.withObject "OneofMiddle"- (\ obj ->- (Hs.pure OneofMiddle) <*> obj .: "first" <*>- (let parseMiddle parseObj- = Hs.msum- [Hs.Just Hs.. OneofMiddleMiddleChoice1 <$>- (HsJSONPB.parseField parseObj "choice1"),- Hs.Just Hs.. OneofMiddleMiddleChoice2 <$>- (HsJSONPB.parseField parseObj "choice2"),- Hs.pure Hs.Nothing]- in- ((obj .: "middle") Hs.>>=- (HsJSONPB.withObject "middle" parseMiddle))- <|> (parseMiddle obj))- <*> obj .: "last"))- -instance HsJSONPB.ToJSON OneofMiddle where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON OneofMiddle where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema OneofMiddle where- declareNamedSchema _- = do let declare_first = HsJSONPB.declareSchemaRef- oneofMiddleFirst <- declare_first Proxy.Proxy- let declare_middle = HsJSONPB.declareSchemaRef- oneofMiddleMiddle <- declare_middle Proxy.Proxy- let declare_last = HsJSONPB.declareSchemaRef- oneofMiddleLast <- declare_last Proxy.Proxy- let _ = Hs.pure OneofMiddle <*> HsJSONPB.asProxy declare_first <*>- HsJSONPB.asProxy declare_middle- <*> HsJSONPB.asProxy declare_last- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "OneofMiddle",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("first", oneofMiddleFirst),- ("middle", oneofMiddleMiddle),- ("last", oneofMiddleLast)]}})- -data OneofMiddleMiddle = OneofMiddleMiddleChoice1 Hs.Text- | OneofMiddleMiddleChoice2 Hs.Text- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named OneofMiddleMiddle where- nameOf _ = (Hs.fromString "OneofMiddleMiddle")- -instance HsJSONPB.ToSchema OneofMiddleMiddle where- declareNamedSchema _- = do let declare_choice1 = HsJSONPB.declareSchemaRef- oneofMiddleMiddleChoice1 <- declare_choice1 Proxy.Proxy- let _ = Hs.pure OneofMiddleMiddleChoice1 <*>- HsJSONPB.asProxy declare_choice1- let declare_choice2 = HsJSONPB.declareSchemaRef- oneofMiddleMiddleChoice2 <- declare_choice2 Proxy.Proxy- let _ = Hs.pure OneofMiddleMiddleChoice2 <*>- HsJSONPB.asProxy declare_choice2- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "OneofMiddleMiddle",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("choice1", oneofMiddleMiddleChoice1),- ("choice2", oneofMiddleMiddleChoice2)],- HsJSONPB._schemaMinProperties = Hs.Just 1,- HsJSONPB._schemaMaxProperties = Hs.Just 1}})- -newtype WithImported = WithImported{withImportedPickOne ::- Hs.Maybe WithImportedPickOne}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named WithImported where- nameOf _ = (Hs.fromString "WithImported")- -instance HsProtobuf.HasDefault WithImported- -instance HsProtobuf.Message WithImported where- encodeMessage _- WithImported{withImportedPickOne = withImportedPickOne}- = (Hs.mconcat- [case withImportedPickOne of- Hs.Nothing -> Hs.mempty- Hs.Just x- -> case x of- WithImportedPickOneDummyMsg1 y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- (Hs.coerce @(Hs.Maybe TestProtoOneof.DummyMsg)- @(HsProtobuf.Nested TestProtoOneof.DummyMsg)- (Hs.Just y)))- WithImportedPickOneWithOneof y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)- (Hs.coerce @(Hs.Maybe TestProtoOneofImport.WithOneof)- @(HsProtobuf.Nested TestProtoOneofImport.WithOneof)- (Hs.Just y)))])- decodeMessage _- = (Hs.pure WithImported) <*>- (HsProtobuf.oneof Hs.Nothing- [((HsProtobuf.FieldNumber 1),- (Hs.pure (Hs.fmap WithImportedPickOneDummyMsg1)) <*>- (Hs.coerce @(_ (HsProtobuf.Nested TestProtoOneof.DummyMsg))- @(_ (Hs.Maybe TestProtoOneof.DummyMsg))- HsProtobuf.decodeMessageField)),- ((HsProtobuf.FieldNumber 2),- (Hs.pure (Hs.fmap WithImportedPickOneWithOneof)) <*>- (Hs.coerce @(_ (HsProtobuf.Nested TestProtoOneofImport.WithOneof))- @(_ (Hs.Maybe TestProtoOneofImport.WithOneof))- HsProtobuf.decodeMessageField))])- dotProto _ = []- -instance HsJSONPB.ToJSONPB WithImported where- toJSONPB (WithImported f1_or_f2)- = (HsJSONPB.object- [(let encodePickOne- = (case f1_or_f2 of- Hs.Just (WithImportedPickOneDummyMsg1 f1)- -> (HsJSONPB.pair "dummyMsg1" f1)- Hs.Just (WithImportedPickOneWithOneof f2)- -> (HsJSONPB.pair "withOneof" f2)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("pickOne" .= (HsJSONPB.objectOrNull [encodePickOne] options))- options- else encodePickOne options)])- toEncodingPB (WithImported f1_or_f2)- = (HsJSONPB.pairs- [(let encodePickOne- = (case f1_or_f2 of- Hs.Just (WithImportedPickOneDummyMsg1 f1)- -> (HsJSONPB.pair "dummyMsg1" f1)- Hs.Just (WithImportedPickOneWithOneof f2)- -> (HsJSONPB.pair "withOneof" f2)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("pickOne" .= (HsJSONPB.pairsOrNull [encodePickOne] options))- options- else encodePickOne options)])- -instance HsJSONPB.FromJSONPB WithImported where- parseJSONPB- = (HsJSONPB.withObject "WithImported"- (\ obj ->- (Hs.pure WithImported) <*>- (let parsePickOne parseObj- = Hs.msum- [Hs.Just Hs.. WithImportedPickOneDummyMsg1 <$>- (HsJSONPB.parseField parseObj "dummyMsg1"),- Hs.Just Hs.. WithImportedPickOneWithOneof <$>- (HsJSONPB.parseField parseObj "withOneof"),- Hs.pure Hs.Nothing]- in- ((obj .: "pickOne") Hs.>>=- (HsJSONPB.withObject "pickOne" parsePickOne))- <|> (parsePickOne obj))))- -instance HsJSONPB.ToJSON WithImported where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON WithImported where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema WithImported where- declareNamedSchema _- = do let declare_pickOne = HsJSONPB.declareSchemaRef- withImportedPickOne <- declare_pickOne Proxy.Proxy- let _ = Hs.pure WithImported <*> HsJSONPB.asProxy declare_pickOne- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "WithImported",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("pickOne", withImportedPickOne)]}})- -data WithImportedPickOne = WithImportedPickOneDummyMsg1 TestProtoOneof.DummyMsg- | WithImportedPickOneWithOneof TestProtoOneofImport.WithOneof- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named WithImportedPickOne where- nameOf _ = (Hs.fromString "WithImportedPickOne")- -instance HsJSONPB.ToSchema WithImportedPickOne where- declareNamedSchema _- = do let declare_dummyMsg1 = HsJSONPB.declareSchemaRef- withImportedPickOneDummyMsg1 <- declare_dummyMsg1 Proxy.Proxy- let _ = Hs.pure WithImportedPickOneDummyMsg1 <*>- HsJSONPB.asProxy declare_dummyMsg1- let declare_withOneof = HsJSONPB.declareSchemaRef- withImportedPickOneWithOneof <- declare_withOneof Proxy.Proxy- let _ = Hs.pure WithImportedPickOneWithOneof <*>- HsJSONPB.asProxy declare_withOneof- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "WithImportedPickOne",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("dummyMsg1", withImportedPickOneDummyMsg1),- ("withOneof",- withImportedPickOneWithOneof)],- HsJSONPB._schemaMinProperties = Hs.Just 1,- HsJSONPB._schemaMaxProperties = Hs.Just 1}})
− gen/TestProtoOneofImport.hs
@@ -1,259 +0,0 @@-{-# 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 TestProtoOneofImport 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- -data AMessage = AMessage{amessageX :: Hs.Text,- amessageY :: Hs.Int32}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named AMessage where- nameOf _ = (Hs.fromString "AMessage")- -instance HsProtobuf.HasDefault AMessage- -instance HsProtobuf.Message AMessage where- encodeMessage _- AMessage{amessageX = amessageX, amessageY = amessageY}- = (Hs.mconcat- [(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- amessageX),- (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)- amessageY)])- decodeMessage _- = (Hs.pure AMessage) <*>- (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 "x")- []- ""),- (HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 2)- (HsProtobuf.Prim HsProtobuf.Int32)- (HsProtobuf.Single "y")- []- "")]- -instance HsJSONPB.ToJSONPB AMessage where- toJSONPB (AMessage f1 f2)- = (HsJSONPB.object ["x" .= f1, "y" .= f2])- toEncodingPB (AMessage f1 f2)- = (HsJSONPB.pairs ["x" .= f1, "y" .= f2])- -instance HsJSONPB.FromJSONPB AMessage where- parseJSONPB- = (HsJSONPB.withObject "AMessage"- (\ obj -> (Hs.pure AMessage) <*> obj .: "x" <*> obj .: "y"))- -instance HsJSONPB.ToJSON AMessage where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON AMessage where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema AMessage where- declareNamedSchema _- = do let declare_x = HsJSONPB.declareSchemaRef- amessageX <- declare_x Proxy.Proxy- let declare_y = HsJSONPB.declareSchemaRef- amessageY <- declare_y Proxy.Proxy- let _ = Hs.pure AMessage <*> HsJSONPB.asProxy declare_x <*>- HsJSONPB.asProxy declare_y- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "AMessage",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("x", amessageX), ("y", amessageY)]}})- -newtype WithOneof = WithOneof{withOneofPickOne ::- Hs.Maybe WithOneofPickOne}- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named WithOneof where- nameOf _ = (Hs.fromString "WithOneof")- -instance HsProtobuf.HasDefault WithOneof- -instance HsProtobuf.Message WithOneof where- encodeMessage _ WithOneof{withOneofPickOne = withOneofPickOne}- = (Hs.mconcat- [case withOneofPickOne of- Hs.Nothing -> Hs.mempty- Hs.Just x- -> case x of- WithOneofPickOneA y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)- (HsProtobuf.ForceEmit y))- WithOneofPickOneB y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 2)- (HsProtobuf.ForceEmit y))- WithOneofPickOneC y- -> (HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 3)- (Hs.coerce @(Hs.Maybe TestProtoOneofImport.AMessage)- @(HsProtobuf.Nested TestProtoOneofImport.AMessage)- (Hs.Just y)))])- decodeMessage _- = (Hs.pure WithOneof) <*>- (HsProtobuf.oneof Hs.Nothing- [((HsProtobuf.FieldNumber 1),- (Hs.pure (Hs.Just Hs.. WithOneofPickOneA)) <*>- HsProtobuf.decodeMessageField),- ((HsProtobuf.FieldNumber 2),- (Hs.pure (Hs.Just Hs.. WithOneofPickOneB)) <*>- HsProtobuf.decodeMessageField),- ((HsProtobuf.FieldNumber 3),- (Hs.pure (Hs.fmap WithOneofPickOneC)) <*>- (Hs.coerce @(_ (HsProtobuf.Nested TestProtoOneofImport.AMessage))- @(_ (Hs.Maybe TestProtoOneofImport.AMessage))- HsProtobuf.decodeMessageField))])- dotProto _ = []- -instance HsJSONPB.ToJSONPB WithOneof where- toJSONPB (WithOneof f1_or_f2_or_f3)- = (HsJSONPB.object- [(let encodePickOne- = (case f1_or_f2_or_f3 of- Hs.Just (WithOneofPickOneA f1) -> (HsJSONPB.pair "a" f1)- Hs.Just (WithOneofPickOneB f2) -> (HsJSONPB.pair "b" f2)- Hs.Just (WithOneofPickOneC f3) -> (HsJSONPB.pair "c" f3)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("pickOne" .= (HsJSONPB.objectOrNull [encodePickOne] options))- options- else encodePickOne options)])- toEncodingPB (WithOneof f1_or_f2_or_f3)- = (HsJSONPB.pairs- [(let encodePickOne- = (case f1_or_f2_or_f3 of- Hs.Just (WithOneofPickOneA f1) -> (HsJSONPB.pair "a" f1)- Hs.Just (WithOneofPickOneB f2) -> (HsJSONPB.pair "b" f2)- Hs.Just (WithOneofPickOneC f3) -> (HsJSONPB.pair "c" f3)- Hs.Nothing -> Hs.mempty)- in- \ options ->- if HsJSONPB.optEmitNamedOneof options then- ("pickOne" .= (HsJSONPB.pairsOrNull [encodePickOne] options))- options- else encodePickOne options)])- -instance HsJSONPB.FromJSONPB WithOneof where- parseJSONPB- = (HsJSONPB.withObject "WithOneof"- (\ obj ->- (Hs.pure WithOneof) <*>- (let parsePickOne parseObj- = Hs.msum- [Hs.Just Hs.. WithOneofPickOneA <$>- (HsJSONPB.parseField parseObj "a"),- Hs.Just Hs.. WithOneofPickOneB <$>- (HsJSONPB.parseField parseObj "b"),- Hs.Just Hs.. WithOneofPickOneC <$>- (HsJSONPB.parseField parseObj "c"),- Hs.pure Hs.Nothing]- in- ((obj .: "pickOne") Hs.>>=- (HsJSONPB.withObject "pickOne" parsePickOne))- <|> (parsePickOne obj))))- -instance HsJSONPB.ToJSON WithOneof where- toJSON = HsJSONPB.toAesonValue- toEncoding = HsJSONPB.toAesonEncoding- -instance HsJSONPB.FromJSON WithOneof where- parseJSON = HsJSONPB.parseJSONPB- -instance HsJSONPB.ToSchema WithOneof where- declareNamedSchema _- = do let declare_pickOne = HsJSONPB.declareSchemaRef- withOneofPickOne <- declare_pickOne Proxy.Proxy- let _ = Hs.pure WithOneof <*> HsJSONPB.asProxy declare_pickOne- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "WithOneof",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("pickOne", withOneofPickOne)]}})- -data WithOneofPickOne = WithOneofPickOneA Hs.Text- | WithOneofPickOneB Hs.Int32- | WithOneofPickOneC TestProtoOneofImport.AMessage- deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)- -instance HsProtobuf.Named WithOneofPickOne where- nameOf _ = (Hs.fromString "WithOneofPickOne")- -instance HsJSONPB.ToSchema WithOneofPickOne where- declareNamedSchema _- = do let declare_a = HsJSONPB.declareSchemaRef- withOneofPickOneA <- declare_a Proxy.Proxy- let _ = Hs.pure WithOneofPickOneA <*> HsJSONPB.asProxy declare_a- let declare_b = HsJSONPB.declareSchemaRef- withOneofPickOneB <- declare_b Proxy.Proxy- let _ = Hs.pure WithOneofPickOneB <*> HsJSONPB.asProxy declare_b- let declare_c = HsJSONPB.declareSchemaRef- withOneofPickOneC <- declare_c Proxy.Proxy- let _ = Hs.pure WithOneofPickOneC <*> HsJSONPB.asProxy declare_c- Hs.return- (HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =- Hs.Just "WithOneofPickOne",- HsJSONPB._namedSchemaSchema =- Hs.mempty{HsJSONPB._schemaParamSchema =- Hs.mempty{HsJSONPB._paramSchemaType =- Hs.Just HsJSONPB.SwaggerObject},- HsJSONPB._schemaProperties =- HsJSONPB.insOrdFromList- [("a", withOneofPickOneA),- ("b", withOneofPickOneB),- ("c", withOneofPickOneC)],- HsJSONPB._schemaMinProperties = Hs.Just 1,- HsJSONPB._schemaMaxProperties = Hs.Just 1}})
proto3-suite.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: proto3-suite-version: 0.5.0+version: 0.5.1 synopsis: A higher-level API to the proto3-wire library description: This library provides a higher-level API to <https://github.com/awakesecurity/proto3-wire the `proto3-wire` library>@@ -17,11 +17,11 @@ license: Apache-2.0 author: Arista Networks <opensource@awakesecurity.com> maintainer: Arista Networks <opensource@awakesecurity.com>-copyright: 2017-2020 Awake Security, 2021 Arista Networks+copyright: 2017-2020 Awake Security, 2021-2022 Arista Networks category: Codec build-type: Simple data-files: test-files/*.bin tests/encode.sh tests/decode.sh-extra-source-files: CHANGELOG.md+extra-source-files: CHANGELOG.md, gen/.gitignore flag dhall Description: Turn on Dhall interpret and inject codegen@@ -78,7 +78,7 @@ base >=4.8 && <5.0, base64-bytestring >= 1.0.0.1 && < 1.3, binary >=0.8.3,- bytestring >=0.10.6.0 && <0.11.0,+ bytestring >=0.10.6.0 && <0.12.0, deepseq ==1.4.*, cereal >= 0.5.1 && <0.6, containers >=0.5 && < 0.7,@@ -95,7 +95,7 @@ parsers >= 0.12 && <0.13, pretty ==1.1.*, pretty-show >= 1.6.12 && < 2.0,- proto3-wire >= 1.2.2 && < 1.3,+ proto3-wire >= 1.2.2 && < 1.5, QuickCheck >=2.10 && <2.15, quickcheck-instances < 0.4, safe ==0.3.*,@@ -103,7 +103,7 @@ time, text >= 0.2 && <1.3, transformers >=0.4 && <0.6,- turtle,+ turtle < 1.6.0 || >= 1.6.1 && < 1.7.0, vector >=0.11 && < 0.13 if !impl(ghc >= 8.0) build-depends: semigroups >= 0.18 && < 0.20@@ -131,6 +131,12 @@ if flag(swagger-wrapper-format) cpp-options: -DSWAGGER_WRAPPER_FORMAT + autogen-modules:+ TestProto+ TestProtoImport+ TestProtoOneof+ TestProtoOneofImport+ TestProtoNestedMessage other-modules: ArbitraryGeneratedTestTypes TestCodeGen@@ -149,7 +155,7 @@ , attoparsec >= 0.13.0.1 , base >=4.8 && <5.0 , base64-bytestring >= 1.0.0.1 && < 1.3- , bytestring >=0.10.6.0 && <0.11.0+ , bytestring >=0.10.6.0 && <0.12.0 , cereal >= 0.5.1 && <0.6 , containers >=0.5 && < 0.7 , deepseq ==1.4.*@@ -159,7 +165,7 @@ , mtl ==2.2.* , pretty-show >= 1.6.12 && < 2.0 , proto3-suite- , proto3-wire == 1.2.*+ , proto3-wire >= 1.2 && < 1.5 , QuickCheck >=2.10 && <2.15 , tasty >= 0.11 && <1.5 , tasty-hedgehog@@ -190,12 +196,12 @@ main-is: Main.hs hs-source-dirs: tools/canonicalize-proto-file default-language: Haskell2010- build-depends: base >=4.8 && <5.0+ build-depends: base >=4.11.0.0 && <5.0 , containers >=0.5 && <0.7 , mtl ==2.2.* , optparse-generic , proto3-suite- , proto3-wire == 1.2.*+ , proto3-wire >= 1.2 && <1.5 , range-set-list >=0.1.2 && <0.2 , system-filepath , turtle
src/Proto3/Suite/DotProto/AST.hs view
@@ -37,7 +37,6 @@ import Data.Int (Int32) import qualified Data.List.NonEmpty as NE import Data.String (IsString)-import qualified Filesystem.Path.CurrentOS as FP import Numeric.Natural import Prelude hiding (FilePath) import Proto3.Wire.Types (FieldNumber (..))@@ -91,7 +90,7 @@ instance Arbitrary DotProtoImport where arbitrary = do dotProtoImportQualifier <- arbitrary- let dotProtoImportPath = FP.empty+ let dotProtoImportPath = mempty return (DotProtoImport {..}) data DotProtoImportQualifier
src/Proto3/Suite/DotProto/Generate.hs view
@@ -48,8 +48,6 @@ import qualified Data.Set as S import Data.String (fromString) import qualified Data.Text as T-import Filesystem.Path.CurrentOS ((</>), (<.>))-import qualified Filesystem.Path.CurrentOS as FP import Language.Haskell.Parser (ParseResult(..), parseModule) import Language.Haskell.Pretty import Language.Haskell.Syntax@@ -62,7 +60,7 @@ import Text.Parsec (Parsec, alphaNum, eof, parse, satisfy, try) import qualified Text.Parsec as Parsec import qualified Turtle-import Turtle (FilePath)+import Turtle (FilePath, (</>), (<.>)) -------------------------------------------------------------------------------- @@ -82,7 +80,9 @@ (dotProto, importTypeContext) <- readDotProtoWithContext includeDir inputProto modulePathPieces <- traverse renameProtoFile (toModuleComponents dotProto) - let relativePath = FP.concat (map fromString $ NE.toList modulePathPieces) <.> "hs"+ let relativePath = foldr combine mempty (map fromString $ NE.toList modulePathPieces) <.> "hs"+ combine p1 p2 | p2 == mempty = p1+ combine p1 p2 = p1 </> p2 let modulePath = outputDir </> relativePath Turtle.mktree (Turtle.directory modulePath)@@ -90,7 +90,7 @@ extraInstances <- foldMapM getExtraInstances extraInstanceFiles haskellModule <- renderHsModuleForDotProto extraInstances dotProto importTypeContext - liftIO (writeFile (FP.encodeString modulePath) haskellModule)+ liftIO (writeFile (Turtle.encodeString modulePath) haskellModule) where toModuleComponents :: DotProto -> NonEmpty String toModuleComponents = components . metaModulePath . protoMeta@@ -223,7 +223,7 @@ => FilePath -> m ([HsImportDecl], [HsDecl]) getExtraInstances extraInstanceFile = do - contents <- liftIO (readFile (FP.encodeString extraInstanceFile))+ contents <- liftIO (readFile (Turtle.encodeString extraInstanceFile)) case parseModule contents of ParseOk (HsModule _srcloc _mod _es idecls decls) -> do
src/Proto3/Suite/DotProto/Internal.hs view
@@ -34,8 +34,6 @@ import Data.Maybe (fromMaybe) import qualified Data.Text as T import Data.Tuple (swap)-import Filesystem.Path.CurrentOS ((</>))-import qualified Filesystem.Path.CurrentOS as FP import qualified NeatInterpolation as Neat import Prelude hiding (FilePath) import Proto3.Suite.DotProto.AST@@ -45,7 +43,8 @@ import System.FilePath (isPathSeparator) import Text.Parsec (ParseError) import qualified Turtle-import Turtle (ExitCode (..), FilePath, Text)+import Turtle (ExitCode (..), FilePath, Text,+ (</>)) import Turtle.Format ((%)) import qualified Turtle.Format as F @@ -130,8 +129,13 @@ -- >>> toModulePath "foo/FiLeName_underscore.and.then.some.dots.proto" -- Right (Path {components = "Foo" :| ["FiLeName_underscore","And","Then","Some","Dots"]}) --+#if MIN_VERSION_turtle(1,6,0) -- >>> toModulePath "foo/bar/././baz/../boggle.proto"+-- Left "path contained unexpected .. after canonicalization, please use form x.y.z.proto"+#else+-- >>> toModulePath "foo/bar/././baz/../boggle.proto" -- Right (Path {components = "Foo" :| ["Bar","Boggle"]})+#endif -- -- >>> toModulePath "./foo.proto" -- Right (Path {components = "Foo" :| []})@@ -140,16 +144,16 @@ -- >>> toModulePath ".foo.proto" -- Right (Path {components = "Foo" :| []}) toModulePath :: FilePath -> Either String Path-toModulePath fp0@(fromMaybe fp0 . FP.stripPrefix "./" -> fp)+toModulePath fp0@(fromMaybe fp0 . Turtle.stripPrefix "./" -> fp) | Turtle.absolute fp = Left "expected include-relative path" | Turtle.extension fp /= Just "proto" = Left "expected .proto suffix" | otherwise- = case FP.stripPrefix "../" fp of+ = case Turtle.stripPrefix "../" fp of Just{} -> Left "expected include-relative path, but the path started with ../" Nothing- | T.isInfixOf ".." . Turtle.format F.fp . FP.collapse $ fp+ | T.isInfixOf ".." . Turtle.format F.fp . Turtle.collapse $ fp -> Left "path contained unexpected .. after canonicalization, please use form x.y.z.proto" | otherwise -> maybe (Left "empty path after canonicalization") (Right . Path)@@ -161,7 +165,7 @@ . concatMap (T.splitOn ".") . T.split isPathSeparator . Turtle.format F.fp- . FP.collapse+ . Turtle.collapse . Turtle.dropExtension $ fp
src/Proto3/Suite/DotProto/Parsing.hs view
@@ -27,7 +27,6 @@ import qualified Data.List.NonEmpty as NE import Data.Functor import qualified Data.Text as T-import qualified Filesystem.Path.CurrentOS as FP import Proto3.Suite.DotProto.AST import Proto3.Wire.Types (FieldNumber(..)) import Text.Parsec (parse, ParseError)@@ -57,7 +56,7 @@ -- relative to some @--includeDir@. parseProtoFile :: Turtle.MonadIO m => Path -> Turtle.FilePath -> m (Either ParseError DotProto)-parseProtoFile modulePath (FP.encodeString -> fp) =+parseProtoFile modulePath (Turtle.encodeString -> fp) = parseProtoWithFile modulePath fp <$> Turtle.liftIO (readFile fp) ----------------------------------------@@ -212,7 +211,7 @@ qualifier <- option DotProtoImportDefault $ symbol "weak" $> DotProtoImportWeak <|> symbol "public" $> DotProtoImportPublic- target <- FP.fromText . T.pack <$> stringLit+ target <- Turtle.fromText . T.pack <$> stringLit semi return $ DotProtoImport qualifier target
src/Proto3/Suite/DotProto/Rendering.hs view
@@ -22,7 +22,6 @@ import Data.Char import qualified Data.List.NonEmpty as NE import qualified Data.Text as T-import Filesystem.Path.CurrentOS (toText) #if (MIN_VERSION_base(4,11,0)) import Prelude hiding ((<>)) #endif@@ -31,6 +30,7 @@ import Text.PrettyPrint (($$), (<+>), (<>)) import qualified Text.PrettyPrint as PP import Text.PrettyPrint.HughesPJClass (Pretty(..))+import Turtle (toText) -- | Options for rendering a @.proto@ file. data RenderingOptions = RenderingOptions
tools/canonicalize-proto-file/Main.hs view
@@ -17,7 +17,7 @@ import Data.List (sort, sortOn) import qualified Data.List.NonEmpty as NE import Data.RangeSet.List (fromRangeList, toRangeList)-import Data.Semigroup (Min(..), Option(..))+import Data.Semigroup (Min(..)) import Options.Generic import Prelude hiding (FilePath) import Proto3.Suite.DotProto.AST@@ -147,7 +147,7 @@ instance CanonicalRank [DotProtoField] (Maybe FieldNumber) where canonicalRank =- fmap getMin . getOption . foldMap (Option . fmap Min . canonicalRank)+ fmap getMin . foldMap (fmap Min . canonicalRank) instance Canonicalize [DotProtoField] where canonicalize = canonicalSort . filter keep