Skip to content

AsyncAPI.NET isn't able to load external file #20

@lillo42

Description

@lillo42

Describe the bug

When I set the ReferenceResolution as ReferenceResolutionSetting.ResolveAllReferences and the message payload is referencing an external file, that file is not loaded

To Reproduce

Having an AsyncAPI V3 where the message payload is an external file and mark to resolve all references

var path = Path.Combine(Environment.CurrentDirectory, "V3_TestData", "AsyncApiSchema_MessageInDiffFile.yml");
var reader = new AsyncApiStreamReader(new AsyncApiReaderSettings
{
    ReferenceResolution = ReferenceResolutionSetting.ResolveAllReferences,
});

var doc = reader.Read(File.OpenRead(path), out var diag);
Assert.IsEmpty(diag.Errors);

Error:

Something went wrong trying to fetch './AsyncApiSchema_MessagePayload.yml. Could not find file '<READACT>\AsyncAPI.NET\test\ByteBard.AsyncAPI.Tests\bin\Debug\net8.0\AsyncApiSchema_MessagePayload.yml'.'

Expected behaviour

The diagnostic should be empty

Sample document

Async file:

asyncapi: 3.0.0

info:
  title: Streetlights Kafka API
  version: 1.0.0
  description: The Smartylighting Streetlights API allows you to remotely manage the city lights.
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0

channels:
  mychannel:
    messages:
      whatever:
        payload:
          $ref: "./AsyncApiSchema_MessagePayload.yml"

Payload file:

type: object
required:
  - testB
properties:
  testC:
    type: object
    properties:
      testD:
        type: string
        format: uuid
  testB:
    type: boolean
    description: test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions