@@ -139,6 +139,7 @@ public T ReadFragment<T>(JsonNode input, AsyncApiVersion version, out AsyncApiDi
139139 where T : IAsyncApiElement
140140 {
141141 diagnostic = new AsyncApiDiagnostic ( ) ;
142+ diagnostic . SpecificationVersion = version ;
142143 this . context ??= new ParsingContext ( diagnostic , this . settings )
143144 {
144145 ExtensionParsers = this . settings . ExtensionParsers ,
@@ -370,51 +371,51 @@ private IAsyncApiSerializable ResolveStreamReference(Stream stream, IAsyncApiRef
370371 case ReferenceType . Schema :
371372 if ( reference is AsyncApiJsonSchemaReference )
372373 {
373- result = this . ReadFragment < AsyncApiJsonSchema > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
374+ result = this . ReadFragment < AsyncApiJsonSchema > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
374375 }
375376
376377 if ( reference is AsyncApiAvroSchemaReference )
377378 {
378- result = this . ReadFragment < AsyncApiAvroSchema > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
379+ result = this . ReadFragment < AsyncApiAvroSchema > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
379380 }
380381
381382 break ;
382383
383384 case ReferenceType . Server :
384- result = this . ReadFragment < AsyncApiServer > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
385+ result = this . ReadFragment < AsyncApiServer > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
385386 break ;
386387 case ReferenceType . Channel :
387- result = this . ReadFragment < AsyncApiChannel > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
388+ result = this . ReadFragment < AsyncApiChannel > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
388389 break ;
389390 case ReferenceType . Message :
390- result = this . ReadFragment < AsyncApiMessage > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
391+ result = this . ReadFragment < AsyncApiMessage > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
391392 break ;
392393 case ReferenceType . SecurityScheme :
393- result = this . ReadFragment < AsyncApiSecurityScheme > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
394+ result = this . ReadFragment < AsyncApiSecurityScheme > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
394395 break ;
395396 case ReferenceType . Parameter :
396- result = this . ReadFragment < AsyncApiParameter > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
397+ result = this . ReadFragment < AsyncApiParameter > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
397398 break ;
398399 case ReferenceType . CorrelationId :
399- result = this . ReadFragment < AsyncApiCorrelationId > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
400+ result = this . ReadFragment < AsyncApiCorrelationId > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
400401 break ;
401402 case ReferenceType . OperationTrait :
402- result = this . ReadFragment < AsyncApiOperationTrait > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
403+ result = this . ReadFragment < AsyncApiOperationTrait > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
403404 break ;
404405 case ReferenceType . MessageTrait :
405- result = this . ReadFragment < AsyncApiMessageTrait > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
406+ result = this . ReadFragment < AsyncApiMessageTrait > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
406407 break ;
407408 case ReferenceType . ServerBindings :
408- result = this . ReadFragment < AsyncApiBindings < IServerBinding > > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
409+ result = this . ReadFragment < AsyncApiBindings < IServerBinding > > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
409410 break ;
410411 case ReferenceType . ChannelBindings :
411- result = this . ReadFragment < AsyncApiBindings < IChannelBinding > > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
412+ result = this . ReadFragment < AsyncApiBindings < IChannelBinding > > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
412413 break ;
413414 case ReferenceType . OperationBindings :
414- result = this . ReadFragment < AsyncApiBindings < IOperationBinding > > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
415+ result = this . ReadFragment < AsyncApiBindings < IOperationBinding > > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
415416 break ;
416417 case ReferenceType . MessageBindings :
417- result = this . ReadFragment < AsyncApiBindings < IMessageBinding > > ( json , AsyncApiVersion . AsyncApi2_0 , out fragmentDiagnostic ) ;
418+ result = this . ReadFragment < AsyncApiBindings < IMessageBinding > > ( json , diagnostic . SpecificationVersion , out fragmentDiagnostic ) ;
418419 break ;
419420 default :
420421 diagnostic . Errors . Add ( new AsyncApiError ( reference . Reference . Reference , "Could not resolve reference." ) ) ;
0 commit comments