mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
* Migrate to swift 6.0 & swift-gRPC 2.0 The following migrates to swift 6.0, and also migrate to swift-grpc 2.0 that uses swift-nio under the hood to provide nicer API and async await Adds sendable to enum & update @_implementationOnly imports to use internal imports * Address PR comments regarding misspelling & proper method naming.
Languages known issues
Python
- Assert the type required in your server/client since python is able to receive
Bytes arrayorutf8 strings.
def SayHello(self, request, context):
# request might be a byte array or a utf8 string
r = HelloRequest.HelloRequest().GetRootAs(request, 0)
reply = "Unknown"
if r.Name():
reply = r.Name()
# Issues might happen if type checking isnt present.
# thus encoding it as a `reply.decode('UTF-8')`
return build_reply("welcome " + reply.decode('UTF-8'))
This can be prevented by making sure all the requests coming to/from python are Bytes array
def say_hello(stub, builder):
hello_request = bytes(builder.Output())
reply = stub.SayHello(hello_request)
r = HelloReply.HelloReply.GetRootAs(reply)
print(r.Message())
Go
- Always requires the
content-typeof the payload to be set toapplication/grpc+flatbuffers
example: .SayHello(ctx, b, grpc.CallContentSubtype("flatbuffers"))