@@ -64,6 +64,8 @@ public ClientTypescriptGenerator(CsharpTypeInfoProvider typeInfoProvider, CSharp
6464 typeof ( AllField ) ,
6565#pragma warning restore 618
6666 typeof ( Indices . ManyIndices ) ,
67+ typeof ( PostType ) ,
68+ typeof ( IDescriptor ) ,
6769 } ) ;
6870
6971 private readonly Dictionary < Type , string [ ] > _typesPropertiesToIgnore = new Dictionary < Type , string [ ] >
@@ -135,9 +137,9 @@ private void AppendClassDef(TsClass classModel, ScriptBuilder sb, TsGeneratorOut
135137 return ;
136138 }
137139
138- void EnforceBaseClass < TInterface , TBase > ( )
140+ void EnforceBaseClass < TInterface , TBase > ( bool force = false )
139141 {
140- if ( classModel . BaseType != null ) return ;
142+ if ( ! force && classModel . BaseType != null ) return ;
141143 if ( classModel . Type == typeof ( TBase ) ) return ;
142144 if ( typeof ( TInterface ) . IsAssignableFrom ( classModel . Type ) ) classModel . BaseType = new TsClass ( typeof ( TBase ) ) ;
143145 }
@@ -148,6 +150,7 @@ void EnforceBaseClass<TInterface, TBase>()
148150 EnforceBaseClass < ICharFilter , CharFilterBase > ( ) ;
149151 EnforceBaseClass < IProperty , PropertyBase > ( ) ;
150152 EnforceBaseClass < IResponse , ResponseBase > ( ) ;
153+ EnforceBaseClass < WriteResponseBase , WriteResponseBase > ( true ) ;
151154
152155 if ( classModel . BaseType != null )
153156 {
@@ -192,6 +195,7 @@ private void GenerateProperties(TsClass classModel, ScriptBuilder sb, TsGenerato
192195 {
193196 foreach ( var property in members )
194197 {
198+ if ( property . Name == "IsValid" ) continue ;
195199 if ( property . IsIgnored ||
196200 PropertyTypesToIgnore ( property . PropertyType . Type ) ||
197201 ( _typesPropertiesToIgnore . ContainsKey ( classModel . Type ) && _typesPropertiesToIgnore [ classModel . Type ] . Contains ( property . Name ) ) )
@@ -254,7 +258,7 @@ private void AddDocCommentForCustomJsonConverter(ScriptBuilder sb, TsProperty pr
254258 sb . AppendLineIndented ( "@request_parameter()" ) ;
255259 }
256260
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 " ) ;
258262 if ( converter != null )
259263 {
260264 if ( GetConverter ( converter , out var type ) ) return ;
@@ -294,7 +298,7 @@ private static void AddDocCommentForCustomJsonConverter(ScriptBuilder sb, TsClas
294298 if ( iface != null ) attributes . AddRange ( iface . GetCustomAttributes ( ) ) ;
295299 attributes . AddRange ( classModel . Type . GetCustomAttributes ( ) ) ;
296300
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 " ) ;
298302 if ( converter != null )
299303 {
300304 if ( GetConverter ( converter , out var type ) ) return ;
@@ -310,8 +314,8 @@ private static string GetDescriptorFor(Attribute attribute, string classModelNam
310314
311315 private static bool GetConverter ( Attribute converter , out Type type )
312316 {
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 ;
315319 if ( type . Name . StartsWith ( "VerbatimDictionary" ) ) return true ;
316320 if ( type . Name . Contains ( "DictionaryResponse" ) ) return true ;
317321 if ( type . Name . StartsWith ( "StringEnum" ) ) return true ;
@@ -445,6 +449,11 @@ protected bool Ignore(TsClass classModel)
445449 {
446450 if ( TypeRenames . ContainsKey ( classModel . Name ) ) return false ;
447451 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 ;
448457 if ( IsClrType ( classModel . Type ) ) return true ;
449458 if ( _typesToIgnore . Contains ( classModel . Type ) ) return true ;
450459 return false ;
0 commit comments