Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] asyncapi bundle does not report error if external reference cannot be resolved #1475

Closed
2 tasks done
tsauerwein opened this issue Jun 27, 2024 · 3 comments · Fixed by asyncapi/bundler#176
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@tsauerwein
Copy link

tsauerwein commented Jun 27, 2024

Describe the bug.

In case a document uses an invalid external reference, asyncapi bundle ignores the error and outputs:

Check out your shiny new bundled files at bundled.yml

It seems that the whole process stops and no other document is processed anymore.

Expected behavior

The command fails and reports the error

Screenshots

➜  demo git:(main) ✗ npx asyncapi --version
@asyncapi/cli/2.0.2 darwin-arm64 node-v18.20.3
➜  demo git:(main) ✗ npx asyncapi bundle --output=bundled.yml --base=main.yml operations/*.yml
Check out your shiny new bundled files at bundled.yml

How to Reproduce

Documents to reproduce:

$ tree .
.
├── main.yml
├── operations
│   ├── a.yml
│   └── b.yml
└── shared.yml

main.yml:

asyncapi: 3.0.0
id: https://some.id
info:
  title: Docs
  version: 1.0.0
defaultContentType: application/json

shared.yml:

asyncapi: 3.0.0
id: https://some.id
info:
  title: Docs
  version: 1.0.0

components:
  schemas:
    SomeSchema:
      type: integer
      minimum: 0
      maximum: 1

operations/a.yml:

asyncapi: 3.0.0
id: https://some.id
info:
  title: Docs
  version: 1.0.0

operations:
  operationA:
    action: send
    summary: Topic A
    channel:
      $ref: "#/channels/channelA"

channels:
  channelA:
    address: "a"
    messages:
      something:
        name: Something
        payload:
          $ref: "./shared.yml#/components/schemas/SomeSchema"

operations/b.yml:

asyncapi: 3.0.0
id: https://some.id
info:
  title: Docs
  version: 1.0.0

operations:
  operationB:
    action: send
    summary: Topic B
    channel:
      $ref: "#/channels/channelB"

channels:
  channelB:
    address: "b"
    messages:
      somethingElse:
        name: somethingElse
        payload:
          $ref: "./shared.yml#/components/schemas/SomeInvalidSchemaReference"

The external reference in operations/b.yml is wrong. Running asyncapi bundle outputs:

$ npx asyncapi bundle --output=bundled.yml --base=main.yml operations/*.yml
Check out your shiny new bundled files at bundled.yml

bundle.yml contains:

asyncapi: 3.0.0
id: https://some.id
info:
  title: Docs
  version: 1.0.0
operations:
  operationA:
    action: send
    summary: Topic A
    channel:
      $ref: '#/channels/channelA'
channels:
  channelA:
    address: a
    messages:
      something:
        name: Something
        payload:
          type: integer
          minimum: 0
          maximum: 1
defaultContentType: application/json

🥦 Browser

None

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

@tsauerwein
Copy link
Author

A proposal to address the issue is here: asyncapi/bundler#176

@VANSH3104
Copy link

hey tsauerwein is this issue resolved i want to contribute to this issue can you address the issue to me

@tsauerwein
Copy link
Author

hey tsauerwein is this issue resolved i want to contribute to this issue can you address the issue to me

The related PR is under review: asyncapi/bundler#176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants