asyncapi / vs-asyncapi-preview

VSCode AsyncAPI Preview Extension
Apache License 2.0
40 stars 26 forks source link

plugin fails when referencing a file in the parent directory #237

Open mackler opened 6 days ago

mackler commented 6 days ago

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?

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

github-actions[bot] commented 6 days ago

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.