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

grpc-gateway/generator: respect full package #462

Merged
merged 1 commit into from
Nov 8, 2017
Merged

grpc-gateway/generator: respect full package #462

merged 1 commit into from
Nov 8, 2017

Conversation

glerchundi
Copy link
Contributor

@glerchundi glerchundi commented Sep 14, 2017

Rebased on top of master, done by @notbdu.

Superseeds #417.

@glerchundi
Copy link
Contributor Author

Tested on our CI and it works as expected. Take into account that file.GoPkg.Path cannot be empty.

@tmc PTAL.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@glerchundi
Copy link
Contributor Author

do you agree @notbdu? :)

@notbdu
Copy link

notbdu commented Sep 14, 2017

Fine with me. Thanks @glerchundi.

@achew22
Copy link
Collaborator

achew22 commented Sep 17, 2017

Wouldn't this change the output path for every file generated, not just the ones using go_package?

@glerchundi
Copy link
Contributor Author

glerchundi commented Sep 18, 2017

@achew22 yep, it will. It's a breaking change. I can refactor to switch on a parameter or whatever and keep the old behaviour but the question is, what is desired? IMHO this is what end-user expects , me included.

I can create another PR after this one to override go_package based path for one that lets user choose (or directly defaults to the old behaviour in case go_package is empty) which output folder to use.

WDYT?

@glerchundi
Copy link
Contributor Author

@tmc, @achew22 I changed the code to keep backward compatibility.

@glerchundi
Copy link
Contributor Author

I don't think this is related to the PR itself...Flaky tests? IWOMM...

@glerchundi
Copy link
Contributor Author

Any chance/free-slot to look at this, @achew22, @tmc? Thanks

@achew22
Copy link
Collaborator

achew22 commented Oct 28, 2017

@tmc what do you think about this?

From my vantage it appears to be the correct behavior but I would like a 2nd set of eyes before we merge a breaking change. Also, once we merge this let's do a release.

@glerchundi, could you add some tests to verify the behavior and prevent regression?

@achew22
Copy link
Collaborator

achew22 commented Nov 8, 2017

@glerchundi, I just tagged a release which means now is a GREAT time to introduce breaking changes like this. Please update the PR with some tests and let's get it merged.

@glerchundi
Copy link
Contributor Author

glerchundi commented Nov 8, 2017 via email

@glerchundi glerchundi changed the title Use go_package option as base path. grpc-gateway/generator: respect full package Nov 8, 2017
@glerchundi
Copy link
Contributor Author

@achew22 PTAL

func newExampleFileDescriptor() *descriptor.File {
return newExampleFileDescriptorWithGoPkg(
&descriptor.GoPackage{
Path: "example.com/path/to/example/example.pb",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the file name end in .go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so.

I migrated an already existing example into a customisable function without doing any change to it but as you can observe in the two cases that I've implemented i used this descriptor as a 1-1 representation of the go_package proto option.

I tried to touch as less as possible :)

@achew22
Copy link
Collaborator

achew22 commented Nov 8, 2017

I have manually verified CLAs on glerchundi@ and notbdu@. Merging

@achew22 achew22 merged commit 93cf3eb into grpc-ecosystem:master Nov 8, 2017
@glerchundi
Copy link
Contributor Author

glerchundi commented Nov 8, 2017 via email

@glerchundi glerchundi deleted the notbdu-master branch November 9, 2017 08:15
@c4milo
Copy link

c4milo commented Nov 12, 2017

How can I disable this behavior? it broke my existing code :/

@glerchundi
Copy link
Contributor Author

@c4milo can you give us more details? Example proto file which was working and not now, as well as an expected behaviour explanation.

Although it should work as it was behaving before with just explicitly specifying the same go_package name as the one you're using in package.

@c4milo
Copy link

c4milo commented Nov 13, 2017

I should have clarified a bit better. I have no issues with the generated code itself. I had code relying on the Swagger gateway generated code being placed in the same location as the code generated by protoc-gen-go. The piece of code relying on that broke.

gdbelvin added a commit to gdbelvin/trillian that referenced this pull request Dec 6, 2017
grpc-gateway v1.3 doesn't contain grpc-ecosystem/grpc-gateway#462
which fixes a bug that prevents grpc-gateway from fully respecting
the go_path option in proto files.
adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
If you provide a go_package, your wishes will be reflected in the grpc-gateway output.
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.

5 participants