Skip to content

Instantly share code, notes, and snippets.

@fmvilas
Created May 16, 2017 13:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmvilas/a8eb976d9410fea213d26e91090b9dc8 to your computer and use it in GitHub Desktop.
Save fmvilas/a8eb976d9410fea213d26e91090b9dc8 to your computer and use it in GitHub Desktop.
AsyncAPI basic example
asyncapi: '1.0.0'
info:
title: 'Sign up email example'
version: '1.0.0'
baseTopic: 'hitch'
host: 'asyncapi.hitchhq.com'
schemes:
- 'amqp'
- 'mqtt'
topics:
accounts.1.0.event.user.signup:
subscribe:
$ref: '#/components/messages/userSignedUp'
email.1.0.event.email.sent:
publish:
$ref: '#/components/messages/emailSent'
components:
messages:
emailSent:
summary: 'Email sent to user.'
description: 'A message notifying an email has been sent.'
payload:
type: 'object'
properties:
user:
$ref: '#/components/schemas/user'
content:
$ref: '#/components/schemas/content'
userSignedUp:
summary: 'A user has signed up.'
payload:
type: 'object'
properties:
user:
$ref: '#/components/schemas/user'
signup:
$ref: '#/components/schemas/signup'
schemas:
content:
title: 'content'
description: 'The email content'
type: 'string'
id:
title: 'id'
description: 'Resource identifier'
type: 'string'
username:
title: 'username'
description: 'User handle'
type: 'string'
datetime:
title: 'datetime'
description: 'Date and Time of the message'
type: 'string'
format: 'date-time'
user:
type: 'object'
required:
- 'id'
- 'username'
properties:
id:
description: 'User Id'
$ref: '#/components/schemas/id'
full_name:
description: "User's full name"
type: 'string'
username:
$ref: '#/components/schemas/username'
signup:
type: 'object'
required:
- 'method'
- 'datetime'
properties:
method:
description: 'Signup method'
type: 'string'
enum:
- 'email'
- 'facebook'
- 'twitter'
- 'github'
- 'google'
datetime:
$ref: '#/components/schemas/datetime'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment