[BUG] CLI does not support reading AsyncAPI documents from stdin (-) and fails with misleading error
- Dominant language
- TypeScript
- Stars
- 272
- Forks
- 375
- Avg merge
- 3h 22m
- Merged PRs (30d)
- 8
Description
### Describe the bug.
The AsyncAPI CLI does **not support** reading an AsyncAPI document from **stdin** using `-` as the input path.
When `-` is provided, the CLI treats it as a literal file path and fails during AsyncAPI file resolution, emitting an error that only lists file paths, URLs, or contexts as valid inputs. This behavior is not documented.
While stdin support is not explicitly documented as supported, `-` is a widely accepted convention in Unix-style CLIs. The lack of stdin handling breaks common pipeline and automation workflows and forces users to write temporary files to disk, reducing CLI composability and usability in CI and scripting scenarios.
### Expected behavior
- If the AsyncAPI file argument is `-`, the CLI should read the AsyncAPI document from `stdin` and proceed with generation normally.
- If stdin input is not supported, the CLI should fail immediately with a clear and explicit error message stating that reading from stdin (`-`) is not supported.
- The CLI should not attempt file, URL, or context resolution when `-` is used as the input argument.
### Screenshots
### How to Reproduce
1. Create an AsyncAPI file (`asyncapi.yaml`):
```yaml
asyncapi: '2.6.0'
info:
title: Stdin test
version: '1.0.0'
channels:
test:
publish:
message:
payload:
type: string
```
2. Run the AsyncAPI CLI using stdin as the input source:
```
asyncapi generate fromTemplate - @asyncapi/html-template -o out < asyncapi.yaml
```
3. Observe that the CLI fails to locate the AsyncAPI document and does not read from stdin, instead showing an error describing only file paths, URLs, or contexts as valid inputs.
### 🖥️ Device Information [optional]
- Operating System (OS): Windows(WSL)
- Browser:
- Browser Version:
### 👀 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](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md)
### Are you willing to work on this issue ?
Yes I am willing to submit a PR!
Contributor guide
Assessment
This issue has not been assessed yet.