Skip to content
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

Merged
merged 28 commits into from
Apr 15, 2024
Merged

Protobuf support #1455

merged 28 commits into from
Apr 15, 2024

Conversation

Baccata
Copy link
Contributor

@Baccata Baccata commented Mar 20, 2024

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 on protobuf-runtime-scala, a pure-scala implementation of protobuf-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)

  • Added unit-tests (for runtime code)
  • Added documentation
  • Updated changelog

@Baccata Baccata marked this pull request as ready for review March 21, 2024 15:17
build.sbt Outdated Show resolved Hide resolved
@kubukoz
Copy link
Member

kubukoz commented Apr 4, 2024

Looks good UX-wise. Do we have a plan to support full-blown gRPC as well?

@Baccata
Copy link
Contributor Author

Baccata commented Apr 5, 2024

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 😄

@kubukoz
Copy link
Member

kubukoz commented Apr 5, 2024

I call dibs on the blogpost then. @velvetbaldmime don't you dare 🤣

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
@Baccata Baccata merged commit b6c7897 into series/0.18 Apr 15, 2024
11 checks passed
@Baccata Baccata deleted the protobuf-support branch April 15, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants