[BUG] asyncapi bundle does not report error if external reference cannot be resolved
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?
- [X] I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- [X] I have read the Contributing Guidelines
Are you willing to work on this issue ?
None
A proposal to address the issue is here: https://github.com/asyncapi/bundler/pull/176
hey tsauerwein is this issue resolved i want to contribute to this issue can you address the issue to me
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: https://github.com/asyncapi/bundler/pull/176