Skip to content

Commit

Permalink
docs(generator): update latest generator docs
Browse files Browse the repository at this point in the history
  • Loading branch information
asyncapi-bot committed Jan 27, 2025
1 parent c4b12e0 commit be599de
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions markdown/docs/tools/generator/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FLAGS
--map-base-url=<value> Maps all schema references from base url to local folder

EXAMPLES
$ asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template --param version=1.0.0 singleFile=true --output ./docs --force-write
$ asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template@3.0.0 --use-new-generator --param version=1.0.0 singleFile=true --output ./docs --force-write
```
All templates are installable npm packages. Therefore, the value of `template` can be anything supported by `npm install`. Here's a summary of the possibilities:
Expand Down Expand Up @@ -60,29 +60,29 @@ asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template
**The shortest possible syntax:**
```bash
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template@3.0.0 --use-new-generator
```
**Generating from a URL:**
```bash
asyncapi generate fromTemplate https://bit.ly/asyncapi @asyncapi/html-template
asyncapi generate fromTemplate https://bit.ly/asyncapi @asyncapi/html-template@3.0.0 --use-new-generator
```
**Specify where to put the result:**
```bash
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template -o ./docs
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template@3.0.0 --use-new-generator -o ./docs
```
**Passing parameters to templates:**
```bash
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template -o ./docs -p title='Hello from param'
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template@3.0.0 --use-new-generator -o ./docs -p title='Hello from param'
```
In the template you can use it like this: ` {{ params.title }}`
**Disabling the hooks:**
```bash
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template -o ./docs -d generate:before generate:after=foo,bar
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template@3.0.0 --use-new-generator -o ./docs -d generate:before generate:after=foo,bar
```
The generator skips all hooks of the `generate:before` type and `foo`, `bar` hooks of the `generate:after` type.
Expand All @@ -101,7 +101,7 @@ asyncapi generate fromTemplate asyncapi.yaml https://github.com/asyncapi/html-te
**Map schema references from baseUrl to local folder:**
```bash
asyncapi generate fromTemplate test/docs/apiwithref.json @asyncapi/html-template -o ./build/ --force-write --map-base-url https://schema.example.com/crm/:./test/docs/
asyncapi generate fromTemplate test/docs/apiwithref.json @asyncapi/html-template@3.0.0 --use-new-generator -o ./build/ --force-write --map-base-url https://schema.example.com/crm/:./test/docs/
```
The parameter `--map-base-url` maps external schema references to local folders.
Expand All @@ -122,7 +122,7 @@ asyncapi/cli [COMMAND HERE]
docker run --rm -it \
-v ${PWD}/test/fixtures/asyncapi_v1.yml:/app/asyncapi.yml \
-v ${PWD}/output:/app/output \
asyncapi/cli generate fromTemplate -o /app/output /app/asyncapi.yml @asyncapi/html-template --force-write
asyncapi/cli generate fromTemplate -o /app/output /app/asyncapi.yml @asyncapi/html-template@3.0.0 --use-new-generator --force-write
```
Note: Use ``` ` ``` instead of `\` for Windows.
Expand All @@ -133,7 +133,7 @@ Note: Use ``` ` ``` instead of `\` for Windows.
Use the following npx command on your terminal:
```bash
npx -p @asyncapi/cli asyncapi generate fromTemplate ./asyncapi.yaml @asyncapi/html-template
npx -p @asyncapi/cli asyncapi generate fromTemplate ./asyncapi.yaml @asyncapi/html-template@3.0.0 --use-new-generator
```
## Using as a module/package
Expand All @@ -154,4 +154,4 @@ try {
}
```
See the [API documentation](api) for more examples and full API reference information.
See the [API documentation](api) for more examples and full API reference information.

0 comments on commit be599de

Please sign in to comment.