-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
openapiv2_tag.name does not work #3829
Comments
…generating openapi docs
[Bug grpc-ecosystem#3829] consider openapiv2_tag.name attribute when generating ope…
…ute when generating ope… (#3830) * [Bug #3829] consider openapiv2_tag.name attribute when generating openapi docs * fix artifacts * fix test --------- Co-authored-by: Omri Eival <[email protected]>
* [Bug #3829] consider openapiv2_tag.name attribute when generating openapi docs * fix tags in methods * fixup * generated * fixup * fu * fixup of code * ran bazel build command * weird test is flakey
Is there any additional config needed to make this work? I've been trying it with the latest release (2.19.1) and the syntax = "proto3";
package test;
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "testing/test";
// ABitOfEverything service is used to validate that APIs with complicated
// proto messages and URL templates are still processed correctly.
service ABitOfEverythingService {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {
name: "ABitOfEverything"
description: "ABitOfEverythingService description -- which should not be used in place of the documentation comment!"
external_docs: {
url: "https://github.com/grpc-ecosystem/grpc-gateway";
description: "Find out more about EchoService";
}
};
rpc CreateBody(CreateBodyRequest) returns (CreateBodyResponse) {
option (google.api.http) = {
post: "/v1/example/a_bit_of_everything"
body: "*"
};
}
}
message CreateBodyRequest {}
message CreateBodyResponse {}
buf yaml: version: v1
managed:
enabled: true
plugins:
- plugin: buf.build/grpc-ecosystem/openapiv2:v2.19.1
out: openapi-spec |
Hm, perhaps there needs to be an additional fix to update the tags of the methods in the service? CC @omrikiei |
Oh I understand the problem, it looks like #3843 didn't address the behavior in all scenarios (unsure if that was intentional due to limitations- or an oversight). It looks like the tag is only being overridden if an RPC happens to have a non-nil Here's an rpc that did properly get the tag overridden/inherited from its grpc-gateway/examples/internal/clients/abe/api/swagger.yaml Lines 1401 to 1405 in ffe8ce6
and its corresponding proto definition grpc-gateway/examples/internal/proto/examplepb/a_bit_of_everything.proto Lines 585 to 595 in ffe8ce6
and here's an rpc within the same service that didn't get the tag applied grpc-gateway/examples/internal/clients/abe/api/swagger.yaml Lines 4494 to 4498 in ffe8ce6
with its corresponding proto defintion grpc-gateway/examples/internal/proto/examplepb/a_bit_of_everything.proto Lines 525 to 530 in ffe8ce6
Do we think thats the desired behavior? If not, should we re-open this issue, or would it be better to create a new one @johanbrandhorst? |
This sounds like a bug, so I've reopened the issue. Thanks for digging into this! |
I am looking into fixing this but Im having a lot of trouble figuring out how to run/test the openapi generator. If I want to regenerate a_bit_of_everything with my changes to the generator- what is the best way to do that? |
Please see the instructions in |
🐛 Bug Report
openapiv2_tag name attribute is not being considered during generation
To Reproduce
Expected behavior
name should override the service name in swagger.json artifact.
Please assign this to me if possible - I'm working on a fix
Actual Behavior
Name doesn't change
Your Environment
The text was updated successfully, but these errors were encountered: