google / gnostic

A compiler for APIs described by the OpenAPI Specification with plugins for code generation and other API support tasks.
Apache License 2.0
2.09k stars 248 forks source link

openapiv3 tags #363

Open 1226151667 opened 2 years ago

1226151667 commented 2 years ago

After setting the tag, why not overwrite the original default but recreate the tag, proto file:

service Test {
    rpc CreateTest (CreateTestRequest) returns (CreateTestReply) {
        option (google.api.http) = {
            post: "/api/test",
            body: "*"
        };
        option (openapi.v3.operation) = {
            tags: ["TS1"],
        };
    }
}

yaml file:

paths:
    /api/test:
        post:
            tags:
                - Test
                - TS1
         ..................

How do I do it, please, Thanks!

an15221315127 commented 2 years ago

I have the same problem as you

shuqingzai commented 1 year ago

I have the same problem as you

alex-sberna commented 1 year ago

I am experiencing similar behavior. Is there a way to suppress the "default" tag of the service and just use the specified tags?

shuqingzai commented 1 year ago

I had the same problem, checked the source code and found that this is hardcoded and currently impossible to change

It uses GoName as the default tag and adds it to document

https://github.com/google/gnostic/blob/ade94e0d08cb9c60272a311608cd5dabd30d1813/cmd/protoc-gen-openapi/generator/generator.go#L587

https://github.com/google/gnostic/blob/ade94e0d08cb9c60272a311608cd5dabd30d1813/cmd/protoc-gen-openapi/generator/generator.go#L739

https://github.com/google/gnostic/blob/ade94e0d08cb9c60272a311608cd5dabd30d1813/cmd/protoc-gen-openapi/generator/generator.go#L754

zhangcz828 commented 3 months ago

I had the same problem, any update?