Skip to content

Commit

Permalink
Add remove_internal_comments option
Browse files Browse the repository at this point in the history
To allow internal comments within the protobuf which won't make
it the generated OAS file.

Using Google's AIP-192:

https://google.aip.dev/192#internal-comments
  • Loading branch information
same-id committed Aug 30, 2023
1 parent a39406f commit 1bd8026
Show file tree
Hide file tree
Showing 13 changed files with 751 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ proto:
buf generate \
--template ./examples/internal/proto/examplepb/ignore_comment.buf.gen.yaml \
--path examples/internal/proto/examplepb/ignore_comment.proto
buf generate \
--template ./examples/internal/proto/examplepb/remove_internal_comment.buf.gen.yaml \
--path examples/internal/proto/examplepb/remove_internal_comment.proto
buf generate \
--template ./examples/internal/proto/examplepb/visibility_rule_preview_echo_service.buf.gen.yaml \
--path examples/internal/proto/examplepb/visibility_rule_echo_service.proto
Expand Down
5 changes: 5 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ lint:
- examples/internal/proto/examplepb/visibility_rule_echo_service.proto
- examples/internal/proto/examplepb/use_go_template.proto
- examples/internal/proto/examplepb/ignore_comment.proto
- examples/internal/proto/examplepb/remove_internal_comment.proto
- examples/internal/proto/examplepb/wrappers.proto
ENUM_VALUE_PREFIX:
- examples/internal/proto/examplepb/a_bit_of_everything.proto
Expand Down Expand Up @@ -61,6 +62,7 @@ lint:
- examples/internal/proto/examplepb/visibility_rule_echo_service.proto
- examples/internal/proto/examplepb/use_go_template.proto
- examples/internal/proto/examplepb/ignore_comment.proto
- examples/internal/proto/examplepb/remove_internal_comment.proto
- examples/internal/proto/examplepb/wrappers.proto
- examples/internal/proto/oneofenum/oneof_enum.proto
- examples/internal/proto/pathenum/path_enum.proto
Expand All @@ -87,6 +89,7 @@ lint:
- examples/internal/proto/examplepb/visibility_rule_echo_service.proto
- examples/internal/proto/examplepb/use_go_template.proto
- examples/internal/proto/examplepb/ignore_comment.proto
- examples/internal/proto/examplepb/remove_internal_comment.proto
- examples/internal/proto/examplepb/wrappers.proto
- runtime/internal/examplepb/example.proto
- runtime/internal/examplepb/non_standard_names.proto
Expand All @@ -108,6 +111,7 @@ lint:
- examples/internal/proto/examplepb/visibility_rule_echo_service.proto
- examples/internal/proto/examplepb/use_go_template.proto
- examples/internal/proto/examplepb/ignore_comment.proto
- examples/internal/proto/examplepb/remove_internal_comment.proto
- examples/internal/proto/examplepb/wrappers.proto
- examples/internal/proto/oneofenum/oneof_enum.proto
- examples/internal/proto/pathenum/path_enum.proto
Expand Down Expand Up @@ -166,6 +170,7 @@ lint:
- examples/internal/proto/examplepb/visibility_rule_echo_service.proto
- examples/internal/proto/examplepb/use_go_template.proto
- examples/internal/proto/examplepb/ignore_comment.proto
- examples/internal/proto/examplepb/remove_internal_comment.proto
- examples/internal/proto/examplepb/wrappers.proto
- runtime/internal/examplepb/non_standard_names.proto
SERVICE_PASCAL_CASE:
Expand Down
2 changes: 2 additions & 0 deletions examples/internal/proto/examplepb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package(default_visibility = ["//visibility:public"])
# gazelle:exclude use_go_template.pb.gw.go
# gazelle:exclude use_go_template_grpc.pb.go
# gazelle:exclude ignore_comment.pb.gw.go
# gazelle:exclude remove_internal_comment.pb.gw.go
# gazelle:exclude ignore_comment_grpc.pb.go
# gazelle:exclude wrappers.pb.gw.go
# gazelle:exclude wrappers_grpc.pb.go
Expand Down Expand Up @@ -53,6 +54,7 @@ proto_library(
"generated_output.proto",
"ignore_comment.proto",
"non_standard_names.proto",
"remove_internal_comment.proto",
"response_body_service.proto",
"stream.proto",
"unannotated_echo_service.proto",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: v1
plugins:
- name: openapiv2
out: .
opt:
- remove_internal_comments=true
240 changes: 240 additions & 0 deletions examples/internal/proto/examplepb/remove_internal_comment.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1bd8026

Please sign in to comment.