Skip to content

fix(docs): correct tutorial code snippets for Go, Python, Java, Kotlin, and Node.js - #1936

Draft
msardara wants to merge 8 commits into
mainfrom
fix/tutorial-docs-go-bindings
Draft

fix(docs): correct tutorial code snippets for Go, Python, Java, Kotlin, and Node.js#1936
msardara wants to merge 8 commits into
mainfrom
fix/tutorial-docs-go-bindings

Conversation

@msardara

@msardara msardara commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix Go slimrpc tutorial code snippets (correct API usage and imports)
  • Fix Python tutorials to use publish_and_wait_async and correct context attribute names
  • Fix Java compilation errors and correct Java/Kotlin tutorial code snippets
  • Add Node.js tabs to slimrpc tutorials (client, serve, multicast)
  • Fix Node.js API bugs and Python context attribute in tutorials
  • Remove deployment_name field from config files

Test plan

  • Review each tutorial page to verify code snippets compile and match the actual SDK APIs
  • Confirm Node.js tabs render correctly alongside existing language tabs

Signed-off-by: Mauro Sardara <msardara@cisco.com>
- Fix slimrpc sub-package import: github.com/agntcy/slim-bindings-go/slimrpc
  -> github.com/agntcy/slim-bindings-go/v2/slim_rpc
- Move Channel/Server constructors to slim_rpc package (not main slim package):
  slim.ChannelNewWithConnection -> slim_rpc.ChannelNewWithConnection
  slim.ChannelNewGroupWithConnection -> slim_rpc.ChannelNewGroupWithConnection
  slim.ServerNewWithConnection -> slim_rpc.ServerNewWithConnection
- Fix non-existent methods: server.Serve() -> server.ServeBlocking(),
  channel.Close() -> channel.CloseBlocking(nil)
- Fix stream type in unary-stream handler: slimrpc.RequestStream[T]
  -> slim_rpc.ServerStream[T] (server sends responses, not requests)
- Fix serverNames slice type: []slim.Name -> []*slim.Name
  (NameFromString returns *Name)
Replace publish_async/publish_to_async with publish_and_wait_async/
publish_to_and_wait_async in tutorial-session.md, tutorial-receive.md,
and tutorial-persistence.md. The _async variants return a CompletionHandle
(fire-and-forget) while tutorials implied blocking behavior; the
_and_wait_async variants are correct for sequential examples.
- Kotlin: publishAsync / publishToAsync return a CompletionHandle; add
  handle.waitAsync() calls in tutorial-session, tutorial-receive, and
  tutorial-persistence so examples block until delivery as intended
- Kotlin: use createAppWithPersistenceAsync (not createAppWithPersistence)
  in tutorial-persistence to avoid blocking the coroutine dispatcher
- Node.js: remove spurious await on app.setRoute() which is synchronous
- slimrpc/tutorial-serve: fix Java/Kotlin server interface signatures for
  streaming methods — replace typed wrappers (TestSlimrpc.ServerResponseStream,
  ServerRequestStream, ServerBidiStream as constructor args) with raw
  RequestStream / ResponseSink params and helper-class wrappers inside the
  method body; replace Kotlin Flow API (which doesn't exist) with suspend
  functions using the same RequestStream/ResponseSink types
- slimrpc/tutorial-client: fix Java/Kotlin client call signatures — all
  methods require (Duration, Map) timeout/metadata params; unary-stream uses
  ResponseStreamReader + ClientResponseStream.create wrapper; stream-unary
  uses finalizeStream() not closeAndReceive().get(); bidi-stream recv()
  returns StreamMessage sealed type, response bytes need parseFrom()
- slimrpc/tutorial-multicast: fix Java/Kotlin group-client call pattern —
  needs Duration/null params, returns MulticastStreamMessage sealed type
  (not hasNext()/next() iterator), response bytes need parseFrom(), and
  source field is context().source() not sourceName()
- tutorial-serve.md Java: replace CompletableFuture.runAsync/supplyAsync
  (whose Runnable/Supplier lambdas cannot throw checked RpcException) with
  synchronous style matching the actual example; wrap parseFrom() calls in
  try/catch and rethrow as RuntimeException inside Function lambdas
- tutorial-client.md Java: wrap parseFrom() in the ClientResponseStream
  lambda so it compiles (InvalidProtocolBufferException is checked)
- tutorial-multicast.md Java: add missing <ExampleResponse> type parameter
  to MulticastResponseStream (generated TestGroupClient returns the typed
  variant, not the raw type); wrap parseFrom() in try/catch
Add Node.js code examples to tutorial-serve.md, tutorial-client.md, and
tutorial-multicast.md based on the slim-bindings Node.js examples. Covers
buf.gen.yaml code generation, AsyncIterable-based servicer implementation,
all four RPC patterns (unary-unary, unary-stream, stream-unary, stream-stream),
and group client multicast using TestGroupClient.
…utorials

- tutorial-app.md: setRoute accepts bigint directly (no Number() cast needed)
- tutorial-session.md: use SessionType enum values instead of string literals
- tutorial-persistence.md: use Direction enum, IdentityProviderConfig/IdentityVerifierConfig
  constructors, and pass connId directly to subscribeAsync
- tutorial-multicast.md: fix Python context attribute from source_name to source
  (RpcMessageContext.source is a Name object)
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 28b6e7cf-8122-4d8b-93fe-828962b6f9ef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

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.

1 participant