-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protobuf support #1455
Protobuf support #1455
Conversation
Looks good UX-wise. Do we have a plan to support full-blown gRPC as well? |
Not at this point. It'd be really easy to do with http4s-grpc (which is still reasonably young) or with the official grpc lib (which is java only), but I don't currently want to a assume the maintenance of a gRPC module in open-source. So it's left as an exercise to the user 😄 |
I call dibs on the blogpost then. @velvetbaldmime don't you dare 🤣 |
modules/protobuf/src/main/scala/smithy4s/protobuf/ProtobufCodec.scala
Outdated
Show resolved
Hide resolved
modules/protobuf/src/main/scala/smithy4s/protobuf/internals/TaggedCodec.scala
Outdated
Show resolved
Hide resolved
modules/protobuf/src/main/scala/smithy4s/protobuf/internals/TaggedCodecSchemaVisitor.scala
Outdated
Show resolved
Hide resolved
Add test to ensure that decoding an unset value into a required field in protobuf is recovered. We could make it throw, in the future.
Changed the logic to ensure that decoding protobuf message fields that are required fails if the field was unset. Also change the ProtobufReadError model to make it an ADT
This adds a
smithy4s-protobuf
module, which provides support for protobuf serialisation following the alloy semantics.The module depends on the official
protobuf-java
library, which provides low-level primitives for parsing protobuf from raw bytes. On scala-js/scala-native, the module depends onprotobuf-runtime-scala
, a pure-scala implementation ofprotobuf-java
provided by the awesome ScalaPB library.The implementation is tested against ScalaPB. The tests involve a conversion from smithy to the proto IDL, performed by means of smithy-translate.
Additionally, this PR adds a documentation page, summarising various serialisation constructs provided by smithy4s out-of-the-box (including Document/JSON/XML/Protobuf). This documentation is by no mean exhaustive but should be helpful to users.
PR Checklist (not all items are relevant to all PRs)