add example code generator

This commit is contained in:
marys
2026-06-03 10:36:11 +02:00
parent b4ad1d2fd7
commit 03b5f3c2ea
17 changed files with 308 additions and 56 deletions
+24 -33
View File
@@ -1,44 +1,35 @@
# .venv/bin/asyncapi-python-codegen asyncapi.yaml out --force
# asyncapi generate fromTemplate ./test/fixtures/asyncapi.yaml ./ -o ./out/project
# kouknout na FastStream
# https://nats.io/blog/nats-supported-by-faststream/#writing-app-code
# https://github.com/asyncapi/python-paho-template
# https://www.asyncapi.com/docs/tools/generator/generator-template
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: Temperature sensor publishing readings
servers:
dev:
host: test.mosquitto.org #in case you're using local mosquitto instance, change this value to localhost.
protocol: mqtt
production:
host: localhost:4222
protocol: nats
channels:
temperatureChanged:
address: temperature/changed
temperature/read:
address: temperature/read
messages:
temperatureChange:
description: Message that is being sent when the temperature in the bedroom changes.
payload:
$ref: '#/components/schemas/temperatureId'
description: Updates the bedroom temperature in the database when the temperatures drops or goes up.
TemperatureMessage:
$ref: '#/components/messages/TemperatureMessage'
operations:
temperatureChange:
receiveTemperature:
action: receive
summary: Message sent to the broker when the temperature is changed.
channel:
$ref: '#/channels/temperatureChanged'
$ref: '#/channels/temperature/read'
description: Receive temperature readings
components:
schemas:
temperatureId:
type: object
additionalProperties: false
properties:
temperatureId:
type: string
messages:
TemperatureMessage:
name: TemperatureMessage
title: Temperature Message
payload:
type: object
properties:
value:
type: number
timestamp:
type: string
sensor_id:
type: string