You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly great work on these libraries. I'm working on a wrapper of sorts myself. Basically I find the protobuf format fustratingly lacking - seriously, no ability to define required types?? - so have wrapped it with io-ts decoders and encoders and send all messages using the Struct and ListValue protobuf types - ie. JSON. This means I lose some of the GRPC tooling nice-ness using utils like BloomRPC in that all messages are Structs or ListValues, but within VS Code at least my clients and server imps are dealing with types based on the io-ts defined types - that is, with all the allowed and powerful constraints of io-ts, not handicapped by Google's half-way house binary protocol!
My one real quirk with nice-grpc is the encoding/decoding step, which doesn't seem to support wrapper types like the other integrations. Because I'm exclusively using Struct and ListValue, this means I need to do the wrap/unwrap explicitly, whereas before the grpc-js integration for example just handled it.
Here's an example of how I wrap methods where I have JSON in, JSON out .....:
Ideally I'd like not to do this at all and just feed in JSON and/or a list, or handle JSON and/or a list out, but that would require nice-grpc to do this step for me, which I believe the grpc-js integration does for example via these encode/decode methods:
I'm guessing there was probably a good reason it wasn't done this way and can workaround the current solution, but this tweak would definitely make nice-grpc even nicer, IMO! :)
The text was updated successfully, but these errors were encountered:
Hi,
Firstly great work on these libraries. I'm working on a wrapper of sorts myself. Basically I find the protobuf format fustratingly lacking - seriously, no ability to define required types?? - so have wrapped it with io-ts decoders and encoders and send all messages using the Struct and ListValue protobuf types - ie. JSON. This means I lose some of the GRPC tooling nice-ness using utils like BloomRPC in that all messages are Structs or ListValues, but within VS Code at least my clients and server imps are dealing with types based on the io-ts defined types - that is, with all the allowed and powerful constraints of io-ts, not handicapped by Google's half-way house binary protocol!
My one real quirk with nice-grpc is the encoding/decoding step, which doesn't seem to support wrapper types like the other integrations. Because I'm exclusively using Struct and ListValue, this means I need to do the wrap/unwrap explicitly, whereas before the grpc-js integration for example just handled it.
Here's an example of how I wrap methods where I have JSON in, JSON out .....:
Ideally I'd like not to do this at all and just feed in JSON and/or a list, or handle JSON and/or a list out, but that would require nice-grpc to do this step for me, which I believe the grpc-js integration does for example via these encode/decode methods:
https://github.com/stephenh/ts-proto/blob/main/src/encode.ts
I'm guessing there was probably a good reason it wasn't done this way and can workaround the current solution, but this tweak would definitely make nice-grpc even nicer, IMO! :)
The text was updated successfully, but these errors were encountered: