Skip to content

Commit

Permalink
protoc-gen-twirp: use camel case for Go type name of proto msg (#146)
Browse files Browse the repository at this point in the history
* protoc-gen-twirp: use camel case when parsing proto msg name

* update license dates to 2019

* fix the same bug for nested messages
  • Loading branch information
dpolansky authored Feb 14, 2019
1 parent d91627b commit f917783
Show file tree
Hide file tree
Showing 9 changed files with 1,268 additions and 3 deletions.

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

20 changes: 20 additions & 0 deletions internal/twirptest/snake_case_names/compile_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2019 Twitch Interactive, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may not
// use this file except in compliance with the License. A copy of the License is
// located at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// or in the "license" file accompanying this file. This file is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.

package snake_case_names

import "testing"

func TestCompilation(t *testing.T) {
// Test passes if this package compiles
}
16 changes: 16 additions & 0 deletions internal/twirptest/snake_case_names/gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2019 Twitch Interactive, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may not
// use this file except in compliance with the License. A copy of the License is
// located at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// or in the "license" file accompanying this file. This file is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.

package snake_case_names

//go:generate ../../protoc_gen.sh snake_case_names.proto
175 changes: 175 additions & 0 deletions internal/twirptest/snake_case_names/snake_case_names.pb.go

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

23 changes: 23 additions & 0 deletions internal/twirptest/snake_case_names/snake_case_names.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";

// Test that protoc-gen-twirp follows the same behavior as protoc-gen-go
// for converting RPCs and message names from snake case to camel case.
package twirp.internal.twirptest.snake_case_names;
option go_package = "snake_case_names";

message MakeHatArgs_v1 {
message Hat_v1 {
int32 size = 1;
string color = 2;
string name = 3;
}

message Size_v1 {
int32 inches = 1;
}
}

// A Haberdasher makes hats for clients.
service Haberdasher {
rpc MakeHat_v1 (MakeHatArgs_v1.Size_v1) returns (MakeHatArgs_v1.Hat_v1);
}
Loading

0 comments on commit f917783

Please sign in to comment.