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

[C++] Tables from different namespace referred incorrectly in RPC interface declarations #8531

Open
PROxZIMA opened this issue Feb 18, 2025 · 0 comments

Comments

@PROxZIMA
Copy link

PROxZIMA commented Feb 18, 2025

Quick example

schemas.fbs

namespace Runtime.Schema;

table SyncRequest
{
    id: uint16;
    name: string;
}

table SyncResponse
{
    data: string;
}

rpc_definition.fbs

include "schemas.fbs";

namespace Runtime.RpcService;

rpc_service SyncServer {
  Sync(Runtime.Schema.SyncRequest):Runtime.Schema.SyncResponse;
}

flatc command line

$ .\flatc.exe .\schemas.fbs --cpp --cpp-std c++11
$ .\flatc.exe .\rpc_definition.fbs --grpc --cpp --cpp-std c++11

rpc_definition_generated.h

...
#include "schemas_generated.h"
...

rpc_definition.grpc.fb.h

...
virtual ::grpc::Status Sync(::grpc::ClientContext* context, const flatbuffers::grpc::Message<SyncRequest>& request, flatbuffers::grpc::Message<SyncResponse>* response) = 0;
...

rpc_definition.grpc.fb.cc

...
::grpc::Status SyncServer::Stub::Sync(::grpc::ClientContext* context, const flatbuffers::grpc::Message<SyncRequest>& request, flatbuffers::grpc::Message<SyncResponse>* response) {
  return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_Sync_, context, request, response);
}
...

Observations

  • The problem here is that the generated files aren't fully qualifying SyncRequest and SyncResponse with their namespace i.e. Runtime::Schema::SyncRequest and Runtime::Schema::SyncResponse respectively.

Old Reference

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

No branches or pull requests

1 participant