@@ -51,7 +51,10 @@ func TestPackageNames(t *testing.T) {
5151 codec .packageMapping = map [string ]* packagez {
5252 "google.protobuf" : {name : "wkt" },
5353 }
54- got := annotateModel (model , codec )
54+ got , err := annotateModel (model , codec )
55+ if err != nil {
56+ t .Fatal (err )
57+ }
5558 want := & modelAnnotations {
5659 PackageName : "google-cloud-workflows-v1" ,
5760 PackageVersion : "1.2.3" ,
@@ -377,7 +380,10 @@ func TestServiceAnnotationsAPIVersions(t *testing.T) {
377380 t .Fatalf ("cannot find service %s" , id )
378381 }
379382 codec := newTestCodec (t , "protobuf" , "" , map [string ]string {})
380- _ = annotateModel (model , codec )
383+ _ , err := annotateModel (model , codec )
384+ if err != nil {
385+ t .Fatal (err )
386+ }
381387 got := service .Codec .(* serviceAnnotations )
382388 if got == nil {
383389 t .Fatalf ("no annotations for service %s" , service .ID )
@@ -1817,7 +1823,10 @@ func TestAnnotateModelWithDetailedTracing(t *testing.T) {
18171823 t .Run (test .name , func (t * testing.T ) {
18181824 model := api .NewTestAPI ([]* api.Message {}, []* api.Enum {}, []* api.Service {})
18191825 codec := newTestCodec (t , "protobuf" , "" , test .options )
1820- got := annotateModel (model , codec )
1826+ got , err := annotateModel (model , codec )
1827+ if err != nil {
1828+ t .Fatal (err )
1829+ }
18211830 if got .DetailedTracingAttributes != test .want {
18221831 t .Errorf ("annotateModel() DetailedTracingAttributes = %v, want %v" , got .DetailedTracingAttributes , test .want )
18231832 }
@@ -1966,11 +1975,20 @@ func TestOneOfExampleFieldSelection(t *testing.T) {
19661975 IsOneOf : true ,
19671976 Deprecated : true ,
19681977 }
1969- map_field := & api.Field {
1978+ mapMessage := & api.Message {
1979+ Name : "$map<string, string>" ,
1980+ ID : "$map<string, string>" ,
1981+ IsMap : true ,
1982+ Fields : []* api.Field {
1983+ {Name : "key" , ID : "$map<string, string>.key" , Typez : api .STRING_TYPE },
1984+ {Name : "value" , ID : "$map<string, string>.value" , Typez : api .STRING_TYPE },
1985+ },
1986+ }
1987+ mapField := & api.Field {
19701988 Name : "map_field" ,
19711989 ID : ".test.Message.map_field" ,
19721990 Typez : api .MESSAGE_TYPE ,
1973- TypezID : ".test.$Map " ,
1991+ TypezID : "$map<string, string> " ,
19741992 IsOneOf : true ,
19751993 Map : true ,
19761994 }
@@ -1987,14 +2005,14 @@ func TestOneOfExampleFieldSelection(t *testing.T) {
19872005 Typez : api .INT32_TYPE ,
19882006 IsOneOf : true ,
19892007 }
1990- message_field := & api.Field {
2008+ messageField := & api.Field {
19912009 Name : "message_field" ,
19922010 ID : ".test.Message.message_field" ,
19932011 Typez : api .MESSAGE_TYPE ,
19942012 TypezID : ".test.OneMessage" ,
19952013 IsOneOf : true ,
19962014 }
1997- another_message_field := & api.Field {
2015+ anotherMessageField := & api.Field {
19982016 Name : "another_message_field" ,
19992017 ID : ".test.Message.another_message_field" ,
20002018 Typez : api .MESSAGE_TYPE ,
@@ -2009,28 +2027,28 @@ func TestOneOfExampleFieldSelection(t *testing.T) {
20092027 }{
20102028 {
20112029 name : "all types" ,
2012- fields : []* api.Field {deprecated , map_field , repeated , scalar , message_field },
2030+ fields : []* api.Field {deprecated , mapField , repeated , scalar , messageField },
20132031 want : scalar ,
20142032 },
20152033 {
20162034 name : "no primitives" ,
2017- fields : []* api.Field {deprecated , map_field , repeated , message_field },
2018- want : message_field ,
2035+ fields : []* api.Field {deprecated , mapField , repeated , messageField },
2036+ want : messageField ,
20192037 },
20202038 {
20212039 name : "only scalars and messages" ,
2022- fields : []* api.Field {message_field , scalar , another_message_field },
2040+ fields : []* api.Field {messageField , scalar , anotherMessageField },
20232041 want : scalar ,
20242042 },
20252043 {
20262044 name : "no scalars" ,
2027- fields : []* api.Field {deprecated , map_field , repeated },
2045+ fields : []* api.Field {deprecated , mapField , repeated },
20282046 want : repeated ,
20292047 },
20302048 {
20312049 name : "only map and deprecated" ,
2032- fields : []* api.Field {deprecated , map_field },
2033- want : map_field ,
2050+ fields : []* api.Field {deprecated , mapField },
2051+ want : mapField ,
20342052 },
20352053 {
20362054 name : "only deprecated" ,
@@ -2063,10 +2081,12 @@ func TestOneOfExampleFieldSelection(t *testing.T) {
20632081 ID : ".test.AnotherMessage" ,
20642082 Package : "test" ,
20652083 }
2066- model := api .NewTestAPI ([]* api.Message {message , oneMesage , anotherMessage }, []* api.Enum {}, []* api.Service {})
2084+ model := api .NewTestAPI ([]* api.Message {message , oneMesage , anotherMessage , mapMessage }, []* api.Enum {}, []* api.Service {})
20672085 api .CrossReference (model )
2068- codec := createRustCodec ()
2069- annotateModel (model , codec )
2086+ codec := newTestCodec (t , "protobuf" , "test" , map [string ]string {})
2087+ if _ , err := annotateModel (model , codec ); err != nil {
2088+ t .Fatal (err )
2089+ }
20702090
20712091 got := group .Codec .(* oneOfAnnotation ).ExampleField
20722092 if diff := cmp .Diff (tc .want , got ); diff != "" {
0 commit comments