1212
1313namespace Elastic . Transport ;
1414
15- internal class ErrorCauseConverter : ErrorCauseConverter < ErrorCause > { }
15+ /// A JSON converter for <see cref="ErrorCause"/>
16+ public class ErrorCauseConverter : ErrorCauseConverter < ErrorCause > { }
1617
17- internal class ErrorConverter : ErrorCauseConverter < Error >
18+ /// A JSON converter for <see cref="Error"/>
19+ public class ErrorConverter : ErrorCauseConverter < Error >
1820{
21+ /// <inheritdoc cref="ErrorCauseConverter{T}.ReadMore"/>
1922 protected override bool ReadMore ( ref Utf8JsonReader reader , JsonSerializerOptions options , string propertyName , Error errorCause )
2023 {
2124 void ReadAssign < T > ( ref Utf8JsonReader r , Action < Error , T > set ) =>
@@ -36,16 +39,16 @@ void ReadAssign<T>(ref Utf8JsonReader r, Action<Error, T> set) =>
3639 }
3740}
3841
39- internal class ErrorCauseConverter < TErrorCause > : JsonConverter < TErrorCause > where TErrorCause : ErrorCause , new ( )
42+ /// A JSON converter for <see cref="ErrorCause"/> implementations
43+ public abstract class ErrorCauseConverter < TErrorCause > : JsonConverter < TErrorCause > where TErrorCause : ErrorCause , new ( )
4044{
45+ /// <inheritdoc cref="JsonConverter{T}.Read"/>
4146 public override TErrorCause Read ( ref Utf8JsonReader reader , Type typeToConvert , JsonSerializerOptions options )
4247 {
4348 if ( reader . TokenType != JsonTokenType . StartObject )
44- {
4549 return reader . TokenType == JsonTokenType . String
4650 ? new TErrorCause { Reason = reader . GetString ( ) }
4751 : null ;
48- }
4952
5053 var errorCause = new TErrorCause ( ) ;
5154 var additionalProperties = new Dictionary < string , object > ( ) ;
@@ -176,8 +179,10 @@ private static IReadOnlyCollection<string> ReadSingleOrCollection(ref Utf8JsonRe
176179 }
177180 }
178181
182+ /// Read additional properties for the particular <see cref="ErrorCause"/> implementation
179183 protected virtual bool ReadMore ( ref Utf8JsonReader reader , JsonSerializerOptions options , string propertyName , TErrorCause errorCause ) => false ;
180184
185+ /// <inheritdoc cref="JsonConverter{T}.Read"/>
181186 public override void Write ( Utf8JsonWriter writer , TErrorCause value , JsonSerializerOptions options )
182187 {
183188 writer . WriteStartObject ( ) ;
0 commit comments