asyncapi / vs-asyncapi-preview

VSCode AsyncAPI Preview Extension
Apache License 2.0
44 stars 36 forks source link

[BUG] TypeError: i.readFile is not a function #247

Open orangejohny opened 3 hours ago

orangejohny commented 3 hours ago

Describe the bug.

Hi!

There is an error showed in UI when trying to preview asyncapi.yaml containing a reference to a local file. The error is TypeError: i.readFile is not a function.

Vscode info:

Version: 1.95.2 (Universal) Commit: e8653663e8840adaf45af01eab5c627a5af81807 Date: 2024-11-07T11:07:22.054Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Darwin x64 24.1.0

asyncapi-preview version: v0.6.5

Expected behavior

asyncapi.yaml renders correctly.

Screenshots

Screenshot 2024-12-02 at 20 30 00

How to Reproduce

  1. Create asyncapi.yaml file with following content:

    asyncapi.yaml ```yaml asyncapi: 2.6.0 info: title: Example version: '0.1.0' defaultContentType: application/json servers: nats: protocol: nats url: '{protocol}://{host}:{port}' variables: protocol: default: nats host: default: localhost port: default: '4222' channels: event/example: publish: operationId: example bindings: nats: queue: 'event.example' message: messageId: example payload: type: object allOf: - $ref: 'https://raw.githubusercontent.com/cloudevents/spec/v1.0.2/cloudevents/formats/cloudevents.json' properties: data: $ref: 'cluster.yaml' ```
  2. Create cluster.yaml file with following content:

    cluster.yaml ```yaml type: object properties: id: type: string ```
  3. Open asyncapi.yaml preview.

🥦 Browser

None

👀 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 3 hours 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.