@@ -64,6 +64,8 @@ public ClientTypescriptGenerator(CsharpTypeInfoProvider typeInfoProvider, CSharp
64
64
typeof ( AllField ) ,
65
65
#pragma warning restore 618
66
66
typeof ( Indices . ManyIndices ) ,
67
+ typeof ( PostType ) ,
68
+ typeof ( IDescriptor ) ,
67
69
} ) ;
68
70
69
71
private readonly Dictionary < Type , string [ ] > _typesPropertiesToIgnore = new Dictionary < Type , string [ ] >
@@ -135,9 +137,9 @@ private void AppendClassDef(TsClass classModel, ScriptBuilder sb, TsGeneratorOut
135
137
return ;
136
138
}
137
139
138
- void EnforceBaseClass < TInterface , TBase > ( )
140
+ void EnforceBaseClass < TInterface , TBase > ( bool force = false )
139
141
{
140
- if ( classModel . BaseType != null ) return ;
142
+ if ( ! force && classModel . BaseType != null ) return ;
141
143
if ( classModel . Type == typeof ( TBase ) ) return ;
142
144
if ( typeof ( TInterface ) . IsAssignableFrom ( classModel . Type ) ) classModel . BaseType = new TsClass ( typeof ( TBase ) ) ;
143
145
}
@@ -148,6 +150,7 @@ void EnforceBaseClass<TInterface, TBase>()
148
150
EnforceBaseClass < ICharFilter , CharFilterBase > ( ) ;
149
151
EnforceBaseClass < IProperty , PropertyBase > ( ) ;
150
152
EnforceBaseClass < IResponse , ResponseBase > ( ) ;
153
+ EnforceBaseClass < WriteResponseBase , WriteResponseBase > ( true ) ;
151
154
152
155
if ( classModel . BaseType != null )
153
156
{
@@ -192,6 +195,7 @@ private void GenerateProperties(TsClass classModel, ScriptBuilder sb, TsGenerato
192
195
{
193
196
foreach ( var property in members )
194
197
{
198
+ if ( property . Name == "IsValid" ) continue ;
195
199
if ( property . IsIgnored ||
196
200
PropertyTypesToIgnore ( property . PropertyType . Type ) ||
197
201
( _typesPropertiesToIgnore . ContainsKey ( classModel . Type ) && _typesPropertiesToIgnore [ classModel . Type ] . Contains ( property . Name ) ) )
@@ -254,7 +258,7 @@ private void AddDocCommentForCustomJsonConverter(ScriptBuilder sb, TsProperty pr
254
258
sb . AppendLineIndented ( "@request_parameter()" ) ;
255
259
}
256
260
257
- var converter = attributes . FirstOrDefault ( a => a . TypeId . ToString ( ) == "Nest.Json.JsonConverterAttribute " ) ;
261
+ var converter = attributes . FirstOrDefault ( a => a . TypeId . ToString ( ) == "Elasticsearch.Net.Utf8Json.JsonFormatterAttribute " ) ;
258
262
if ( converter != null )
259
263
{
260
264
if ( GetConverter ( converter , out var type ) ) return ;
@@ -294,7 +298,7 @@ private static void AddDocCommentForCustomJsonConverter(ScriptBuilder sb, TsClas
294
298
if ( iface != null ) attributes . AddRange ( iface . GetCustomAttributes ( ) ) ;
295
299
attributes . AddRange ( classModel . Type . GetCustomAttributes ( ) ) ;
296
300
297
- var converter = attributes . FirstOrDefault ( a => a . TypeId . ToString ( ) == "Nest.Json.JsonConverterAttribute " ) ;
301
+ var converter = attributes . FirstOrDefault ( a => a . TypeId . ToString ( ) == "Elasticsearch.Net.Utf8Json.JsonFormatterAttribute " ) ;
298
302
if ( converter != null )
299
303
{
300
304
if ( GetConverter ( converter , out var type ) ) return ;
@@ -310,8 +314,8 @@ private static string GetDescriptorFor(Attribute attribute, string classModelNam
310
314
311
315
private static bool GetConverter ( Attribute converter , out Type type )
312
316
{
313
- type = ( Type ) converter . GetType ( ) . GetProperty ( "ConverterType " ) . GetGetMethod ( ) . Invoke ( converter , new object [ ] { } ) ;
314
- if ( type . Name . StartsWith ( "ReadAsTypeJsonConverter " ) ) return true ;
317
+ type = ( Type ) converter . GetType ( ) . GetProperty ( "FormatterType " ) . GetGetMethod ( ) . Invoke ( converter , new object [ ] { } ) ;
318
+ if ( type . Name . StartsWith ( "ReadAsType " ) ) return true ;
315
319
if ( type . Name . StartsWith ( "VerbatimDictionary" ) ) return true ;
316
320
if ( type . Name . Contains ( "DictionaryResponse" ) ) return true ;
317
321
if ( type . Name . StartsWith ( "StringEnum" ) ) return true ;
@@ -445,6 +449,11 @@ protected bool Ignore(TsClass classModel)
445
449
{
446
450
if ( TypeRenames . ContainsKey ( classModel . Name ) ) return false ;
447
451
if ( typeof ( IRequestParameters ) . IsAssignableFrom ( classModel . Type ) ) return true ;
452
+ if ( typeof ( IConnectionPool ) . IsAssignableFrom ( classModel . Type ) ) return true ;
453
+ if ( typeof ( IConnection ) . IsAssignableFrom ( classModel . Type ) ) return true ;
454
+ if ( typeof ( IElasticsearchSerializer ) . IsAssignableFrom ( classModel . Type ) ) return true ;
455
+ if ( typeof ( IMemoryStreamFactory ) . IsAssignableFrom ( classModel . Type ) ) return true ;
456
+ if ( typeof ( IPostData < > ) . IsAssignableFrom ( classModel . Type ) ) return true ;
448
457
if ( IsClrType ( classModel . Type ) ) return true ;
449
458
if ( _typesToIgnore . Contains ( classModel . Type ) ) return true ;
450
459
return false ;
0 commit comments