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

[Bug #3829] consider openapiv2_tag.name attribute when generating ope… #1

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/internal/clients/abe/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tags:
- name: "echo rpc"
description: "Echo Rpc description"
x-traitTag: true
- name: "ABitOfEverythingService"
- name: "ABitOfEverything"
description: "ABitOfEverythingService description -- which should not be used in\
\ place of the documentation comment!"
externalDocs:
Expand Down Expand Up @@ -5727,12 +5727,12 @@ definitions:
code:
type: "integer"
format: "int32"
description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
message:
type: "string"
description: "A developer-facing error message, which should be in English.\
\ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\
\ field, or localized by the client."
\ field, or localized\nby the client."
details:
type: "array"
description: "A list of messages that carry the error details. There is a\
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/clients/echo/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -993,12 +993,12 @@ definitions:
code:
type: "integer"
format: "int32"
description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
message:
type: "string"
description: "A developer-facing error message, which should be in English.\
\ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\
\ field, or localized by the client."
\ field, or localized\nby the client."
details:
type: "array"
description: "A list of messages that carry the error details. There is a\
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/clients/responsebody/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ definitions:
code:
type: "integer"
format: "int32"
description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
message:
type: "string"
description: "A developer-facing error message, which should be in English.\
\ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\
\ field, or localized by the client."
\ field, or localized\nby the client."
details:
type: "array"
description: "A list of messages that carry the error details. There is a\
Expand Down
277 changes: 139 additions & 138 deletions examples/internal/proto/examplepb/a_bit_of_everything.pb.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ message UpdateBookRequest {
// 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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"x-traitTag": true
},
{
"name": "ABitOfEverythingService",
"name": "ABitOfEverything",
"description": "ABitOfEverythingService description -- which should not be used in place of the documentation comment!",
"externalDocs": {
"description": "Find out more about EchoService",
Expand Down Expand Up @@ -7898,11 +7898,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/proto/examplepb/echo_service.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1080,11 +1080,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1165,11 +1165,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/proto/examplepb/stream.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/proto/examplepb/wrappers.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,11 @@
"code": {
"type": "integer",
"format": "int32",
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]."
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
},
"details": {
"type": "array",
Expand Down
3 changes: 3 additions & 0 deletions protoc-gen-openapiv2/internal/genopenapi/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,9 @@ func renderServiceTags(services []*descriptor.Service, reg *descriptor.Registry)
tag.ExternalDocs.Description = goTemplateComments(opts.ExternalDocs.Description, svc, reg)
}
}
if opts.GetName() != "" {
tag.Name = opts.GetName()
}
}
tags = append(tags, tag)
}
Expand Down