Support nested types in GRpc methods (#266)

This commit is contained in:
Akshay Mankar 2020-11-23 09:16:58 +01:00 committed by GitHub
parent 62f9d155b8
commit c94055c935

View File

@ -86,18 +86,18 @@ pbMethodToType s (P.Method nm vr v rr r _)
argToType P.Single (P.TOther ["google","protobuf","Empty"])
= [t| '[ ] |]
argToType P.Single (P.TOther a)
= [t| '[ 'ArgSingle ('Nothing :: Maybe Symbol) ('SchemaRef $(schemaTy s) $(textToStrLit (last a))) ] |]
= [t| '[ 'ArgSingle ('Nothing :: Maybe Symbol) ('SchemaRef $(schemaTy s) $(textToStrLit (T.intercalate "." a))) ] |]
argToType P.Stream (P.TOther a)
= [t| '[ 'ArgStream ('Nothing :: Maybe Symbol) ('SchemaRef $(schemaTy s) $(textToStrLit (last a))) ] |]
= [t| '[ 'ArgStream ('Nothing :: Maybe Symbol) ('SchemaRef $(schemaTy s) $(textToStrLit (T.intercalate "." a))) ] |]
argToType _ _
= fail "only message types may be used as arguments"
retToType P.Single (P.TOther ["google","protobuf","Empty"])
= [t| 'RetNothing |]
retToType P.Single (P.TOther a)
= [t| 'RetSingle ('SchemaRef $(schemaTy s) $(textToStrLit (last a))) |]
= [t| 'RetSingle ('SchemaRef $(schemaTy s) $(textToStrLit (T.intercalate "." a))) |]
retToType P.Stream (P.TOther a)
= [t| 'RetStream ('SchemaRef $(schemaTy s) $(textToStrLit (last a))) |]
= [t| 'RetStream ('SchemaRef $(schemaTy s) $(textToStrLit (T.intercalate "." a))) |]
retToType _ _
= fail "only message types may be used as results"