Skip to content

Instantly share code, notes, and snippets.

@fmvilas
Created June 7, 2017 12:51
Show Gist options
  • Select an option

  • Save fmvilas/3ea921e85cd76e7281a4ecbee013cff0 to your computer and use it in GitHub Desktop.

Select an option

Save fmvilas/3ea921e85cd76e7281a4ecbee013cff0 to your computer and use it in GitHub Desktop.
AsyncAPI Control Panel example
asyncapi: '1.0.0'
info:
title: Control Panel API
version: '0.1.0'
host: 'test.mosquitto.org'
baseTopic: 'smartylighting.streetlights.1.0'
schemes:
- mqtt
topics:
'action.{streetlight_id}.turn.on':
publish:
$ref: '#/components/messages/turnOnOff'
'action.{streetlight_id}.turn.off':
publish:
$ref: '#/components/messages/turnOnOff'
'event.{streetlight_id}.lighting.measured':
subscribe:
$ref: '#/components/messages/lightMeasured'
components:
messages:
lightMeasured:
summary: A message to inform about environmental lighting conditions.
payload:
$ref: "#/components/schemas/lightMeasuredPayload"
turnOnOff:
summary: A message indicating us if we should turn the light on or off.
payload:
$ref: "#/components/schemas/turnOnOffPayload"
schemas:
lightMeasuredPayload:
type: object
properties:
lumens:
type: number
minimum: 0
description: Light intensity measured in lumens.
sent_at:
type: string
format: date-time
turnOnOffPayload:
type: object
properties:
command:
type: string
enum:
- on
- off
description: Whether to turn on or off the light.
sent_at:
type: string
format: date-time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment