Skip to content

Instantly share code, notes, and snippets.

@hguerrero
Last active May 29, 2024 08:33
Show Gist options
  • Save hguerrero/9e35feb62d4c93aee03111b75bffc3d4 to your computer and use it in GitHub Desktop.
Save hguerrero/9e35feb62d4c93aee03111b75bffc3d4 to your computer and use it in GitHub Desktop.
asyncapi v3 example
asyncapi: '3.0.0'
id: 'urn:io.microcks.example.user-signedup'
info:
title: User signed-up API
version: 0.1.1
description: Sample AsyncAPI for user signedup events
defaultContentType: application/json
servers:
production:
host: localhost:9092
protocol: kafka
channels:
user/signedup:
address: user/signedup
messages:
receivedUserSignedUp.message:
description: An event describing that a user just signed up.
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
type: object
additionalProperties: false
properties:
id:
type: string
sendAt:
type: string
fullName:
type: string
email:
type: string
format: email
age:
type: integer
minimum: 18
examples:
- name: laurent
summary: Example for Laurent user
headers: {"my-app-header": 23}
payload: >-
{"id": "{{randomString(32)}}", "sendAt": "{{now()}}",
"fullName": "Laurent Broudoux", "email": "laurent@microcks.io",
"age": 41}
- name: john
summary: Example for John Doe user
headers:
my-app-header: 24
payload:
id: '{{randomString(32)}}'
sendAt: '{{now()}}'
fullName: John Doe
email: john@microcks.io
age: 36
description: The topic on which user signed up events may be consumed
operations:
receivedUserSignedUp:
action: send
channel:
$ref: '#/channels/user~1signedup'
summary: Receive informations about user signed up
messages:
- $ref: '#/channels/user~1signedup/messages/receivedUserSignedUp.message'
components:
messageTraits:
commonHeaders:
headers:
type: object
properties:
my-app-header:
type: integer
minimum: 0
maximum: 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment