Migrating from `ag` CLI to AsyncAPI CLI

Found an error? Have a suggestion?Edit this page on GitHub

This guide provides detailed instructions on how to transition from the old ag Generator CLI to the new AsyncAPI CLI.

Options Overview

Here is a list of ag options and their equivalents in the AsyncAPI CLI:

  • -d, --disable-hook [hooks...]

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --disable-hook <hookType>=<hookName>
  • --debug

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --debug
  • -i, --install

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --install
  • -n, --no-overwrite <glob>

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --no-overwrite <glob>
  • -o, --output <outputDir>

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --output <outputDir>
  • -p, --param <name=value>

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --param <name=value>
  • --force-write

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --force-write
  • --watch-template

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --watch
  • --map-base-url <url:folder>

    • AsyncAPI CLI equivalent: asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --map-base-url <url:folder>

Migration Steps

1. Install AsyncAPI CLI

There are multiple different artifacts that AsyncAPI CLI is provided as. Get familiar with the official CLI installation guide.

2. Update Your Commands

Replace the deprecated ag commands with the AsyncAPI CLI equivalents. Below are examples of how to update your commands:

Using ag:

ag ./asyncapi.yaml ./template -o ./output -p param1=value1 --debug --install --disable-hook hookType=hookName

Using AsyncAPI CLI:

asyncapi generate fromTemplate ./asyncapi.yaml ./template -o ./output -p param1=value1 --debug --install --disable-hook hookType=hookName

Notice that the change basically related to changing from ag to asyncapi generate fromTemplate.

3. Verify and Test

Run the updated commands to ensure they work as expected and verify that the output files are generated correctly.

Additional Resources

CLI Documentation: AsyncAPI CLI Documentation Installation: AsyncAPI CLI Installation Usage: AsyncAPI CLI Usage Support: For any issues with CLI, create an issue in CLI repository.

Was this helpful?
Help us improve the docs by adding your contribution.
OR
Github:AsyncAPICreate Issue on GitHub