Skip to content

Commit

Permalink
Minimize public API
Browse files Browse the repository at this point in the history
As previously attempted on v1, so it shall be on v2.
We want to minimize the public API surface to more easily
allow changes that won't break users.
  • Loading branch information
johanbrandhorst committed Apr 28, 2020
1 parent ed092be commit c3ed09a
Show file tree
Hide file tree
Showing 69 changed files with 98 additions and 98 deletions.
44 changes: 22 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@ GO_PROTOBUF_REPO=github.com/golang/protobuf
GO_PLUGIN_PKG=$(GO_PROTOBUF_REPO)/protoc-gen-go
GO_PTYPES_ANY_PKG=$(GO_PROTOBUF_REPO)/ptypes/any
SWAGGER_PLUGIN=bin/protoc-gen-swagger
SWAGGER_PLUGIN_SRC= utilities/doc.go \
utilities/pattern.go \
utilities/trie.go \
protoc-gen-swagger/genswagger/generator.go \
protoc-gen-swagger/genswagger/template.go \
SWAGGER_PLUGIN_SRC= ./internal/utilities/doc.go \
./internal/utilities/pattern.go \
./internal/utilities/trie.go \
protoc-gen-swagger/internal/genswagger/generator.go \
protoc-gen-swagger/internal/genswagger/template.go \
protoc-gen-swagger/main.go
SWAGGER_PLUGIN_PKG=./protoc-gen-swagger
GATEWAY_PLUGIN=bin/protoc-gen-grpc-gateway
GATEWAY_PLUGIN_PKG=./protoc-gen-grpc-gateway
GATEWAY_PLUGIN_SRC= utilities/doc.go \
utilities/pattern.go \
utilities/trie.go \
GATEWAY_PLUGIN_SRC= ./internal/utilities/doc.go \
./internal/utilities/pattern.go \
./internal/utilities/trie.go \
./internal/descriptor \
./internal/descriptor/registry.go \
./internal/descriptor/services.go \
./internal/descriptor/types.go \
./internal/descriptor/grpc_api_configuration.go \
./internal/descriptor/grpc_api_service.go \
./internal/generator \
./internal/generator/generator.go \
protoc-gen-grpc-gateway \
protoc-gen-grpc-gateway/descriptor \
protoc-gen-grpc-gateway/descriptor/registry.go \
protoc-gen-grpc-gateway/descriptor/services.go \
protoc-gen-grpc-gateway/descriptor/types.go \
protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go \
protoc-gen-grpc-gateway/descriptor/grpc_api_service.go \
protoc-gen-grpc-gateway/generator \
protoc-gen-grpc-gateway/generator/generator.go \
protoc-gen-grpc-gateway/internal/gengateway \
protoc-gen-grpc-gateway/internal/gengateway/doc.go \
protoc-gen-grpc-gateway/internal/gengateway/generator.go \
protoc-gen-grpc-gateway/internal/gengateway/template.go \
protoc-gen-grpc-gateway/httprule \
protoc-gen-grpc-gateway/httprule/compile.go \
protoc-gen-grpc-gateway/httprule/parse.go \
protoc-gen-grpc-gateway/httprule/types.go \
internal/httprule \
internal/httprule/compile.go \
internal/httprule/parse.go \
internal/httprule/types.go \
protoc-gen-grpc-gateway/main.go
GATEWAY_PLUGIN_FLAGS?=
SWAGGER_PLUGIN_FLAGS?=
Expand Down Expand Up @@ -234,11 +234,11 @@ changelog:
--future-release=v1.14.4
lint:
golint --set_exit_status ./runtime
golint --set_exit_status ./utilities/...
golint --set_exit_status ././internal/utilities/...
golint --set_exit_status ./protoc-gen-grpc-gateway/...
golint --set_exit_status ./protoc-gen-swagger/...
go vet ./runtime || true
go vet ./utilities/...
go vet ././internal/utilities/...
go vet ./protoc-gen-grpc-gateway/...
go vet ./protoc-gen-swagger/...

