-
-
Notifications
You must be signed in to change notification settings - Fork 318
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug.
File: src/apps/cli/commands/generate/fromTemplate.ts
The fromTemplate command loads the AsyncAPI file twice during execution.
First via:
const asyncapiInput = await this.loadAsyncAPIInput(asyncapi);Then again via:
specification = await load(asyncapi);
This results in:
- Duplicate disk I/O
- Duplicate parsing
- Unnecessary memory usage
- Slower execution for large specifications
The first loaded result is not reused, making the second load redundant.
This is a performance inefficiency in CLI command flow.
Expected behavior
The AsyncAPI file should be loaded and parsed only once during command execution.
- The result of
loadAsyncAPIInput(asyncapi)should be reused for generation. - The CLI should not call
load(asyncapi)again. - There should be no duplicate disk reads or parsing steps.
- Large AsyncAPI files should not incur unnecessary performance overhead.
- Command execution should remain functionally identical but more efficient.
Screenshots
How to Reproduce
- Create a large AsyncAPI file (e.g., with many channels and components).
2.Run:
time asyncapi generate fromTemplate large.yaml @asyncapi/html-template -o out
-
Observe execution time.
-
Add logging inside:
load(asyncapi)
You will see it is invoked after loadAsyncAPIInput() already processed the file.
🖥️ Device Information [optional]
- Operating System (OS): Windows(WSL)
- Browser:
- Browser Version:
👀 Have you checked for similar open issues?
- I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to work on this issue ?
Yes I am willing to submit a PR!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
To Triage