File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Copyright (c) The LEGO Group. All rights reserved.
22
3+ using FluentAssertions ;
4+
35namespace LEGO . AsyncAPI . Tests
46{
57 using System ;
@@ -591,5 +593,42 @@ public void Read_WithBasicPlusSecurityRequirementsDeserializes()
591593 Assert . IsTrue ( requirement . Value . Contains ( "write:pets" ) ) ;
592594 Assert . IsTrue ( requirement . Value . Contains ( "read:pets" ) ) ;
593595 }
596+
597+ [ Test ]
598+ public void Read_WithExternalResourcesInterfaceDeserializes ( )
599+ {
600+ var yaml = """
601+ asyncapi: 2.3.0
602+ info:
603+ title: test
604+ version: 1.0.0
605+ channels:
606+ workspace:
607+ publish:
608+ message:
609+ $ref: "./some/path/to/external/resource.yaml"
610+ """ ;
611+ var settings = new AsyncApiReaderSettings
612+ {
613+ ExternalReferenceReader = new MockExternalReferenceReader ( ) ,
614+ } ;
615+ var reader = new AsyncApiStringReader ( settings ) ;
616+ var doc = reader . Read ( yaml , out var diagnostic ) ;
617+ doc . Info . Title . Should ( ) . Be ( "test" ) ;
618+ }
619+ }
620+
621+ public class MockExternalReferenceReader : IAsyncApiExternalReferenceReader
622+ {
623+ public string GetExternalResource ( string reference )
624+ {
625+ return """
626+ name: Test
627+ title: Test message
628+ summary: Test.
629+ schemaFormat: application/schema+yaml;version=draft-07
630+ contentType: application/cloudevents+json
631+ """ ;
632+ }
594633 }
595634}
You can’t perform that action at this time.
0 commit comments