@@ -7,7 +7,7 @@ namespace LEGO.AsyncAPI.Models
77 using LEGO . AsyncAPI . Models . Interfaces ;
88 using LEGO . AsyncAPI . Writers ;
99
10- public abstract class AsyncApiAvroSchema : IAsyncApiSerializable , IAsyncApiReferenceable , IAsyncApiMessagePayload
10+ public abstract class AsyncApiAvroSchema : IAsyncApiSerializable , IAsyncApiMessagePayload
1111 {
1212 public abstract string Type { get ; }
1313
@@ -16,31 +16,29 @@ public abstract class AsyncApiAvroSchema : IAsyncApiSerializable, IAsyncApiRefer
1616 /// </summary>
1717 public abstract IDictionary < string , AsyncApiAny > Metadata { get ; set ; }
1818
19- public bool UnresolvedReference { get ; set ; }
20-
21- public AsyncApiReference Reference { get ; set ; }
22-
2319 public static implicit operator AsyncApiAvroSchema ( AvroPrimitiveType type )
2420 {
2521 return new AvroPrimitive ( type ) ;
2622 }
2723
28- public virtual void SerializeV2 ( IAsyncApiWriter writer )
29- {
30- if ( writer is null )
31- {
32- throw new ArgumentNullException ( nameof ( writer ) ) ;
33- }
24+ public abstract void SerializeV2 ( IAsyncApiWriter writer ) ;
3425
35- if ( this . Reference != null && ! writer . GetSettings ( ) . ShouldInlineReference ( this . Reference ) )
36- {
37- this . Reference . SerializeV2 ( writer ) ;
38- return ;
39- }
40-
41- this . SerializeV2Core ( writer ) ;
26+ public virtual bool TryGetAs < T > ( out T result )
27+ where T : AsyncApiAvroSchema
28+ {
29+ result = this as T ;
30+ return result != null ;
31+ }
32+ public virtual bool Is < T > ( )
33+ where T : AsyncApiAvroSchema
34+ {
35+ return this is T ;
4236 }
4337
44- public abstract void SerializeV2Core ( IAsyncApiWriter writer ) ;
38+ public virtual T As < T > ( )
39+ where T : AsyncApiAvroSchema
40+ {
41+ return this as T ;
42+ }
4543 }
4644}
0 commit comments