@@ -10,8 +10,8 @@ import (
10
10
"github.com/golang/protobuf/ptypes"
11
11
"github.com/golang/protobuf/ptypes/duration"
12
12
"github.com/golang/protobuf/ptypes/timestamp"
13
- "github.com/lyft/protoc-gen-star"
14
- "github.com/lyft/protoc-gen-star/lang/go"
13
+ pgs "github.com/lyft/protoc-gen-star"
14
+ pgsgo "github.com/lyft/protoc-gen-star/lang/go"
15
15
"github.com/lyft/protoc-gen-validate/templates/shared"
16
16
)
17
17
@@ -143,15 +143,20 @@ func (fns CCFuncs) hasAccessor(ctx shared.RuleContext) string {
143
143
fns .methodName (ctx .Field .Name ()))
144
144
}
145
145
146
- func (fns CCFuncs ) classBaseName (msg pgs.Message ) string {
147
- if m , ok := msg .Parent ().(pgs.Message ); ok {
148
- return fmt .Sprintf ("%s_%s" , fns .classBaseName (m ), msg .Name ().String ())
146
+ type childEntity interface {
147
+ pgs.Entity
148
+ Parent () pgs.ParentEntity
149
+ }
150
+
151
+ func (fns CCFuncs ) classBaseName (ent childEntity ) string {
152
+ if m , ok := ent .Parent ().(pgs.Message ); ok {
153
+ return fmt .Sprintf ("%s_%s" , fns .classBaseName (m ), ent .Name ().String ())
149
154
}
150
- return msg .Name ().String ()
155
+ return ent .Name ().String ()
151
156
}
152
157
153
- func (fns CCFuncs ) className (msg pgs. Message ) string {
154
- return fns .packageName (msg ) + "::" + fns .classBaseName (msg )
158
+ func (fns CCFuncs ) className (ent childEntity ) string {
159
+ return fns .packageName (ent ) + "::" + fns .classBaseName (ent )
155
160
}
156
161
157
162
func (fns CCFuncs ) packageName (msg pgs.Entity ) string {
0 commit comments