-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[TS] Fixes GRPC code #6441
[TS] Fixes GRPC code #6441
Conversation
this should also land in #6353 |
@bjornharrtell is it always guarantied that the generated TS file will always only contain one Table/struct? |
@mustiikhalil yes, at least that is the intention. |
import { flatbuffers } from 'flatbuffers'; | ||
import * as Greeter_fbs from './greeter_generated'; | ||
import { HelloReply as Welcome_HelloReply } from './welcome/hello-reply'; | ||
import { HelloRequest as Welcome_HelloRequest } from './welcome/hello-request'; | ||
|
||
import * as grpc from 'grpc'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this okay to do? since I am not really sure how the new imports actually work
|
||
grpc::string ToDasherizedCase(const grpc::string pascal_case) { | ||
std::string dasherized_case; | ||
char p = 0; | ||
for (size_t i = 0; i < pascal_case.length(); i++) { | ||
char const &c = pascal_case[i]; | ||
if (flatbuffers::is_alpha_upper(c)) { | ||
if (i > 0 && p != flatbuffers::kPathSeparator) dasherized_case += "-"; | ||
dasherized_case += flatbuffers::CharToLower(c); | ||
} else { | ||
dasherized_case += c; | ||
} | ||
p = c; | ||
} | ||
return dasherized_case; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took this code from BaseGenerator.
@bjornharrtell can you please take a look at this PR if you have time. just to see if it won't have any conflicts with the huge rework the TS language had |
Can't review in detail but what I see looks ok to me. |
Looks good. |
Fixes issues with namespaces in grpc ts Renamed welcome -> models
6c3d30d
to
f4e75b3
Compare
781bc01
to
f4e75b3
Compare
Should I merge? |
The following PR fixes the TS code generator for GRPC to adhere to the new changes introduced in #6302.