Expand Down
2 changes: 1 addition & 1 deletion examples/internal/helloworld/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ go_library(
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/helloworld",
visibility = ["//visibility:public"],
deps = [
"//internal/utilities:go_default_library",
"//runtime:go_default_library",
"//utilities:go_default_library",
"@com_github_golang_protobuf//descriptor:go_default_library_gen",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/helloworld/helloworld.pb.gw.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ go_library(
embed = [":examplepb_go_proto"],
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb",
deps = [
"//internal/utilities:go_default_library",
"//runtime:go_default_library",
"//utilities:go_default_library",
"@com_github_golang_protobuf//descriptor:go_default_library_gen",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
Expand Down

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/echo_service.pb.gw.go

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

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

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

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/stream.pb.gw.go

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

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/use_go_template.pb.gw.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/wrappers.pb.gw.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/standalone/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ go_library(
visibility = ["//examples:__subpackages__"],
deps = [
"//examples/internal/proto/examplepb:go_default_library",
"//internal/utilities:go_default_library",
"//runtime:go_default_library",
"//utilities:go_default_library",
"@com_github_golang_protobuf//descriptor:go_default_library_gen",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
Expand Down

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

4 changes: 2 additions & 2 deletions fuzzit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ cd go-fuzz
go get ./...
go build ./...

#go get -v -u ./protoc-gen-grpc-gateway/httprule
#go get -v -u ./internal/httprule
cd /src/grpc-gateway
go-fuzz-build -libfuzzer -o parse-http-rule.a ./protoc-gen-grpc-gateway/httprule
go-fuzz-build -libfuzzer -o parse-http-rule.a ./internal/httprule
clang-9 -fsanitize=fuzzer parse-http-rule.a -o parse-http-rule

wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go_library(
"doc.go",
"parse_req.go",
],
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/codegenerator",
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator",
deps = [
"@com_github_golang_protobuf//proto:go_default_library",
"@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/golang/protobuf/proto"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
"github.com/google/go-cmp/cmp"
"github.com/grpc-ecosystem/grpc-gateway/v2/codegenerator"
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator"
"google.golang.org/protobuf/testing/protocmp"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ go_library(
"services.go",
"types.go",
],
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor",
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor",
deps = [
"//protoc-gen-grpc-gateway/httprule:go_default_library",
"//internal/httprule:go_default_library",
"@com_github_ghodss_yaml//:go_default_library",
"@com_github_golang_glog//:go_default_library",
"@com_github_golang_protobuf//jsonpb:go_default_library_gen",
Expand All @@ -36,7 +36,7 @@ go_test(
],
embed = [":go_default_library"],
deps = [
"//protoc-gen-grpc-gateway/httprule:go_default_library",
"//internal/httprule:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/golang/glog"
"github.com/golang/protobuf/proto"
descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor"
"github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule"
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule"
options "google.golang.org/genproto/googleapis/api/annotations"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/golang/protobuf/proto"
descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor"
"github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule"
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule"
)

func compilePath(t *testing.T, path string) httprule.Template {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/golang/protobuf/protoc-gen-go/descriptor"
gogen "github.com/golang/protobuf/protoc-gen-go/generator"
"github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule"
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule"
)

// IsWellKnownType returns true if the provided fully qualified type name is considered 'well-known'.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package(default_visibility = ["//visibility:public"])
go_library(
name = "go_default_library",
srcs = ["generator.go"],
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/generator",
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator",
deps = [
"//protoc-gen-grpc-gateway/descriptor:go_default_library",
"//internal/descriptor:go_default_library",
"@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package generator

import (
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
"github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/descriptor"
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor"
)

// Generator is an abstraction of code generators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ go_library(
"parse.go",
"types.go",
],
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/httprule",
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule",
deps = [
"//utilities:go_default_library",
"//internal/utilities:go_default_library",
"@com_github_golang_glog//:go_default_library",
],
)
Expand All @@ -26,7 +26,7 @@ go_test(
],
embed = [":go_default_library"],
deps = [
"//utilities:go_default_library",
"//internal/utilities:go_default_library",
"@com_github_golang_glog//:go_default_library",
],
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package httprule

import (
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities"
)

const (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion utilities/BUILD.bazel → internal/utilities/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ go_library(
"readerfactory.go",
"trie.go",
],
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/utilities",
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities",
)

go_test(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion utilities/trie_test.go → internal/utilities/trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/utilities"
)

func TestMaxCommonPrefix(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions protoc-gen-grpc-gateway/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ go_library(
srcs = ["main.go"],
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway",
deps = [
"//codegenerator:go_default_library",
"//protoc-gen-grpc-gateway/descriptor:go_default_library",
"//internal/codegenerator:go_default_library",
"//internal/descriptor:go_default_library",
"//protoc-gen-grpc-gateway/internal/gengateway:go_default_library",
"@com_github_golang_glog//:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
Expand All @@ -33,8 +33,8 @@ go_proto_compiler(
suffix = ".pb.gw.go",
visibility = ["//visibility:public"],
deps = [
"//internal/utilities:go_default_library",
"//runtime:go_default_library",
"//utilities:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
Expand Down
Loading

0 comments on commit c3ed09a

Please sign in to comment.