Skip to content

Commit

Permalink
corrected the path
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryan4884 committed Oct 12, 2024
1 parent 6f60d50 commit a4a7400
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions apps/generator/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@ title: "Introduction"
weight: 10
---

The AsyncAPI generator is a tool that generates anything you want using the **[AsyncAPI Document](generator/asyncapi-document)** and **[Template](generator/template)** that are supplied as inputs to the AsyncAPI CLI. The generator was built with extensibility in mind; you can use the generator to generate anything you want, provided that it can be defined in a template, such as code, diagrams, markdown files, microservices, and applications. A number of [community-maintained templates](https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate) are now available for immediate usage.
The AsyncAPI generator is a tool that generates anything you want using the **[AsyncAPI Document](asycapi-document.md)** and **[Template](generator/template)** that are supplied as inputs to the AsyncAPI CLI. The generator was built with extensibility in mind; you can use the generator to generate anything you want, provided that it can be defined in a template, such as code, diagrams, markdown files, microservices, and applications. A number of [community-maintained templates](https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate) are now available for immediate usage.

> **Note:**
> If your primary objective is to generate models/classes for your event-driven architecture apps, use [AsyncAPI Modelina](/docs/tools/generator/model-generation), which is supported in the AsyncAPI CLI, instead of using the AsyncAPI Generator. Modelina is specifically designed for model generation and provides utilities for working with the AsyncAPI document.
### Generator use cases
### Generator use cases

- Generation of interactive and understandable API documentation
- Generation of APIs' client libraries
- Generation of APIs' boilerplate code

### Generator advantages

- Quick to setup and easy to use on a regular basis
- Effortless generation of complex documents
- Number of community maintained AsyncAPI templates

### Generation process
1. The **Generator** receives the **[Template](generator/template)** and **[AsyncAPI Document](generator/asyncapi-document)** as inputs.

1. The **Generator** receives the **[Template](generator/template)** and **[AsyncAPI Document](asycapi-document.md)** as inputs.
2. The **Generator** sends to the **[Parser](generator/parser)** the **asyncapiString** which is a stringified version of the original **AsyncAPI Document**.
3. The **Parser** uses additional plugins such as the OpenAPI, RAML, or Avro schemas to validate custom schemas of message payloads defined in the **AsyncAPI Document**.
4. If the **Parser** determines that the original **AsyncAPI Document** is valid, it manipulates the document and returns a set of helper functions and properties and bundles them together into an **asyncapi** variable that is an instance of [**AsyncAPIDocument**](https://github.com/asyncapi/parser-api/blob/master/docs/api.md#asyncapidocument). The **asyncapi** helper functions make it easier to access the contents of the AsyncAPI Document.
5. At this point, the **Generator** passes the **[asyncapi](generator/asyncapi-document#method-2-asyncapi-and-template)**, the **[originalAsyncAPI](generator/asyncapi-document#method-1-originalasyncapi-and-template)**, and the **params** which collectively make up the **[Template Context](generator/template-context)** to the **Render Engine**.
5. At this point, the **Generator** passes the **[asyncapi](asycapi-document.md#method-2-asyncapi-and-template)**, the **[originalAsyncAPI](asycapi-document.md#method-1-originalasyncapi-and-template)**, and the **params** which collectively make up the **[Template Context](generator/template-context)** to the **Render Engine**.
6. AsyncAPI has two **Render Engines**([react](generator/react-render-engine) and [nunjucks](generator/nunjucks-render-engine)). Depending on which one you've specified in your `package.json`, the **Generator** knows the right **Render Engine** to pass both the **Template Files** and the **Template Context**.
7. Once the **Render Engine** receives the **Template Files** and the **Template Context**, it injects all the dynamic values in your react or nunjucks based **Template Files** using the **Template Context**. As a result, the **Render Engine** generates **markdown**, **pdf**, **boilerplate code**, and **anything else** you specified to be generated as output.

> You can generate anything you want using the generator as long as it can be defined in a **Template**.
The diagram below depicts the entire process of passing the **Template** and **AsyncAPI Document** to the AsyncAPI generator tool, how the generator uses these inputs to generate the desired output, and example outputs you can get from the render engine.

``` mermaid
```mermaid
graph LR
A[Template Context]
B{Generator}
Expand All @@ -52,5 +55,6 @@ graph LR
D --> N[Node.js]
D --> J[Java Spring Boot]
D --> K[Anything else]
```
```

**`params`** are template-specific options passed to the `asyncapi generate fromTemplate` CLI command to customize the generated output.

0 comments on commit a4a7400

Please sign in to comment.