vs-asyncapi-preview icon indicating copy to clipboard operation
vs-asyncapi-preview copied to clipboard

plugin fails when referencing a file in the parent directory

Open mackler opened this issue 5 months ago • 1 comments

Describe the bug.

As described here, “You can use the $ref keyword to reference the same document, another local file, or an external URL. ” When the reference is to a local file in the parent directory, the plugin fails to process the referencing file, displaying only a blank window.

I'm using asyncapi-preview v0.6.3.

Expected behavior

When the value following a $ref keyword refers to a file in the parent directory, it should be processed as correctly as if the file were in the same directory.

Screenshots

This is what it looks like when it works, when the two files are in the same directory.

image

When the reference is relative to a file in the parent directory nothing is shown.

How to Reproduce

Put this into one file:

asyncapi: 3.0.0
info:
  title: bug-demo referencing file
  version: 0.0.0
servers:
  $ref: '../asyncapi.yml#/servers'

Put this into a file named asyncapi.yml in the parent directory of the first file:

asyncapi: 3.0.0
info:
  title: bug-demo referenced file
  version: 0.0.0
servers:
  local:
    host: localhost:5672
    protocol: amqp

Open the first file in VSCode and attempt to view with the asyncapi-preview plugin.

Running asyncapi validate says the file is valid, but the plugin shows only a blank panel.

🥦 Browser

Brave

👀 Have you checked for similar open issues?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

mackler avatar Sep 16 '24 06:09 mackler