Skip to content

Instantly share code, notes, and snippets.

@dalelane
Created May 12, 2023 09:03
Show Gist options
  • Select an option

  • Save dalelane/22e844da6f831a7466cd0bd6550bce18 to your computer and use it in GitHub Desktop.

Select an option

Save dalelane/22e844da6f831a7466cd0bd6550bce18 to your computer and use it in GitHub Desktop.
asyncapi: 3.0.0
id: 'https://github.com/dalelane/my-first-asyncapi-v3-doc'
info:
title: 'Title of my app'
version: '0.0.1'
description: 'This is what **my app** does. It uses `code`.'
termsOfService: https://dalelane.co.uk/asyncapi/terms-of-service
contact:
name: Dale Lane
url: https://dalelane.co.uk
email: email@dalelane.co.uk
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
tags:
- name: example
description: Things that are used as examples of the spec
- name: simple
externalDocs:
description: Background about the spec
url: https://www.asyncapi.com/docs/reference/specification/v3.0.0-next-major-spec.8
servers:
eventstreams:
url: es-kafka-bootstrap-eventstreams.{host}:{port}
protocol: kafka-secure
protocolVersion: '3.3.0'
title: Event Streams Kafka cluster
description: A secure Kafka cluster running in **OpenShift**.
tags:
- name: example
- name: openshift
description: Servers that are running in OpenShift
- $ref: '#/components/tags/kafka'
externalDocs:
description: More info about Event Streams
url: https://ibm.github.io/event-streams/
variables:
host:
default: apps.dale-lane.cp.fyre.ibm.com
description: hostname for the OpenShift cluster
examples:
- apps.dale-lane.cp.fyre.ibm.com
- apps.dalelane-neptune.cp.fyre.ibm.com
port:
default: 443
security:
- $ref: '#/components/securitySchemes/kafkaEventStreams'
bindings:
kafka:
schemaRegistryUrl: https://my-apicurio-schema-registry.com
schemaRegistryVendor: apicurio
bindingVersion: '0.4.0'
defaultContentType: application/json
channels:
ordersTopic:
address: MODO.ORDERS
messages:
newOrderMessage:
$ref: '#/components/messages/newOrder'
title: Orders Topic
summary: A topic for notifications of new Modo Jeans orders
description: This is how the **Orders** topic is used in [Modo](https://modojeans.com).
servers:
- $ref: '#/servers/eventstreams'
tags:
- name: example
description: Things that are used as examples of the spec
- name: orders
description: Resources relating to Modo Jeans orders
- $ref: '#/components/tags/kafka'
externalDocs:
description: More info about the Modo order system
url: https://modojeans.com/intranet/orders
bindings:
topic: MODO.ORDERS
partitions: 3
replicas: 3
topicConfiguration:
retention.bytes: 1000000000
max.message.bytes: 1048588
bindingVersion: '0.4.0'
operations:
newOrderNotification:
action: 'receive'
channel:
- $ref: '#/channels/ordersTopic'
title: New order notification
summary: Event detailing a new order
description: This is about how you **subscribe** to receive order notifications
security:
- $ref: '#/components/securitySchemes/kafkaEventStreams'
tags:
- name: orders
description: Resources relating to Modo Jeans orders
externalDocs:
description: Info about signing up for order notifications
url: https://modojeans.com/intranet/orders/signup
traits:
- $ref: '#/components/operationTraits/kafka'
components:
tags:
kafka:
name: kafka
description: Resources relating to Kafka clusters
externalDocs:
description: Modo Jeans use of Kafka
url: https://modojeans.com/intranet/kafka
securitySchemes:
kafkaEventStreams:
type: scramSha512
description: Event Streams credentials
messages:
newOrder:
messageId: modoJeansOrderMessage
name: modoJeansOrder
title: Modo Jeans New Order notification
summary: A message containing details of a new order
description: More info about how the order notifications are **created** and **used**.
tags:
- name: orders
description: Resources relating to Modo Jeans orders
externalDocs:
description: Info about signing up for order notifications
url: https://modojeans.com/intranet/orders/api
headers:
type: object
properties:
orderSource:
description: unique ID of the application used to create the order
type: string
payload:
type: object
order:
$ref: '#/components/schemas/newOrder'
schemaFormat: application/vnd.aai.asyncapi+yaml;version=3.0.0
contentType: application/json
bindings:
kafka:
key:
type: object
required:
- region
properties:
region:
type: string
enum:
- west
- east
- north
- south
bindingVersion: '0.4.0'
examples:
- name: SimpleOrder
summary: Example of a simple order
headers:
orderSource: modo-core-sys
someCustomHeader: my-value
payload:
order:
version: v2
id: ABCD1234
catalogid: ABC013312312
quantity: 3
cost: 9.99
customer: bob@customer.com
traits:
- $ref: '#/components/messageTraits/kafkaHeaders'
schemas:
newOrder:
title: New Order message payload
type: object
oneOf:
- $ref: '#/components/schemas/newOrderV1'
- $ref: '#/components/schemas/newOrderV2'
required:
- version
- id
descriminator: version
properties:
id:
type: string
description: unique order id on the Modo Jeans order system
version:
type: string
enum:
- v1
- v2
externalDocs:
description: Info about signing up for order notifications
url: https://modojeans.com/intranet/orders/data
newOrderV1:
title: New Order message payload
deprecated: true
type: object
required:
- version
- id
- itemid
- cost
properties:
id:
type: string
description: unique order id on the Modo Jeans order system
version:
type: string
enum:
- v1
itemid:
type: string
cost:
type: number
format: double
newOrderV2:
title: Order message payload from new systems
type: object
required:
- version
- id
- catalogid
- quantity
- cost
- customer
properties:
id:
type: string
description: unique order id on the Modo Jeans order system
version:
type: string
enum:
- v2
catalogid:
type: string
quantity:
type: integer
format: int32
default: 1
minimum: 0
cost:
type: number
format: double
discount:
type: number
format: double
customer:
type: string
format: email
description: username for the order - should be the email address of the customer
operationTraits:
kafka:
title: Kafka operation traits
summary: Operation traits that are common to all Kafka operations
description: Detailed **description** goes here
tags:
- name: kafka
bindings:
kafka:
clientId:
type: string
groupId:
type: string
bindingVersion: '0.4.0'
messageTraits:
kafkaHeaders:
headers:
type: object
properties:
someCustomHeader:
description: A common header included for all Kafka messages
type: string
tags:
- name: kafka
@kanekoshoyu
Copy link
Copy Markdown

thanks, good sample for me to test my codegen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment