@@ -97,5 +97,55 @@ public enum Category
97
97
Foo = 1 ,
98
98
Bar = 2 ,
99
99
}
100
+
101
+ [ ServiceContract ]
102
+ public interface IConferencesService
103
+ {
104
+ Task < IEnumerable < ConferenceOverview > > ListConferencesEnumerable ( ) ;
105
+ IAsyncEnumerable < ConferenceOverview > ListConferencesAsyncEnumerable ( ) ;
106
+ Task < ListConferencesResult > ListConferencesWrapped ( ) ;
107
+ }
108
+
109
+ [ DataContract ]
110
+ public class ConferenceOverview
111
+ {
112
+ [ DataMember ( Order = 1 ) ]
113
+ public Guid ID { get ; set ; }
114
+
115
+ [ DataMember ( Order = 2 ) ]
116
+ public string ? Title { get ; set ; }
117
+ }
118
+
119
+ [ DataContract ]
120
+ public class ListConferencesResult
121
+ {
122
+ [ ProtoMember ( 1 ) ]
123
+ public List < ConferenceOverview > Conferences { get ; } = new List < ConferenceOverview > ( ) ;
124
+ }
125
+
126
+ [ Fact ]
127
+ public void ConferenceServiceSchema ( )
128
+ {
129
+ var generator = new SchemaGenerator ( ) ;
130
+ var proto = generator . GetSchema < IConferencesService > ( ) ;
131
+ Log ( proto ) ;
132
+ Assert . Equal ( @"syntax = ""proto3"";
133
+ package protobuf_net.Grpc.Reflection.Test;
134
+ import ""google/protobuf/empty.proto"";
135
+
136
+ message ConferenceOverview {
137
+ string ID = 1; // default value could not be applied: 00000000-0000-0000-0000-000000000000
138
+ string Title = 2;
139
+ }
140
+ message ListConferencesResult {
141
+ repeated ConferenceOverview Conferences = 1;
142
+ }
143
+ service ConferencesService {
144
+ rpc ListConferencesAsyncEnumerable (.google.protobuf.Empty) returns (stream ConferenceOverview);
145
+ rpc ListConferencesEnumerable (.google.protobuf.Empty) returns (IEnumerable_ConferenceOverview);
146
+ rpc ListConferencesWrapped (.google.protobuf.Empty) returns (ListConferencesResult);
147
+ }
148
+ " , proto , ignoreLineEndingDifferences : true ) ;
149
+ }
100
150
}
101
151
}
0 commit comments