yash-agarwa-l opened a new pull request, #3776:
URL: https://github.com/apache/fory/pull/3776
## Why?
Swift users can generate Fory model types today, but schemas that define
services
do not produce Swift gRPC companions. This leaves Swift out of the existing
`--grpc`
workflow used by the other supported service-generation targets.
## What does this PR do?
- Adds Swift gRPC companion generation for Fory compiler services, including
service
metadata descriptors, an `EventLoopFuture` provider, an async/await
provider, an
async client, and Fory-backed request/response stream adapters, targeting
grpc-swift 1.x.
- Serializes request and response bodies with Fory instead of protobuf
through an
internal `GRPCPayload` wrapper. Because the Swift `Fory` runtime is
single-threaded,
the wrapper builds one `Fory` per thread from the schema module's own
configuration
and registrations, so concurrent RPCs are race-free (verified under
ThreadSanitizer).
- Emits an async-only client; the `EventLoopFuture` client and interceptor
hooks are
omitted because their generated types would expose the internal wrapper.
- Adds Swift preflight validation for generated output-path and top-level
symbol
collisions, and reserves inherited provider/client member names (`handle`,
`serviceName`, `channel`, `defaultCallOptions`) so a clashing rpc fails
codegen
with a clear message.
- Updates compiler and service-codegen tests to cover the four streaming
shapes,
identifier escaping, imported and nested service types, the default
package, the
protobuf and FlatBuffers frontends, collision handling, a SwiftPM
build-and-run
fixture, and a marshaller concurrency test under ThreadSanitizer (gated
behind
`FORY_SWIFT_TSAN`).
- Wires Swift output into the cross-language gRPC generation helper.
- Documents Swift gRPC support, dependencies, generated API shape,
streaming, the
shared-top-level-package limitation, troubleshooting, and compiler guide
updates.
Draft: Java<->Swift cross-language interop tests (all four modes, all three
IDL
frontends) are in progress and will be added before this PR is marked ready
for review.
## Related issues
#3266
#3370
## AI Contribution Checklist
- [ ] Substantial AI assistance was used in this PR: `yes`
- [ ] 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?
- [x] Does this PR introduce any public API change?
- Adds generated Swift gRPC companion APIs when `foryc --swift_out=...
--grpc` is used.
- [ ] Does this PR introduce any binary protocol compatibility change?
- The generated services use Fory-encoded gRPC message bodies, but this PR
does not
change the Fory binary protocol.
## Benchmark
Not applicable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]