Skip to content

[BUG] CLI does not support reading AsyncAPI documents from stdin (-) and fails with misleading error #2011

@sahillllllllll-bit

Description

@sahillllllllll-bit

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

Image

How to Reproduce

  1. Create an AsyncAPI file (asyncapi.yaml):
asyncapi: '2.6.0'
info:
  title: Stdin test
  version: '1.0.0'
channels:
  test:
    publish:
      message:
        payload:
          type: string
  1. Run the AsyncAPI CLI using stdin as the input source:
asyncapi generate fromTemplate - @asyncapi/html-template -o out < asyncapi.yaml
  1. 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?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions