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

feat: add example of non-working global grpc_api_configuration file #3062

Closed
wants to merge 3 commits into from
Closed

Conversation

gvencadze
Copy link

It's a reproducible example of issue #3059.

I've added two proto services, grpc_configuration and globalconfig.buf.gen.yaml files to examples/internal/proto/globalconfig

@google-cla
Copy link

google-cla bot commented Dec 13, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

I think you need to run the generation commands? See CONTRIBUTING.md in the root of the repository for a guide.

@gvencadze
Copy link
Author

@johanbrandhorst yeah, I've take a look at contributing guide, but I can't run regenerate command cause it raise following error:

Failure: plugin grpc-gateway: HTTP rules without a matching selector: .grpc.gateway.examples.internal.proto.globalconfig.second_svc.v1.SecondService.Get
HTTP rules without a matching selector: .grpc.gateway.examples.internal.proto.globalconfig.first_svc.v1.FirstService.Get
make: *** [Makefile:115: proto] Error 1

@gvencadze
Copy link
Author

Btw, what do you think about ability to specify multiple configuration files? If it's okay, I'll take a look how to implement it

@johanbrandhorst
Copy link
Collaborator

Btw, what do you think about ability to specify multiple configuration files? If it's okay, I'll take a look how to implement it

I really don't think that will be a good idea. I would sooner we allow users to specify multiple target files and directories in a single file. Specifying an external file is already a hack, unfortunately.

@johanbrandhorst
Copy link
Collaborator

@johanbrandhorst yeah, I've take a look at contributing guide, but I can't run regenerate command cause it raise following error:

Failure: plugin grpc-gateway: HTTP rules without a matching selector: .grpc.gateway.examples.internal.proto.globalconfig.second_svc.v1.SecondService.Get
HTTP rules without a matching selector: .grpc.gateway.examples.internal.proto.globalconfig.first_svc.v1.FirstService.Get
make: *** [Makefile:115: proto] Error 1

Yeah uhm I'm not entirely sure what the selector should be. Try and play around with it a bit 😝

@gvencadze
Copy link
Author

gvencadze commented Jan 7, 2023

@johanbrandhorst selector is right, If I delete second_svc rule and remove folder "second_svc" everything generates as expected, otherwise returns selector error. Also it's look kinda strange that in output with selector error we got dot at the start of selector e.g. instead of svc_selector we got .svc_selector

@gvencadze
Copy link
Author

I really don't think that will be a good idea. I would sooner we allow users to specify multiple target files and directories in a single file. Specifying an external file is already a hack, unfortunately.

Oh, if it's already a hack, than adding new features to it will be strange, I agree

@johanbrandhorst
Copy link
Collaborator

@johanbrandhorst selector is right, If I delete second_svc rule and remove folder "second_svc" everything generates as expected, otherwise returns selector error. Also it's look kinda strange that in output with selector error we got dot at the start of selector e.g. instead of app_selector we got .app_selector

It does look strange, I agree. I think it has to do with how the protobuf internal representation looks. I'm not sure why you're getting that selector error, you might have to do some debugging in the code, sorry. This part of the generator is rarely used and could do with some love.

@gvencadze
Copy link
Author

It does look strange, I agree. I think it has to do with how the protobuf internal representation looks. I'm not sure why you're getting that selector error, you might have to do some debugging in the code, sorry. This part of the generator is rarely used and could do with some love.

Maybe you can share any instruction how to debug such instruments? I tried run it as standard go application, but got error saying that it should be run using protoc

@johanbrandhorst
Copy link
Collaborator

Yes unfortunately you'll need to recompile the binary and rerun protoc to do a full integration test. It might be easier to write a test locally to understand how the logic works.

func TestUnboundExternalHTTPRules(t *testing.T) {
this test tests the external HTTP rule specification code.

@stale
Copy link

stale bot commented Jun 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 18, 2023
@stale stale bot removed the wontfix label Jun 20, 2023
@gvencadze gvencadze closed this by deleting the head repository Sep 13, 2023
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.

2 participants