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>
- AsyncAPI CLI equivalent:
-
--debug
- AsyncAPI CLI equivalent:
asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --debug
- AsyncAPI CLI equivalent:
-
-i, --install
- AsyncAPI CLI equivalent:
asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --install
- AsyncAPI CLI equivalent:
-
-n, --no-overwrite <glob>
- AsyncAPI CLI equivalent:
asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --no-overwrite <glob>
- AsyncAPI CLI equivalent:
-
-o, --output <outputDir>
- AsyncAPI CLI equivalent:
asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --output <outputDir>
- AsyncAPI CLI equivalent:
-
-p, --param <name=value>
- AsyncAPI CLI equivalent:
asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --param <name=value>
- AsyncAPI CLI equivalent:
-
--force-write
- AsyncAPI CLI equivalent:
asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --force-write
- AsyncAPI CLI equivalent:
-
--watch-template
- AsyncAPI CLI equivalent:
asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --watch
- AsyncAPI CLI equivalent:
-
--map-base-url <url:folder>
- AsyncAPI CLI equivalent:
asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --map-base-url <url:folder>
- AsyncAPI CLI equivalent:
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.