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

[TS] Fixes GRPC code #6441

Merged
merged 1 commit into from
Feb 10, 2021
Merged

[TS] Fixes GRPC code #6441

merged 1 commit into from
Feb 10, 2021

Conversation

mustiikhalil
Copy link
Collaborator

The following PR fixes the TS code generator for GRPC to adhere to the new changes introduced in #6302.

@mustiikhalil
Copy link
Collaborator Author

this should also land in #6353

@mustiikhalil
Copy link
Collaborator Author

@bjornharrtell is it always guarantied that the generated TS file will always only contain one Table/struct?

@bjornharrtell
Copy link
Collaborator

@mustiikhalil yes, at least that is the intention.

Comment on lines 2 to 6
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';
Copy link
Collaborator Author

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

Comment on lines 32 to +48

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;
}

Copy link
Collaborator Author

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.

@mustiikhalil mustiikhalil self-assigned this Feb 4, 2021
@mustiikhalil
Copy link
Collaborator Author

mustiikhalil commented Feb 4, 2021

@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

@mustiikhalil mustiikhalil marked this pull request as ready for review February 4, 2021 12:00
@github-actions github-actions bot added the c++ label Feb 4, 2021
@aardappel
Copy link
Collaborator

@krojew

@bjornharrtell
Copy link
Collaborator

Can't review in detail but what I see looks ok to me.

@krojew
Copy link
Contributor

krojew commented Feb 6, 2021

Looks good.

Fixes issues with namespaces in grpc ts

Renamed welcome -> models
@github-actions github-actions bot added the codegen Involving generating code from schema label Feb 6, 2021
@github-actions github-actions bot removed the codegen Involving generating code from schema label Feb 6, 2021
@mustiikhalil
Copy link
Collaborator Author

Should I merge?

@aardappel aardappel merged commit 60eed0c into google:master Feb 10, 2021
@mustiikhalil mustiikhalil deleted the ts-grpc-fix branch February 10, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants