--- url: "https://asyncapi.com/docs/tools/generator/template-context" titulek: "Template context | AsyncAPI Initiative for event-driven APIs" h1: "Template context" popis: "While using the generator tool, you may want dynamic values populated to your templates and rendered in the output. The generator can achieve that using the template context. The template context allo" jazyk: "en" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 02:46:07" znaku: 2648 slov: 362 kodovani: "utf-8" sha256: "64425adb75d25ea701a4be21eab9f17bc056171ce2811924722175494a943bcd" --- ##### On this page Generation process Template context # Template context Found an error? Have a suggestion?[Edit this page on GitHub](https://github.com/asyncapi/generator/tree/master/apps/generator/docs/template-context.md) While using the generator tool, you may want dynamic values populated to your templates and rendered in the output. The generator can achieve that using the **template context**. The **template context** allows you to access the contents of the [AsyncAPI document](asyncapi-document) and inject dynamic values to the template files passed to the asyncAPI CLI during the generation process. The render engine then displays these dynamically assigned values in the output. ## Generation process 1. The **Generator** receives **Template** and **params** as input. 2. The **Generator** sends to the **Parser** the **asyncapiString** which is a stringified version of the original **AsyncAPI document** . 3. The **Parser** validates the format of the **asyncapiString** using OpenAPI, RAML, or Avro schemas. 4. If the **asyncapiString** is valid, the **parser** manipulates it, returns a set of helper functions and properties, and bundles them into an **asyncapi** variable. The **asyncapi** variable is an instance of the **AsyncAPI document** . The helper functions and properties make it easier to access the contents of the **AsyncAPI document** in the template. 5. The **Generator** then passes the **params** , which are template-specific options used to customize the output, the **Template files** , and the **asyncapi** which collectively make up the **Template Context** . 6. The **Template Context** is then passed to the **Render Engine** . The **Render Engine** then injects all the dynamic values from the **Template Context** into the **Template files** . ## Template context The extra context passed to the render engine during the generation process and made accessible in the templates includes: - **`originalAsyncAPI`** is a stringified version of the original AsyncAPI document that the user passed to the Generator. - **`asyncapi`** is a parsed AsyncAPI document with helper functions and properties. You should use it to access document contents e.g `asyncapi.title` . - **`params`** is an object with all the parameters passed to the Generator by the user. [Go BackConfiguration file](/docs/tools/generator/configuration-file) [Up NextReact render engine](/docs/tools/generator/react-render-engine) Was this helpful? Help us improve the docs by sharing your feedback. [Submit Feedback](https://github.com/asyncapi/website/issues/new?template=docs-feedback.yml&title=Docs%20Feedback%3A%20%2Fdocs%2Ftools%2Fgenerator%2Ftemplate-context&labels=%F0%9F%93%91%20docs) OR [Create Issue on GitHub](https://github.com/asyncapi/website/issues/new/choose)