diff --git a/apps/generator/docs/generator-template.md b/apps/generator/docs/generator-template.md index 497c282a9d..c9a14ad016 100644 --- a/apps/generator/docs/generator-template.md +++ b/apps/generator/docs/generator-template.md @@ -42,14 +42,13 @@ Before you begin, make sure you have the following set up: There is a list of [community maintained templates](https://www.asyncapi.com/docs/tools/generator/template#generator-templates-list), but what if you do not find what you need? In that case, you'll create a user-defined template that generates custom output from the generator. Before you create the template, you'll need to have an [AsyncAPI document](https://www.asyncapi.com/docs/tools/generator/asyncapi-document) that defines the properties you want to use in your template to test against. In this tutorial, you'll use the following template saved in the **test/fixtures/asyncapi.yml** file in your template project directory. -``` yml - -asyncapi: 2.6.0 +```yaml +asyncapi: "3.0.0" info: title: Temperature Service version: 1.0.0 - description: This service is in charge of processing all the events related to temperature. + description: Service that emits temperature changes from a bedroom sensor. servers: dev: @@ -57,21 +56,24 @@ servers: protocol: mqtt channels: - temperature/changed: - description: Updates the bedroom temperature in the database when the temperatures drops or goes up. - publish: - operationId: temperatureChange - message: - description: Message that is being sent when the temperature in the bedroom changes. + temperatureChanged: + address: temperature/changed + messages: + temperatureChange: + description: Message sent when the temperature in the bedroom changes. payload: - type: object - additionalProperties: false - properties: - temperatureId: - type: string + $ref: '#/components/schemas/Temperature' # refactored from inline payload for better reuse + +operations: + recieveTemperatureChanged: + action: recieve + summary: Temperature changes are recieved from the broker + channel: + $ref: '#/channels/temperatureChanged' + components: schemas: - temperatureId: + Temperature: type: object additionalProperties: false properties: @@ -100,7 +102,7 @@ python-mqtt-client-template └── package.json ``` -Lets break it down: +Let's break it down: ### package.json file @@ -649,4 +651,4 @@ Great job completing this tutorial! You have learnt how to use an AsyncAPI file If you want to tinker with a completed template and see what it would look like in production, check out the [Paho-MQTT template](https://github.com/derberg/python-mqtt-client-template/tree/v1.0.0). You can also check out the accompanying [article about creating MQTT client code](https://www.brainfart.dev/blog/asyncapi-codegen-python). -You can also check out the [MQTT beginners guide](https://medium.com/python-point/mqtt-basics-with-python-examples-7c758e605d4) tutorial to learn more about asynchronous messaging using MQTT. \ No newline at end of file +You can also check out the [MQTT beginners guide](https://medium.com/python-point/mqtt-basics-with-python-examples-7c758e605d4) tutorial to learn more about asynchronous messaging using MQTT.