Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanBaulch committed Sep 25, 2024
1 parent 1a70061 commit 17de61b
Show file tree
Hide file tree
Showing 35 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/README_GITHUB.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Whats up with the Dockerfile?
### What's up with the Dockerfile?

The `Dockerfile` in this folder is used as the build environment when regenerating the files (see CONTRIBUTING.md).
The canonical repository for this Dockerfile is `docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env`.
2 changes: 1 addition & 1 deletion docs/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ See the question above at first.
The gRPC-Gateway is intended to cover 80% of use cases without forcing you to write comprehensive but complicated annotations. So the gateway itself does not always cover all the use cases you have by design. In other words, the gateway automates typical boring boilerplate mapping between gRPC and HTTP/1 communication, but it does not do arbitrarily complex custom mappings for you.

On the other hand, you can still add whatever you want as a middleware which wraps
[`runtime.ServeMux`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#ServeMux). Since `runtime.ServeMux` is just a standard [`http.Handler`](http://golang.org/pkg/http#Handler), you can easily write a custom wrapper of `runtime.ServeMux`, leveraged with existing third-party libraries in Go (e.g. [gateway main.go program](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/gateway/main.go).
[`runtime.ServeMux`](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#ServeMux). Since `runtime.ServeMux` is just a standard [`http.Handler`](http://golang.org/pkg/http#Handler), you can easily write a custom wrapper of `runtime.ServeMux`, leveraged with existing third-party libraries in Go (e.g. [gateway main.go program](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/gateway/main.go)).

## My gRPC server is written in (Scala or C++ or Ruby or Haskell etc). Is there a (Scala or C++ or Ruby or Haskell etc) version of gRPC-Gateway?

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/mapping/customizing_openapi_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can provide comments directly in your Protocol Buffer definitions and they w

```protobuf
message MyMessage {
// This comment will end up direcly in your Open API definition
// This comment will end up directly in your Open API definition
string uuid = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The UUID field."}];
}
```
Expand All @@ -33,7 +33,7 @@ message ABitOfEverything {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
json_schema: {
title: "A bit of everything"
description: "Intentionaly complicated message type to cover many features of Protobuf."
description: "Intentionally complicated message type to cover many features of Protobuf."
required: ["uuid", "int64_value", "double_value"]
}
external_docs: {
Expand Down Expand Up @@ -113,7 +113,7 @@ Please see this [a_bit_of_everything.proto](https://github.com/grpc-ecosystem/gr

## Using google.api.field_behavior

Google provides an [field option](https://github.com/googleapis/googleapis/blob/master/google/api/field_behavior.proto) for defining the behavior of fields that is also supported:
Google provides a [field option](https://github.com/googleapis/googleapis/blob/master/google/api/field_behavior.proto) for defining the behavior of fields that is also supported:

```protobuf
import "google/api/field_behavior.proto";
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/mapping/customizing_your_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ You might not like [the default mapping rule](https://pkg.go.dev/github.com/grpc
)
```

To keep the [the default mapping rule](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#DefaultHeaderMatcher) alongside with your own rules write:
To keep the [default mapping rule](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/runtime?tab=doc#DefaultHeaderMatcher) alongside with your own rules write:

```go
func CustomMatcher(key string) (string, bool) {
Expand Down Expand Up @@ -461,7 +461,7 @@ This method is not used outside of the initial routing.

### Customizing Routing Errors

If you want to retain HTTP `405 Method Not Allowed` instead of allowing it to be converted to the equivalent of the gRPC `12 UNIMPLEMENTED`, which is HTTP `501 Not Implmented` you can use the following example:
If you want to retain HTTP `405 Method Not Allowed` instead of allowing it to be converted to the equivalent of the gRPC `12 UNIMPLEMENTED`, which is HTTP `501 Not Implemented` you can use the following example:

```go
func handleRoutingError(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, httpStatus int) {
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/clients/abe/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func selectHeaderAccept(accepts []string) string {
return strings.Join(accepts, ",")
}

// contains is a case insenstive match, finding needle in a haystack
// contains is a case insensitive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/clients/abe/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c contextKey) String() string {
}

var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")

// ContextBasicAuth takes BasicAuth as authentication for the request.
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/clients/echo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
)

// APIClient manages communication with the Echo Service API vversion not set
// APIClient manages communication with the Echo Service API version not set
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration
Expand Down Expand Up @@ -97,7 +97,7 @@ func selectHeaderAccept(accepts []string) string {
return strings.Join(accepts, ",")
}

// contains is a case insenstive match, finding needle in a haystack
// contains is a case insensitive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/clients/echo/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (c contextKey) String() string {
}

var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")

// ContextBasicAuth takes BasicAuth as authentication for the request.
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/clients/generateunboundmethods/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
)

// APIClient manages communication with the examples/internal/proto/examplepb/generate_unbound_methods.proto API vversion not set
// APIClient manages communication with the examples/internal/proto/examplepb/generate_unbound_methods.proto API version not set
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration
Expand Down Expand Up @@ -97,7 +97,7 @@ func selectHeaderAccept(accepts []string) string {
return strings.Join(accepts, ",")
}

// contains is a case insenstive match, finding needle in a haystack
// contains is a case insensitive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (c contextKey) String() string {
}

var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")

// ContextBasicAuth takes BasicAuth as authentication for the request.
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/clients/responsebody/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
)

// APIClient manages communication with the examples/internal/proto/examplepb/response_body_service.proto API vversion not set
// APIClient manages communication with the examples/internal/proto/examplepb/response_body_service.proto API version not set
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration
Expand Down Expand Up @@ -97,7 +97,7 @@ func selectHeaderAccept(accepts []string) string {
return strings.Join(accepts, ",")
}

// contains is a case insenstive match, finding needle in a haystack
// contains is a case insensitive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/clients/responsebody/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (c contextKey) String() string {
}

var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")

// ContextBasicAuth takes BasicAuth as authentication for the request.
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/clients/unannotatedecho/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func selectHeaderAccept(accepts []string) string {
return strings.Join(accepts, ",")
}

// contains is a case insenstive match, finding needle in a haystack
// contains is a case insensitive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/clients/unannotatedecho/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c contextKey) String() string {
}

var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")

// ContextBasicAuth takes BasicAuth as authentication for the request.
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/openapi_merge_a.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ message OutMessageC {
string value = 1;
}

// ServiceA provices MethodOne and MethodTwo
// ServiceA provides MethodOne and MethodTwo
service ServiceA {
// ServiceA.MethodOne receives InMessageA and returns OutMessageA
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
openapiOptions:
file:
# the file name must be the same as one passed to protoc when generating generating .swagger.json
# the file name must be the same as one passed to protoc when generating .swagger.json
- file: "examples/internal/proto/examplepb/unannotated_echo_service.proto"
option:
info:
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/use_go_template.pb.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/use_go_template.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ message LogoutRequest {
int32 test = 2;
// This is an array
//
// It displays that using [] infront of the type
// It displays that using [] in front of the type
repeated string stringarray = 3;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"/v1/example/logout": {
"post": {
"summary": "Logout",
"description": "Logout is a call with the method(s) POST within the \"LoginService\" service.\nIt takes in \"LogoutRequest\" and returns a \"LogoutReply\".\n\n## LogoutRequest\n| Field ID | Name | Type | Description |\n| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | \n| 1 | timeoflogout | TYPE_STRING | The time the logout was registered | \n| 2 | test | TYPE_INT32 | This is the title\u003cbr\u003e\u003cbr\u003eThis is the \"Description\" of field test\u003cbr\u003eyou can use as many newlines as you want\u003cbr\u003e\u003cbr\u003e\u003cbr\u003eit will still format the same in the table | \n| 3 | stringarray | []TYPE_STRING | This is an array\u003cbr\u003e\u003cbr\u003eIt displays that using [] infront of the type | \n\n## LogoutReply\n| Field ID | Name | Type | Description |\n| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | \n| 1 | message | TYPE_STRING | Message that tells you whether your\u003cbr\u003elogout was successful or not |",
"description": "Logout is a call with the method(s) POST within the \"LoginService\" service.\nIt takes in \"LogoutRequest\" and returns a \"LogoutReply\".\n\n## LogoutRequest\n| Field ID | Name | Type | Description |\n| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | \n| 1 | timeoflogout | TYPE_STRING | The time the logout was registered | \n| 2 | test | TYPE_INT32 | This is the title\u003cbr\u003e\u003cbr\u003eThis is the \"Description\" of field test\u003cbr\u003eyou can use as many newlines as you want\u003cbr\u003e\u003cbr\u003e\u003cbr\u003eit will still format the same in the table | \n| 3 | stringarray | []TYPE_STRING | This is an array\u003cbr\u003e\u003cbr\u003eIt displays that using [] in front of the type | \n\n## LogoutReply\n| Field ID | Name | Type | Description |\n| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | \n| 1 | message | TYPE_STRING | Message that tells you whether your\u003cbr\u003elogout was successful or not |",
"operationId": "LoginService_Logout",
"responses": {
"200": {
Expand Down Expand Up @@ -138,7 +138,7 @@
"items": {
"type": "string"
},
"description": "It displays that using [] infront of the type",
"description": "It displays that using [] in front of the type",
"title": "This is an array"
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/descriptor/grpc_api_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func registerHTTPRulesFromGrpcAPIService(registry *Registry, service *apiconfig.
// and registers the HttpRule descriptions contained in it as externalHTTPRules in
// the given registry. This must be done before loading the proto file.
//
// You can learn more about gRPC API Service descriptions from google's documentation
// You can learn more about gRPC API Service descriptions from Google's documentation
// at https://cloud.google.com/endpoints/docs/grpc/grpc-service-config
//
// Note that for the purposes of the gateway generator we only consider a subset of all
Expand Down
20 changes: 10 additions & 10 deletions internal/descriptor/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type Registry struct {
// - `legacy`: use the legacy naming strategy from protoc-gen-swagger, that generates unique but not necessarily
// maximally concise names. Components are concatenated directly, e.g., `MyOuterMessageMyNestedMessage`.
// - `simple`: use a simple heuristic for generating unique and concise names. Components are concatenated using
// dots as a separator, e.g., `MyOuterMesage.MyNestedMessage` (if `MyNestedMessage` alone is unique,
// dots as a separator, e.g., `MyOuterMessage.MyNestedMessage` (if `MyNestedMessage` alone is unique,
// `MyNestedMessage` will be used as the OpenAPI name).
// - `fqn`: always use the fully-qualified name of the proto message (leading dot removed) as the OpenAPI
// name.
Expand Down Expand Up @@ -244,7 +244,7 @@ func (r *Registry) load(gen *protogen.Plugin) error {
}

// loadFile loads messages, enumerations and fields from "file".
// It does not loads services and methods in "file". You need to call
// It does not load services and methods in "file". You need to call
// loadServices after loadFiles is called for all files to load services and methods.
func (r *Registry) loadFile(filePath string, file *protogen.File) {
pkg := GoPackage{
Expand Down Expand Up @@ -350,7 +350,7 @@ func (r *Registry) LookupMsg(location, name string) (*Message, error) {
return nil, fmt.Errorf("no message found: %s", name)
}

// LookupEnum looks up a enum type by "name".
// LookupEnum looks up an enum type by "name".
// It tries to resolve "name" from "location" if "name" is a relative enum name.
func (r *Registry) LookupEnum(location, name string) (*Enum, error) {
if grpclog.V(1) {
Expand Down Expand Up @@ -519,7 +519,7 @@ func (r *Registry) IsIncludePackageInTags() bool {
return r.includePackageInTags
}

// GetRepeatedPathParamSeparator returns a rune spcifying how
// GetRepeatedPathParamSeparator returns a rune specifying how
// path parameter repeated fields are separated.
func (r *Registry) GetRepeatedPathParamSeparator() rune {
return r.repeatedPathParamSeparator.sep
Expand Down Expand Up @@ -662,7 +662,7 @@ func (r *Registry) SetVisibilityRestrictionSelectors(selectors []string) {
}
}

// GetVisibilityRestrictionSelectors retrieves he visibility restriction selectors.
// GetVisibilityRestrictionSelectors retrieves the visibility restriction selectors.
func (r *Registry) GetVisibilityRestrictionSelectors() map[string]bool {
return r.visibilityRestrictionSelectors
}
Expand Down Expand Up @@ -707,12 +707,12 @@ func (r *Registry) GetOmitPackageDoc() bool {
return r.omitPackageDoc
}

// SetProto3OptionalNullable set proto3OtionalNullable
func (r *Registry) SetProto3OptionalNullable(proto3OtionalNullable bool) {
r.proto3OptionalNullable = proto3OtionalNullable
// SetProto3OptionalNullable set proto3OptionalNullable
func (r *Registry) SetProto3OptionalNullable(proto3OptionalNullable bool) {
r.proto3OptionalNullable = proto3OptionalNullable
}

// GetProto3OptionalNullable returns proto3OtionalNullable
// GetProto3OptionalNullable returns proto3OptionalNullable
func (r *Registry) GetProto3OptionalNullable() bool {
return r.proto3OptionalNullable
}
Expand Down Expand Up @@ -839,7 +839,7 @@ func (r *Registry) GetDisableServiceTags() bool {
return r.disableServiceTags
}

// SetDisableDefaultResponses setsdisableDefaultResponses
// SetDisableDefaultResponses sets disableDefaultResponses
func (r *Registry) SetDisableDefaultResponses(use bool) {
r.disableDefaultResponses = use
}
Expand Down
2 changes: 1 addition & 1 deletion internal/descriptor/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,6 @@ func TestOptionalProto3URLPathMappingError(t *testing.T) {
t.Errorf("loadServices(%q, %q) failed with %v; want %s", target, input, err, wantErrMsg)
}
} else {
t.Errorf("loadServices(%q, %q) expcted an error %s, got nil", target, input, wantErrMsg)
t.Errorf("loadServices(%q, %q) expected an error %s, got nil", target, input, wantErrMsg)
}
}
4 changes: 2 additions & 2 deletions protoc-gen-grpc-gateway/internal/gengateway/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (b binding) HasRepeatedEnumPathParam() bool {
}

// hasEnumPathParam returns true if the path parameter slice contains a parameter
// that maps to a enum proto field and that the enum proto field is or isn't repeated
// that maps to an enum proto field and that the enum proto field is or isn't repeated
// based on the provided 'repeated' parameter.
func (b binding) hasEnumPathParam(repeated bool) bool {
for _, p := range b.PathParams {
Expand All @@ -100,7 +100,7 @@ func (b binding) hasEnumPathParam(repeated bool) bool {
return false
}

// LookupEnum looks up a enum type by path parameter.
// LookupEnum looks up an enum type by path parameter.
func (b binding) LookupEnum(p descriptor.Parameter) *descriptor.Enum {
e, err := b.Registry.LookupEnum("", p.Target.GetTypeName())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion protoc-gen-openapiv2/internal/genopenapi/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func mergeTargetFile(targets []*wrapper, mergeFileName string) *wrapper {
// type aliases, and those don't have the custom MarshalJSON methods defined
// on them. See http://choly.ca/post/go-json-marshalling/ (or, if it ever
// goes away, use
// https://web.archive.org/web/20190806073003/http://choly.ca/post/go-json-marshalling/.
// https://web.archive.org/web/20190806073003/http://choly.ca/post/go-json-marshalling/).
func (so openapiSwaggerObject) MarshalJSON() ([]byte, error) {
type alias openapiSwaggerObject
return extensionMarshalJSON(alias(so), so.extensions)
Expand Down
2 changes: 1 addition & 1 deletion protoc-gen-openapiv2/internal/genopenapi/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ func fullyQualifiedNameToOpenAPIName(fqn string, reg *descriptor.Registry) (stri
return ret, ok
}

// Lookup message type by location.name and return a openapiv2-safe version
// Lookup message type by location.name and return an openapiv2-safe version
// of its FQMN.
func lookupMsgAndOpenAPIName(location, name string, reg *descriptor.Registry) (*descriptor.Message, string, error) {
msg, err := reg.LookupMsg(location, name)
Expand Down
Loading

0 comments on commit 17de61b

Please sign in to comment.