Skip to content

Commit

Permalink
Fix typos (#4762)
Browse files Browse the repository at this point in the history
* Fix typos

* Restore swagger codegen typos
  • Loading branch information
NathanBaulch authored Oct 4, 2024
1 parent c30ccbc commit 5469869
Show file tree
Hide file tree
Showing 25 changed files with 55 additions and 55 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/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
10 changes: 5 additions & 5 deletions protoc-gen-openapiv2/internal/genopenapi/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ func TestMessageToQueryParameters(t *testing.T) {
}
}

// TestMessagetoQueryParametersNoRecursive, is a check that cyclical references between messages
// TestMessageToQueryParametersNoRecursive, is a check that cyclical references between messages
// are not falsely detected given previous known edge-cases.
func TestMessageToQueryParametersNoRecursive(t *testing.T) {
type test struct {
Expand All @@ -683,7 +683,7 @@ func TestMessageToQueryParametersNoRecursive(t *testing.T) {
tests := []test{
// First test:
// Here is a message that has two of another message adjacent to one another in a nested message.
// There is no loop but this was previouly falsely flagged as a cycle.
// There is no loop but this was previously falsely flagged as a cycle.
// Example proto:
// message NonRecursiveMessage {
// string field = 1;
Expand Down Expand Up @@ -791,8 +791,8 @@ func TestMessageToQueryParametersNoRecursive(t *testing.T) {
}
}

// TestMessagetoQueryParametersRecursive, is a check that cyclical references between messages
// are handled gracefully. The goal is to insure that attempts to add messages with cyclical
// TestMessageToQueryParametersRecursive, is a check that cyclical references between messages
// are handled gracefully. The goal is to ensure that attempts to add messages with cyclical
// references to query-parameters returns an error message.
func TestMessageToQueryParametersRecursive(t *testing.T) {
type test struct {
Expand All @@ -802,7 +802,7 @@ func TestMessageToQueryParametersRecursive(t *testing.T) {

tests := []test{
// First test:
// Here we test that a message that references it self through a field will return an error.
// Here we test that a message that references itself through a field will return an error.
// Example proto:
// message DirectRecursiveMessage {
// DirectRecursiveMessage nested = 1;
Expand Down
6 changes: 3 additions & 3 deletions runtime/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func Int64(val string) (int64, error) {
}

// Int64Slice converts 'val' where individual integers are separated by
// 'sep' into a int64 slice.
// 'sep' into an int64 slice.
func Int64Slice(val, sep string) ([]int64, error) {
s := strings.Split(val, sep)
values := make([]int64, len(s))
Expand All @@ -118,7 +118,7 @@ func Int32(val string) (int32, error) {
}

// Int32Slice converts 'val' where individual integers are separated by
// 'sep' into a int32 slice.
// 'sep' into an int32 slice.
func Int32Slice(val, sep string) ([]int32, error) {
s := strings.Split(val, sep)
values := make([]int32, len(s))
Expand Down Expand Up @@ -190,7 +190,7 @@ func Bytes(val string) ([]byte, error) {
}

// BytesSlice converts 'val' where individual bytes sequences, encoded in URL-safe
// base64 without padding, are separated by 'sep' into a slice of bytes slices slice.
// base64 without padding, are separated by 'sep' into a slice of byte slices.
func BytesSlice(val, sep string) ([][]byte, error) {
s := strings.Split(val, sep)
values := make([][]byte, len(s))
Expand Down
4 changes: 2 additions & 2 deletions runtime/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestConvertTimestamp(t *testing.T) {
case err != nil && !spec.wanterr:
t.Errorf("got unexpected error\n%#v", err)
case err == nil && spec.wanterr:
t.Errorf("did not error when expecte")
t.Errorf("did not error when expected")
case !proto.Equal(ts, spec.output):
t.Errorf(
"when testing %s; got\n%#v\nexpected\n%#v",
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestConvertDuration(t *testing.T) {
case err != nil && !spec.wanterr:
t.Errorf("got unexpected error\n%#v", err)
case err == nil && spec.wanterr:
t.Errorf("did not error when expecte")
t.Errorf("did not error when expected")
case !proto.Equal(ts, spec.output):
t.Errorf(
"when testing %s; got\n%#v\nexpected\n%#v",
Expand Down
2 changes: 1 addition & 1 deletion runtime/fieldmask.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func buildPathsBlindly(name string, in interface{}) []string {
return paths
}

// fieldMaskPathItem stores a in-progress deconstruction of a path for a fieldmask
// fieldMaskPathItem stores an in-progress deconstruction of a path for a fieldmask
type fieldMaskPathItem struct {
// the list of prior fields leading up to node connected by dots
path string
Expand Down
Loading

0 comments on commit 5469869

Please sign in to comment.