Skip to content

feat(scala): add generated grpc service support for scala#3762

Merged
chaokunyang merged 3 commits into
apache:mainfrom
chaokunyang:add_fory_scala_grpc_support
Jun 13, 2026
Merged

feat(scala): add generated grpc service support for scala#3762
chaokunyang merged 3 commits into
apache:mainfrom
chaokunyang:add_fory_scala_grpc_support

Conversation

@chaokunyang

@chaokunyang chaokunyang commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Why?

Scala schema generation already emits Scala 3 model types and modules, but schemas with service definitions could not generate Scala gRPC companions. This left Scala users without generated client/server bindings for Fory-encoded gRPC services even though Java, Python, Go, Rust, and Kotlin already support --grpc.

What does this PR do?

  • Adds Scala gRPC service companion generation for foryc --scala_out=... --grpc, including service descriptors, server base classes, generated clients, Fory-backed grpc-java marshallers, unary calls, and streaming method shapes.
  • Adds Scala compiler preflight validation for package/import combinations and generated file path collisions, including service companion paths.
  • Adds transport-free Scala RPC handle traits, RpcFuture and RpcIterator, for generated unary and server-streaming client convenience APIs.
  • Extends service codegen tests to cover Scala marshalling output, streaming shapes, imported type references, collision handling, keyword escaping, protobuf/FlatBuffers service inputs, and end-to-end --grpc output creation.
  • Documents Scala gRPC generation across the compiler docs and Scala guide, including dependencies, client/server examples, streaming behavior, and cross-IDL support.

Related issues

#3266

AI Contribution Checklist

  • Substantial AI assistance was used in this PR: yes / no
  • If yes, I included a completed AI Contribution Checklist in this PR description and the required AI Usage Disclosure.
  • If yes, my PR description includes the required ai_review summary and screenshot evidence of the final clean AI review results from both fresh reviewers on the current PR diff or current HEAD after the latest code changes.

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

User-facing changes:

  • Adds Scala --grpc service companion generation and new Scala RPC handle traits used by generated clients.
  • Does not change the Fory binary protocol.

Benchmark

@chaokunyang chaokunyang changed the title feat(scala): add generated grpc service support feat(scala): add generated grpc service support for scala Jun 13, 2026
@chaokunyang chaokunyang merged commit 0d8f412 into apache:main Jun 13, 2026
49 checks passed
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.

2 participants